Live data from Hacker News

Haskell to Perl 6

docs.perl6.org

41–50 of 136 posts

Re: Haskell to Perl 6

#41
post #33
post #31

Earlier quoted context omitted.

Sigils have been standard in shells for decades. And sigils allow string interpolation to work; again, just like in normal unix shells. The python people decided that sigils are a bad idea, so instead of being able to say "I have $n apples" (like you could in shells we've all been using forever!) I now need to say "I have {} apples".format(n). I know which one I prefer!

Javascript has `I have ${n} apples`, or even `This is chapter ${i+1}.` In terms of interpolation, that's the variant that I like best.

Also in groovy. I too am a fan.

Re: Haskell to Perl 6

#42
post #17

Perl 6 is for people who are very smart and have a great spirit in seeking and having fun in programming, I really admire that. That's my thought after two failed attempts (each lasted about two days) to learn it in 2012 and 2014. I felt the use of sigils, syntax oddities and the cleverness were beyond my ability to master the language. I should mention in 1998 I used (modified it a little bit) Selena Sol's shopping…

> Perl 6 is for people who are very smart and have a great spirit in seeking and having fun in programming

Not sure why you felt the need to include this. How did you come to this conclusion? Is this in comparison to Haskell, or what?

Re: Haskell to Perl 6

#43
post #17

Perl 6 is for people who are very smart and have a great spirit in seeking and having fun in programming, I really admire that. That's my thought after two failed attempts (each lasted about two days) to learn it in 2012 and 2014. I felt the use of sigils, syntax oddities and the cleverness were beyond my ability to master the language. I should mention in 1998 I used (modified it a little bit) Selena Sol's shopping…

> Perl 6 is for people who are very smart and have a great spirit in seeking and having fun in programming Not sure why you felt the need to include this. How did you come to this conclusion? Is this in comparison to Haskell, or what?

It was tongue in cheek, haha... I was only frustrated by my own inability to get the hang of Perl 6. As an old casual fan of Perl, I still want to take another shot at learning it very much.

Re: Haskell to Perl 6

#44

Not to be trollish, but is anyone actually using Perl 6 for more than just for kicks? It is a super interesting language, but has it been battle tested over the years similar to Perl 5?

Perl 6 is still 9 times slower than Perl 5 when parsing log files with a regex. I don't quite get why the feature which made Perl famous has now taken a back seat. Why should I take a 9x performance hit?

Re: Haskell to Perl 6

#45
post #37

Earlier quoted context omitted.

Except the resulting code will look nothing like “the humans say it”, and instead will be a cryptic charade requiring a ton of knowledge to decipher - ending up being neither natural language nor machine code.

> Except the resulting code will look nothing like “the humans say it”, Actually, I find it maps rather directly to how a lot of people explain things. For example, "Examine each number, and as long as it's greater than 10 and odd, then pass it to the the work function." for my $number ( @numbers ) { next unless $number > 10; next unless $number % 2; work($number); } Perl generally allows you to structure your code a…

One can write pretty much the same code in python/c++11/whatnot and it also feels quite natural to read:

   for number in numbers:
       if number 
Do you have a better example where the Perl syntax would shine?

Re: Haskell to Perl 6

#46
post #44

Not to be trollish, but is anyone actually using Perl 6 for more than just for kicks? It is a super interesting language, but has it been battle tested over the years similar to Perl 5?

Perl 6 is still 9 times slower than Perl 5 when parsing log files with a regex. I don't quite get why the feature which made Perl famous has now taken a back seat. Why should I take a 9x performance hit?

The Perl 5 core is hack upon hack, to the point that it's been mostly abandoned due to how hard is to change things without breaking anything. Perl 6 was born as a specification, which allows for a "first make it right, then make it fast" approach.

Re: Haskell to Perl 6

#47
post #44

Earlier quoted context omitted.

Perl 6 is still 9 times slower than Perl 5 when parsing log files with a regex. I don't quite get why the feature which made Perl famous has now taken a back seat. Why should I take a 9x performance hit?

The Perl 5 core is hack upon hack, to the point that it's been mostly abandoned due to how hard is to change things without breaking anything. Perl 6 was born as a specification, which allows for a "first make it right, then make it fast" approach.

That's assuming it can be made fast. It's been stagnant around this level of performance for quite some time now.

Re: Haskell to Perl 6

#48
post #2

What’s the objective or rationale here? I don’t understand why this is interesting.

I'm not sure, but I've got to say, as someone with 10 years Perl 6 experience, I nevertheless learned useful new-to-me things in the second section of it.

Re: Haskell to Perl 6

#49
post #11

There's also a Python version of this[1], which starts with a discussion about Perl 6's equivalent of print, which is put. This makes no sense to me whatsoever, as print is both a much easier way to say it and _what was used in Perl 5_, but not my circus, not my monkeys. But then it goes on to say: > There is also say, which behaves similarly, but will call the gist method of its argument. And after having read the l…

print in Perl 6 works the same as print in Perl 5.

put/say are output functions which automatically add a newline at the end.

If you want fancier formatting, printf is available as well.

And notice the relative lengths of these names. As much as possible, p6 is organized so that the more commonly used thing will have the shorter name.

PS I don't think I have ever used put in p6. My code uses say, or print if I don't want a newline added to the output.

Re: Haskell to Perl 6

#50
post #43

Earlier quoted context omitted.

> Perl 6 is for people who are very smart and have a great spirit in seeking and having fun in programming Not sure why you felt the need to include this. How did you come to this conclusion? Is this in comparison to Haskell, or what?

It was tongue in cheek, haha... I was only frustrated by my own inability to get the hang of Perl 6. As an old casual fan of Perl, I still want to take another shot at learning it very much.

The perl6intro website shows you the essentials of what you need and the ecosystem has matured a lot since 2014 as well as many good books being published. Laurent Rosenfield has a Think Perl6 book that you can buy in paper or read online for free. If you can already code, getting proficient in basic Perl6 is easy. Becoming a master is outside my current grasp.
Post reply on HN