Use $%m to explode a map, like how you use $@a to explode a list.
~> fn f [&foo=bar &lorem=ipsum]{ echo $foo $lorem }
~> m = [&foo=qux &lorem=dolar]
~> f $%m
qux dolar
~> put [$%m k=v]
[&foo=bar &lorem=ipsum &k=v]
Rest option:
~> fn f [%opts]{ echo $opts }
~> f &foo=bar &lorem=ipsum
[&foo=bar &lorem=ipsum]
why use % and not @ as well to keep consistency?
You need a different sigil in the lambda parameter list to disambiguate rest argument and rest option.
You also need it to disambiguate between [$@li] and [$%m] since Elvish uses [] for both lists and maps.
But like kind-of $li and kind-of $m should be different so it should be possible for the implementation to do the right thing?
In lambda signatures @li and %m are declarations, so you cannot know their types.
In other cases, yes it's doable by looking at the type dynamically, but I tend towards having more static information.
I tentatively suggest a @@ operator, a la Python's * for lists vs ** for maps. It feels more consistent/easy to remember than %, IMO.
The choice of % is in analogy to Perl's hash sigil.
As a former Perl-head, I thoroughly endorse the choice of % 馃槂
Most helpful comment
In lambda signatures @li and %m are declarations, so you cannot know their types.
In other cases, yes it's doable by looking at the type dynamically, but I tend towards having more static information.