From j_hearon at hotmail.com Thu Sep 7 10:47:11 2023 From: j_hearon at hotmail.com (James Hearon) Date: Thu, 7 Sep 2023 17:47:11 +0000 Subject: [CM] cons value for float vector Message-ID: 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: From bil at ccrma.Stanford.EDU Thu Sep 7 12:07:33 2023 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Thu, 07 Sep 2023 12:07:33 -0700 Subject: [CM] cons value for float vector In-Reply-To: References: Message-ID: <70b1b79f288bb82fd58d6191b6e25f95@ccrma.stanford.edu> I think you want to use a multidimensional float-vector: (let* ((fsize 10) (im (make-float-vector (list fsize 2))) (x 1) (y 1.0) ) (do ((k 0 (+ k 1))) ((>= k fsize)) (set! (im k 0) x) ; this will be turned into a float (set! (im k 1) y) (format #t "~% ~A ~A ~A" k (im k 0) (im k 1)) (set! x (1+ x)) (set! y (1+ y)) )) From j_hearon at hotmail.com Fri Sep 8 10:20:40 2023 From: j_hearon at hotmail.com (James Hearon) Date: Fri, 8 Sep 2023 17:20:40 +0000 Subject: [CM] cons value for float vector In-Reply-To: References: Message-ID: 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 on behalf of cmdist-request at ccrma.Stanford.EDU Sent: Thursday, September 7, 2023 9:00 AM To: 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 To: "cmdist at ccrma.Stanford.EDU" Subject: [CM] cons value for float vector Message-ID: 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: ------------------------------ _______________________________________________ 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: From bil at ccrma.Stanford.EDU Sun Sep 10 13:18:09 2023 From: bil at ccrma.Stanford.EDU (bil at ccrma.Stanford.EDU) Date: Sun, 10 Sep 2023 13:18:09 -0700 Subject: [CM] Snd 23.7 Message-ID: <9b9a821b308df199ec8eede7ec24e8ff@ccrma.stanford.edu> Snd 23.7: various minor optimizations and bugfixes in s7 checked: sbcl 2.3.8