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:11
ab5tract left,
ab5tract joined
02:45
hythm joined
03:00
hythm left
03:30
hythm joined
05:47
hythm left
09:00
dakkar joined
|
|||
knorrfg | Hey, I'm having a problem: raku sub start_something() { indir "/", { my $proc = Proc::Async.new: <sleep 10000000>; $proc.stdout.tap: {}; $proc.stderr.tap: {}; $proc.start; sub { $proc.kill(); } } } sub MAIN() { my &kill_fn = start_something(); LEAVE { &kill_fn(); } sleep 5; } | 09:14 | |
running this produces: $ raku rakuproblem.raku No such method 'CALL-ME' for invocant of type 'Callable' in sub MAIN at rakuproblem.raku line 13 in block <unit> at rakuproblem.raku line 1 | |||
and I really don't understand why | |||
11:20
Tirifto left
11:21
Tirifto joined
|
|||
antononcube | Where I can find an example of a proper implementation of the gist method for a class? My naive attempts, e.g. method gist(-->Str) { self.Hash.Str; } lead to hanging during assigments and not being able to invoke .WHAT of the corresponding objects. | 14:26 | |
lizmat | antononcube that example feels... weird? | 14:30 | |
nemokosch | perhaps you want to set a different gist for the type object? | ||
lizmat | the only thing a .gist method is supposed to do, is to create a string representation of the invocant | ||
if you make it a multi gist(class:D:) | 14:31 | ||
then the type object case will be handled for you | |||
nemokosch | you'll have to type out multi method in this case, or else you fall back to multi sub | 14:32 | |
antononcube | @lizmat Ok. I will try that. | ||
lizmat | nemokosch good catch, I meant multi method indeed | ||
antononcube | Thank you both! | 14:33 | |
librasteve | KnorrFG: after some changing around with your code, I got a different error Type check failed in binding to parameter '&emit'; expected Callable but got Hash ({}) | 15:08 | |
to fix this you need the empty Callables for .tap to be like this: $proc.stdout.tap: {;}; $proc.stderr.tap: {;}; | |||
the semi colon is needed in the case of an do nothing Callable otherwise the compiler thinhs this is a literal empty hash (docs.raku.org/type/Callable) | 15:09 | ||
or I think it is OK to omit the empty Callable like this: $proc.stdout.tap; $proc.stderr.tap; | 15:10 | ||
yeah the docs show that you will get an empty Callable set as default, in that case it is spelled a bit different to {;} method tap(Supply:D: &emit = -> $ { }, ...) | 15:14 | ||
nemokosch | it's an explicitly one-argument empty Block | 15:15 | |
drudgesentinel | Hey all- I'm trying to get my comments on MAIN arguments to show, and want to know if I'm doing it wrong. Given this very simple program, I'd expect 'thing to print` to show when this is called without an argument(I'm on v6.d): » cat test.raku drudge@fedora sub MAIN( Str $message, #=thing to print ) { say $message; } Based on the CLI interface docs I would expect this to print | 15:59 | |
the comment » raku test.raku Usage: test.raku <message> | |||
lizmat | sub MAIN(Str $message) { #=thing to print | 16:07 | |
say $message; | |||
} | |||
note that #= indicates a comment, ad as such should be "outside" code | |||
drudgesentinel ^^ | 16:08 | ||
hope this makes sense | |||
nemokosch | I think it can actually work - when there is a space after | 16:20 | |
I've used that stuff a lot | |||
librasteve | ^^ that | ||
the docs say # inside "frobnicate.raku" sub MAIN( Str $file where *.IO.f = 'file.dat', #= an existing file to frobnicate Int :$length = 24, #= length needed for frobnication Bool :$verbose, #= required verbosity ) { say $length if $length.defined; say $file if $file.defined; say 'Verbosity ', ($verbose ?? 'on' !! 'off'); } | |||
(and it works providing you have the space after #= | 16:21 | ||
) | |||
docs.raku.org/routine/MAIN | |||
nemokosch | I don't think I have actual scripts to show now because they belong to my now-previous workplace | 16:22 | |
but it worked pretty well | |||
youtu.be/gJKN9nVHe6w?t=394 | 16:24 | ||
some snippets were included in the presentation 😄 | |||
these definitely worked | |||
17:45
dakkar left
18:10
hythm joined
|
|||
.vushu | <ab5tract> you were right that I can use int32 is rw, which will simplify things 🙂 | 18:17 | |
ab5tract | \o/ | ||
.vushu | got way cleaner my int32 $count = 0; my $text = "Ab5tract"; my int32 $point = load-codepoints($text, $count); say $count; # show 8 my $snow-a = load-font-ex("resources/DotGothic16-Regular.ttf", 48, $point, $count); | 18:27 | |
ab5tract | great! I’ll take a look at it now that I’ve finished Tetris: gist.github.com/ab5tract/d71b8e2f4...02ac08cc4c | 18:29 | |
.vushu | damn thats cool 😆 | 18:46 | |
ab5tract | Thanks :D | 18:47 | |
librasteve | omg - tetris in 228 lines (vs. 7432 for the original - that asm for you) | 19:19 | |
ab5tract | Nice to know the original lines, I was pretty happy to land at 228. It could get golfed of course, but I want it to be a reference example. | 19:22 | |
librasteve | well i only counted the main.asm github.com/CelestialAmber/TetrisNESDisasm | 19:23 | |
19:27
hythm left
|
|||
ab5tract | fair enough, we aren’t counting Raylib::Bindings or raylib :) | 19:46 | |
I followed a tutorial for this, by the way. There are a few differences but mostly the line count is just a result of writing Raku instead of C++ — www.youtube.com/watch?v=wVYKG_ch4yM | 19:50 | ||
.vushu | I'm a bit rusty at tetris :d | 20:03 | |
cdn.discordapp.com/attachments/768...f6202& | |||
btw <ab5tract> here is raygui for raku if you will like to try github.com/vushu/raygui-raku | 20:05 | ||
20:26
destroycomputers left
20:28
destroycomputers joined
|
|||
ab5tract | .vushu: awesome! I will definitely be exploring this | 20:35 | |
scullucs | Speaking of Tetris, how do you like this one? (watch till the end, so to speak) twitter.com/jagarikin/status/14575...cJyyZcxfgA | 21:02 | |
21:05
thowe left,
thowe joined
|
|||
.vushu | that is nauseating 😵💫 | 21:06 | |
scullucs | The colors are annoying, but did you get the point? | 21:07 | |
ab5tract | Its a weird illusion, for sure | 21:09 | |
.vushu: I needed these changes to make `zef install .` work for raygui-raku | 21:11 | ||
www.irccloud.com/pastebin/CAnc1YoO | |||
.vushu | cool thanks I don’t have a mac to test on, will fix it 🙂 | 21:14 | |
ab5tract | Have you had any luck with getting the audio streams working? It might be worth asking on stack overflow, some people answer there who don’t hang out here | 21:35 | |
.vushu | no I haven’t look more into it, for sure I will try to ask SO for help 🙂 | 21:55 |