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 list-ops exercise #178

Merged
merged 3 commits into from
May 9, 2024
Merged

Add list-ops exercise #178

merged 3 commits into from
May 9, 2024

Conversation

ErikSchierboom
Copy link
Member

@ErikSchierboom ErikSchierboom commented May 8, 2024

This was surprisingly easy.

@ErikSchierboom ErikSchierboom changed the title Add 'list-ops' exercise Add list-ops exercise May 8, 2024
Comment on lines 43 to 51
"empty list"
( [] ( 2 n:/mod drop 1 n:= ) filter )
[]
equal?

"non-empty list"
( [1, 2, 3, 5] ( 2 n:/mod drop 1 n:= ) filter )
[1, 3, 5]
equal?
Copy link
Contributor

Choose a reason for hiding this comment

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

How about a little helper word?

Suggested change
"empty list"
( [] ( 2 n:/mod drop 1 n:= ) filter )
[]
equal?
"non-empty list"
( [1, 2, 3, 5] ( 2 n:/mod drop 1 n:= ) filter )
[1, 3, 5]
equal?
: odd? \ n -- t
2 n:/mod drop 1 n:=
;
"empty list"
( [] ' odd? filter )
[]
equal?
"non-empty list"
( [1, 2, 3, 5] ' odd? filter )
[1, 3, 5]
equal?

@ErikSchierboom ErikSchierboom merged commit 21c94c2 into main May 9, 2024
1 of 2 checks passed
@ErikSchierboom ErikSchierboom deleted the list-ops branch May 9, 2024 06:35
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.

3 participants