[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] How do I name these procedures?
From: |
Jeronimo Pellegrini |
Subject: |
[Chicken-users] How do I name these procedures? |
Date: |
Thu, 15 Apr 2010 15:39:25 -0300 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Hi,
I'm working on bindings for a library (MPFI, a C library for
interval arithmetic [0]), which I'd like to make available as
an egg.
Most mpfi functions receive pointer to structures that represent
intervals, and the return value is the first argument:
mpfi_add (a, b, c); /* This is a <- b + c */
When translating this into Scheme, I thought I'd offer
three versions of each function. For example, the function
mpfi_add, which sums intervals, would generate:
(ia+ia!! a b c) ; same as mpfi (a, b, c)
(ia+ia! a b) ; defined as (ia+ia!! a a c)
; a will be overwritten
(ia+ia a b) ; allocates a new structure x and
; does (ia+ia!! x a b)
; See below:
(define (ia+ia a b)
(let ((x (make-ia-interval)))
(ia+ia!! x a b)
x))
I am using the "ia" prefix/suffix to mean "interval arithmetic",
since there will also be functions like "ia+f64!"; also,
I may also in the future make bindings for affine arithmetic
libraries[1] -- which will then be named "aa+aa!", and so on.
I'd like some opinions on the naming of these procedures.
Since there are two mutating procedures for each C function,
I would use "!" in one of them and "!!" in another (and I
thought it'd be better to use "!!" on the one likely to be
the least used one). But I'm not really comfortable with
this ! and !! idea...
Any comments?
Thanks,
J.
[0] MPFI: http://cadadr.org/fm/package/mpfi.html
(but right now the site seems to be down)
[1] Affine arithmetic:
http://en.wikipedia.org/wiki/Affine_arithmetic
http://www.ic.unicamp.br/~stolfi/EXPORT/projects/affine-arith/Welcome.html
- [Chicken-users] How do I name these procedures?,
Jeronimo Pellegrini <=