5 ms·
The Raku Programming Language
- jjice 2y agoThey show it on the landing page, but having first class support for CTF grammars is such an interesting niche for a language. Perl (Rake was originally Perl 6 if I recall) always had solid tooling for dealing with text manipulation, but adding context free grammars in directly is another level. I have to imagine it ends up being seldom used for a lot of applications, but I wonder if you end up with a "see nails when you have a hammer" situation (and not necessarily in a bad way). I personally have never used a context free grammar outside of writing a programming language parser.
- etyp 2y agoYeah, I've never really considered using a grammar like that for string processing like they suggest. And it's the first thing they show. Maybe I'm missing out and I just haven't had the tooling.
- giraffe_lady 2y agoI first came across something like this in janet, which includes a PEG system in the standard library. It definitely changed how I think about text processing. Very much of the time what I find myself doing with regex is defining a grammar, but I didn't realize that. I wish more languages included the tools for it, it's a core operation of practical programming. https://janet-lang.org https://janet-lang.org
- Pet_Ant 2y agoFor those who didn't know and read comments first: Raku was originally known as Perl 6. https://en.wikipedia.org/wiki/Raku_(programming_language)#History https://en.wikipedia.org/wiki/Raku_(programming_language)#Hi... The main implementation is called Rakudo: https://en.wikipedia.org/wiki/Rakudo https://en.wikipedia.org/wiki/Rakudo "Raku" is Japanese for "camel" which is named after the O'Reilly book cover.
- bloopernova 2y agoIn https://rosettacode.org/wiki/FizzBuzz https://rosettacode.org/wiki/FizzBuzz there's a nice Raku implementation, with ever-more-compact varieties following. It seems like a really nice language but which niche should it occupy? Edited to add, now that I'm at a computer: for 1 .. 100 { when $_ %% (3 & 5) { say 'FizzBuzz'; } when $_ %% 3 { say 'Fizz'; } when $_ %% 5 { say 'Buzz'; } default { .say; } } The multi sub version is interesting. I'm not quite sure what multi subs are, they seem to be performing a pre-function-call validation to choose which sub to use? multi sub fizzbuzz(Int $ where * %% 15) { 'FizzBuzz' } multi sub fizzbuzz(Int $ where * %% 5) { 'Buzz' } multi sub fizzbuzz(Int $ where * %% 3) { 'Fizz' } multi sub fizzbuzz(Int $number ) { $number } (1 .. 100)».&fizzbuzz.say;
- agumonkey 2y agoThey're nearing apl density :)
- klibertp 2y agoNon-interactive shell scripting. It's actually the best language in this niche, outclassing Perl and Tcl in terms of features and Python/JS in terms of expressivity. General purpose scripting. Orders of magnitude fewer packages and batteries than in Python or Ruby, but it does have a package manager and a bunch of libs for typical tasks. It's also capable of calling Python code almost seamlessly. For small (1 file) scripts, the expressivity of Raku means often half the lines of equivalent Python code, unless you hit a package that Python has and Raku doesn't. Everything related to text processing. The grammars parsed by Grammars don't have to be context-free. Parsing just about anything is a joy. Also, light data mangling - if it fits in RAM, you might not need any other tool (like R/Pandas). It's also a general-purpose, gradually typed, JIT-compiled, multiparadigm (OO, FP, procedural, array) language, so you can use just about anywhere you want. It's less great for mission-critical things (error handling is peculiar) and shell one-liners (the JIT takes a toll on startup time). It has a REPL, instead.
- deleted 2y ago[deleted]
- xbar 2y agoI've doing some text processing in Raku for the past two weeks. It has been a pleasant and efficient experience.
- systems 2y agois larry wall at all engaged with raku?
- klibertp 2y agoNot sure; he was involved in the design in the 2000s, but I haven't seen him while I was active in the community. Some other prominent Perl community members are there (the kinder ones, I'm told).
- lizmat 2y agoNot actively, not anymore. Very occasionally (maybe once a year) he will post a comment on an issue. But that's about it. In other words: (hopefully happily) enjoying his retirement.
- deleted 2y ago[deleted]
- liveoneggs 2y agoRaku is like the everything language. Reading its docs is a wild ride. https://docs.raku.org/language/operators https://docs.raku.org/language/operators
- klibertp 2y agoNot my experience with it: the language is indeed rich, but not overly so. The number of concepts you need to learn is comparable to (modern) Python or less. Raku is also very consistent, choosing to apply already existing concepts rather than invent a new one (when designers are forced to choose) most of the time. While you still have many ways of accomplishing each task, no language elements are dedicated to a single task. As for operators - most of them are simply aliases for method names, you don't have to use them. However, some operators are representations of concepts that are not available through other means (e.g., `...`[1], circumfix `[]`, infix `Z`) The page you linked to makes no distinction and dumps everything that is syntactically an operator on a single page, resulting in a very long list. In practice, you don't need to remember more than a small fraction of them. [1] https://docs.raku.org/language/operators#infix_%2E%2E%2E https://docs.raku.org/language/operators#infix_%2E%2E%2E
- mempko 2y agoI use Raku for production. It's great for orchestration, or writing a quick server. Text manipulation and processing is amazing. I'm shocked it hasn't gotten more adoption in the LLM space. You would think someone would make a really great library to create AI Agents using Raku.
- klibertp 2y agoThe community is tiny. The fact that it was called "Perl6" for 20 years (Raku is from after 2019 I think) absolutely doesn't help in anything, the least in adoption. The historical churn in terms of VM (experimental in Haskell, dead Parrot, JVM, current MoarVM), the lack of planned features (macros!) for long years, and the slow death of Perl over a similar time frame - all that (and more) means not many people use it, even if they happen to know about it. On the other hand, there's a similarly tiny - or smaller - community around Glamorous Toolkit (a Smalltalk distribution) that managed to produce one of the most hackable and rich LLM clients out there: https://github.com/feenkcom/gt4llm https://github.com/feenkcom/gt4llm https://gtoolkit.com/ https://gtoolkit.com/ Here, though, LLMs are so close a match for the community interests that it just had to happen...
- librasteve 2y agorakulang reddit has 1.5k members ... it's not Python or Rust yet ... but the community is very open and friendly and its great to rub shoulders with such knowledgable and committed folks
- klibertp 2y ago> but the community is very open and friendly Yes, it is - you'll see I said precisely that in another comment here. :) However, I will not yield in that it's tiny. Emacs sub on Reddit has 63k users, half of whom are Emacs Lisp programmers (by necessity). That's 20x more community members than Raku, and we're talking about a) a Lisp; and b) one bundled as an extension language for a text editor... Raku currently has a community comparable to Smalltalk, Racket, or Haxe - enough to keep the lights on, but not much more than that. Similarly to them, Raku doesn't have any strategy for breaking into the mainstream. In effect, these communities don't grow over time. There's an "old guard" - a few dozen people - who are passionate about (and invested in) the project, but the retention of other users rarely exceeds a year or two. I like Raku as a language, but the lack of hands shows. Imagine my surprise when a partially applied sub (`.assuming`) turned out to be 1000x (really) slower than an equivalent block. It's a known issue, just nobody had the time to work on optimizing it. RakuAST work is still ongoing 5 years later. There are other rough edges and unimplemented features, all still there because there is not enough contributors. In any case: Raku is great, and its community is warm and friendly. At the same time, the community is tiny and Raku adoption most likely won't shoot up anytime soon. That doesn't mean you shouldn't use it, but you should be aware of the situation so that you can decide if it offers a suitable trade-off for you.
- melezhik 2y agoThere is https://sparrowhub.io https://sparrowhub.io and Sparky - devops tooling with Raku API ( disclosure - I am - the author ) which enables Raku for various automation and devops tasks