News for hackers. Stuff that matters.
Re:Ask HN: Why hasn't Perl 6 taken off yet? by markrushing on Monday November 07, 2016 @06:17AM (#12890236)
Yeah, I didn't mean compact as in, oh let's see how few letters we can use. I meant compact in the way you can organize even VERY complex stuff, especially using their concept of grammars. You can write whole languages and protocols pretty neatly with those.

Or like type. I've been loving their type system. You can use Perl as a heavily typed and enforced language, or not at all. And it's really easy to make up your own types, which you can also easily use for handling arbitrary constraints you might need.

  subset Even of Int where * mod 2 == 0;
  (1..1000).map: { when .is-prime { .say }
                   when Even      { say 'EVEN Num' }
                   default        { say 'no'}
                 }
Like there I just made up an new type called "Even", and used it when printing out stuff about numbers between 1 and 1000. But the really cool thing is you can use the exact sort of stuff for all kinds of variable types and even structures. It's just amazingly weird and open wonderful. I admit I've really fallen for it. ;)
Re:Ask HN: Why hasn't Perl 6 taken off yet? by b2gills on Tuesday November 08, 2016 @01:01AM (#12898036)
There is an operator to check if one number is divisible by another.

    subset Even of Int where * %% 2;
You also don't have to write the where clause as a lambda.

    subset Even of Int Where $_ %% 2;
Re:Ask HN: Why hasn't Perl 6 taken off yet? by markrushing on Tuesday November 08, 2016 @02:18AM (#12898318)
woot! :) still learning stuff ;) - though I'll use the first.