[Csnd] how to assign to a sub-array?
Date | 2020-12-19 20:56 |
From | Dave Seidel |
Subject | [Csnd] how to assign to a sub-array? |
Attachments | min-arrary-udo.csd |
I'm trying to write code that copies an array (created by a UDO) to an array within another array. That is, given an array or arrays thus
Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
I would like to be able to assign/copy to the "inner" arrays. for example
where "my_udo" returns an array. However, I get this: error: Unable to find opcode entry for '=' with matching argument types: Found: i = k[] I've attached an example. Thanks for any help! - Dave |
Date | 2020-12-19 23:47 |
From | Dave Seidel |
Subject | Re: [Csnd] how to assign to a sub-array? |
FWIW, using setrow() instead of "=" gives the same error. On Sat, Dec 19, 2020 at 3:56 PM Dave Seidel <dave.seidel@gmail.com> wrote:
|
Date | 2020-12-20 00:26 |
From | Steven Yi |
Subject | Re: [Csnd] how to assign to a sub-array? |
There's an issue here about gi_array[0] being reported as an i-type, but regardless your idea to assign a one dimensional array to the area within a two dimensional array shouldn't work. Multidimensional arrays are different from a list of lists and it seems like you're thinking more the latter than the former. (For example, see the conversation here: https://stackoverflow.com/questions/40895721/python-is-a-multidimensional-array-matrix-the-same-thing-as-lists-within-li). I don't know if we can do something to address making something like this possible with some checks for matching dimensions but as it stands now it's not possible. Regarding setrow(), I would expect that to work though I'm not sure if it would using function-call syntax (not sure of its implementation). What code did you use to test that? On Sat, Dec 19, 2020 at 6:48 PM Dave Seidel |
Date | 2020-12-20 03:47 |
From | Dave Seidel |
Subject | Re: [Csnd] how to assign to a sub-array? |
You're correct that I was thinking of them as lists of lists. But after some thought, I've decided to use an array of tables instead, and that seems to work fine. - Dave On Sat, Dec 19, 2020 at 7:26 PM Steven Yi <stevenyi@gmail.com> wrote: There's an issue here about gi_array[0] being reported as an i-type, |
Date | 2020-12-20 13:01 |
From | Dave Seidel |
Subject | Re: [Csnd] how to assign to a sub-array? |
That said, I think it would be very useful to be able to have an array of arrays (list of lists) as distinct from a multidimensional array. On Sat, Dec 19, 2020 at 10:47 PM Dave Seidel <dave.seidel@gmail.com> wrote:
|
Date | 2020-12-21 14:39 |
From | Bernard Geyer |
Subject | Re: [Csnd] how to assign to a sub-array? |
I am currently using tables instead of arrays. Since I can't have array pointers in csound, I'm using tables instead. I can create and destroy tables at will (like with new and free in c ++), and therefore load and change different projects without leaving csound, because I don't need to know their sizes in advance. Also, with tables, I don't need to know if my data is irate or krate. And instead of table arrays, I am using tables of tables. Am i wrong? Le dim. 20 déc. 2020 à 14:01, Dave Seidel <dave.seidel@gmail.com> a écrit :
|
Date | 2020-12-21 14:47 |
From | Dave Seidel |
Subject | Re: [Csnd] how to assign to a sub-array? |
Nothing wrong with that whatsoever. I just have a slight preference for arrays, because (as a programmer) I find array syntax -- my_array[1] -- more intuitive than table syntax -- table(0, my_table). Tables work great. But variable rate does matter depending on context -- sometimes I can use table(), sometimes I need to use tablekt() (for example). On Mon, Dec 21, 2020 at 9:39 AM Bernard Geyer <micamusic2@gmail.com> wrote:
|
Date | 2020-12-21 15:30 |
From | John ff |
Subject | Re: [Csnd] how to assign to a sub-array? |
You should know that in csound there are no lefthand values available in arrays. Maybe in cs7?
On 21 Dec 2020, at 14:48, Dave Seidel <dave.seidel@gmail.com> wrote:
|
Date | 2020-12-21 15:48 |
From | Dave Seidel |
Subject | Re: [Csnd] how to assign to a sub-array? |
John, what do you mean by "lefthand value"? On Mon, Dec 21, 2020 at 10:30 AM John ff <jpff@codemist.co.uk> wrote:
|