scheme - How to have a pair whose second element is a list? -


i'd have pair second element may either symbol or list. example, '(x . y) , '(x . (a b c d)) both valid pairs in context. if second element symbol, can pair cons, if list?

then still use cons scheme printer better @ printing sort of pairs vs other ones. that's reason different.

> (define x '(1 2 3)) > (car (cons 0 x))   0 > (cdr (cons 0 x))   (1 2 3) 

scheme lists defined recursively formula

  1. a list pair of datum , list
  2. '() list. (really that's totally arbitrary , anything, '() strong tradition)

here's pretty picture of it.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -