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 :unless loop modifier #1289

Merged
merged 1 commit into from
Sep 13, 2023
Merged

Conversation

primo-ppcg
Copy link
Contributor

Related: #1286

  • Adds :unless loop modifier
> (seq [i :range [0 10] :unless (odd? i)] i)
@[0 2 4 6 8]

Copy link
Member

@pepe pepe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sogaiu
Copy link
Contributor

sogaiu commented Sep 13, 2023

Tests gave good results 👍

Some manual invocations (edited for readability):

$ ./build/janet
Janet 1.30.0-db366558 linux/x64/gcc - '(doc)' for help

repl:1:> (seq [i :range [10] :unless (even? i)] i)
@[1 3 5 7 9]

repl:2:> (loop [i :down-to [5] :unless (even? i)] (print i))
5
3
1
nil

@bakpakin bakpakin merged commit dbcc1fa into janet-lang:master Sep 13, 2023
8 checks passed
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

Successfully merging this pull request may close these issues.

4 participants