Re: Pondering parameterized operators

2003-09-29 Thread Austin Hastings
--- Luke Palmer [EMAIL PROTECTED] wrote: Yeah, that's true. But note that you can't do that black magic you were speaking of earlier: $a [ (cond ?? infix:+ : infix:*) but tighter(infix:*) ] $b Because we can't choose the precedence of an operator after we parse it... unless we're

Re: Pondering parameterized operators

2003-09-28 Thread Eirik Berg Hanssen
Austin Hastings [EMAIL PROTECTED] writes: [Eirik wrote:] Let us see ... somewhat speculative and probably short-of-the-mark generalization coming up: macro infix:[ ($lhs, $op, $rhs) is parsed(/(Perl6.expr) \] (Perl6.expr)/) { return { $op($lhs, $rhs) };

Re: Pondering parameterized operators

2003-09-28 Thread Simon Cozens
[EMAIL PROTECTED] (Luke Palmer) writes: [$lhs, $rhs]æ\220\215.æ\235\237compile; What's that in old money? -- As the saying goes, if you give a man a fish, he eats for a day. If you teach him to grep for fish, he'll leave you alone all weekend. If you encourage him to beg for fish, pretty soon

Re: Pondering parameterized operators

2003-09-28 Thread Luke Palmer
Simon Cozens writes: [EMAIL PROTECTED] (Luke Palmer) writes: [$lhs, $rhs]\220\215.\235\237compile; What's that in old money? Eep. I thought I had mutt's utf-8 working, but apparently not. Does anyone who knows about these things want to mail me instructions, or something? That'd be nice

Re: Pondering parameterized operators

2003-09-28 Thread Eirik Berg Hanssen
Luke Palmer [EMAIL PROTECTED] writes: Cool stuff. In my usual pedantic sort of way, I'll go through the message and fix everything you said. For educational purposes only, of course :-) Thanks :-) For further education, some more questions/comments, if I may: # Let's say Cis

Re: Pondering parameterized operators

2003-09-27 Thread Eirik Berg Hanssen
Luke Palmer [EMAIL PROTECTED] writes: Hmm, since we're requiring no whitespace between a variable and it's subscript, this should be possible: if Dough [eqn 4] Douglas {...} Lisp! :-) Well, almost. Now this would be lisp-y: if $test [$moon.is_waxing ? infix: : infix:=] $target

RE: Pondering parameterized operators

2003-09-27 Thread Austin Hastings
-Original Message- From: Eirik Berg Hanssen [mailto:[EMAIL PROTECTED] Sent: Saturday, September 27, 2003 11:35 AM To: [EMAIL PROTECTED] Subject: Re: Pondering parameterized operators Luke Palmer [EMAIL PROTECTED] writes: Hmm, since we're requiring no whitespace between

Re: Pondering parameterized operators

2003-09-27 Thread Luke Palmer
Cool stuff. In my usual pedantic sort of way, I'll go through the message and fix everything you said. For educational purposes only, of course :-) Eirik Berg Hanssen writes: Luke Palmer [EMAIL PROTECTED] writes: Hmm, since we're requiring no whitespace between a variable and it's

Pondering parameterized operators

2003-09-26 Thread Austin Hastings
So I sit here and think for a minute about how nice it will be in P6 to be able to define operator infix:eqi($str1, $str2) {...} for doing if ($1 eqi last) and I think about the whole 'C' string library. Which dredges up my old questions about parameterized operators: How can I

Re: Pondering parameterized operators

2003-09-26 Thread Dan Sugalski
On Fri, 26 Sep 2003, Austin Hastings wrote: How can I conveniently pass an extra parameter to a historically binary operator? If it's one of the 'base' binary operators (addition, subtraction, and whatnot) you don't. Dan

Re: Pondering parameterized operators

2003-09-26 Thread Luke Palmer
Austin Hastings writes: How can I conveniently pass an extra parameter to a historically binary operator? I see a few possibilities. The first, call it like a function: if infix:eqn(Dough, Douglas, n = 4) {...} Or, you could use the adverbial modifier Cwhere (well, not officially yet,

Re: Pondering parameterized operators

2003-09-26 Thread Dave Whipp
Austin Hastings [EMAIL PROTECTED] wrote if (Dough eqn(4) Douglas) ... I wonder if the . operator is available here: if Dough eq.n(4) Douglas { ... } that makes it intuitive how to define new equality methods. One thing of concern is that we'd need whitespace rules to disambiguate things. I