🦋 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.
summerisle i'll add that the only noticeable slowness (for what i've been doing) seems to be from the parse phase, which i'm sure could be optimized 00:31
leont Which is really slowness in the grammar engine 00:38
Which is exactly what it's so difficult 00:39
summerisle playing with the lazy keyword and i notice that it's really only friendly to loops, wheras if i say `my $foo = lazy frobnicate;` then `frobnicate` is called and lazy is treated as a prefix call (e.g. lazy on invocant) 06:21
moritz yes, lists can be lazy in raku, scalars not so much 06:29
summerisle that's what i was wondering
lizmat summerisle: maybe modules.raku.org/dist/Object::Delayed is what your looking for, specifically "slack" ? 10:32
summerisle lizmat: yeah, that's it 16:51
tonyo i'd kind of expect a lazy &x to behave like haskell and only call x when the scalar is used 17:27
tbrowder hi, gang. 20:53
codesections o/
tbrowder is there any way to get raku to return the same sequence from pick on multiple calls? 20:54
codesections: hey!
something like setting the initial seed to a constant. 20:55
codesections I'm confused. That sounds like you just want a sequence. Why use pick at all? 20:56
tbrowder it would be handy in some use cases, like repeated monte carlo runs.
hm, maybe so
tbrowder i have an ordered list of numbers and i want to randomize the list one time 20:57
every time the script is run i should get the same result unless i change the seed 20:58
codesections Oh, I see 20:59
tbrowder hm, i'll look into rand/random some more
thnx
codesections yeah, there is docs.raku.org/type/Num#sub_srand but that's not quite it 21:00
tbrowder i'm having non-secure connection problems again and can't see that :-( 21:05
codesections (my first thought is just to do that with a cache of some sort - either compute it at compile time and then use that value until the module is re-compiled or compute it once and read it to disk. But that might be more work/IO than you want to do)
tbrowder yepper!
codesections > sub srand(Int $seed --> Int:D) 21:06
> Seeds the pseudo random number generator used by Num.rand with the provided value.
tbrowder it's easy in perl as i recall, but my perl foo is very rusty.
ok, thnx, i'll go play with that a bit, bye. 21:07
raydiak p6: for ^10 { srand 0; (^10).pick.say } 21:15
evalable6 4
3
3
3
3
3
3
3
3
3
raydiak why is the first one different?
MasterDuke that's...interesting... 21:50
tbrowder codesections: success. it took 127 tries to collect all 29 numbers in a random order. script gave repeatable results 21:52
codesections ooh, cool. What's the trick?
tbrowder time was almost instantaneous
codesections So what do you do to get it to work? Does it use srand? 21:55
tbrowder i had to use a hash and an array. while the hash.elems < 29, get the int for 30.rand. next if zero, next if it's in the hash; put in hash, push to array. spit out array which is list of 29 random numbers
clunky but i'm sure someone can golf into much less 21:56
codesections I'm sure! 21:57
tbrowder i started the script with settin srand
the use case is i have to pick 5 candidates out of 29 for board members on college grad assoc. i've read all 5 and think they're all pretty much qualified, so i'm picking 5 to study closer. 22:00
read all 29!
Raku to the Rescue! 22:01
thnx for hint
codesections No problem. Thanks for telling me how you got it to work 22:02
guifa2 New module! github.com/alabamenhu/IntlNumberPlural 22:34
(not that this is one anyone will use probably but me lol) 22:37
codesections guifa2: that actually looks _very_ useful. I've written at least two hacky &pluralize functions in the last couple of months – and that was just to support English, with only two grammatical numbers. I don't know if/when I'll internationalize anything, but if I do that will *definitely* be in my dependencies 23:24
guifa2 codesections: if you're doing a lot of localized text, you'll probably want one of the localziation modules (which in turn will depend on this one) 23:26
I've actually now got enough stuff rewritten to the new version of Intl::CLDR that I'm going to go back and rewrite Fluent from scratch
instead of building in the localization manager into the module, I'm going to split them, that way the localization manager can pull from any number of localization formats that will (hopefully) have a mostly standardized API or be able to have 1-2 liner bridging functions 23:28
codesections well, by the time I need to localize anything, it sounds like it'll 23:29
*be a pretty smooth experience!
guifa2 Also the Plural module will need to be rewritten when RakuAST comes out haha 23:30
So much rewriting to do haha 23:31
codesections also, I was reading this man page the other day and thought of you when I got to the second item in the BUGS section at the bottom: www.gsp.com/cgi-bin/man.cgi?sectio...;topic=MTM 23:33