TeXmacs Scheme: Some questions on the current situation

TeXmacs 2.1.2 still uses guile 1.8.8 as its extension language. The TeXmacs-Scheme Developer Guide https://www.texmacs.org/tmweb/documents/manuals/texmacs-scheme.en.pdf mentions two online manuals.

  1. Dybvig, The Scheme programming language. 2nd ed.(1996). Is this still up to date?

  2. The Guile Reference Manual (v.1.8.8) which unfortunately has been taken off from the gnu.org site. Does anyone have a pdf-version of the file or know a link that is still working?

  3. Will guile 3.0.8 or s7 be the future extension language? Following the discussions here on this forum I have the impression it might well be s7. How much does s7 differ from guile 1.8.8 from a “user” perspective?

  4. Where should, in this transitory situation, the uninitiated best get stared to get acquainted with TeXmac’s extension language?


the various schemes differs by the way some particular structures are implemented, or how macros are written. personally I read Dybvig book to get a feeling of the basic constructs. Then the point of having a scheme is that you can build via macros a language on top of it which is tailored to your particular use case. TeXmacs has a whole series of macros and ways to do things, which are mostly mentioned in the user guide “texmacs-scheme”. There is no better way to learn that to read the code. You will not find in the manuals the meaning of the many macros which TeXmacs define like tm-menu, tm-define, etc… the cool thing about scheme is that you do not really need a manual to understand the basics. Most of the basic constructs are explained here: https://groups.csail.mit.edu/mac/ftpdir/scheme-reports/r5rs-html/r5rs_toc.html . but note that TeXmacs use “old-style” lisp macros and not the more modern macro systems of the various schemes. I.e. macros are just functions which are invoked before evaluation of the arguments and which returns a new form which is then evaluated. See e.g. https://www.gnu.org/software/guile/manual/html_node/Defmacros.html


As an introduction to Scheme, I like http://www.shido.info/lisp/idx_scm_e.html

I need to look at my bookmarks to see whether I have saved some more good ones.

1 Like

Thank‘s for the hints and links, @mgubi, @pireddag.

We could try to make up a tutorial on texmacs/scheme based on your questions/input/experince. I guess we can work on it together but I really need the eyes of an unexperienced user to come up with useful questions/answers. So feel free to ask things in this thread and then we can come up with answers which at some point we can compile and consolidate in a document.

@pireddag, @jeroen, @darcy what do you think? I’m not thinking about documentation which has to be maintained, but a tutorial on TeXmacs internals which give the basic idea and allow people to explore the codebase themselves, and also records our findings (like how to customise biblio, useful scheme commands, example code, etc…)


I’m more than willing to participate. After Xmas I am going to ask some questions here on issues like changing the formatting of footnotes that have been on my mind for quite a while.

So long


I like the idea. Perhaps we could use as a starting point for basic Scheme concepts an existing Scheme tutorial we all like. It will also help me learn the Scheme used in TeXmacs

1 Like

I’m happy to participate.

When I first started using TeXmacs Scheme I made a few notes on TeXmacs Scheme functions:

  • cAr: last item in a list
  • cDr: all but the last item in a list
  • with: abbreviation for let with less parentheses. Can also be used with multiple variables at the same time, e.g. (with (a b) '(1 2) (+ a b 2))
  • and-with: with, with additional and such that the code is only executed if the provided value for the variable is not #f, e.g. (and-with a 1 (+ a 2)) returns 3, while (and-with a #f (+ 1 a)) returns #f. Using with in the latter example would throw an error.

Documentation is needed. But currently GNU TeXmacs is using GNU Guile 1.8. I think we should focus only one Scheme implementation.

Unit tests and usage of Scheme routines should be carefully documented.

My experience with the codebase says that the actual implementation does not matter much unless you need to do low level stuff. I think we can explain and exemplify most of the useful stuff without relying on precise behaviour of the different implementations e.g. Guile 1.6 vs. Guile 1.8, Guile 3.0 or S7.


The problem for S7 is the code related meta programming for GNU Guile 1.8.x does not actually work for now. Because it only affects the developers’ experience, I have not started my work to improve it.

Here is the API doc for url related routines: https://gitee.com/texmacs/texmacs/blob/master/TeXmacs/doc/devel/scheme/api/url.en.tm

We started our work, but the API doc is not complete.

It seems that the Scheme in TeXmacs is untyped. Is it possible to write typed-scheme?

1 Like

There exists dialects which support explicit types (look at Racket). Note that Scheme/Lisp is strongly typed (i.e. you get errors if you apply functions to wrong arguments), but is dynamically typed (https://wiki.c2.com/?DynamicTyping).


Thanks for the wiki @mgubi. Following some of the links given there, I came across this guile Cookbook: https://pleac.sourceforge.net/pleac_guile/index.html#AEN4. Not sure how useful it really is, but it looks kind of interesting.


1 Like

That’s a really good source of examples. I guess the fastest way to learn. Another good book is “The Little Schemer” https://mitpress.mit.edu/9780262560993/the-little-schemer/

1 Like

First two chapters of SICP are available in GNU TeXmacs format: https://github.com/XmacsLabs/interactive-sicp

@jingkaimori is working on Chapter 3.

I tried to use the TeXmacs Graphics Tool to re-draw the most figures in Chapter 1 and Chapter 2.


I think this could go forward step by step if we set up the infrastructure. I would be much happier with a wiki than with a website like the current TeXmacs notes: despite spending on it time, I still am very slow in using git, and it dissuades me from writing.

Addition: maybe, with an adaptation, such a tutorial could be on-topic for Wikibooks (e.g. see https://en.wikibooks.org/wiki/Scheme_Programming). A wiki on TeXmacs/Scheme on the other hand probably would not be on topic there (see https://en.wikibooks.org/wiki/Wikibooks:What_is_Wikibooks and https://en.wikibooks.org/wiki/Wikibooks:What_is_Wikibooks#Wikibooks_is_not_a_free_wiki_host_or_webspace_provider in particular).

I do not agree with the idea to have a wiki. Any wiki requires infrastructure and a server. The point is that a git workflow is compatible with TeXmacs, but I do not know how to set up a wiki which works with TeXmacs format. Nobody knows how to use git, everybody knows how to use 2/3 commands with git: (clone, commit, add). This is all you need. It is not very different from others versioning systems and with time we could hope to have a TeXmacs interface to it. If you like you can send me your contributions and I can integrate them to the blog. Please also feel free to suggest how to improve the blog. I was thinking to add authors of the articles, so that people feel rewarded for their work.