Csound Csound-dev Csound-tekno Search About

[Cs-dev] Array syntax

Date2013-02-22 06:35
FromAndres Cabrera
Subject[Cs-dev] Array syntax
Hi,

Array notation is currently:
kvar[] init 6

I think using:
Kvar dim 6

(BTW I think using init here is confusing, and something like "dim" or
"alloc" or "size" would be more appropriate)

would be better because it makes it clear that it is an array of k
variables. That way, it would eventually allow syntax like:

Ksigs portk Ksigs, 0.02

My proposal for array syntax:

http://sourceforge.net/apps/mediawiki/csound/index.php?title=RFC_1-Arrays

Cheers,
Andres

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-02-22 11:39
FromSteven Yi
SubjectRe: [Cs-dev] Array syntax
Hi Andres,

Using init matches what was used for t-vars (at least, if I remember
correctly).  It currently maps to an opcode called array_init, with
some tricks done behind the scenes to convert from init to aray_init.
If everyone wants a different name, it's easy enough to change.

As for not using [], I think it would be limiting  Using caps to
denote an array of a type doesn't scale; if there's new types we might
be able to claim a letter, as there are a fair number used internally.
 Plus, if we start using multi-letter type names and do user-types,
i.e. AmbiB, AmbiB2, AmbiB3,  then I think we'd put ourselves in a hole
for how much further we could extend Csound in the future with just
caps. Also, we could denote an array of Strings, as S is already used.

steven

On Fri, Feb 22, 2013 at 6:35 AM, Andres Cabrera  wrote:
> Hi,
>
> Array notation is currently:
> kvar[] init 6
>
> I think using:
> Kvar dim 6
>
> (BTW I think using init here is confusing, and something like "dim" or
> "alloc" or "size" would be more appropriate)
>
> would be better because it makes it clear that it is an array of k
> variables. That way, it would eventually allow syntax like:
>
> Ksigs portk Ksigs, 0.02
>
> My proposal for array syntax:
>
> http://sourceforge.net/apps/mediawiki/csound/index.php?title=RFC_1-Arrays
>
> Cheers,
> Andres
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel


On Fri, Feb 22, 2013 at 6:35 AM, Andres Cabrera  wrote:
> Hi,
>
> Array notation is currently:
> kvar[] init 6
>
> I think using:
> Kvar dim 6
>
> (BTW I think using init here is confusing, and something like "dim" or
> "alloc" or "size" would be more appropriate)
>
> would be better because it makes it clear that it is an array of k
> variables. That way, it would eventually allow syntax like:
>
> Ksigs portk Ksigs, 0.02
>
> My proposal for array syntax:
>
> http://sourceforge.net/apps/mediawiki/csound/index.php?title=RFC_1-Arrays
>
> Cheers,
> Andres
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2013-02-23 15:51
FromAndres Cabrera
SubjectRe: [Cs-dev] Array syntax
Hi,

On Fri, Feb 22, 2013 at 3:39 AM, Steven Yi  wrote:
> Using init matches what was used for t-vars (at least, if I remember
> correctly).  It currently maps to an opcode called array_init, with
> some tricks done behind the scenes to convert from init to aray_init.
> If everyone wants a different name, it's easy enough to change.
>

Maybe an opcode called initarray could be added, that takes both the
number of elements and optionally the contents the array should be
initialized to.

> As for not using [], I think it would be limiting  Using caps to
> denote an array of a type doesn't scale; if there's new types we might
> be able to claim a letter, as there are a fair number used internally.
>  Plus, if we start using multi-letter type names and do user-types,
> i.e. AmbiB, AmbiB2, AmbiB3,  then I think we'd put ourselves in a hole
> for how much further we could extend Csound in the future with just
> caps. Also, we could denote an array of Strings, as S is already used.

You're right. I think the syntax for passing an array would have to be like:
asig[] oscil kamps[], kfreqs[], itabs[]

(to let the parser know that we are passing an array of a certain type).

Cheers,
Andrés

> steven
>
> On Fri, Feb 22, 2013 at 6:35 AM, Andres Cabrera  wrote:
>> Hi,
>>
>> Array notation is currently:
>> kvar[] init 6
>>
>> I think using:
>> Kvar dim 6
>>
>> (BTW I think using init here is confusing, and something like "dim" or
>> "alloc" or "size" would be more appropriate)
>>
>> would be better because it makes it clear that it is an array of k
>> variables. That way, it would eventually allow syntax like:
>>
>> Ksigs portk Ksigs, 0.02
>>
>> My proposal for array syntax:
>>
>> http://sourceforge.net/apps/mediawiki/csound/index.php?title=RFC_1-Arrays
>>
>> Cheers,
>> Andres
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_d2d_feb
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
>
> On Fri, Feb 22, 2013 at 6:35 AM, Andres Cabrera  wrote:
>> Hi,
>>
>> Array notation is currently:
>> kvar[] init 6
>>
>> I think using:
>> Kvar dim 6
>>
>> (BTW I think using init here is confusing, and something like "dim" or
>> "alloc" or "size" would be more appropriate)
>>
>> would be better because it makes it clear that it is an array of k
>> variables. That way, it would eventually allow syntax like:
>>
>> Ksigs portk Ksigs, 0.02
>>
>> My proposal for array syntax:
>>
>> http://sourceforge.net/apps/mediawiki/csound/index.php?title=RFC_1-Arrays
>>
>> Cheers,
>> Andres
>>
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_d2d_feb
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net
https://li

Date2013-02-23 16:09
FromVictor Lazzarini
SubjectRe: [Cs-dev] Array syntax
Also the plan is to implement all the list functionality (comprehensions, mapping etc) that we had implemented for tvars to
k-rate and i-rate arrays.

Victor
On 23 Feb 2013, at 15:51, Andres Cabrera wrote:

> Hi,
> 
> On Fri, Feb 22, 2013 at 3:39 AM, Steven Yi  wrote:
>> Using init matches what was used for t-vars (at least, if I remember
>> correctly).  It currently maps to an opcode called array_init, with
>> some tricks done behind the scenes to convert from init to aray_init.
>> If everyone wants a different name, it's easy enough to change.
>> 
> 
> Maybe an opcode called initarray could be added, that takes both the
> number of elements and optionally the contents the array should be
> initialized to.
> 
>> As for not using [], I think it would be limiting  Using caps to
>> denote an array of a type doesn't scale; if there's new types we might
>> be able to claim a letter, as there are a fair number used internally.
>> Plus, if we start using multi-letter type names and do user-types,
>> i.e. AmbiB, AmbiB2, AmbiB3,  then I think we'd put ourselves in a hole
>> for how much further we could extend Csound in the future with just
>> caps. Also, we could denote an array of Strings, as S is already used.
> 
> You're right. I think the syntax for passing an array would have to be like:
> asig[] oscil kamps[], kfreqs[], itabs[]
> 
> (to let the parser know that we are passing an array of a certain type).
> 
> Cheers,
> Andrés
> 
>> steven
>> 
>> On Fri, Feb 22, 2013 at 6:35 AM, Andres Cabrera  wrote:
>>> Hi,
>>> 
>>> Array notation is currently:
>>> kvar[] init 6
>>> 
>>> I think using:
>>> Kvar dim 6
>>> 
>>> (BTW I think using init here is confusing, and something like "dim" or
>>> "alloc" or "size" would be more appropriate)
>>> 
>>> would be better because it makes it clear that it is an array of k
>>> variables. That way, it would eventually allow syntax like:
>>> 
>>> Ksigs portk Ksigs, 0.02
>>> 
>>> My proposal for array syntax:
>>> 
>>> http://sourceforge.net/apps/mediawiki/csound/index.php?title=RFC_1-Arrays
>>> 
>>> Cheers,
>>> Andres
>>> 
>>> ------------------------------------------------------------------------------
>>> Everyone hates slow websites. So do we.
>>> Make your web apps faster with AppDynamics
>>> Download AppDynamics Lite for free today:
>>> http://p.sf.net/sfu/appdyn_d2d_feb
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> 
>> 
>> On Fri, Feb 22, 2013 at 6:35 AM, Andres Cabrera  wrote:
>>> Hi,
>>> 
>>> Array notation is currently:
>>> kvar[] init 6
>>> 
>>> I think using:
>>> Kvar dim 6
>>> 
>>> (BTW I think using init here is confusing, and something like "dim" or
>>> "alloc" or "size" would be more appropriate)
>>> 
>>> would be better because it makes it clear that it is an array of k
>>> variables. That way, it would eventually allow syntax like:
>>> 
>>> Ksigs portk Ksigs, 0.02
>>> 
>>> My proposal for array syntax:
>>> 
>>> http://sourceforge.net/apps/mediawiki/csound/index.php?title=RFC_1-Arrays
>>> 
>>> Cheers,
>>> Andres
>>> 
>>> ------------------------------------------------------------------------------
>>> Everyone hates slow websites. So do we.
>>> Make your web apps faster with AppDynamics
>>> Download AppDynamics Lite for free today:
>>> http://p.sf.net/sfu/appdyn_d2d_feb
>>> _______________________________________________
>>> Csound-devel mailing list
>>> Csound-devel@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/csound-devel
>> 
>> ------------------------------------------------------------------------------
>> Everyone hates slow websites. So do we.
>> Make your web apps faster with AppDynamics
>> Download AppDynamics Lite for free today:
>> http://p.sf.net/sfu/appdyn_d2d_feb
>> _______________________________________________
>> Csound-devel mailing list
>> Csound-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/csound-devel
> 
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> Csound-devel mailing list
> Csound-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/csound-devel

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie




------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net