Quantcast

A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 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)

  • This Question is Open
  1. teal
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    The 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.

  2. dbastos
    • 9 months ago
    Best Response
    You've already chosen the best response.
    Medals 1

    Like 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?

  3. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

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
  • 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.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.