Re: lambda error update

About this list Date view Thread view Subject view Author view Other groups

Subject: Re: lambda error update
From: Peter Dalgaard BSA (p.dalgaard@biostat.ku.dk)
Date: Sat 18 Sep 1999 - 09:53:55 EST


Message-ID: <x2aeqlt7qk.fsf@blueberry.kubism.ku.dk>

Matthew Wiener <mcw@ln.nimh.nih.gov> writes:

> Two more details:
>
> Someone else who works here, and hasn't used 0.65.0, thinks he's seen the
> error before. He restarted R, and it went away.
>
> Second, I think the relevant code is in
> SEXP do_function, in eval.c in the main directory.
>
> line 695: WrongArgCount("lambda")
>
> Beyond that I'm afraid I'm getting in over my head.
>
> Matt

"lambda" is essentially "function" (revealing the fact that R's engine
is really a Lisp/Scheme dialect). It's a very strange error you're
getting because the calls to "function" are almost impossible to
create, except by having the parser parse a

function (<args>) <body>

construction and that would set up a call with the right number of
parameters (xxdefun in gram.y calls lang4). The arg count got changed
from 0.64.2 to 0.65.0 (from 3 to 4) to accommodate the stored source
attribute. I suppose that a function stored in a saved workspace might
cause some kind of mess when restored.

You can provoke the error by messing with the parse tree of function()
constructs, e.g.

> e<-quote(function()1)
> e[[4]]<-NULL
> eval(e)
Error: incorrect number of arguments to "lambda"
> e
function() 1
> e<-quote(function()1)
> e[[3]]<-NULL
> eval(e)
Error: incorrect number of arguments to "lambda"
> e
function() "function()1"
> e[[2]]<-NULL
> eval(e)
Error: incorrect number of arguments to "lambda"
> e
Segmentation fault (core dumped)

(That last one seems to indicate yet another spot where the deparser
needs to take better care).

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:08 EST