chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Re: A few questions


From: John Cowan
Subject: Re: [Chicken-users] Re: A few questions
Date: Thu, 31 Jan 2008 17:31:33 -0500
User-agent: Mutt/1.5.13 (2006-08-11)

Elf scripsit:

> unless the procedure accepts unlimited arguments (explicitly or implicitly),
> it should be possible to trace how many args are absorbed.  

Consider this:

(define (foo . rest) (if (= 1 (random 1)) (car rest) #f)

How many arguments does it consume?

> any compiler should know the argcount and retval of any procs
> its handling.  it would mean adding a single field to the AST.
> not exactly difficult.

Again, you are misunderestimating the scope of the problem.  Consider this:

(define (bar lst)
     blah blah ...
     (apply values lst))

How many values does it return?

> there are (at minimum) an extra 3 apply/continuations, if i just
> calculated it correctly, because of the call-with-values itself,
> the additional apply, and the thunk wrapper for the values generator.
> procedure calls arent free.   this is also neglecting the extra layer
> of arity checks.

Fair enough, though Chicken can inline simple cases like this.

> multiple values are not the dual of multiple arguments.  lists are
> the dual of multiple arguments.

True in another sense.

> the simplest theoretical construction for multiple args is currying, and
> at least in my current thinkings, the dual of currying is nested lists.

I don't follow that.

> if they WERE duals as you claim, the point you made above regarding
> (bar (foo x)) would not hold.

Or that.

-- 
John Cowan                              address@hidden
            http://www.ccil.org/~cowan
Humpty Dump Dublin squeaks through his norse
                Humpty Dump Dublin hath a horrible vorse
But for all his kinks English / And his irismanx brogues
                Humpty Dump Dublin's grandada of all rogues.  --Cousin James




reply via email to

[Prev in Thread] Current Thread [Next in Thread]