--- Damian Conway <[EMAIL PROTECTED]> wrote:
> Austin Hastings wrote:
> 
> >>    ?&      ?|      ?^              - [maybe] C-like bool
> operations
> >>    ?&=     ?|=     ?^=             - (result is always just 1 or
> 0)
> >>   [?&]    [?|]    [?^]             - (hyperversions)
> >>   [?&]=   [?|]=   [?^]=
> >>   [?&=]   [?|=]   [?^=]
> > 
> > 
> > Two possible differences between double-[&|] and single-[&|]:
> > 
> > 1- Force (unlazy) evaluation of all operands.
> > 2- Force conversion to 1 or 0. (Are "true" and "false" going to be
> > built-in literals, a la java?)
> > 
> > Which (or both) of these are supposed to come from the single-op
> > versions of these?
> 
> Superpositions don't lazily evaluate their operands (unless those
> operands are themselves superpositions).

Sorry, let me be more explicit: Forget the flexops for now. What's a
C-like boolean single-letter do?

> >>  - [maybe] C-like bool operations
> >>  - (result is always just 1 or 0)

In the C that I learned, the &^| ops were bitwise.

Likewise, the && || ops were lazy booleans.

So what's a single-letter boolean act like? Is it lazy? Does it retain
its bitwise-ness but (since boolean) force evaluation for 1 or 0 first?
I just don't understand what the "implied" behavior is, since the
reference is outside my experience.


> > $a = 1 | 5;
> > $a &= 10;

> > What's $a?
> > 
> > 1 | 5 & 10
> 
> Yes (by precedence)

Umm, is this wrong? As I understand it, that's the same as 1 | (5&10)
because of precedence, no?

> > (1|5) & 10
> 
> Yes (explcitly).

(With apologies to the folks at "Sesame Street"):
One of these answers isn't like the other ...
One of these answers just doesn't belong ... 

> > On the other hand, some of the examples seem counterintuitive. That
> is,
> > considering Damian's:
> > 
> > $seen = $start | $finish;
> > for ... -> $line {
> >   print "$line\n" unless $line == $seen;
> >   $seen |= $line;
> > }
> > 
> > I can understand the notion of "unless $line is a-or-b-or-c-or..."
> but
> > I keep THINKING in terms of "I've seen a-and-b-and-c-and..."
> 
> That's understandable. So you write:
> 
>      $seen = $start & $finish;
>      for ... -> $line {
>         print "$line\n" if $line != $seen;
>         $seen &= $line;
>      }

Yeah, that's better. Thanks.

> > So when would multiple flexops be combined? Anyone have any real
> world
> > examples, even simple ones?
> 
> Sure (for sufficiently complex values of simple ;-)
> 
> Here's how to find the love of your life:
> 
>      $requirements = "tall" & "dark & "handsome"
>                    | "old" & "rich"
>                    | "Australian";
> 
>      for <> -> $candidate {
>          my $traits = any( split /<ws>/, $candidate );
>       print "True love: $candidate\n"
>              if $requirements eq $traits;
>      }
> 
> Of course, not everyone can hope to be lucky enough to meet an
> Australian, but you get the idea. ;-)

Well, thank God for small favors. 

traits = any ( ... )
requirements = .. & ..
if $requirements eq $traits

Should that be traits = all()?

I mean, assuming that the split returns only adjectives, you've got
something like:

"short" & "busty" & "dark" & "nymphomaniac" & "father owns a chain of
liquor stores"

in the requirements

and you've got 

a | b | ... | z

in the traits

How do THOSE work together?

(In other words: Can you write Apoc.Flexible now, please?)

=Austin



__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

Reply via email to