cepl icon indicating copy to clipboard operation
cepl copied to clipboard

very unforgiving lack of type error on make-c-array

Open cbaggers opened this issue 9 years ago • 1 comments

very unforgiving lack of type error on make-c-array

ARRPG> #((1 2) (3 4))
#((1 2) (3 4))
ARRPG> (make-c-array * :element-type :vec2)
#<C-ARRAY :element-type :VEC2 :dimensions (2)>
ARRPG> (aref-c * 0)
#(1.6630957e-34 2.2420775e-44)

should'nt this have worked?

ARRPG> #((1s0 2s0) (3s0 4s0))
#((1.0 2.0) (3.0 4.0))
ARRPG> (make-c-array * :element-type :vec2)
#<C-ARRAY :element-type :VEC2 :dimensions (2)>
ARRPG> (aref-c * 1)
#(2.6170414e-34 2.2420775e-44)

This REALLY should have worked

ARRPG> (make-c-array `((,(v! 0 0) (v! 1 1))
                       (,(v! 2 2) (v! 3 3)))
                     :dimensions '(2 2) :element-type :Vec2)
#<C-ARRAY :element-type :VEC2 :dimensions (2 2)>
ARRPG> (aref-c * 1 1)
#(6.778271e-34 2.2420775e-44)

cbaggers avatar Jul 24 '16 19:07 cbaggers

This one:

ARRPG> (make-c-array `((,(v! 0 0) (v! 1 1))
                       (,(v! 2 2) (v! 3 3)))
                     :dimensions '(2 2) :element-type :Vec2)

would have worked except for (v! 1 1) & (v! 3 3) don't have commas in from of them :facepalm:

cbaggers avatar Jul 25 '16 07:07 cbaggers