TeaLoverGuy
TeaLoverGuy

Reputation: 87

Scheme remove list itself

How do I remove the list itself in scheme? Are there any functions that does this?

 (1 2 3 4 5) -> 1 2 3 4 5

Car does almost what I want, but it only gives the first element.

Upvotes: 1

Views: 50

Answers (2)

John Clements
John Clements

Reputation: 17203

At the risk of getting all www.htdp.org on you, I have to ask: what value is it you want to produce?

Taking a step back: In Racket/Scheme/whatever, programs take in values and produce values. So, for your question, you want to take in a list, and return ... what? Specifically, what Scheme value do you want to return?

Upvotes: 0

soegaard
soegaard

Reputation: 31147

A literal interpretation of your question:

> (apply values '(1 2 3 4 5))
1
2
3
4
5

But maybe, you are looking for list-ref ?

> (list-ref '(a b c d) 2)
'c

Upvotes: 3

Related Questions