Tom
Tom

Reputation: 673

Scheme - value in list

I have list of lists:

((1500) (2500) (3500))

Now, I want to use the values in each list. when I do (car list), It give me (1500) - list, but I want the value 1500 (int).

How can I do it?

Thank u!

Upvotes: 1

Views: 117

Answers (3)

erjiang
erjiang

Reputation: 45657

> (map car '((1500) (2500) (3500)))
(1500 2000 3)

Upvotes: 0

Feanor
Feanor

Reputation: 2725

You need the car of the list containing 1500, which will be the value.

Something like:

(car (car '((1500)(2500)(3500))))

This suffices for the first value. There are other ways to go about it to get all the other values, as larsman pointed out.

Upvotes: 2

Fred Foo
Fred Foo

Reputation: 363567

> (apply append '((1500) (2500) (3500)))
(1500 2500 3500)

Upvotes: 1

Related Questions