This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html Set by lizmat on 8 June 2022. |
|||
00:52
Manifest0 left
05:05
hudo_ joined
06:18
hudo_ left
08:59
dakkar joined
|
|||
ab5tract | The L10N work necessarily involves collecting all “operators” (remember, these are just functions with funny names) so yeah, definitely it is where you want to look | 10:00 | |
lizmat | Note that most operators are not alphanumeric: they are not localized, only the alphanumeric ones | 10:03 | |
Nahita | might be error prone but can we grep the keys of CORE? like | 10:07 | |
m: CORE::.grep({ .value ~~ Callable && .key ~~ /^ "\&" .* "fix:<" /})>>.key.map({ .comb(/ <after ":<"> .* <before '>'> /).head }).sort.list.raku.put | |||
Raku eval | ("!", "!=", "!~~", "\%", "\%\%", "\&", "\&\&", "(\&)", "(+)", "(-)", "(.)", "(==)", "(^)", "(cont)", "(elem)", "(|)", "*", "**", "+", "+", "+\&", "++", "++", "++⚛", "+^", "+^", "+|", ",", "-", "-", "--", "--", "--⚛", "..", "...", "...^", "..^", "/", "//", ":\{ }", "=", "=:=", "==", "===", "=~", "=~=", "?", "?\&", "?^", "?^", "?|", "X", "Z", "[ ]", "[ ]", "[; ]", "^", "^", "^..", "^...", "^...^", | ||
"^..^", "^^", "^…", "^…^", "after", "and", "andthen", "before", "but", "cmp", "coll", "div", "does", "eq", "eqv", "gcd", "ge", "gt", "i", "lcm", "le", "leg", "let", "lt", "max", "min", "minmax", "mod", "ne", "not", "notandthen", "o", "or", "orelse", "so", "temp", "unicmp", "x", "xor", "xx", "\{ }", "\{ }", "\{; }", "|", "|", "||", "~", "~", "~\&", "~^", "~^", "~|", "~~", "×", "÷", "…", "…^", "ⁿ", "∈", | |||
"∉", "∊", "∋", "∌", "∍", "−", "−", "∖", "∘", "∩", "∪", "≅", "≠", "≡", "≢", "≤", "≥", "≼", "≽", "⊂", "⊃", "⊄", "⊅", "⊆", "⊇", "⊈", "⊉", "⊍", "⊎", "⊖", "⚛", "⚛++", "⚛+=", "⚛--", "⚛-=", "⚛=", "⚛−=", "⩵", "⩶") | |||
Nahita | m: CORE::.grep({ .value ~~ Callable && .key ~~ /^ "\&" .* "fix:<" /}).elems.put | 10:08 | |
Raku eval | 159 | ||
Nahita | counts aliases too | ||
on 2023.09 it reported 160 so at least 1 operator added between glot.io's version and that, which seems to be ⇒ | 10:11 | ||
lizmat | indeed, as an alias for => | 10:13 | |
11:33
habere-et-disper joined
|
|||
habere-et-disper | m: .say for 1...5...3 | 11:34 | |
camelia | 1 2 3 4 5 |
||
habere-et-disper | m: say gather .take for 1...5...3 | 11:35 | |
camelia | (1 2 3 4 5 4 3) | ||
habere-et-disper | Why doesn't say print the whole sequence? | 11:36 | |
m: dd 1...5...3 | 11:40 | ||
camelia | (1, 2, 3, 4, 5, 4, 3).Seq | ||
lizmat | habere-et-disper: no idea, feels like a bug :-) | 11:41 | |
habere-et-disper | .say for (1, 2, 3, 4, 5, 4, 3).Seq | ||
lizmat | m: .say for (1, 2, 3, 4, 5, 4, 3).Seq | ||
camelia | 1 2 3 4 5 4 3 |
||
lizmat | m: Q|.say for 1...5...3|.AST.EVAL | 11:42 | |
camelia | 1 2 3 4 5 4 3 |
||
lizmat | looks like it does do the right thing in RakuAST | ||
habere-et-disper: could you still make an issue for it ? | 11:43 | ||
habere-et-disper | Sure, this evening. Thanks for confirming. | 11:44 | |
lizmat | you're welcome and thanks in advance! | ||
habere-et-disper: BTW, .put, .print, .note suffer from the same issue | 11:50 | ||
11:51
habere-et-disper left
|
|||
lizmat | so I wonder if it's really about .say at all | 11:52 | |
and yet another Rakudo Weekly News hits the Net: rakudoweekly.blog/2024/01/29/2024-05-brain-nrg/ | 12:27 | ||
tbrowder__ | .ask aruniecrisps are you interested in producing calendars in your many-languages projects? | 13:47 | |
aruniecrisps | Are there any resources on writing slangs? | 14:32 | |
antononcube | Good guestion. I think (as far as I can recall) slangs are not part of the language. I would advice looking up packages for simple slangs, like, say Roman numbers. | 14:38 | |
I think I tried to find a package somebody wrote about LISP. Also, many of those packages are fairly old. | |||
librasteve | hmmm - some of the packages use the "old fashioned" way ... need to check that you are using the new AST based approach | ||
also lizmat did a set of AST posts oin Nov 2023 ish iirc | 14:39 | ||
I'm pretty sure that this one uses the latest approach ... github.com/alabamenhu/PolyglotBrainfuck | 14:40 | ||
(pardon my french) | |||
dev.to/lizmat/series/23109 | 14:41 | ||
github.com/lizmat/Slangify/tree/main | 14:45 | ||
^^ this | |||
antononcube | @librasteve Good point/links, but I personally am not inclined to use language features that are not officially released. | ||
I understand and admire the long/tedious/hard work on RakuAST, but until it gets "main-stream" I am not inclined to use it. | 14:46 | ||
Again, that is a personal view. Mostly, because I try and look for "production level" and "reproducible research" applications of Raku. | 14:47 | ||
librasteve | okaaay - I could be mixing up the latest language facilities for slang and the wider AST project, looking at the code in the libs I referenced, I do not see any dependency on PREVIEW pragma | 14:50 | |
lizmat: please do chime in and let us know the facts! | 14:51 | ||
lizmat | aruniecrisps for activating slangs, I would recommend using raku.land/zef:lizmat/Slangify | 15:47 | |
.oO( we of Toilet Duck recommend Toilet Duck :-) |
15:48 | ||
as to examples: I would recommend looking at the code of Slang::Tuxic / ::Subscripts / ::Roman / ::Piersing / ::Otherwise / ::Emoji | 15:50 | ||
(which all use Slangify) | |||
librasteve | lizmat: please can you tell us if this approach (use Slangify) depends on non production raku. | 16:25 | |
lizmat | it's all Raku code in there, nothing fancy, if that is what you mean? | 16:28 | |
not sure what you mean with "non production raku" | |||
antononcube | @lizmat I think @librasteve is asking is the Raku "standard", not depending on: (1) compiler only features, (2) preview or experimental features. | 16:30 | |
lizmat | the slang interface will be different in RakuAST, and the Grammar as well | 16:31 | |
so I wanted to create a consistent interface for activating slangs that would make a. consistent, b. not relying on internals, c. making transition to RakuAST / Raku grammar easier | 16:32 | ||
that is Slangify | 16:33 | ||
maybe Slangify should be core... | |||
it does not depend on any e.PREVIEW features | 16:35 | ||
antononcube | @lizmat Thanks! | 16:45 | |
aruniecrisps | Thanks for all your help @lizmat! I've bookmarked everything you've sent | 16:59 | |
lizmat | you're welcome! | ||
aruniecrisps | I'm also looking for a Raku equivalent of a job scheduler like Sidekiq (sidekiq.org/) or Oban (hexdocs.pm/oban/Oban.html), any tips? | 17:01 | |
lizmat | perhaps raku.land/zef:jonathanstowe/Chronic ? | 17:03 | |
aruniecrisps | Not exactly, I was looking for something that would run background tasks in response to requests | 17:05 | |
lizmat | perhaps Cro? cro.services | ||
aruniecrisps | I'm using Cro already for the app, does it have a job scheduler baked in? | 17:08 | |
Like for example how would I fire off an email as a background job and return some data? | 17:09 | ||
lizmat | aha: docs.raku.org/language/control#start | ||
m: my $p = start { sleep 1; say "slept nicely" }; say "waiting"; $p.await; say "waited" | 17:10 | ||
camelia | waiting No such method 'await' for invocant of type 'Promise' in block <unit> at <tmp> line 1 |
||
lizmat | m: my $p = start { sleep 1; say "slept nicely" }; say "waiting"; await $p; say "waited" | ||
camelia | waiting slept nicely waited |
||
aruniecrisps | Interesting so you would use the language itself to solve that problem | 17:11 | |
antononcube | I guess, when the student is ready, the programming language appears... | 17:16 | |
lizmat | yeah, async / events are built into the Raku core | 17:17 | |
antononcube | I think, that is the most unstudied by functionality area of Raku. | 17:34 | |
*... unstdudied by me... | 17:35 | ||
17:35
dakkar left
|
|||
It is in my TODO list to review those functionalities and think / consider how to utilize them in the LLM packages. | 17:36 | ||
librasteve | lizmat: thanks for explanation on Slangify | 18:00 | |
(I assumed that the new Slang approach was tied to the experimental AST based on the various blog info I have read - see comments above - and anton rightly raised that as a possible concern ... so now you have explanied the role of the Slangify module to remove this dependency and allow for a smooth transition all is clear) | 18:07 | ||
18:52
hudo_ joined
|
|||
scullucs | Can I get the Test module to output backtrace info when a test fails? | 19:26 | |
(if that makes any sense) | 19:39 | ||
librasteve | I would try eg zef test . --verbose (or --debug) | 19:42 | |
scullucs | Hmm... I'm not using zef for testing. | 19:43 | |
(will look at how zef does it) | 19:44 | ||
librasteve | I also use App::Prove6 but that does not seem to have as good debug option | ||
gfldex | Unless you use throws-like you can put your own CATCH block into the test file and display the whole stacktrace. | 20:12 | |
scullucs | Heh. Turns out I need this because a throws-like test is failing 🙂 | 20:14 | |
But I'll keep your idea in mind. | |||
gfldex | You could .wrap &throws-like. | 20:16 | |
scullucs | Getting a bit complicated for my skill level :/ | 20:17 | |
gfldex | m: use Test; &throws-like.wrap(-> $code, |rest { callwith({ $code(); CATCH { default { say .backtrace.full; .rethrow } } }, |rest); }); throws-like { die }, X::AdHoc, 'something bad happend'; | 20:26 | |
Raku eval | # Subtest: something bad happend 1..2 in method throw at SETTING::src/core.c/Exception.pm6 line 62 in sub die at SETTING::src/core.c/control.pm6 line 247 in block at main.raku line 10 in block at main.raku line 5 in block at /nix/store/paigpapymi5rpv51zjnpv7xlgcym4752-rakudo-2022.02/share/perl6/core/sources/2D4A7CA10695CD2B374573413D261A660E282E2A (Test) line 635 in block at | ||
/nix/store/paigpapymi5rpv51zjnpv7xlgcym4752-rakudo-2022.02/share/perl6/core/sources/2D4A7CA10695CD2B374573413D261A660E282E2A (Test) line 633 in block at /nix/store/paigpapymi5rpv51zjnpv7xlgcym4752-rakudo-2022.02/share/perl6/core/sources/2D4A7CA10695CD2B374573413D261A660E282E2A (Test) line 437 in sub subtest at | |||
/nix/store/paigpapymi5rpv51zjnpv7xlgcym4752-rakudo-2022.02/share/perl6/core/sources/2D4A7CA10695CD2B374573413D261A660E282E2A (Test) line 435 in sub throws-like at /nix/store/paigpapymi5rpv51zjnpv7xlgcym4752-rakudo-2022.02/share/perl6/core/sources/2D4A7CA10695CD2B374573413D261A660E282E2A (Test) line 630 in sub callwith at SETTING::src/core.c/control.pm6 line 133 in block at main.raku line 4 in block <unit> at | |||
main.raku line 10 ok 1 - code dies ok 2 - right exception type (X::AdHoc) ok 1 - something bad happend | |||
gfldex | @scullucs ^^^ there you go! | ||
20:27
hudo_ left
|
|||
scullucs | Wow, cool, thanks a bunch! | 20:27 | |
aruniecrisps | can you use java libraries with raku when compiling to the JVM? | 20:39 | |
antononcube | No. | 20:43 | |
I do not think the Raku-JVM is actively worked on. (Few years ago, I spent way too much time trying to figure out how Java to be used with Raku and vice versa...) | 20:44 |