The Atronix va_list
interface took a block. It required a type to be specified for each argument--achieving what you would get if you used a C cast on each variadic argument.
You had to REDUCE it, also...which I don't think you should have to do:
printf reduce ["%d, %f" 10 + 20 [int32] 12.34 [float]]
It may be useful to use defaulting like C's where integer types default to int
and floating point types default to double
:
printf ["%d, %f" (10 + 20) 12.34]
If you do want to specify types, I'm leaning towards liking the FENCE! for lightweight construction, so maybe more like:
printf ["%d, %f" {int32 10 + 20} 12.34]
printf ["%d, %f" {int32 10 + 20} {float 12.34}]
Back in the day I suggested putting it inside a group instead of passing a block...so that notationally it wouldn't put space between the printf and the arguments:
(printf "%d, %f" (10 + 20) 12.34)
Though that has the bad property that if you forget it's a variadic, it will consume all the parameters of all ensuing calls.
However, it has the good property that "ordinary" variadics work with APPLY, including its //
operator form:
apply printf/ ["%d, %f" {int32 10 + 20} 12.34]
printf // ["%d, %f" {int32 10 + 20} 12.34]