Scheme – use car to display the first element of list

Contributor Icon Contributed by William_Wilson  
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)

 

4 Comments -


  1. Dream Cars said on November 17, 2008

    He is just thankful he has not lost a leg but he is expected to recover.”

  2. Porsche Blog said on December 1, 2008

    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

  3. Land rover said on May 8, 2009

    Nice one..Not sure I do understab=nd how it will be applied in real life.

  4. www.centralcontracts.com said on December 31, 2010

    A bit confusing, but I like it.

 

RSS feed for comments on this post. TrackBack URL

Leave a comment -