Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add these as tests to mac-catch.t #430

Open
masak opened this issue Sep 7, 2022 · 1 comment
Open

Add these as tests to mac-catch.t #430

masak opened this issue Sep 7, 2022 · 1 comment

Comments

@masak
Copy link
Owner

masak commented Sep 7, 2022

$ 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
Copy link
Owner Author

masak commented Sep 12, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant