On Fri 11 Jan 2013 15:23, brom...@lavabit.com writes:

> (call-with-values * -)
> ⇒ -1

So it's like:

  (call-with-values producer consumer)

The producer is called with no arguments, then the results of that call
are passed to the consumer.

So first `*' is called with no arguments, like this:

  (*)

Calling `*' always returns just one value, so in this case it's
equivalent to binding a single value, so the original expression is
completely equivalent to:

  (let ((tmp (*)))
    (- tmp))

Reducing this further:

  => (let ((tmp 1))
       (- tmp))

  => (- 1)

  => -1

See the R5RS for more, including the definition of (*) and (+).

> (call-with-values + +)
> 0

  (let ((tmp (+)))
    (+ tmp))

> (call-with-values + -)
> 0

  (let ((tmp (+)))
    (- tmp))

> (call-with-values - -)

  (let ((tmp (-)))
    (- tmp))

> ERROR: Wrong number of arguments to -
> ABORT: (wrong-number-of-args)

(-) has no sensible answer.

Happy hacking,

Andy
-- 
http://wingolog.org/

Reply via email to