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.
02:17 tea3po left 02:18 tea3po joined 04:37 thowe left 08:08 habere-et-disper joined 08:12 dakkar joined
holmdunc and the confusing thing on the JS side is that it has Maps too: developer.mozilla.org/en-US/docs/W...bjects/Map 09:48
lizmat that'd be raku.land/zef:lizmat/Hash::Ordered in Raku 09:54
10:09 habere-et-disper left
Nemokosch well, Map is more of a "modernism" in JS 10:15
holmdunc Objects were Good Enough for the first 20 years! 10:29
lizmat feels more like a PHPism in JS to me 10:31
if I remember correctly, hashes in PHP were just arrays of pairs with an associative interface on them
aka, the order of insertion was kept
but with severe performance issues for large hashes, especially if the key didn't exist 10:32
Nemokosch I think in JS they just genuinely recognized that objects, or even records, have different implication and different "baggage" compared to an associative data type 10:41
now if you do Typescript, you can still use objects the associative way but it's kinda cumbersome and the old restrictions also hold so like there is no real reason to use them that way 10:42
the Mozilla site does mention the insertion order, honestly I didn't even know about it, and after checking the site, it still appears to me that it's not "the killer feature" of Map, just a kind of cherry on top thing 10:45
anyway, I have a Raku question! 😄 10:46
what's the idiomatic way to create an infinite sequence from an iterable that loops through the elements, much like itertools.cycle in Python?
lizmat |(iterable) xx * 10:59
m: my @a = 1,2,3; say (|@a xx *)[^10] 11:00
camelia (1 2 3 1 2 3 1 2 3 1)
lizmat Nemokosch ^^
Nemokosch yes well, this is what I was thinking of 11:27
thanks anyway
13:52 raiph joined 14:14 raiph left
librasteve role Object::Literal { has %.object; method new( %object ) { return self.bless( :%object ) } method FALLBACK( $key ) { %!object{$key} ~~ Callable ?? %!object{$key}() !! %!object{$key} } } my Object::Literal $olly .= new( %( :a(7), :b(42), :c({ "hi {$olly.b}" }) ) ); say $olly.c; #hi 42 14:15
^^^ thought it would be interesting to try some way to do method call semantics on a Hash 14:16
since this is the example set out at medium.com/the-codehub/object-lite...affed2d6b4
14:17 tea3po left, tea3po joined
only snag is I can't work out how to get the Callable to be a method on the object like :c({ "hi {self.b}" }), 14:18
but since it is a literal it seems fair to use the var name itself 14:19
16:36 dakkar left 21:34 guifa left 22:33 habere-et-disper joined 23:07 teatwo joined 23:10 tea3po left 23:20 tea3po joined 23:23 teatwo left