Lutz,
I've found use on several occasions to have an optional list of variables or values in format.
For instance, suppose L = ("bob" "this" "that" 3 2 10 "a" 96 "----" 456). We could write
(println (format "%s,%d,%s,%dn" (select L 0 4 1 7)))
vs
(println (format "%s,%d,%s,%dn" (L 0) (L 4) (L 1) (L 7))))
Implicit indexing helps, but selecting from a list would be nicer.
Eddie
> (define (myformat str) (apply format (cons str (flat (args)))))
(lambda (str) (apply format (cons str (flat (args)))))
> (myformat "%s,%d,%s,%dn" (select L 0 4 1 7))
"bob,2,this,96n"
Thanks Sammo!
Works like a charm :) I didn't know I could use "apply" on functions with a variable number of arguments without defining a lambda or helper function. I can use this knowlege to make more elegant solutions for a lot of other functions as well :)
Eddie