tags:

views:

176

answers:

3

What does the following Guile scheme code do?

(eq? y '.)
(cons x '.)

The code is not valid in MzScheme, is there a portable equivalent across scheme implementations?

I am trying to port this code written by someone else. Guile seems to respond to '. with #{.}#, but I'm not sure what it means or how to do this in another scheme.

A: 

I'm surprised any Scheme system will accept a dot symbol at all. My advice is to use another symbol as (I'm sure you're aware) the dot is a shorthand to represent a pair, and even if you can find a Scheme that will take your code you will likely confuse anyone that has the unfortunate task of actually reading your code.

Kyle Cronin
A: 

Thank you Kyle, I already recognise that this code is not portable, which is why I seek a replacement. I also know that (a . b) is the syntax for a pair in Scheme, but I don't know what (a b '.) means to Guile, which is why I ask the question in the first place. If anyone knows the symbol needed instead, your reply would be most welcome.

Ali
+2  A: 

Okay, it seems that '. is valid syntax for (string->symbol ".") in Guile, whereas MzScheme at least requires |.| for the period as a symbol.

Ali