Quantcast
Channel: Are pair and list different in Scheme? - Stack Overflow
Browsing all 6 articles
Browse latest View live

Answer by Ira for Are pair and list different in Scheme?

List must end with empty list (also termed as null). Below sample code on repl illustrates the difference. > (cons 1 (cons 2 '())) ; I am a pair as well as list'(1 2)(pair? (cons 1 (cons 2 '())))...

View Article



Answer by Guglielmo Guglielmi for Are pair and list different in Scheme?

dr rackect explains it much more clearer: "A pair joins two arbitrary values.....The cons procedure constructs pairs"(cons 1 2)'(1 . 2)(pair? (cons 1 2))#ton the other hand"A list is a combination of...

View Article

Answer by Reggie for Are pair and list different in Scheme?

Yes!Pairs:(cons y z) creates a pair between the values y and z. Likewise, the (more complicated) expression (cons x (cons y z)) creates a pair between x and the pair (y . z). You can also represent...

View Article

Answer by Chang Peng for Are pair and list different in Scheme?

(1 . 2) is sometimes called an improper list, because it is not NIL terminated. (1 2) represented in dot form may be written (1 2 . NIL), but you should not write something like this.

View Article

Answer by hammar for Are pair and list different in Scheme?

No, they are not the same.'(1 . 2) means (cons 1 2)whereas'(1 2) means (cons 1 (cons 2 nil))

View Article


Are pair and list different in Scheme?

I wonder whether '(1 . 2) and '(1 2) mean the same data (equal to each other) in Scheme or not? I think they are the same thing, is this correct?

View Article
Browsing all 6 articles
Browse latest View live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>