From: Nicolas Neuss on
Nicolas Neuss <lastname(a)math.uni-karlsruhe.de> writes:

> Ask yourself also the question if you really that short notation. The
^
want
> interpretation of this message passing OO stuff is something like "send
> object message", so instead of getting around funcall one better should
> rename it:
>
> (defun send (object arg)
> (funcall object arg))
>
> (I have introduced such a send function even when using Scheme.)

Or better

(defun send (object method &rest args)
(apply (funcall object method) args))

which can be used without many parens as

(send balance 'withdraw 10)

Nicolas
From: Pascal J. Bourguignon on
D Herring <dherring(a)at.tentpost.dot.com> writes:

> Yongwei Xing wrote:
>> On 1月3日, 下午2时59分, D Herring <dherr...(a)at.tentpost.dot.com> wrote:
>>> Yongwei Xing wrote:
>>>> Today I read the book SICP, chapter 3. I read the code below
>>>> (define (make-simplified-withdraw balance)
>>>> (lambda (amount)
>>>> (set! balance (- balance amount))
>>>> balance))
>>>
>>> (defun make-simplified-withdraw (balance)
>>> (lambda (amount)
>>> (setf balance (- balance amount))
>>> balance))
>
>> Thanks very much for your detailed explanation.
> You're welcome.
>
>> One question, if I want to use it like the Schema (f 10). What should
>> I do in the commin lisp?
> (defvar x) ; you can give it a value if desired

There's no need to declare a special variable if you don't need it.

Just the following will do:

> (setf (symbol-function 'x) (make-simplified-withdraw 10))
> (x 10)
>
> Later,
> Daniel

--
__Pascal Bourguignon__ http://www.informatimago.com/