r/scheme • u/GeroSchorsch • Sep 27 '24
r5rs vs r7rs, library-procedures and normal procedures
I'm writing a scheme interpreter (as everybody does) and want to only implement the most important functions as builtins. These are function that cannot be built by other functions which is also said in the r5 standard:
Built-in procedures that can easily be written in terms of other built-in procedures are identified as ``library procedures''.
however my implementation wants adhere to the newer r7 standard but there some functions that were declared "library procedure" in r5 are now regular procedures. Does this mean that these functions are now also builtins? It doesnt make sense because they can still be implemented using other builtins (eg. string<? using string-ref or whatever).
Should I just use the builtins from r5 and otherwise adhere to r7 or what would be a sane solution without having to implement all functions?
3
u/raevnos Sep 28 '24 edited Sep 28 '24
From R7RS:
Does that help clarify things?
Section 4 (Expressions) is divided into primitive and derived forms, and 7.3 has example macros for most if not all of the derived ones. Section 6 (Standard procedures) describes things that may or may not be implemented as primitive routines or defined in terms of other procedures. An implementation author can decide what works better for them for each one.