Skip to content

Does hy have cons, car and cdr equivalents? #2246

Answered by Kodiologist
yatsukha asked this question in Q&A
Discussion options

You must be logged in to vote

To create a list, use [ … ]. To get the first item (a la car), use (get x 0), or (first x) from the toolz library. To get all but the first item (a la cdr), use (slice x 1 None) (cut x 1 None), or (rest x) from Hyrule, or (drop 1 x) from toolz.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@Zambito1
Comment options

@Kodiologist
Comment options

@brandonwillard
Comment options

Answer selected by yatsukha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants