diagonalworks/diagonal-b6

Support lists as parameters to b6 functions

Closed this issue · 1 comments

There are many situations in which it'd be useful to pass a hand-curated list to b6 functions - for example - to form the convex hull of a manually curated list of neighbouring boundary features, or to manually list a small number of important service providers (eg major hospitals). We neither support this in the shell or Python.

Reported by @gacafe

Some possible approaches:
Add a function that takes a variable number of parameters, and returns a collection of values, with integer indices as keys, eg:
list /n/123343 /n/123343 /n/95494
could return a collection of feature ids, with indices as keys.
Alternatively/additionally, we could add some syntax sugar to the shell, eg:
{/n/123343, /n/123343, /n/95494}
and could add key values via:
{/n/123343: 42, /n/123343: 86, /n/95494: 90}

This also gives a lightweight way to supply structured values to functions:
"walking|elevation|uphill hard|downhill hard|peak traffic|"
could be:
{mode=walking, uphill=hard}