Ace school

with brainly

  • Get help from millions of students
  • Learn from experts with step-by-step explanations
  • Level-up by helping others

A community for students.

All trailing zeros in a list-of-digits can be removed without changing the number it represents. Write a function lod-clean that removes trailing zeros from a list-of-digits. this is to be done using scheme @Computer Science

Computer Science
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

such that (lod-clean (list 1 2 3 4 0 0 0)) => (list 1 2 3 4) (lod-clean (list 0 0 0))=> empty (lod-clean (list 5 5 0 5)) => (list 5 5 0 5)
How to really use scheme escapes me at the moment, I'm out of practice with it, but if I remember correctly, the solution to this problem should be something as follows: 1. Recursively go to the end of the list. (until cddr is null or empty) 2. Check if cadr is a zero. 3. If cadr is different from zero, put it together with the rest of the list using (cons ..) or another way of putting lists together. Throw it away otherwise. 4. Return fully assembled list. I'll try to come up with the actual function, but don't trust me on it, since I don't have Scheme on this machine, and it's been long since I last used it. Good luck.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Not the answer you are looking for?

Search for more explanations.

Ask your own question