Re: call-with-values and primitives

2013-01-11 Thread Andy Wingo
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:

Re: call-with-values and primitives

2013-01-11 Thread Ian Price
brom...@lavabit.com writes: > Hello. > > Why does it return -1? Could anyone explain? > (Comments are mine.) The general principle is to try and give sensible results when +,*,etc are called with a number of arguments other than 2. By thinking them through at this level you can, in theory, write m

call-with-values and primitives

2013-01-11 Thread bromley
Hello. Why does it return -1? Could anyone explain? (Comments are mine.) (call-with-values (lambda () (values 4 5)) (lambda (a b) b)) ; a is 4 and b is 5; return 5 ⇒ 5 (call-with-values * -) ⇒ -1 More: (call-with-values + +) 0 (call-with-values + -) 0 (call-with-values - -)