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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAnswer 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 ArticleAre 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
More Pages to Explore .....