From: Andrei Zorine
Subject: Array of lambda functions
Date: 
Message-ID: <b795f7d2.0402091425.685a9565@posting.google.com>
Hello, group. 
please explain why I get an error here:
(setq a #( #'(lambda() 0)))
(funcall (aref a 0))

Funcall complains #'(lambda nil 0) is not a name of a function. So,
the problem is to call a function which is stored in an array. Maybe
other standart solutions exist to have a handful of lambda functions
and refer a particular function to get it evaluated?
--
Andrei Zorine

From: Christopher C. Stacy
Subject: Re: Array of lambda functions
Date: 
Message-ID: <un07rvo8l.fsf@news.dtpq.com>
>>>>> On 9 Feb 2004 14:25:28 -0800, Andrei Zorine ("Andrei") writes:

 Andrei> Hello, group. 
 Andrei> please explain why I get an error here:
 Andrei> (setq a #( #'(lambda() 0)))
 Andrei> (funcall (aref a 0))

Look at what's in (AREF A 0)
and compare with  (FUNCTION (LAMBDA () 0))
and compare with  (SETQ B #((+ 1 2) GOODIE))
From: rydis (Martin Rydstr|m) @CD.Chalmers.SE
Subject: Re: Array of lambda functions
Date: 
Message-ID: <w4cisifc1ha.fsf@basil.cd.chalmers.se>
·····@uic.nnov.ru (Andrei Zorine) writes:
> Hello, group. 
> please explain why I get an error here:
> (setq a #( #'(lambda() 0)))
> (funcall (aref a 0))
> 
> Funcall complains #'(lambda nil 0) is not a name of a function. So,
> the problem is to call a function which is stored in an array. Maybe
> other standart solutions exist to have a handful of lambda functions
> and refer a particular function to get it evaluated?

Arrays written like #() are self-evaluating, meaning that the FUNCTION
special form isn't evaluated. Try `#(,#'(lambda () 0)) instead.

Regards,

'mr

-- 
[Emacs] is written in Lisp, which is the only computer language that is
beautiful.  -- Neal Stephenson, _In the Beginning was the Command Line_
From: Frode Vatvedt Fjeld
Subject: Re: Array of lambda functions
Date: 
Message-ID: <2hsmhjvnf9.fsf@vserver.cs.uit.no>
rydis (Martin Rydstr|m) @CD.Chalmers.SE writes:

> [..] Try `#(,#'(lambda () 0)) instead.

I'd suggest (vector (lambda () 0)).

-- 
Frode Vatvedt Fjeld