A community for students.
Here's the question you clicked on:
 0 viewing
ericrost
 one year ago
For Problem Lec.5.3.3: Functions on Lists Part 2 question 12, I don't understand why (length (cons y y)) is 4. For reference y => (1 2 3)
ericrost
 one year ago
For Problem Lec.5.3.3: Functions on Lists Part 2 question 12, I don't understand why (length (cons y y)) is 4. For reference y => (1 2 3)

This Question is Open

teal
 one year ago
Best ResponseYou've already chosen the best response.0The list is ((1 2 3) 1 2 3), which is 4 items. The first list is only a single item, because it's in car.

dbastos
 11 months ago
Best ResponseYou've already chosen the best response.1Like our friend above says, the first element is a single item. In Lisp, lists can contain any kind of elements. (Even other lists.) In that list of yours, the first element is a list (with 3 elements), but that list with 3 elements is /the first/ element of the list (cons y y). Does that clarify?
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.