Whenever I try to use srfi/1 functions like fold and reduce in drracket r5rs language I get an null-list? error. After some research I found that it is due to the fact that the function requires and immutable list but gets a mutable one. How do I create immutable list in r5rs or is this srfi/1 not designed with r5rs in mind?
Share
This is basically reiterating what John said, but it definitely does merit a full answer status. (John, I’ll be happy to delete this if you copy this answer verbatim…)
The thing about Racket’s R5RS language is that it sticks very strictly to just the R5RS language, and therefore comes with nothing beyond that. (SRFIs could be implemented for the R5RS mutable pairs too, but nobody ever came up with the adapted code.)
In any case, the bottom line here is that R5RS is basically useful only in those rare cases where you want to inflict on yourself the pain of writing using just the basic r5rs language — which means that you basically can’t do much useful things. So especially if you want to get a feel for the language, you’ll likely want to play with all kinds of things that go beyond the narrow r5rs world — and for that you should use
#lang racket.It’s also better in terms of “just grokking the language”, and you can even apply the same lessons to other Scheme implementations baring in mind that they all come with their own extensions. If you use the limited r5rs language, you’ll likely to experience the frustration that comes with such a limited language and this can easily overwhelm any positive experience you might have with it otherwise.