Wrap a C Function with Variable Length Argument List

This would be difficult as the typechecker needs to parse the format sting
in order to do static typechecking.
One possibility is this:

abstype command (ts:types)

macdef foo = $extval (command(string::string::int::nil(), “foo”)

val () = redisCommand (redisCtx, foo, @(“str1”, “str2”, 123))

Thanks for the link.

The approach is largely based on the one by Olivier Danvy.
Its limitation is well-known (e.g., it does not support non-static format
strings).
Supporting something like printf (“%2.2d”, …) would be harder.

Also, supporting scanf would be much harder due to the need for
error-handling.
Actually, printf also needs error-handling; supporting it in Idris, I
think, can be a real
challenge.On Monday, May 12, 2014 8:18:14 PM UTC-4, Chris Double wrote:

On Tue, May 13, 2014 at 12:13 PM, Brandon Barker <brand...@gmail.com <javascript:>> wrote:

Any updates on this topic? Primarily just curious about what the best
way to
call multityped c-variadic functions is, as I’m about to do a lot of it
(e.g. scanf and fprintf - and am hoping the answer is not to create a
separate function for each).
github githwxi
I create a separate function but it’s a bit of a pain. It’d be
wonderful if it was as easy as this Idris example:

https://www.youtube.com/watch?v=fVBck2Zngjo


http://www.bluishcoder.co.nz

It is redisCommand, which is a function used to issue command to redis
server.

e.g.

redisCommand(redisCtx, “Some Command”)
redisCommand(redisCtx, “Some Command with Arguments %s %s %d”, “str1”,
“str2”, 123)
redisCommand(redisCtx, “Some Command with Arguments %b %b”, “hello”,
(size_t)5, “hi”, (size_t)2)