When I do a cons on two atoms, I am getting a . in between.
1]=>(cons 'one 'two)
;Value 1: (one . two)
Why I am getting the . operator. Does it have any meaning?
I am using mit-scheme.
I have seen this stackoverflow link but not clear.
UPDATE:
The definition of cons in Little Schemer states that,
cons takes two arguments, the first one is any S-expression and the second one is any list.
The dot is just the way Scheme displays a
conscell when thecdrpart is not itself aconscell or the empty list. The dot is not an operator in this case, for example:If the
cdrpart is aconscell or the empty list'(), then we have a list:The definition in The Little Schemer is a simplification, in reality
conscan take any type of value for each one of its arguments. By convention if the second argument is a list it'll be considered a list and displayed as such, otherwise it's a plain oldconscell and the dot is there to remind you of this.