bel
bel copied to clipboard
Add these as tests to mac-catch.t
$ 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
>
And maybe one that does effectively a tree traversal, but breaks out of it early, returning the result-so-far.