Luke Palmer <[EMAIL PROTECTED]> writes: > Ugh, hit "a" in gmail when replying! > > On 5/5/05, Terrence Brannon <[EMAIL PROTECTED]> wrote: >> I was looking at a line in the hangman program: >> >> @letters == @solution.grep:{ $_ ne '' }; >> >> and was told that I was looking at an adverbial block. > > The adverbial block is what you're giving to `if` when you say: > > if $foo { ... }
It is? An adverb describes a verb. What is the verb here? > On the statement level, it looks like a block in operator position. On statement level... hmmm. Statement I think I understand: a complete sentence made up of expressions. "operator position" - how am I to know where operator position is? I'm really just asking these two questions about "statement level" and "operator position" so that you will be aware that not everyone will understand what you mean by these terms and you might want to explain them fully before using them when you write a Perl 6 tutorial/book/ etc. Don't bother explaining them to me. I can figure out what I need without knowing what you meant here. > > However, on the expression level, it is preceded by a colon, and goes > into the *& argument of the sub. > > sub grep (*&block, [EMAIL PROTECTED]) {...} why must &block be slurpy? can't it be specified as a required parameter like so: sub grep (&block, [EMAIL PROTECTED]) {...} > > (I don't know about the ordering of those arguments) > > It was invented to avert the annoying ({ }) construct, especially when > used in a series: > > @result = @input.grep:{...}.map:{...} So the annoying way to write this would be this? @result = map { } (grep { } @input) ; where the parentheses are required? So what are the colon-free ways to write this, which is not in series: sub has_won returns Bool { @letters == @solution.grep:{ $_ ne '' }; } > > Did that answer your question? yes, to a large extent and way way faster than anticipated! > > > Luke -- Carter's Compass: I know I'm on the right track when, by deleting something, I'm adding functionality.