electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
<<< chuck >>>
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [7 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Tue Aug 29, 2006 4:17 pm    Post subject: <<< chuck >>>
Subject description: printing in chuck
Reply with quote  Mark this post and the followings unread

Code:
// what'd it print out? eh.. i'm confused with this one
<<< <<< <<<0>>>, <<<1>>> >>> , <<< <<<2>>>, <<<3>>> >>> >>>;


i'm using chuck 1.2.0.6 (dracula)
i've got this result:

Code:
0 :(int)
1 :(int)
0 1
2 :(int)
3 :(int)
2 3
2 3

i can't figure out how the last line 2 3 is computed from..
please help me out heheh.. Laughing

actually i was playing with <<< >>>
and wanna know what more we can do with it.

i guess there must be a lot of fun way we can play with printing.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
ge



Joined: Aug 13, 2006
Posts: 108
Location: Palo Alto, CA

PostPosted: Wed Aug 30, 2006 12:26 am    Post subject: Re: <<< chuck >>>
Subject description: printing in chuck
Reply with quote  Mark this post and the followings unread

Code:
// what'd it print out? eh.. i'm confused with this one
<<< <<< <<<0>>>, <<<1>>> >>> , <<< <<<2>>>, <<<3>>> >>> >>>;

Interesting usage! The reason this works is because it was designed to work "out of band", so you can more easily observe subexpressions.

Code:
// the expression
3 + foo * x => bar;

// print out foo * x and still evaluate
3 + <<< foo * x >>> => bar;

It is not completely neutral to the expression. It's possible to change the precedent of the evaluation. Anyway, this is the first time I've seen <<< >>> nested. Cool!

Once file I/O is in, there will be many more ways of printing and writing to file.
Back to top
View user's profile Send private message Visit poster's website
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24085
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Wed Aug 30, 2006 2:58 am    Post subject: Reply with quote  Mark this post and the followings unread

I had expected the last output lune would have been

0 1 2 3

instead of

2 3

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Wed Aug 30, 2006 3:12 am    Post subject: Reply with quote  Mark this post and the followings unread

Embarassed Blue Hell: hello
yeah, that's what i thought also.
that's what i'm still figuring out. hehehe..


oh i'm back!
yeah, i've figured it out.
expression , expression returns the last expression

try <<< <<< 1, 2 >>> >>>;
my result:
1 2
2 :(int)

1, 2 => int k; <<< k >>>; returns the same kind of 2 as the above.
maybe this is how it works that way.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
blue hell
Site Admin


Joined: Apr 03, 2004
Posts: 24085
Location: The Netherlands, Enschede
Audio files: 278
G2 patch files: 320

PostPosted: Wed Aug 30, 2006 4:27 am    Post subject: Reply with quote  Mark this post and the followings unread

kijjaz wrote:

expression , expression returns the last expression


Well I thought that as well at some stage (and I think I read something about it in a manual or a tutorial), but in that case I would have expected the output to be :

0
1
1
2
3
3
3

_________________
Jan
also .. could someone please turn down the thermostat a bit.
Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message Visit poster's website
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Wed Aug 30, 2006 4:49 am    Post subject: Reply with quote  Mark this post and the followings unread

(i guess again:) but surely with an exception that
<<< ___ , ___ , ___ >>>; will print the list out
but the value returned after printing is the last expression.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
kijjaz



Joined: Sep 20, 2004
Posts: 765
Location: bangkok, thailand
Audio files: 4

PostPosted: Tue Sep 12, 2006 8:32 am    Post subject: Reply with quote  Mark this post and the followings unread

wow.. this works like this..
i'll try to figure this out also hahah.


code:
Code:
<<<
<<< <<< <<< "<<< >>>" >>> , <<< "<<< >>>" >>> >>> >>>,
<<< <<< <<< "<<< >>>" >>> , <<< "<<< >>>" >>> >>> >>>
>>>;


result:
Code:
​"<<< >>>" : (string)
"<<< >>>" : (string)
<<< >>> <<< >>>
"<<< >>>" : (string)
"<<< >>>" : (string)
"<<< >>>" : (string)
<<< >>> <<< >>>
"<<< >>>" : (string)
<<< >>> <<< >>>


... oh! it's the same case and same method.
i was confused lol.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [7 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use