From p.dalgaard@biostat.ku.dk  Sat Sep 18 00:53:55 1999
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 18 Sep 1999 01:53:55 +0200
Subject: lambda error update
In-Reply-To: Matthew Wiener's message of "Fri, 17 Sep 1999 16:44:17 -0400 (EDT)"
References: <Pine.SGI.3.96.990917164220.909I-100000@ln.nimh.nih.gov>
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


lambda error update
Peter Dalgaard BSA