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)" (some-func))
some-func returns a list, '("bob", "george"). query-exec throws an
exception because it wants to see two elements for the bind parameters,
not a list. The solution I found was this:
(call-with-values
(lambda () (apply values the-list))
(curry query-exec conn stmt))
You can also write that as just
(apply query-exec conn stmt the-list)
so your example above would be
(apply query-exec
conn
"insert into foo (bar, baz) values ($1, $2)"
(some-func))
Ryan
--
You received this message because you are subscribed to the Google Groups "Racket
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.