Raku Programming Language

profoundlynerdy,
@profoundlynerdy@bitbang.social avatar

What are some underappreciated superpowers that and/or has EXCLUDING and ?

RogerBW,
@RogerBW@emacs.ch avatar
rakulang,
@rakulang@fosstodon.org avatar

@RogerBW

Solution to 1. with shortcutting:

sub uniqueoccurrences(@a) {
@a.repeated.head =:= Nil
}

https://docs.raku.org/type/Any#method_repeated

Also note that The Raku Programming Language uses the tag, to not interfere with the good people doing Raku pottery.

RogerBW,
@RogerBW@emacs.ch avatar

@rakulang Thanks, I'll tweak the tag for future posts. I tend not to use the sexier language features in favour of a portable polyglot approach (also because I find them hard to parse when I come back to the code later).

alchemistsstudio,
@alchemistsstudio@mstdn.social avatar

Yesterday I was daydreaming of spring and our gardens and these raku pottery pieces come to mind. What do these pieces remind you of?

Here's hoping my poor flower bulbs are not too confused (they started coming up in February.

A multi-coloured raku pottery vase with various shades of blues, pinks and purples.

mjgardner,
@mjgardner@social.sdf.org avatar

@Perl Per @PerlRakuFoundation's announcement yesterday,* The & Conference 2024 in Las Vegas is now accepting proposals for live in-person session talks! https://tprc.us/talks

Need ideas? That page also has previous conference schedules as well as a wiki link to request topics.

New this year: a peer-reviewed track with its own process: https://science.PerlCommunity.org

ology,
@ology@fosstodon.org avatar

@mjgardner @Perl @PerlRakuFoundation Woo! I just submitted two: {Beginning,Advanced} Algorithmic Music with Perl - Thanks for announcing! :D

samebchase,
@samebchase@fantastic.earth avatar

I want to try out https://www.morling.dev/blog/one-billion-row-challenge/ in

The baseline solution in Java clocks in just under 5 seconds, so with Raku what should be a decent timing for a closest translation of that. The optimized solutions are less than 2 seconds.

What is a good time to target?

lizmat,
@lizmat@mastodon.social avatar

@samebchase

my atomicint $i;
$path.IO.lines.race(batch => 10000).map({ ++⚛$i });

would be a better benchmark. This will at least parallelize the work (incrementing $i). But that still needs serial decoding.

How fast would this be:

my $h = open $path;
Nil while $h.read;

that would be the lower bound.

You could .list.grep(10, :k) on each Blob, and use that to decode async (10 being "\n".ord).

Is that a plan?

samebchase,
@samebchase@fantastic.earth avatar

@lizmat Let me try this out.

For comparision with single threaded wc -l i mplementation:

  1. Go takes 23 seconds.
  2. Common Lisp (SBCL) takes 70 seconds.

CL => 3x Go
Raku => 10x CL

The Nil while read thing that you've given runs in 20 seconds.

The race and atomic increment thing, I killed it after 3 mins.

VZ,
@VZ@fosstodon.org avatar

I really like , in theory, and would like to use it more, but whenever I have something to write, I still often end up with using for it.

Just the latest example: I had to write a simple text-wrangling script that needed UUID generation. With Perl, I used App::Fatpacker to embed UUID::Tiny to make the script runnable just about anywhere without any extra dependencies, but there is nothing like that for Raku AFAIK and it just didn't seem worth it to do something more complicated.

18+ mjgardner,
@mjgardner@social.sdf.org avatar

@VZ’s design all came from the question, ‘What could I build if I could basically start again from scratch? What ideas might I have? How do I build a coherent whole from this blank canvas?’

’s ongoing design is all rooted in, ‘What would I use right now in this real code I am writing today? What features would I like to have that I currently do not?’”

@leonerd (https://x.com/cpan_pevans/status/1596972022952779782)

mjgardner,
@mjgardner@social.sdf.org avatar

@VZ @leonerd IMHO is great but it’s also a classic case of Fred Brooks’ “second-system effect”: https://archive.org/details/mythicalmanmonth00broo/page/53

Greguti,

J'ai réalisé un en terre cuite et puis je l'ai cui en et puis j'ai mis des émaux dessus et puis je l'ai cui en cuisson . Le résultat est un mignon petit hippo qui est dans l'eau et dont seule la partie supérieure émerge, tête, dos, petite queue.

samebchase,
@samebchase@fantastic.earth avatar

Great post featuring while trying to explain an algorithm using which we can do mental arithmetic to generate pseudorandom numbers.

https://www.hillelwayne.com/post/randomness/

I learnt a few tricks! 👌

goldstein,

I solved this day of in , which still looks fun, until I try to actually write it and discover once again that basically every operation has some weird footguny semantics. nevertheless, I’m quite happy with the final result, which looks nice and concise.

https://github.com/GoldsteinE/aoc2023/blob/master/day13/code/main.raku

18+ goldstein,

some random examples of weird footguny semantics in Raku:

my @arr = (2, 3);<br></br>reduce &[+], 1, @arr;<br></br>

is 3 (list gets reinterpreted as a scalar). you need to use |@arr for it to work.

reduce &[(&)], ();<br></br>

(identity element for set intersection) is an empty set for some reason.

Set.new((1, 2), (3, 4)) (&) Set.new((3, 4), (5, 6))<br></br>

is an empty set (sets use comparison by identity, so all the lists are considered different).

set((1, 2), (3, 4))<br></br>

is a set of four numbers 1, 2, 3, 4, set flattens its arguments, while Set.new does not.

sequences like x...^y and (x..^y).reverse are either not actually lazy, or just really slow, not sure which one.

18+ samebchase,
@samebchase@fantastic.earth avatar

@goldstein Hmm, even in the official documentation it seems to require the | (slip) operator. https://docs.raku.org/routine/reduce

Could any experienced Rakoon let us know why this is necessary?

opoku,

I've completed "Pipe Maze" - Day 10 - Advent of Code 2023 https://adventofcode.com/2023/day/10

As I suspected, day 10 was a doozy (especially part 2). I've always had trouble with these enclosed spaces algorithms.

https://git.sr.ht/~opoku/aoc2023/tree/main/item/day10.raku

18+ jeff,
@jeff@phpc.social avatar

@opoku Nice work! This seems like the proper approach. 👍

I was getting hung up on the adjacent pipes, and decided to just upscale the map 3X then flood fill.

masukomi,
@masukomi@connectified.com avatar

I've been asked to write an article for the advent calendar this year. I have a simple tutorial idea that I think will be good for beginners, and I swear to god I spent half the effing day yesterday fighting with ORM libraries and now I'm thinking "Fuck-it. I'll just write raw SQL."

Personally, I love SQL, but it feels kinda bullshit that that's where I ended up, and it's terrible for a beginner tutorial. Never-mind the fact that dramatically complicates the amount of code I'll need.

smokemachine,

@masukomi yes, you are right, that’s the reason. I really need to find a way to fix that. But if you are not going to use Postgres (and you are going to use SQLite) you could install it with —force…

masukomi,
@masukomi@connectified.com avatar

@smokemachine a) thanks b) owing to time constraints I've gone off in another direction with what I'm working on, but I'll try that on the next personal project. Not really a fan of making a project for others when I have to tell them to force-install specific dependencies.

bocs,
@bocs@toot.wales avatar

For the first day of living in UTC+0, I actually have to be up at stupid o'clock anyway. In the interests of speed, which I usually do not care about, given the opportunity I shall start day 1 in in which the thing will take moments. I'll clean it up into because, well, one ought to. I'll then start again in because that's what I want to learn this time around.
I see a lot of exotic things, or rust, or R. Where's my perl tribesfolk?!

mjgardner,
@mjgardner@social.sdf.org avatar

@bocs I’m in the tribe but wasn’t going to participate in . Should I?

sjn,

I just submitted a talk to the and track at . Deadline for submission is tomorrow (Friday Dec 1st), and it's not too late to share! 😄

https://news.perlfoundation.org/post/fosdem2024

WGAvanDijk,
@WGAvanDijk@mastodon.social avatar

TPRF (The Perl and Raku Foundation) is organising a Raku & perl devroom at FOSDEM. Sadly, no booth for Raku & Perl. Still, plenty of interesting stands.

https://fosdem.org/2024/news/2023-11-20-accepted-stands-fosdem-2024/

CIAvash,

If you're looking for a more powerful tool(and regex) than , , …, then rak is the answer

App::Rak - 21st century grep / find / ack / ag / rg on steroids
https://raku.land/zef:lizmat/App::Rak

  • All
  • Subscribed
  • Moderated
  • Favorites
  • raku
  • rosin
  • thenastyranch
  • mdbf
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • Youngstown
  • cisconetworking
  • slotface
  • vwfavf
  • everett
  • Durango
  • kavyap
  • GTA5RPClips
  • megavids
  • khanakhh
  • osvaldo12
  • ngwrru68w68
  • normalnudes
  • anitta
  • ethstaker
  • cubers
  • modclub
  • tacticalgear
  • provamag3
  • Leos
  • tester
  • JUstTest
  • All magazines