Live data from Hacker News

Unusual Raku Features

buttondown.com

81–90 of 166 posts

Re: Unusual Raku Features

#81

Earlier quoted context omitted.

very cohesive, [7] > (1,3,9...*)[4,5] (81 243) [8] > (1,3,9...*)[(1..3)] (3 9 27) and nestable [0] > (1,2,4...*)[(1,2,4...*)[1,2,3]]

These are all very clever, but what's the use case? I'm not saying there isn't one, I just don't know what it is! Not to speak of the dead, but Perl was utilitarian: it was built to solve problems. From my point of view, these are solutions to problems I've never had.

I've heard that the best way to solve a hard problem is to create a language in which solving that problem would be easy.

Basically creating a Domain Specific Language.

Raku isn't necessarily that language. What it is, is a language which you can modify into being a DSL for solving your hard problem.

Raku is designed so that easy things are easy and hard things are possible. Of course it goes even farther, as some "hard" things are actually easy. (Hard from the perspective of trying to do it in some other language.)

Lets say you want a sequence of Primes. At first you think sieve of Eratosthenes.

Since I am fluent in Raku, I just write this instead:

  ( 2..∞ ).grep( *.is-prime )
This has the benefit that it doesn't generate any values until you ask for them. Also If you don't do anything to cache the values, they will be garbage collected as you go.

Re: Unusual Raku Features

#82
post #19
post #3

I’m not sure this page loaded properly for me, half of it is arbitrary punctuation characters assembled in bizarre nonsensical ways.

That's an interesting way to describe the English language.

I've often thought of Raku as being a lot like the English language. It borrows heavily from other languages.

Of course since Raku has the benefit of an actual designer, it is more cohesive than English.

Re: Unusual Raku Features

#83
post #29

Shocking that they stopped at five.

I'm sure that there has been more changes from Perl 5.8 to Perl 5.40 than there is between Python 2.0 to Python 3.x (Whatever version it is up to at the moment.)

What's more is that every change from Python 2 to Python 3 that I've heard of, resembles a change that Perl5 has had to do over the years. Only Perl did it without breaking everything. (And thus didn't need a major version bump.)

Re: Unusual Raku Features

#84

I got the title confused for "Roku".

Someone downvoted this message. If downvoting also comes with reason, it will be helpful.

I didn't downvote, but this is by far not the first time something like that was stated (Raku being similar to Roku).

I know I'm tired of seeing it, I'm sure others are as well.

Re: Unusual Raku Features

#85

# Does weird things with nested lists too > [1, [2, 3], 4, 5] > [10, 20] [11 [22 23] 14 25] This article makes me feel like I'm watching a Nao Geo/Animal Planet documentary. Beautiful and interesting to see these creatures in the wild? Absolutely. Do I want to keep my distance? As far away as possible.

You're making a mistake if you're thinking like that. Applying an operation that generally works on single values over a list of values automatically is an incredibly powerful technique. If you have ever used Numpy, you will appreciate not needing it in many cases where Raku's built-ins suffice.

That's not really the issue here. The problem is they've elevated this super weird recursive looping operation to the level of a built-in operator.

Built-in operators should be reserved for tasks that are extremely common and have obvious behaviours.

This would be more suitable as a function, like

    applyBroadcast([1, [2, 3], 4, 5], [10, 20], +, recursive=true, loop=true)
There are so many subtle behaviours in `>` that you really want to spell out. Did you notice that it was [22, 23] not [22, 13] for example?

Re: Unusual Raku Features

#86
post #70

Earlier quoted context omitted.

Things do not require to be useful or to increase revenue in order for them to be enjoyable. If the only reason you ever do something is because you get material wealth out of it, are you even making choices or are you a perfect rational actor as described in textbooks? Things are allowed to exist and be enjoyed on the sole basis that they are enjoyable

Oh I’m not wealth motivated at all . My regrets are about uselessness of that time itself. E.g. I could learn ML instead and do nothing useful with it, rather than not doing nothing useful with my perl knowledge today.

the irony

Re: Unusual Raku Features

#87
post #65
post #44

Earlier quoted context omitted.

Same as Perl, nobody wants to maintain it, but it's extremely fun to write. It has a lot of expression. You can see that in Raku's ability to define keyword arguments with a shorthand (e.g. :global(:$g)' as well as assuming a value of 'True', so you can just call match(/foo/, :g) to get a global regex match). Perl has tons of this stuff too, all aimed at making the language quicker and more fun to write, but less rea…

it's extremely fun to write Then your contrarian phase ends and you regret that you didn’t learn something useful in that time.

I was paid to write it, but still find it useful for short scripts and one liners. I'd use it over sed, awk or shell without pause.

It is very strong for text processing, particularly regexes.

Finally learning any language helps you learn new paradigms which you can apply anywhere. Same as Haskell or Lisp or something.

Re: Unusual Raku Features

#89
post #62

Earlier quoted context omitted.

>> magic functions—which behave differently on lists-of-scalars vs. lists-of-lists by special default logic ... That is completely the wrong way to think about it. Before the Great List Refactor those were dealt with the same by most operations (as you apparently want it). And that was the absolute biggest problem that needed to be changed at the time. There were things that just weren't possible to do no matter how…

That concept of "strange consistency" reminds me of my experience writing Clojure, for some reason.

Nil punning in Clojure gives you that kind of experience, for example. Things that would break in other languages, just "work as you'd expect them" in Clojure (except when you drop down to host primitives, and then nils don't behave nicely anymore). In general, it makes for a really pleasant dev experience, I find.

Re: Unusual Raku Features

#90

I got the title confused for "Roku".

Someone downvoted this message. If downvoting also comes with reason, it will be helpful.

The reason is that no one cares about your failure to read correctly. It adds nothing to the conversation. (I didn't downvote.)
Post reply on HN