Open countvajhula opened 1 year ago
Just like Racket's cond vs if and Qi's switch vs if or partition vs sieve, we'd like to have a multi-clause version of bundle:
cond
if
switch
partition
sieve
bundle
(-< (~> (select 2 4) min) (~> (select 1 3) max))
could be written as:
(bundle (2 4) min max)
but, to be more explicit, and in case there are more than just two cases, it could be written as:
(bundle* [(2 4) min] [(1 3) max])
Here's a macro that does it:
(define-qi-syntax-rule (bundle* [(index ...) f] ...) (-< (~> (select index ...) f) ...))
Suggested by @jairtrejo .
Just like Racket's
cond
vsif
and Qi'sswitch
vsif
orpartition
vssieve
, we'd like to have a multi-clause version ofbundle
:could be written as:
but, to be more explicit, and in case there are more than just two cases, it could be written as:
Here's a macro that does it:
Suggested by @jairtrejo .