Differences between Scheme and Common Lisp

submited by
Style Pass
2024-09-23 19:00:08

Some of these features include: packages, arrays, structures, hash tables, object-oriented programming features, a powerful macro feature for extending the language, generalized assignment, and much more. Numbers The Scheme specification allows an implementation of Scheme to have very little support for numbers. In fact, it would be acceptable to have only floating point numbers and still call it Scheme.

Common Lisp, by contracts, requires every implementation to support floating point numbers, rational numbers, integers of arbitrary precision, complex floating point number, and complex rational numbers. This fact makes programs that use numbers more portable. Tail call optimization In Scheme, tail calls must be optimized by the compiler, so that no additional stack space is consumed. Thus, in Scheme, iteration is a special case of tail recursion. You can count on the Scheme compiler (or interpreter) to convert tail calls to simple jumps.

No such rule exists in Common Lisp, although many Common Lisp compilers actually do optimize tail calls. It is therefore less frequent in Common Lisp to use tail recursion for (say) traversing lists. Instead, Common Lisp has a rich set of iteration primitives for exactly that purpose. Program/data equivalence A major problem with Scheme that does not exist in Common Lisp is that the Scheme language does not define an internal representation for programs, although to be fair, all Scheme implementations do.

Leave a Comment