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:15 jgaz left 00:18 Manifest0 left 03:08 frost joined 03:10 frost left 03:29 rf left 05:00 frost joined 05:04 frost left 07:55 Heptite left 08:35 Manifest0 joined 09:05 dakkar joined 09:16 ab5tract joined 09:33 ab5tract left 10:06 ab5tract joined 10:41 ab5tract left, ab5tract joined 11:00 ab5tract left 11:20 ab5tract joined 12:09 ab5tract left 12:33 frost joined 13:37 rf joined
rf . 13:47
lizmat rf: any of the channels with tellable will give you your messages... no need to . on different channels, unless you meant something else by it 13:49
rf Oh didn't know that. Thanks! 13:54
16:38 Heptite joined 17:35 dakkar left 17:38 hizibiz joined 18:32 tg57 joined 20:58 QhpAptyj9hj0RQwM joined 21:21 hizibiz left, hizibiz joined 21:30 codesections joined, codesections left 21:34 tg57 left 21:37 hizibiz left 22:00 frost left
Yeuph If I'm initializing classes within some set operations like $classTest = Stop.new(thing => $num) (|) Stop.new(thing => $num) (|) Go.new(thing => $num) (|) Jump.new(thing => $num) (|) Walk.new(thing => $num); 23:09
how can I access the elements of #classTest? 23:10
Nemokosch docs.raku.org/images/type-graph-Set.svg 23:12
Yeuph I don't know what that means lol
Nemokosch point being, Sets are kind of Hashes still
Yeuph well say I want to perform some logic on Stop.new(thing => $num) after the algebra 23:13
how do I grab it?
Nemokosch basically, a usual set would consist of Pairs, the item you pushed into being the key of the pair
Yeuph by accessing my $classTest SetHash that it's initialized in 23:14
Nemokosch m: my Set() $demo = <alma körte barack körte alma SZÉN>; say $demo.keys;
Raku eval (alma SZÉN körte barack)
Nemokosch there are also funky methods for taking one element, including the one you already named: grab 23:15
(well, not necessarily only one but you get the idea - elements, rather than the whole thing at once)
docs.raku.org/type/Set 23:16
Yeuph gotta play with this for a bit, thanks
Nemokosch tenor.com/view/cat-typing-typing-o...f-21481919 23:17
Yeuph basically lol
would I just type the string representing the initialized class in the set? 23:22
like say Go.new(thing => 1) (elem) $classTest;
it's returning false
Nemokosch well a custom object would have reference type semantics 23:23
Yeuph my ultimate goal here is to move classes - some of which being initialized in the algebra - into other sets
Nemokosch if you know Python, that's like saying it's not "hashable" by default 23:24
Yeuph I don't 😦
Nemokosch but just like in Python you can implement the magic method for hashing, there is something similar for Raku as well - the WHICH method
Yeuph docs.raku.org/routine/WHICH 23:25
this?
Nemokosch yes
docs.raku.org/routine/WHICH#(Mu)_method_WHICH
Yeuph so what, it has a special string assigned to it as an object; and even if that string doesn't match the "words or whatever" that the element in the set has 23:26
it would likely access it within the set?
Nemokosch I can't understand this 23:27
Yeuph I'll do some reading and work on my own and if I get stuck I'll come back
thanks man
(my question was in reference to the first sentence of the WHICH method page: "This returns a string that identifies the object. ") 23:28
Nemokosch docs.raku.org/type/ValueObjAt 23:29
this page has a good example I'd say
Yeuph Yeah I can see how this will work but I think figuring it out is a bit more work than I'm wanting to do here before bed 23:43
I think I'll get this working tomorrow
but thanks, this does look like it'll do it once I figure it out 23:44
Nemokosch yes, this is mostly something you need to do once in order to get these "hashability" features and then === and these hash-based data types will just work the way you expect 23:45
Yeuph right
I'll have some functions giving my the hashes
Nemokosch it's all up to what representation you decide on; the default would be some kind of address 23:46
Yeuph then I'll check the sets for those
Nemokosch I think Sets themselves are reference types
m: say <1 2 3>.Set === ❤️ 2 1>.Set
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Missing required term after infix at /home/glot/main.raku:1 ------> say <1 2 3>.Set ===⏏ ❤️ 2 1>.Set expecting any of: prefix term
Nemokosch bruh discord
Yeuph lol
Nemokosch m: say <1 2 3>.Set === <3 2 1>.Set 23:47
Raku eval True
Nemokosch hmmm, maybe not, then? let's see
m: <1 2 3>.WHICH.say
Raku eval List|5635469267696
Nemokosch oops, that's the List
well, you can see that the List has the default, reference-based behavior, by the way 23:48
it's a random number; you could create another one with the same content and it would be another number
m: <1 2 3>.Set.WHICH.say
Raku eval Set|6AF0F9BD7836549B13210B50833463F26D63E18B
Nemokosch the Set has something trickier... I don't know by heart, need to look it up 23:49
Yeuph It seems like I'll be able to use the ObjAt:(hash?) (elem) someSet
eh I'm tired 23:50
I'll come back tomorrow lol
Nemokosch github.com/rakudo/rakudo/blob/2022...Set.pm6#L8 um
Yeuph my eyes aren't cooperating with reading anymore
Nemokosch let's say, the hashing of a Set is not trivial 23:51
Yeuph well computers don't do set algebra
sooo
making one do it
is serious business
that's why I'm not even trying with C++
someone did the work for me here already lol
Nemokosch but yeah, you can create a WHICH that isn't this complex
that really is like that code snippet; type + attribute values 23:52
Yeuph Yeah, I may get a rain day tomorrow (bricklayer) so I'll have plenty of time to play
w00t!
Nemokosch good luck to that 😂 23:54
23:57 jgaz joined