Skip to content

Conversation

@rwtolbert
Copy link
Contributor

add examples for eachp

@sogaiu sogaiu marked this pull request as draft February 5, 2025 04:15
@sogaiu
Copy link
Collaborator

sogaiu commented Feb 5, 2025

May be using [:a :b :c :d :e] as below instead of [1 2 3 4 5] makes it slightly easier to read the printed output?

# keys for tuple/array are 0-based index
# prints 0->a 1->b 2->c 3->d 4->e
(eachp [i x] [:a :b :c :d :e] (prin i "->" x " ")) # -> nil

For comparison, ATM, the original is:

# keys for tuple/array are 0-based index
# prints 0->1 1->2 2->3 3->4 4->5
(eachp [i x] [1 2 3 4 5] (prin i "->" x " "))

@sogaiu sogaiu marked this pull request as ready for review February 5, 2025 16:14
@sogaiu
Copy link
Collaborator

sogaiu commented Feb 5, 2025

LGTM

@sogaiu sogaiu merged commit 18dc7cd into janet-lang:master Feb 5, 2025
1 check 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.

2 participants