For what it's worth I am (working occasionally and at random) doing something similar; and I went with the multiple values<-> struct solution thad jsnell went with. With a small readtable hack, you can pass multiple values around like python tuples.
John Fred Connors:
Animation Programmer and all round cyber-dogsbody.
----- Original Message -----
From: Nikodemus Siivola <nikodemus@...>
Sent: 17/12/2006 17:00:31
Subject: Re: [Sbcl-help] Performance: vector math, boxing
> "Andreas Fredriksson" <deplinenoise@...> writes:
> > Ouch! Is there any FP type that can be used without consing on X86 or
> > 32-bit PPC then? I'm just starting with this so I'm unsure about
> > short-float, single-float and so on.
> No. short- and single-float are synonyms in SBCL, as are double- and
> long-float. (Though technically we could implement a short-float that
> would fit into 32bits along with tags, the payoff doesn't seem all the
> To get unboxed return values you need to inline the callee. Another
> alternative is destructive operations on your vector representations:
> (deftype 3d-vector ()
> '(simple-array double-float (3)))
> (declaim (ftype (function (3d-vector) (values 3d-vector &optional))
> (defun n3d-vector-add (a b)
> (incf (aref a 0) (aref b 0))
> (incf (aref a 1) (aref b 1))
> (incf (aref a 2) (aref b 2))
> Toplevel ftype declamations are also better for your stuff then
> in-function declares (provided that the declaim appears before both
> the callee and callers), as it allows callers to elide type-checks on
> the return value.
> -- Nikodemus Schemer: "Buddha is small, clean, and serious."
> Lispnik: "Buddha is big, has hairy armpits, and laughs."
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> Sbcl-help mailing list