[CM] cons value for float vector
James Hearon
j_hearon at hotmail.com
Fri Sep 8 10:20:40 PDT 2023
Hi,
Thank you for that info. I didn't realize you can have multidimensional float-vectors, nor knew how to go about that. This helps.
Jim
________________________________
From: cmdist-bounces at ccrma.Stanford.EDU <cmdist-bounces at ccrma.Stanford.EDU> on behalf of cmdist-request at ccrma.Stanford.EDU <cmdist-request at ccrma.Stanford.EDU>
Sent: Thursday, September 7, 2023 9:00 AM
To: cmdist at ccrma.Stanford.EDU <cmdist at ccrma.Stanford.EDU>
Subject: Cmdist Digest, Vol 184, Issue 1
Send Cmdist mailing list submissions to
cmdist at ccrma.stanford.edu
To subscribe or unsubscribe via the World Wide Web, visit
https://cm-mail.stanford.edu/mailman/listinfo/cmdist
or, via email, send a message with subject or body 'help' to
cmdist-request at ccrma.stanford.edu
You can reach the person managing the list at
cmdist-owner at ccrma.stanford.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Cmdist digest..."
Today's Topics:
1. cons value for float vector (James Hearon)
----------------------------------------------------------------------
Message: 1
Date: Thu, 7 Sep 2023 17:47:11 +0000
From: James Hearon <j_hearon at hotmail.com>
To: "cmdist at ccrma.Stanford.EDU" <cmdist at ccrma.Stanford.EDU>
Subject: [CM] cons value for float vector
Message-ID:
<BYAPR10MB2536562C85954CF25C290386E5EEA at BYAPR10MB2536.namprd10.prod.outlook.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi,
I'm having a difficult time trying to create two columns of data (or three or four etc.) in a float vector.
A list works fine, but the vector gives an error that the data is a pair but should
be a real. I could use make-env for this probably, but seems like I should
be able to get the vector to cooperate. I'm wondering what I'm misunderstanding or if there's
a better way to think of this such as individual vectors then zip them together?
Thanks,
Jim
;float vector XXX
(let* ((fsize 10)
(im (make-float-vector fsize))
(x 1)
(y 1.0)
)
(do ((k 0 (+ k 1)))
((>= k fsize))
(set! (im k) (cons x y)) ;XXX is a pair but should be a real?
;(float-vector-set! im k (cons x y))
(format #t "~% ~A ~A" k (im k) )
(set! x (1+ x))
(set! y (1+ y))
))
;list OK
(let* ((fsize 10)
(mylist (make-list fsize))
(x 1)
(y 1.0)
)
(do ((k 0 (+ k 1)))
((>= k fsize))
(set! (list-ref mylist k) (cons x y))
(format #t "~% ~A ~A" k (list-ref mylist k))
(set! x (1+ x))
(set! y (1+ y))
))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20230907/2168650d/attachment-0001.html>
------------------------------
_______________________________________________
Cmdist mailing list
Cmdist at ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist
End of Cmdist Digest, Vol 184, Issue 1
**************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20230908/d7dcd3ae/attachment.html>
More information about the Cmdist
mailing list