This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: patch to unif.c...
| >>>>> "Per" == Per Bothner <per@bothner.com> writes:
|
| Per> Clark McGrew <mcgrew@ale.physics.sunysb.edu> writes:
|
| >> I keep running into this problem over and over again when I'm
| >> working with uniform vectors; There isn't a good clean way to
| >> generate a vector of floats vs doubles.
|
| Per> Can I suggest SRFI-4 "Homogeneous numeric vector datatypes"?
| Per> http://srfi.schemers.org/srfi-4/srfi-4.html
|
| Per> I'm a big believer in following standards, as long as the
| Per> standard is reasonable, and I believe this one is.
|
| I agree in the long run. The problem as the array support in guile
| currently stands there is no clean way to generate a vector of floats
| vs doubles. My patch is the minimal change to handle the problem
| (seriously, it only took 30-40 key stokes).
The interface is pretty weird. Wouldn't it work in this case if you
used the canonical templates?:
guile> (make-uniform-vector 3 1/3)
#i(0.333333333333333 0.333333333333333 0.333333333333333)
guile> (make-uniform-vector 3 1.0)
#s(1.0 1.0 1.0)
There's an optional argument for the initialiser:
guile> (make-uniform-vector 3 1.0 1/3)
#s(0.333333343267441 0.333333343267441 0.333333343267441)