Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可以提供形如 var in [1, 2, 3]这样的表达式吗? #4

Closed
yanxiyue opened this issue Sep 23, 2016 · 5 comments
Closed

可以提供形如 var in [1, 2, 3]这样的表达式吗? #4

yanxiyue opened this issue Sep 23, 2016 · 5 comments

Comments

@yanxiyue
Copy link

目前提供了基本的逻辑运算符, 但在实际使用中经常有这种场景:

 判断某个变量是否在某个常量集合中, 如果能提供类似python的 in 算符就很好了。否则还需要把常量作为变量,再通过include才能实现 。

或者还有其他简便的方法我没看到?

@killme2008
Copy link
Owner

你的意思是字面量(literal) 级别的数组支持?

@killme2008
Copy link
Owner

目前是不支持的,可以支持下。

@yanxiyue
Copy link
Author

对,支持字面量的集合, 这样也行

@killme2008
Copy link
Owner

hello,考虑下来,其实没有必要提供直接支持,你只要自定义一个 list 函数 ,返回一个数组或者List即可:

seq.incldue(list(1,2,3), 3)

@killme2008
Copy link
Owner

更进一步,map 之类的也可以加下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants