[plt-scheme] Question about Intermediate Student

From: Todd O'Bryan (toddobryan at gmail.com)
Date: Thu Apr 9 22:33:17 EDT 2009

So, one of the things about Intermediate Student is that you can use
functions as arguments and return functions. So, following along in
section 23, we've been writing stuff like:

(define (arithmetic-sequence a0 d)
    [(define (seq n)
         [(zero? n) a0]
         [else (+ (seq (sub1 n)) d)]))]

The problem is that you can pass the result of this function to other
functions, but you can't call it.

(build-list 5 (arithmetic-sequence 2 3)) --> (list 2 5 8 11 14)


((arithmetic-sequence 2 3) 0) produces an error.

Is this intended behavior? Intermediate with Lambda works fine, but it
seems weird that you can create functions that you can't then use as
functions except through other higher-order functions.


Posted on the users mailing list.