bel icon indicating copy to clipboard operation
bel copied to clipboard

Add these as tests to mac-catch.t

Open masak opened this issue 3 years ago • 1 comments

$ perl -Ilib bin/bel
Language::Bel 0.58 -- msys.
> (catch (throw 'hah))
hah
> (catch (bind break (fn () (throw 'break)) (break)))
break

These have the expected semantics, but I just noticed that the test file for catch is extremely sparse.

Maybe this one too:

$ perl -Ilib bin/bel
Language::Bel 0.58 -- msys.
> (mac each/b (var expr . body) `(catch (bind break (fn () (throw 'break)) (map (fn (,var) ,@body) ,expr))))
> (each/b x '(1 2 3 4 5) (pr x \lf) (if (> x 3) (break)))
1
2
3
4
break
>

masak avatar Sep 07 '22 09:09 masak

And maybe one that does effectively a tree traversal, but breaks out of it early, returning the result-so-far.

masak avatar Sep 12 '22 14:09 masak