Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Re^3: Why not support this syntax?

by clemburg (Curate)
on Apr 24, 2001 at 15:29 UTC ( [id://75096]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re^3: Why not support this syntax?
in thread Why not support this syntax?

Good idea, and we can even cover that one ourselves, too:

sub is_ordered_according_to { my ($binary_predicate, @values) = @_; if (@values < 3) { return $binary_predicate->(@values); } else { return $binary_predicate->($values[0], $values[1]) && is_ordered_according_to($binary_predicate, @values[1..$#values]); } } sub less_than { return shift() < shift(); } print is_ordered_according_to(\&less_than, 1, 2, 3, 4, 5, 6) ? "yes" : "no", "\n" ; print is_ordered_according_to(\&less_than, 3, 2, 1, 4, 5, 6) ? "yes" : "no", "\n" ; print is_ordered_according_to(\&less_than, 1, 2, 3, 4, 6, 5) ? "yes" : "no", "\n" ;

Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com

Replies are listed 'Best First'.
Re: Re: Re^3: Why not support this syntax?
by MeowChow (Vicar) on Apr 24, 2001 at 16:12 UTC
    Nice, but try this:
    $val = $min <= $x < $y <= $z <= $max
    IMO, A syntactic solution would be both cleaner and faster.
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print
Re: Re: Re^3: Why not support this syntax?
by scott (Chaplain) on Apr 30, 2001 at 14:13 UTC

    Cool. If you don't mind, I'll just add this to my personal collection of bits o'code.

    Good idea, and we can even cover that one ourselves, too

    But we can cover *anything* ourselves ... with enough effort.

    From another of your posts on the same topic:

    Perl is a language for getting your job done - right. After writing this little subroutine, the job is done. Why wait for other people to do jobs for you that you can do for yourself in 30 seconds.

    I don't think anyone said anything about *waiting*.

    Making Perl6 will require a great deal of effort, it's going to happen regardless of whether or not this particular syntax is included, and the process of deciding what the syntax will be has been deliberately opened to public debate.

    So why not let everyone know on what we think said effort should be spent constructing?

    Philosophically yours,

    Scott

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://75096]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.