Questions tagged [seasoned-schemer]

**The Seasoned Schemer**, a book on recursive programming by Daniel P. Friedman and Matthias Felleisen. It's the continuation of **The Little Schemer**

The Seasoned Schemer is a book by Daniel P. Friedman and Matthias Felleisen, it's the continuation of The Little Schemer, introducing more advanced concepts of recursive programming to an audience which may have no prior experience with programming or mathematics. All the examples are in the Scheme language but it is not intended as an introduction to Scheme, and only uses that subset of the language necessary to implement solutions to the various tasks set in the book. Some of the new subjects introduced include: let, continuations and mutable state.

13 questions
10
votes
1 answer

The Seasoned Schemer, letcc and guile

A few questions here, regarding letcc that is used in The Seasoned Schemer. (define (intersect-all sets) (letcc hop (letrec ((A (lambda (sets) (cond ((null? (car sets)) (hop '()) ((null? (cdr…
d11wtq
  • 34,788
  • 19
  • 120
  • 195
6
votes
2 answers

Is there any function like 'try' in Racket

Now I'm leaning schemer by looking the book The Seasoned Schemer. I writed the code by racket, however when I using the try, the schemer didn't have this method or macro. And It reported expand: unbound identifier in module in: try. The code as the…
Colin Ji
  • 803
  • 7
  • 15
5
votes
1 answer

Seasoned Schemer's get-first, get-next, and waddle functions

(define get-first (lambda (l) (call-with-current-continuation (lambda (here) (set! leave here) (waddle l) (leave (quote ())))))) (define get-first (lambda (l) (call-with-current-continuation (lambda…
5
votes
1 answer

Length function in " The Seasoned Schemer"

I have been reading The Seasoned Schemer and i came across this definition of the length function (define length (let ((h (lambda (l) 0))) (set! h (L (lambda (arg) (h arg)))) h)) Later they say : What is the value of (L (lambda (arg) (h…
Rajesh Bhat
  • 980
  • 6
  • 8
2
votes
3 answers

get-first - the-seasoned-schemer

Please take a look at two-in-a-row*? function in chapter 19. My question is about the (leave '()) in the get-first helper function. Note that (waddle l) will either return '() or an atom, which indicates the list has exhausted or an atom from the…
Lin
  • 1,547
  • 2
  • 12
  • 26
2
votes
1 answer

Testing whether two pairs (cons cells) are the same

The following function from pg 150 of the Seasoned Schemer establishes whether two lists have the same identity (i.e. occupy the same memory) by mutating each list's cdr and then checking whether the change has affected both: (define same? (lambda…
planarian
  • 2,047
  • 18
  • 18
1
vote
3 answers

Scheme/"The Seasoned Schemer": Question about the syntax of the definition of "try" function

In their book "The Seasoned Schemer", Felleisen and Friedman introduce the try function. According to http://community.schemewiki.org/?seasoned-schemer, this function can be defined as (define-syntax try (syntax-rules () ((try var a . b) …
J. Hauser
  • 115
  • 1
  • 9
1
vote
0 answers

Forecasting with 2 time series with inequal lenght and frequency

I have 2 time series. 1) monthly residential natural gas demand from 2013 to 2016 2) daily average temperature from 2013 to 31/03/2017 I have to provide a monthly and daily prediction of the residential natural gas demand for the period January 2017…
1
vote
1 answer

The Seasoned Schemer: Intersectall (page 49)

At page 49 of The Seasoned Schemer, I can't understand what is going on in the following code (lines 14-16): (define intersectall (lambda (lset) (letcc hop (letrec ((A (lambda (lset) (cond ((null? (car lset)) (hop…
0
votes
2 answers

How does scramble function works? (Chapter 1 of The Seasoned Schemer)

According to the book, this is what the function definition is, The function scramble takes a non-empty tuple in which no argument is greater than its own index and returns a tuple of same length. Each number in the argument is treated as a…
0
votes
0 answers

Season in Forcasting in Tableau

enter image description hereenter image description here my data is a monthly accumulated revenue table. start at the beginning day of the month and end at the ending day of the month. in my tableau forcasting, it cannot detect the season = 1 month…
0
votes
1 answer

caching previous return values of procedures in scheme

In Chapter 16 of "The Seasoned Schemer", the authors define a recursive procedure "depth", which returns 'pizza nested in n lists, e.g (depth 3) is (((pizza))). They then improve it as "depthM", which caches its return values using set! in the lists…
Brock
  • 330
  • 1
  • 6
0
votes
1 answer

leftmost and lm in Seasoned Schemer

The seasoned schemer on page 78 has the below definition of leftmost and lm. (define leftmost (lambda (l) (letcc skip (lm l skip)))) (define lm (lambda (l out) (cond ((null? l) (quote ())) ((atom? (car l)) (out (car…
user782220
  • 10,677
  • 21
  • 72
  • 135