From: ·····@shum.huji.ac.il
Subject: A Franz Lisp question.
Date: 
Message-ID: <660@shuldig.Huji.Ac.IL>
As a novice to Franz Lisp, I have the following question:

As you all might well know, Franz Lisp is a dynamic binding langauge, while
Scheme is not. Therefore, the following code is unwriteable in Franz Lisp:

(Scheme):

(define (func param)
 (lambda (x) (param x)))

[This function accepts a parameter which is also a function, and returns yet
another function which 'apply's param on x.]

Am I right? And if I am not, how is it done then?


Thanks,
   Misha.
From: Jeff Dalton
Subject: Re: A Franz Lisp question.
Date: 
Message-ID: <1851@skye.ed.ac.uk>
In article <···@shuldig.Huji.Ac.IL> ·····@boojum.huji.ac.il writes:
>As you all might well know, Franz Lisp is a dynamic binding langauge, while
>Scheme is not. Therefore, the following code is unwriteable in Franz Lisp:
>
>(define (func param)
> (lambda (x) (param x)))
>
>[This function accepts a parameter which is also a function, and returns yet
>another function which 'apply's param on x.]

In Opus 38.92, you would write this:

(declare (special param))

(defun func (param)
  (fclosure '(param)
    #'(lambda (x) (funcall param x))))

"funcall" is used to call a functional object.  "fclosure" is
used to make a closure over dynamic (ie, special) variables.
Hence "param" must be declared special if you want your code
to compile correctly.

The problem with compilation occurs because Franz is not a totally
dynamic binding language.  It is for interpreted code, but in compiled
code variables have lexical scope (but only dynamic extent) by default.

-- Jeff