Scheme session in TeXmacs: brackets [] give error

I try to learn scheme language by using scheme sessions in TeXmacs. I use this book and try to solve examples there. In this book, the brackets, [ ], used to make more understandable syntax. But in the scheme session, it gives an error. For example, (let ((x 2)) (+ x x)) is correct but (let ([x 2]) (+ x x)) gives error for assigning [x.

Scheme is a language with many variants which are only partly compatible with each other and this very unfortunately (IMHO) causes low portability of code (there is the whole issue of syntax extension as the reason for using Scheme but I am not expert enough to discuss that).

There are standards (plural) for the language, which are established by successive elaborations by the same committee (as far as I understand—and I assume that the people in the committee changed with time) but different versions of Scheme (e.g. MIT Scheme, Chez Scheme, Guile, Racket) follow different standards.

TeXmacs uses the Guile version of Scheme, version of Guile is 1.8.8.

I just read on Wikipedia that—referring I assume to the last version of Guile— “Guile implements the Scheme standard R5RS, most of R6RS and R7RS, several Scheme Requests for Implementation ( (SRFI), and many extensions of its own.” (R5RS, R6RS and R7RS are the names of successive standards and SRFIs are a library hosted at

I expect it is possible to figure out what part of the standard is implemented by Guile but I am not motivated to do that :slight_smile:

A good strategy is that if forms “look” simple, then they have a good probability of being implemented in Guile. If they look complicated and they do not work, one can check the Guile manual to see if the the syntax is supported. After a couple of weeks you will probably develop a good feeling for what is in Guile and what is not there. It is very likely that brackets aren’t. My experience is that code which is written for MIT Scheme usually works in Guile, and code that is written for Racket might not.
For the book that you are reading my feeling (after going through some of the pages) is that most of the code should work in Guile (maybe, even, the brackets are the only exception, but I am guessing).

The reference manual for Guile 1.8 (the version used by TeXmacs) is, and in particular at you find the list of function where you can check the syntax. For example, at there is the syntax for conditional expressions.

As a separate topic from this, it is possible to manipulate the syntax of the input (which is different from manipulating the syntax of the expressions!), but I never tried to do that. This means that maybe one could introduce the brackets into Guile :-).

Thank you for your explanation. I just verified in drracket. If I change the language to R5RS, the "read-syntax: illegal use of [" appears. For Pretty Big and Racket there is no error. I read elsewhere that the Pretty Big closer to Scheme.

The Guile 1.8 manual is here:
There is also an introduction to Scheme. The book of Dybvig is very good but refers to R6RS and as Giovanni says the different implementations can use different dialects. R6RS is quite difficult to implement because was quite huge, this was the reason that the new standard R7RS divided the language in a “small” and “large” components. Guile 1.8 is mostly R5RS as far as I understand, so as you remarked does not support the various parenthesis styles. In my experience the parts where the various languages diverge is in exception handling, special characters representation and the records syntax. Also in TeXmacs we usually use the old style (lisp) macros and not the syntax-case system which the book introduces. But usually to extend TeXmacs you should not need to write your own macros.

Thank you for your explanation and reference. The drracket supports R5RS and I will use it to learn guile. I learn guile for fun and so as not to go crazy in this endless quarantine :slight_smile: . Learning languages keeps your mind in order, especially as you age.

1 Like