Live data from Hacker News

A Complete Course of the Raku programming language

course.raku.org

71–80 of 110 posts

Re: A Complete Course of the Raku programming language

#71
post #7

Over the years I have learned and dipped my toes in many programming languages, and I'd need some kind of reason to look into yet another language. What are Raku's main contributions to the programming language design space that I probably haven't seen elsewhere?

phasers are very neat https://docs.raku.org/language/phasers

Re: A Complete Course of the Raku programming language

#72
post #53
post #42

Earlier quoted context omitted.

But as Perl-compatible regular expressions are available in many other languages, this is not really a reason for learning Perl itself, right? Or am I missing some deeper insight into regexes, because I don't know Perl?

That's true, but it's worth mentioning that using the regexes in perl is quick and even fun to write. They are built-in to the language. some people find it very convenient.

Also the Perl community has been pushing the boundaries of regex and text processing generally.

If you find yourself in a place with frequent one-off text wrangling or Unix admin problems some Perl knowledge is worthwhile.

Re: A Complete Course of the Raku programming language

#73
post #68

This language looks cool! I also really like the page-by-page format for the tutorial, which strikes exactly the right balance (for me) between giving too little and too much info. As a side note, I noticed that the "Notes on using Unicode" page[1] referred to the quotation marks used in kanji-based languages[2] as "fancy." I think this kind of exotification of non-western cultures (where mundane things become exciti…

Thanks. I've updated that.

Nice! As a side note, I think it's very cool that Raku supports multiple quote characters. It's unusual to see that in source code and, while I code mostly in English, I imagine it would be nice for people writing in other languages.

Re: A Complete Course of the Raku programming language

#74
post #42

Earlier quoted context omitted.

Learning Perl is worthwhile because it is ubiquitous on Unix-like systems and Perl-compatible regular expressions are the defacto standard regular expression syntax. Perl may not be as popular now as it was in the past, but it is still around and lots of legacy systems that were written in Perl are still in active use.

But as Perl-compatible regular expressions are available in many other languages, this is not really a reason for learning Perl itself, right? Or am I missing some deeper insight into regexes, because I don't know Perl?

It is a matter of personal preference.

I find that regular expressions and text-wrangling tasks are faster and easier in Perl than in other programming languages due to its accessible syntax and regular expression engine speed.

This article shows the regular expression syntax in several popular programming languages: https://cs.lmu.edu/~ray/notes/regex/

This GitHub repo gives some regex performance test benchmarks: https://github.com/mariomka/regex-benchmark Perl is pretty fast among the scripting languages that were benchmarked.

If you are familiar with C / C++, then learning Perl is relatively fast and easy: https://perldoc.perl.org/perlintro

Re: A Complete Course of the Raku programming language

#75
post #8

I'm so glad they renamed Perl 6, having it dangling for decades like a Sword of Damocles hurt Perl more than anything else could. At least both languages are now able to progress in their separated ways, and I must say Raku is a really pleasant language, and a joy to use.

I'm going to butcher my question so my apologies, I've heard Perl described as a sort of linguist / grammatical type of language, where you can solve the same problem using multiple approaches and syntax. Is this something Raku is drifting from or embracing? I think Raku is kind of interesting and I did try it out a few times whilst it was called Perl 6, but I'm not sure what its niche is. I mostly do Python for prof…

There are a TON of experiments and language mash-ups in Raku. Let's see here.... Types can include guard clauses that are evaluated at runtime. Typed multi-dispatch on top of that. In addition to normal "sets" it has "junctions", like some sort of funky quantum superposition or something. In theory those can be made parallel at some point. Stuff like that.

One that is particularly funky is the "whatever-star". This is a "" char that can be used in a few places to mean more or less... whatever. For example:

    .map(-> $x { $x + 7 }) # result: (11 12 13 14)
That stabby inline lambda there can be sugared down in a lot of ways, including with the whatever-star:

    .map(* + 7) # result: (11 12 13 14)
... I've not seen anything quite like that in other languages, not sure if it is a new invention or if only nobody else is crazy enough to try it. And yes, you can use multiplication next to it to make it look crazier:

    .map(* * 7) # result: (28 35 42 49)
(also yes, (
* *) will take two inputs and multiply them.)

I will note though that dwelling on these crazy/fun edge cases is amusing, but programs can look quite a bit more like a basic ruby app (with sigils) if you so desire.

Re: A Complete Course of the Raku programming language

#76

I literally clicked on this thinking "Neat! Let's try something new" until I remembered it's just perl rebranded... unless i'm missing something?

I think that in some ways the semantics of Raku are closer to Ruby than to Perl5. https://docs.raku.org/language/rb-nutshell is a ruby-to-raku walk through. Among other things, Raku has first-class Roles that I think Ruby should consider adopting. In Raku the sigils (symbols prefixing variables) give an immediate indicator as to a general role that the variable implements -- so $ for single-values, @ for lists, % for dictionaries (hashes), & for callables. That adds a lot of "noise" that makes Raku look different, but under that it is like a lot of modern dynamic OO languages ... lots of objects and method invocations with a few JSON like built in types.

Re: A Complete Course of the Raku programming language

#77

Earlier quoted context omitted.

I'm going to butcher my question so my apologies, I've heard Perl described as a sort of linguist / grammatical type of language, where you can solve the same problem using multiple approaches and syntax. Is this something Raku is drifting from or embracing? I think Raku is kind of interesting and I did try it out a few times whilst it was called Perl 6, but I'm not sure what its niche is. I mostly do Python for prof…

As someone who wrote a limited amount of Perl 5 before writing a not insignificant amount of Perl 6 (now Raku), I find Raku syntax to be deeply Perlish while also being more modern and internally consistent than Perl 5. IMO Raku has three standout features: 1. Grammars in the stdlib [1] 2. The absolute most flexible multi-dispatch system of any programming language [2] 3. The best regex syntax of any programming lang…

Thanks; as someone whose three favorite languages include Perl and Erlang, this gives me more reason to look at it.

Re: A Complete Course of the Raku programming language

#78
post #63

I literally clicked on this thinking "Neat! Let's try something new" until I remembered it's just perl rebranded... unless i'm missing something?

If you insist on comparing it to Perl, you could consider it "Perl Re-Imagined". Just like "The Lord Of The Rings" is a re-imagination of "The Hobbit".

I do have to say i'm rather impressed after your comment inspired me to look at the docs for the first time.

Re: A Complete Course of the Raku programming language

#79
post #75

Earlier quoted context omitted.

I'm going to butcher my question so my apologies, I've heard Perl described as a sort of linguist / grammatical type of language, where you can solve the same problem using multiple approaches and syntax. Is this something Raku is drifting from or embracing? I think Raku is kind of interesting and I did try it out a few times whilst it was called Perl 6, but I'm not sure what its niche is. I mostly do Python for prof…

There are a TON of experiments and language mash-ups in Raku. Let's see here.... Types can include guard clauses that are evaluated at runtime. Typed multi-dispatch on top of that. In addition to normal "sets" it has "junctions", like some sort of funky quantum superposition or something. In theory those can be made parallel at some point. Stuff like that. One that is particularly funky is the "whatever-star". This i…

Note that HN's formatting ate several of the * in the comment above, which makes it much harder to follow.

> (also yes, (* * *) will take two inputs and multiply them.)

That's true, but Raku also supports non-Unicode math operators, so the more idiomatic way to write that would be

  (* × *)
which, in isolation, still isn't that clear. But it usually is in context. And, if it isn't – well, that's why there's more than one way to do it!

Re: A Complete Course of the Raku programming language

#80
post #75

Earlier quoted context omitted.

I'm going to butcher my question so my apologies, I've heard Perl described as a sort of linguist / grammatical type of language, where you can solve the same problem using multiple approaches and syntax. Is this something Raku is drifting from or embracing? I think Raku is kind of interesting and I did try it out a few times whilst it was called Perl 6, but I'm not sure what its niche is. I mostly do Python for prof…

There are a TON of experiments and language mash-ups in Raku. Let's see here.... Types can include guard clauses that are evaluated at runtime. Typed multi-dispatch on top of that. In addition to normal "sets" it has "junctions", like some sort of funky quantum superposition or something. In theory those can be made parallel at some point. Stuff like that. One that is particularly funky is the "whatever-star". This i…

Scala has something similar with "placeholder syntax for anonymous functions", where

    _.methodname()
or

    _ + 1
is equivalent to

    x => x.methodname()
or

    x => x + 1
https://www.scala-lang.org/files/archive/spec/2.13/06-expres...
Post reply on HN