Skip to main content
5 votes
Accepted

Are lessons on tail recursion transferable to languages that don't optimize for it?

In fact, I'm nearly 100 pages in and have yet to see a single for or while loop - it's all been recursion. Spoiler alert: you won't be seeing any loops in the book, for the simple reason that the ...
Jörg W Mittag's user avatar
2 votes

Are lessons on tail recursion transferable to languages that don't optimize for it?

The SCIP book is about the fundamentals of programming and programming languages. It is not about lessons which you will apply to one specific programming language, rather it is about understanding ...
JacquesB's user avatar
  • 61.6k
2 votes
Accepted

Using define in a conditional expression in Scheme

define can only be used at either the top-level, or at the beginning of a body. It cannot be used in other places where expressions can be used. Here is the relevant quote from R5RS: Definitions are ...
user102008's user avatar
2 votes

Scheme's define in Common Lisp

You don't have to use LET when using DEFUN: you can define local variables in the parameter list: (defun foo (a) (let ((b (expt a 3))) (+ a b))) is also (defun foo (a &aux (b (expt a 3))) ...
Rainer Joswig's user avatar
1 vote

Scheme's define in Common Lisp

Yes, of course this is possible: CL is a language which excels in creating new languages: that's what Lisps are for. You could start with something like binding. This is a macro which works so that (...
ignis volens's user avatar
1 vote

How does Lamé's Theorem give us an order-of-growth estimate for Euclid's Algorithm?

In my edition of SICP (first edition from 1987), the final sentence in that paragraph contained indeed O(log n), not Theta(log n), which fits to your observation - the provided proof literally just ...
Doc Brown's user avatar
  • 218k
1 vote

Are lessons on tail recursion transferable to languages that don't optimize for it?

For example, the sum of integers from n to m is 0 if n > m, and n plus the sum of integers from n+1 to m otherwise. You can write code for this using tail recursion. If tail recursion is part of ...
gnasher729's user avatar
  • 48.8k
1 vote

"preempts no lexical conventions" in a Scheme PL report

What they're saying is that a conforming implementation must provide a syntactic mode that complies exactly with the lexical conventions of the report. It may ALSO provide ways to change the ...
John R. Strohm's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible