From: Jim Freeze Date: 2003-09-28T14:05:25+09:00 Subject: Re: Thoughts on yield On Sunday, 28 September 2003 at 9:30:15 +0900, Nolan J. Darilek wrote: > > clef do > measure("4/4") do > c d e f g a b c > chord do > c e g > end > end > end > > In this example, a-g are methods returning note objects. > > What I'd like is to have that return a list like so: > > ["c", "d", "e", "f", "g", "a", "b", "c", ["c", "e", "g"]] > > But, as it stands, each expression is evaluated and discarded. I'd > like to avoid having to include actual lists in the blocks; while > arbitrary ruby expressions would be possible, I'm aiming to hide much > of that from the casual user. > At the basic level do you want chord { c e g } to return ["c", "e", "g"]? It seems that you want to generate a list using a lisp syntax. And to do that inside a block, you probably need a hook to catch the return value of each statment. I'm not sure that would be advisable. Have you considered parsing a string and using eval? For example, do: chord %{ c e g } Of course, some smarter people than me may provide the answer you are looking for. -- Jim Freeze ---------- A celebrity is a person who is known for his well-knownness.