1. Please Help ME figure it out
- Posted by David Roach <roachd_76 at YAHOO.COM> May 06, 2000
- 475 views
I can not figure out how to Take a sequence and print the sequence starting somewhere in the middle going to the end and then jumping to the begining and stopping where it started. I don't know how to explain it. E.G. sequence scale scale = {"C"}, {"D"},{"E"},{"F"} --some print routine I need to start at say "D" (depending on the user's pick)and print this: D E F C This for a music scale program I am working on. Thanks Dave
2. Re: Please Help ME figure it out
- Posted by Chris Bensler <bensler at MAILOPS.COM> May 06, 2000
- 437 views
Hi Dave, > I can not figure out how to Take a sequence and print the sequence starting > somewhere in the middle going to the end and then jumping to the begining > and stopping where it started. I don't know how to explain it. > > E.G. > > sequence scale > scale = {"C"}, {"D"},{"E"},{"F"} > > --some print routine > > I need to start at say "D" (depending on the user's pick)and print this: > > D E F C Try something like this... (untested code) <CODE> sequence scale atom scale_length scale = "CDEF" scale_length = length(scale) procedure print_scale(atom scale_pos) sequence tmp tmp = scale[scale_pos..scale_length] & scale[1..scale_pos-1] puts(1, tmp) end procedure print_scale(2) <CODE> Chris
3. Re: Please Help ME figure it out
- Posted by CenSe <cense at MAIL.RU> May 06, 2000
- 452 views
not quite sure about your question but here is a solution to what i think you want. i assume one thing, you know the array position of where to start printing. <un tested code> sequence scale scale = {"D", "E", "F", "C"} printf(1, "%s", scale[2..length(scale)]) puts(1, "scale[1..2]\n") </un tested code> that should prints out: E F C D I just used sequence slicing. hope that helps a little. CenSe, a member of the ak-software development team http://ak-software.virtualave.net/
4. Re: Please Help ME figure it out
- Posted by Alan Tu <alantu at STUDENTS.UIUC.EDU> May 06, 2000
- 457 views
Dave, This works, but perhaps someone's got a more efficient way. Warning: I've been doing Java more than EU recently, so some of the syntax may be off. for i = x to length(s) do // s is your sequence, x is your middle index // your code here end for for i = 1 to x-1 do your code here end for Hope this helps. Alan ----- Original Message ----- From: "David Roach" <roachd_76 at YAHOO.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Friday, May 05, 2000 11:55 PM Subject: Please Help ME figure it out > I can not figure out how to Take a sequence and print the sequence starting > somewhere in the middle going to the end and then jumping to the begining > and stopping where it started. I don't know how to explain it. > > E.G. > > sequence scale > scale = {"C"}, {"D"},{"E"},{"F"} > > --some print routine > > I need to start at say "D" (depending on the user's pick)and print this: > > D E F C > > This for a music scale program I am working on. > Thanks > > Dave >