Re: [racket-users] Is my model of (values) accurate?

2016-07-22 Thread David Storrs
*sigh* Just when I was feeling clever, I discover I missed the obvious. ;> Thanks, everyone. On Fri, Jul 22, 2016 at 8:05 PM, Ryan Culpepper wrote: > On 07/22/2016 07:58 PM, David Storrs wrote: > >> Thanks Jon, I appreciate the clear explanation. >> >> I'm using

Re: [racket-users] Is my model of (values) accurate?

2016-07-22 Thread Ryan Culpepper
On 07/22/2016 07:58 PM, David Storrs wrote: Thanks Jon, I appreciate the clear explanation. I'm using call-with-values in database code in order to turn a list into an acceptable set of bind parameters. Here's an example: (query-exec conn "insert into foo (bar, baz) values ($1, $2)"

Re: [racket-users] Is my model of (values) accurate?

2016-07-22 Thread Jon Zeppieri
On Fri, Jul 22, 2016 at 7:58 PM, David Storrs wrote: > Thanks Jon, I appreciate the clear explanation. > > I'm using call-with-values in database code in order to turn a list into > an acceptable set of bind parameters. Here's an example: > > (query-exec conn "insert

Re: [racket-users] Is my model of (values) accurate?

2016-07-22 Thread Andrew Kent
I don't fully understand the use case... but have you looked at 'apply'? > (define (sum4 a b c d) (+ a b c d)) > (apply sum4 1 2 (list 3 4)) 10 On Fri, Jul 22, 2016 at 7:58 PM, David Storrs wrote: > Thanks Jon, I appreciate the clear explanation. > > I'm using

Re: [racket-users] Is my model of (values) accurate?

2016-07-22 Thread David Storrs
Thanks Jon, I appreciate the clear explanation. I'm using call-with-values in database code in order to turn a list into an acceptable set of bind parameters. Here's an example: (query-exec conn "insert into foo (bar, baz) values ($1, $2)" (some-func)) some-func returns a list, '("bob",

Re: [racket-users] Is my model of (values) accurate?

2016-07-22 Thread Jon Zeppieri
On Fri, Jul 22, 2016 at 6:30 PM, David Storrs wrote: > > The best mental model I've been able to come up with is that (values) > returns its results vertically but most functions expect to get them > horizontally and will die if there are parallel lines of uncollected >

[racket-users] Is my model of (values) accurate?

2016-07-22 Thread David Storrs
I think I don't understand (values) very well. I expected the following to return '(1 2 3): -> (list (apply values '(1 2 3))) (list (apply values '(1 2 3))) ; result arity mismatch; ; expected number of values not received ; expected: 1 ; received: 3 ; [,bt for context] This, on the other