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

Eval: List comprehensions #45

Open
plepe opened this issue Aug 1, 2014 · 0 comments
Open

Eval: List comprehensions #45

plepe opened this issue Aug 1, 2014 · 0 comments

Comments

@plepe
Copy link
Owner

plepe commented Aug 1, 2014

We could use list comprehension to iterate over lists. Instead of map and filter (which would be even harder to implement, due to lack of functions in mapcss).

Could look like:

node[amenity=restaurant] {
  text: join("\n", [
    concat($a, "=", tag($a))
    for $a in tag_keys()
    if $a != "source"
  ]);
}

should produce (by omitting a tag called "source") e.g.:

amenity=restaurant
name=Foobar
cuisine=local
  • We have to distinguish between identifiers and variables, hence $a

Idea for list comprehensions comes from Python, see https://docs.python.org/3/tutorial/datastructures.html#list-comprehensions

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

No branches or pull requests

1 participant