Reputation: 1024
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.
Upvotes: 4
Views: 588
Reputation: 74
#{.}#
is Guile specific way to define the symbol contains some delimiters of Scheme.
http://www.gnu.org/software/guile/manual/html_node/Symbol-Read-Syntax.html
For other Scheme dialect, there should be another way.
Upvotes: 1
Reputation: 1024
Okay, it seems that '. is valid syntax for (string->symbol ".") in Guile, whereas MzScheme at least requires |.| for the period as a symbol.
Upvotes: 3
Reputation: 79103
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.
Upvotes: 0