> Clearly, I would like to be able to write:
>
> define get_results( p );
> lvars p;
> [% p() %]
> enddefine;
>
> : get_results( [a b c], dest ) =>
> ** [a [b c]]
>
> Any ideas for how to write this?
Partial application was designed into the language to support precisely
this requirement.
get_results(dest(%[a b c]%) )
gives the overall behaviour that you want.
It also makes sense from the grammatical type view. The type of p, the
parameter of get_results, must clearly be
() => {<object>}
(using the {....} grammatical notation to mean zero or more repeats.)
dest has the type
<list('a)> => <'a> <list 'a>
dest(%L%), where L has the type <list('a)>, has the type
() -> <'a> <list('a)>
which is a sub-type (i.e. sub-grammar, i.e. a grammar that generates a
sub-sequence of symbols of.. ) {<object>}, and so is acceptable for p.
Robin.
|