Scheme – use car to display the first element of list

Contributor Icon Contributed by William_Wilson Date Icon October 14, 2006  
Tag Icon Tagged: Computer programming

This is a simple demonstration of the car feature in scheme. The car command simply displays the first element of a list, no matter what it is, be it a character, symbol, int, or even another list. This is useful for streams later on.



(define a (list 1 2 3))
(write car a);prints 1

Questions/Comments: william_a_wilson@hotmail.com
-William. § (marvin_gohan)

Previous recipe | Next recipe |
 
  • He is just thankful he has not lost a leg but he is expected to recover.”
  • a simple demonstration of the car feature in scheme. The car command simply displays the first element of a list, no matter what it is, be it a character
  • Nice one..Not sure I do understab=nd how it will be applied in real life.
blog comments powered by Disqus