🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
[Coke] yawns. 01:16
guifa is thinking about making a psuedo app bundle in macOS just to give raku files their own icons 01:57
stanrifkin what does zef stand for? Is it a abbreviation? 02:38
guifa stanrifkin: I don’t believe it has any meaning, it’s just short, pronounceable, and not taken :-) 02:43
stanrifkin guifa: OK 02:44
guifa but who knows, maybe ugexe is just from NC originally and used to fly out of the ZEF airport all the time ha 02:52
rypervenche I'm trying to figure out how to take a bag and get the weights in descending order and then map the key and values to variables, but I'm having trouble figuring it out. I've got: $bag.antipairs.sort(-*.key).map: -> but I'm not sure what signature will get me what I want. I think I need to decont it, but can't find the right combination. 03:52
parabolize rypervenche: I'm not sure what you want the variables to be. maybe this? 04:09
:m say [ bag( < a a a b b c c c c >).pairs.sort(-*.values) ]
rypervenche So I got it to work with 2 for loops, but I feel like it could be done in a single map somehow. I'm trying to get the (sorted) weight and value into variables to be used later: gist.github.com/rypervenche/1d3e0a...c242899bce 04:14
guifa2 can I get some sample data to run with that? 04:28
rypervenche It's from a larger script with a few different data sources. I'll come up with a small example tomorrow to simply things. 04:31
guifa2 m: my $bag = Bag.new(<a d a b a c a d a a a b b b b b c a c c d d d>); for $bag.pairs.sort(-*.value) -> (:$key, :$value) { say "$key ($value)" } 04:33
camelia a (8)
b (6)
d (5)
c (4)
guifa2 That should work 04:34
and if you prefer different variable names
-> ( :key($new-key-name), :value($new-value-name) )
jmerelo releasable6:status 06:04
releasable6 jmerelo, Next release will happen when it's ready. GitHub is down. There are no known blockers. Changelog for this release was not started yet
jmerelo, Sorry kid, that's not my department.
raku-bridge <frost> I want to know the difference of multi { } and multi sub { }, or are they the same? 10:55
Altai-man They are the same, multi without anything default to multi sub. Be careful with `multi method` in a class, there `method` has to be specified for this reason. 10:58
s/default/defaults/ 10:59
raku-bridge <frost> Thanks 😘 13:05
rypervenche guifa2: Thanks! That's exactly what I was looking for. I know you've shown me the syntax before, but I couldn't remember it or find it anywhere. :P 13:09
JJAtria[m] Is there a Raku equivalent to weak refs? I'm thinking of how they are used in eg. Perl to avoid memory leaks. Or is that something that doesn't translate to Raku? 13:25
moritz Raku uses a "proper" garbage collector (not ref counting), so you don't need to avoid circular data structures 13:38
there are some *very* few cases where you could still use weak references; I don#t think we have a good solution for that yet 13:39
andrzejku hey guys 13:49
do you know how raku gaming stands now? 13:50
guifa I don’t think anyone has done any games wtih it except for a few command line things
MasterDuke timotimo has done a demo or two with the SDL bindings 13:51
andrzejku yes timotimo was done a game
and tadzik
guifa made a Rakudo.js loading status image 13:55
github.com/alabamenhu/IntlX/blob/m...imated.png
JJAtria[m] moritz: Thanks! 13:56
[Coke] (loading status image) owmyeyes. :) 14:33
tellable6 2020-09-23T03:16:51Z #raku-dev <Kaiepi> [Coke], can i talk to you next time you're on?
[Coke] Kaiepi: you can try, but my time on IRC is sporadic. 14:40
Kaiepi: what's up?
guifa [Coke]: she goes solid all colors when it’s loaded. I got bored last night lol 14:49
[Coke] guifa: :) 14:51
guifa is there a way to pass args to a module loaded with -M ? 14:52
Altreus It looks like when I press the cycle colours button in fractint
in p5 it was -MModule=import,list 14:53
perhaps this?
guifa ah hmm I’ll try that 14:54
guifa :-( no dice 14:57
[Coke] wonders why hacktoberfest repo is not using artistic. 15:35
gibranrosa p6: say 3; 16:47
camelia 3
gibranrosa m: say 3;
camelia 3
gibranrosa m: say now - INIT now
camelia 0.00110039
pduh list 17:00
codesections 17:32
[Coke] 17:36
m: "".uninames.say 17:37
camelia ()
[Coke] :P
codesections m: say ''; 17:38
camelia
[Coke] I had used a unicode space in my blank send, but something got lost in translation. :)
Xliff andrzejku: The pieces are there to make some really nice games in Raku. 18:24
tellable6 Xliff, I'll pass your message to andrzejku
Xliff andrzejku: However Raku's performance issues (particularly compiling) are offputting to most game developers. 18:25
tellable6 Xliff, I'll pass your message to andrzejku
Xliff I actually wrote a generic card deck class a while ago. Never took the time to make a formal game out of it.
andrzejku: I actually wrote a generic card deck class a while ago. Never took the time to make a formal game out of it. 18:26
tellable6 Xliff, I'll pass your message to andrzejku
rypervenche Is it possible to use gather/take with a map? For example, I'm looping through some lines in an array and only taking items if they match a certain criteria and then assigning all of that to a variable. I've got it working with a for loop right, but haven't been able to figure out how to do it with a map (so I can hyper it). I'll give an example of the code so it makes more sense. 21:15
MasterDuke you probably want a grep? 21:17
timotimo you can also hyper a for, it has to be a "hyper for", though 21:19
rypervenche The portion of code in question: gist.github.com/rypervenche/326be5...eb38fde7af
I converted it to a map with a hyper, but I couldn't find any place to put a gather. 21:20
hyper for :O
Hmm, I can't change batch and degree though when using "hyper for", can I? 21:23
timotimo you can, you'll need to "hyper for @blah.hyper(...) { ... }"
rypervenche Ahhh 21:24
rypervenche Hmmm, gather still doesn't work when I use hyper for. I get "Died at: take without gather" 21:49
timotimo oh 21:50
i should have pointed this out before 21:51
with gather/take where you're take-ing from hypered workers, you would be accessing an array concurrently
that's a big no-no
you can return an array from each map or for block and slurp them all together afterwards, or send values to a Channel 21:52
Xliff You'd need a Lock
Channel would be better, I suspect
rypervenche Hmmm, ok. I'll poke around the documentation to see if I can figure that out. If not, it's not the end of the world. Just wanted to shave off some time from this little script. 21:57
Xliff Who is handling raku support for Repl.it? 22:08
rypervenche: Any luck? 22:21
rypervenche Haven't started yet. I'll have to reorganize it a bit in my test to work with promises. 22:25
guifa had to do an assignment for his CS class in Java and it was ugly 22:26
Xliff You shouldn't need any promises. Just a channel.
See my comment on your gist.
guifa In Raku I could have done it in like five 20-char max lines
unclechu hey, is there any way to define some text for `--help` with line breaks? smth like #|«…» before MAIN function would associate it with particular multi-sub pattern and would remove any line breaks 22:27
I want to add some generic description 22:28
Xliff unclechu: Write a sub USAGE { } that adds to $*USAGE var
Xliff unclechu: See here github.com/Xliff/p6-GtkPlus/blob/m...xample.pl6 22:30
unclechu Xliff: thanks! 22:31
Xliff unclechu: Live sample -- repl.it/@Xliff/PersonalModernRobots#main.raku 22:33
rypervenche Xliff: Oooh, I'll try that out. 22:34
Xliff unclechu: Check the repl.it again. It's cleaner
unclechu Xliff: why does example from the first link uses `nqp` in order to concatenate string with `$*USAGE`?
Xliff Old code
Back when I originally wrote this, that was the only way to access $*USAGE. It's unnecessary, now 22:35
unclechu Xliff: okay, i just realized i don’t need nqp there
Xliff Oops! Sure don't. ;) 22:36
rypervenche Xliff: Out of curiosity, couldn't I replace (my $s = $c.Supply).tap with $c.Supply.tap ?
I don't see you using the $s anywhere else in the gist. 22:37
Xliff rypervenche: I was wondering about that. The only reason I assign to $s is to make sure the Supply object doesn't fall out of scope.
That might not be necessary
stanrifkin with what algorithm is is-prime implemented in? AKS-test or Fermat primality test? 22:42
Xliff stanrifkin: Miller-Rabin according to the docs 22:43
stanrifkin i didn't find it in the docs 22:44
Xliff docs.raku.org/type/Int#routine_is-prime
guifa I swear I remember Damian doing a whole conference talk on it but I can’t seem to find it 22:45
but maybe it was jnthn or someone else? 22:46
stanrifkin i watched the talk, but he mentioned different methods
guifa oh yeah
www.youtube.com/watch?v=Nq2HkAYbG5o
ah I thought I remmeber him saying that one is the one that’s used in Raku
stanrifkin guifa: ok, than i missed it 22:47
guifa stanrifkin: I could be wrong though. It’s been a while since I watched the video
timotimo wakelift.de/p/64fec54c-8b69-4dd1-8...23d13ddbf/ - who wants to proofread my blog post 22:48
stanrifkin i don't understand the design choice with sub routine parentheses sub f(...) and sub f (...). i think that's another rule to remember and always forget when someone comes to raku again. 22:54
AlexDaniel stanrifkin: what's the alternative? 23:06
stanrifkin AlexDaniel: use a reference 23:07
AlexDaniel stanrifkin: I'm talking about sub f(...) vs sub f (...) 23:08
stanrifkin AlexDaniel: sub f($a, $b, $c) are three arguments and sub f ($a, $b, $c) is one argument i. e. a list with my understanding... 23:12
AlexDaniel stanrifkin: yes, but what would be the alternative design choice? 23:13
stanrifkin AlexDaniel: in perl i used sub f(\@arr) for that... maybe than something like sub f(\($a, $b, $c)) but maybe that's more irritating 23:14
AlexDaniel ahh 23:15
stanrifkin :)
AlexDaniel actually would've been interesting to have no list type, just mutable arrays. Then () syntax would not be there, so f (42, 43) could be a function call 23:17
edgy, I know, but it's a possibility :) 23:18
not the most wonderful possibility though :P 23:20
stanrifkin: there was a discussion some years ago about the preferred style for sub declaration 23:21
stanrifkin: actually, rereading this conversation, I'm not entirely sure what we're talking about exactly :) 23:22
Grinnz thinks its better than spaces having no syntactical significance
AlexDaniel stanrifkin: thing is, `sub foo () {}` is actually valid
so you can define your subs this way, but you cannot use the same syntax to call them 23:23
Grinnz in perl say (something)[0] attempts to run say(something) and then has a syntax error, because that makes sense :P 23:24
AlexDaniel a lot of people prefer the space for some reason, but IIRC even more people argued that the preferred style should be without a space, this way I guess you're less likely to assume that it'd be valid to call your subs this way
Grinnz i very much prefer requiring no space between symbol and opening parentheses for calls 23:25
because that solves taht ambiguity in particular
in raku it's more complicated since it actually means something different
timotimo there's always slang::tuxic to do the space thing differently 23:30
stanrifkin AlexDaniel: I missed the point that defining the sub the space is valid. OK. I get used to that. 23:33
AlexDaniel timotimo: and how is that useful in practice? 23:34
timotimo dunno, i didn't read enough of the discussion i guess 23:35
AlexDaniel timotimo: it's not about the discussion, but about the whole idea
of having modules that introduce slight syntax changes
timotimo if you don't like a (1, 2) being one argument, use slang::tuxic and it no longer is that way, hooray 23:36
AlexDaniel and then say you go to work, and what happens? You convince all your colleagues to add `use Slang::Tuxic` to all of the files? 23:37
or you don't, and then you'd probably be writing it the wrong way by acciddent
Slang::Tuxic is a party trick, that's it 23:38
timotimo hm, does tuxic break when you use it inside curlies? 23:39
AlexDaniel slangs are fantastic for relatively big features, say inline SQL or anything like that. But suggesting to use them for minor syntax differences is just out of touch 23:40
because what we have here is actually a trap in the language. If we had Raku::Critic I guess it would've been easy to add a check for that, but it seems like we're missing an alternative also 23:42
for example, say you write `foo (1, 2, 3)`. Then Raku::Critic could've warned you about it because maybe you didn't mean it
but… what would it say? 23:43
AlexDaniel like how can you write explicitly that you meant it. foo((1, 2, 3)) ? Ew. 23:43
timotimo m: sub foo(*@x) { dd @x }; foo\ (1, 2, 3) 23:44
camelia Array element = [1, 2, 3]
timotimo m: sub foo(*@x) { dd @x }; foo (1, 2, 3)
camelia Array element = [1, 2, 3]
timotimo m: sub foo(*@x) { dd @x }; foo(1, 2, 3)
camelia Array element = [1, 2, 3]
timotimo ah, right
AlexDaniel yeah, that's the opposite I think :)
timotimo m: sub foo(**@x) { dd @x }; foo (1, 2, 3); foo\ (1, 2, 3); foo(1, 2, 3); foo((1, 2, 3))
camelia Array element = [(1, 2, 3),]
Array element = [1, 2, 3]
Array element = [1, 2, 3]
Array element = [(1, 2, 3),]
timotimo right, it is
AlexDaniel not enough ASCII parens, I guess 23:46
or maybe an optional colon could've done it
foo: (1, 2, 3) 23:47
sure, that's a label, but I don't know why labels need to have this neat syntax :
:)
timotimo why did labels get the colon, we may never know 23:52
rypervenche Xliff: Interestingly, when I try what you sent, it no longer sees my variable... Updated gist.github.com/rypervenche/326be5...eb38fde7af 23:59