[chuck-users] chuck arguments

Renato Fabbri renato.fabbri at gmail.com
Sat Aug 16 14:19:17 EDT 2008


thanks for the approach :o).

but i dont know the size of the vectors and i dont know the number of
vectors in each of the two sets of vectors. (to be used in different stuff).

i know the number of first n string arguments. so, when i start the vector
(all integers) part of argument, i intend using some two special integer
tags (say 999 and 9999) to delineate each vector and each set of vectors. i
think it works as ChucK reises an error in trying to compare string and
integers, but it can convert numeric strings (as numeric arguments are
understood) to integers and compare integers. i try it out soon.



>
>
> chuck test.ck:1:2:3:4:5
>
> test.ck as follows:
>
> int vect1[2];
> int vect2[3];
>
> for( 0 => int i; i < me.args(); i++) {
>     //fill vect1
>     if(i == 0) {
>         for( 0 => int i; i < vect1.cap(); i++) {
>             Std.atoi(me.arg(i)) => vect1[i];
>         }
>     }
>
>     //fill vect2
>     if(i == 2) {
>         for( 0 => int i; i < vect2.cap(); i++) {
>             Std.atoi(me.arg(i+2)) => vect2[i];
>         }
>     }
>
> }
>
> for(0 => int i; i < vect1.cap(); i++) {
>     <<<"vect1", vect1[i]>>>;
> }
>
> for(0 => int i; i < vect2.cap(); i++) {
>     <<<"vect2", vect2[i]>>>;
> }
>
> test.ck outputs:
> vect1 1
> vect1 2
> vect2 3
> vect2 4
> vect2 5
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080816/963950b5/attachment.html>


More information about the chuck-users mailing list