Live data from Hacker News

Haskell to Perl 6

docs.perl6.org

61–70 of 136 posts

Re: Haskell to Perl 6

#62
post #54

Earlier quoted context omitted.

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.

Thanks for the recommendations. One liners are fun, and life-saving. I am curious about this aspect compared to Perl 5. With Perl 6's new syntax and language features, can we still easily [ab]use one liners for fun and profit?

Cons:

* Rakudo -- the only P6 compiler for now (and likely many years, maybe forever) -- has a slow startup, around 0.1 seconds or so.

* Rakudo is still a work in progress. What's done is pretty solid but, for example, no one has implemented the `-a` awk/autosplit command line option (cf https://gist.github.com/raiph/1d0cbefcb3cfe45b0b906282e6e405...) and command line usage is currently `use strict;` by default so you have to declare variables with `my`.

* Pros

P6 makes for sweet oneliners...

25 one liners being written up this month: https://perl6.online/category/advent-calendar/

9 categories last updated a year ago: https://github.com/dnmfarrell/Perl6-One-Liners

https://www.google.com/search?q=perl6+oneliners https://www.google.com/search?q=perl6+one+liners

Re: Haskell to Perl 6

#63

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.

The linguistic target Larry Wall aims at has little to do with uttering the line of code out loud.. The attempt to mirror human language is in the flexibility of the constructs. This is the much maligned There Is More Than One Way To Do It (TMTOWTDI) principle. The language is designed to allow the programmer to express themselves in they way that makes the point best for their brains. Now, this is almost a classical…

Hmm, interesting. TMTOWTDI is great for a small (one person) script, and One Way is better for a large (multi person) code base? That seems very plausible.

Re: Haskell to Perl 6

#64
post #36

Earlier quoted context omitted.

No, it's designed. It's just not designed the way everyone expects a computer language to be designed. It was designed by a linguist. He produced a language with some of the flexibility (and messiness) of human languages, which is completely foreign as a goal to other languages. One of the places this shows up to me is being able to say "it" (in essence). That is, we humans, when talking to each other, we say things…

This makes so much sense, in its own way. Is there anywhere I can read more about this perspective?

http://modernperlbooks.com/books/modern_perl/chapter_01.html

Re: Haskell to Perl 6

#65
post #36

Earlier quoted context omitted.

No, it's designed. It's just not designed the way everyone expects a computer language to be designed. It was designed by a linguist. He produced a language with some of the flexibility (and messiness) of human languages, which is completely foreign as a goal to other languages. One of the places this shows up to me is being able to say "it" (in essence). That is, we humans, when talking to each other, we say things…

This makes so much sense, in its own way. Is there anywhere I can read more about this perspective?

Try the "state of the onion" series of speeches.

Re: Haskell to Perl 6

#66
post #38

It may be that it's of interest, as an early Perl 6 implementation was written in Haskell (Pugs)

I think this Haskell version (pugs) came at a time when perl6-development was somewhat stuck, and it enabled the Perl 6 developers to test new language constructs on an improved runtime (I believe); so Haskell was actually key to Perl 6 development. ( https://gist.github.com/masak/479846/4908b28645b8815d1afe2b4... )

HTML, more readable: http://strangelyconsistent.org/blog/happy-10th-anniversary-p...

Re: Haskell to Perl 6

#67
post #47

Earlier quoted context omitted.

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.

Unfortunately, the performance of regexes has not been improved much in the past years, that is true and on the radar. Yes, it can be improved (very much indeed).

Most other subsystems of Rakudo Perl 6 have been improved significantly, some by orders of magnitude. And then there's work on the basic runtime of MoarVM and its JIT that will benefit all programs running on MoarVM.

The Perl Foundation recently approved another grant for the JIT: http://news.perlfoundation.org/2018/11/september-2018-grant-... about http://news.perlfoundation.org/2018/10/grant-proposal-moarvm...

Re: Haskell to Perl 6

#68

I'd like to hear opinions on how the use of sigils and the other syntax oddities like Int:D, Int:U, given, when, etc improves the codabliity/readability of Perl 6 vs other languages. The examples vs Haskell are not helping me understand. Personally I don't think the added verbosity is helping in any way.

FWIW, with a little syntactic trick, you can actually have sigillless variables in Perl 6:

    my \foo = $ = 42;  # bind sigilless name to a container with 42
    say foo;    # 42
    foo = 666;
    say foo;    # 666
See https://opensource.com/article/18/9/using-sigils-perl-6 for more information.

Re: Haskell to Perl 6

#69
post #14

Earlier quoted context omitted.

I've never used Perl6, but it took me about 30 seconds to figure out what 'say' and 'gist' do from the linked docs? 'gist' prints a string representation of an object aimed at being human-readable at the expense of not necessarily being a complete representation (e.g. the doc page gives an example that an array has only its first 100 elements printed followed by a '...'). 'say' is a version of 'put' that does this fo…

So, I sort of took that away from it, but there's stuff in the gist page like: > The default gist method in Mu re-dispatches to the perl method for defined invocants, and returns the type name in parenthesis for type object invocants. Many built-in classes override the case of instances to something more specific that may truncate output. And I have no idea how anyone that isn't already fluent in Perl 6 is expected t…

You cannot blame the language reference manual for exposing all the complexity and using precise wording. You are not expected to read that.

Other resources exist which are targeted at newcomers and explain things differently.

Re: Haskell to Perl 6

#70
Actually Perl 6 comes off badly in this comparison. The Haskell expressions are almost always easier to read, understand, reproduce, and overall even shorter.

Nevertheless it shows that Perl 6 can do real functional programming. Even if the syntax looks exceptional sometimes, even for people familiar with Perl 5.

Post reply on HN