[chuck-users] determining the type of an Object in code

mike clemow gelfmuse at gmail.com
Fri Sep 5 04:05:14 EDT 2008


Dan,

On Thu, Sep 4, 2008 at 11:51 PM, Dan Zinkevich <dzinkevich at gmail.com> wrote:
> I haven't gotten around the typing issue yet, I'm working exclusively w/
> floats, since they're relatively simple to convert to ints and durs.

That's true, I hadn't thought about that.  Similarly, I'm working with
one datatype: an object that is supposed to contain the data necessary
to play a grain in granular synthesis.  I have a limited set of
grain-types worked out and I'm trying to built higher and higher
levels of semantics to describe them.  I'm leaning heavily on arrays
for this.

Or that's my plan, anyway.  To be honest, so far I'm just going
through SuperCollider documentation and stealing ideas for methods...
;-)

> I started out w/ ChucK and put together a pretty reusable class this past
> weekend, that includes all your standard add/subtract/merge/pop/no dups,
> etc, as well as a few different sorting algos
> (up/down/converge/diverge/random for now), with the long-term idea to create
> a flexible sequencer or arpeggiator. It would be great to apply these to a
> collection-like superclass, so I was hoping any headway (if any) could be
> shared before I get too married to floats.

That sounds really helpful, actually.  One thing I learned from the SC
docs on their Collection class was that they have borrowed a bunch of
tricks from functional programming that, in the context of arrays,
might make it a bit more worth while to use functors in Chuck.  A lot
of their Collection methods take functions as parameters and iterate
the function with the array values as inputs to the functions and
return the results as an array or collect them as a single item.  This
might be very helpful in the case of floats, since you could
encapsulate a lot of mathematical operations as functors and save on
all that "for( 0 = int i; i < ... " business.

> Is the ChucK wiki the best place to post it for collaboration?

Sounds like as good a place as any.

-Mike

> DFZ
>
>
> mike clemow wrote:
>>
>> Hi Daniel,
>>
>> I personally believe that it's in the best interest of the Chuck
>> community if this discussion stays on-list.  I hope that's okay with
>> you--I'm not trying to step on anyone's privacy here.  How exactly are
>> you getting around the typing issue?
>>
>> Cheers,
>> Mike
>>
>> On Wed, Sep 3, 2008 at 6:50 PM, Daniel Zinkevich <dzinkevich at gmail.com>
>> wrote:
>>
>>>
>>> Hi list,
>>>
>>> New here, and to ChucK in general, but I'm also working on a similar
>>> collection class. Don't want to step on anyone's toes, Mike, let's talk
>>> dzinkevich at gmail.com
>>>
>>> DFZ
>>>
>>>
>>> On Wed, Sep 3, 2008 at 6:29 PM, mike clemow <gelfmuse at gmail.com> wrote:
>>>
>>>>
>>>> I wanted to write a class that would abstract arrays like the
>>>> Collection class in SuperCollider.  I guess I can't.  I would have to
>>>> write a class for each type of object that I wanted to make
>>>> Collections of.
>>>>
>>>> -Mike
>>>>
>>>> On Wed, Sep 3, 2008 at 5:17 PM, Kassen <signal.automatique at gmail.com>
>>>> wrote:
>>>>
>>>>>
>>>>> 2008/9/3 mike clemow <gelfmuse at gmail.com>
>>>>>
>>>>>>
>>>>>> Hi list,
>>>>>>
>>>>>> Is there a way to determine an object's type programmatically?
>>>>>>
>>>>>>
>>>>>
>>>>> I don't think so, I thought for a moment that we could write a
>>>>> massively
>>>>> overloaded function but then remembered arrays are separate types and
>>>>>
>>>>> int foo[ ];
>>>>>
>>>>> is a different type from
>>>>>
>>>>> int bar[ ] [ ];
>>>>>
>>>>> So we'd need a infinitely overloaded function...
>>>>>
>>>>> I'm not sure why you could need this. I'm not sure in what kind of
>>>>> situation
>>>>> you would get a object from somewhere yet be unaware of it's type;
>>>>> because
>>>>> of our strong typing I don't think we ever get such objects (which can
>>>>> be
>>>>> nice yet is related to limitations as well).
>>>>>
>>>>> Could you illustrate the issue?
>>>>>
>>>>> Yours,
>>>>> Kas.
>>>>>
>>>>> _______________________________________________
>>>>> chuck-users mailing list
>>>>> chuck-users at lists.cs.princeton.edu
>>>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> http://semiotech.org
>>>> http://semiotech.org/michael
>>>> _______________________________________________
>>>> chuck-users mailing list
>>>> chuck-users at lists.cs.princeton.edu
>>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>>>
>>>
>>> _______________________________________________
>>> chuck-users mailing list
>>> chuck-users at lists.cs.princeton.edu
>>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>>>
>>>
>>>
>>
>>
>>
>>
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>



-- 
http://semiotech.org
http://semiotech.org/michael


More information about the chuck-users mailing list