On Thu, Apr 15, 2010 at 10:33:51PM +0200, Thomas Chust wrote: > Hello Jeronimo, > > thinking about it, I would only provide two wrappers per function: One > destructive version that accepts two mandatory input arguments and an > optional output argument defaulting to the first input argument. And > one non-destructive version that accepts just the two input > arguments and allocates an output target. > > The code would look like this: > > (define (ia+! a b #!optional [out a]) > ((foreign-lambda void "mpfi_add" c-pointer c-pointer c-pointer) > out a b) > out)
OK, that sounds much better! I wonder if the optional argument would make the function call too much slower? > (define (ia+ a b) > (ia+! a b (make-ia-interval))) > I would also just prefix the operator names with characters, not > suffix them — mostly because of the stylistic similarity to existing > bindings like fx+. But there's a difference between these two: ia+ia (sums two intervals) ia+f64 (sums an interval to a flonum) Using only ia+ would mean checking the type inside the procedure, which I'd like to avoid. J. _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users