[08:12] *** dakkar joined [08:35] How can I use `reduce` , or similar operation, with initial value? Something like `reduce( $op, $init, $list)`. [08:36] *** lizmat_ joined [08:36] *** TempIRCLogger__ left [08:37] *** lizmat left [08:37] *** TempIRCLogger joined [08:37] *** lizmat_ left [08:37] *** lizmat joined [09:15] m:``` [09:15] use v6; [09:15] sub foldl1(&f, @xs) { @xs.reduce: &f } [09:15] sub foldl(&f, $init, @xs) { foldl1 &f, ($init, |@xs) } [09:15] say foldl &infix:, 64, (8, 8); [09:15] ``` [09:16] <@!694526400488669234> [09:17] the `&reduce` with its `+list` parameter might be more readable in some cases [09:18] <@!210313526928080896> Ok, using my own fold/reduce definition is good. Thanks! [09:20] <@!210313526928080896> Of course, it should have occurred to me to use slip, `($init, |@list)`... [09:33] This statement made read the documentation more carefully around `+list`. So, this works : `‌‌reduce( &infix:<+>, 1..5, 1000)` . [09:33] This statement made read the documentation more carefully around `+list`. So, this works : `‌‌reduce( &infix:<+>, 1..5, 1000)` , i.e. it is what I asked for. [10:30] *** discord-raku-bot left [10:30] *** discord-raku-bot joined [12:11] btw I definitely like this simple sentinel-approach for iterators more than throwing an exception as it is in Python [12:11] when iterating two things together, this is much more comfortable [12:49] *** codesections joined [14:19] By the way [14:20] how do I check whether any of the given iterators reached the end? [16:05] *** discord-raku-bot left [16:06] *** discord-raku-bot joined [16:41] *** dakkar left [21:26] <@!297037173541175296> WIth `IterationEnd`, which you should never acutally encounter. Iterators are quite internal and not part of the language spec. [21:29] *** discord-raku-bot left [21:29] *** discord-raku-bot joined [21:33] It's important enough to be able to use iterators actually [21:33] and something that has an implementable interface shouldn't be that internal [22:03] Nemokosch#9980, I agree that Iterators aren't **that** internal (and they _are_ well documented/have a stable API, unlike something that genuinely `.is-implementation-detail`). But still gfldex is right that it's pretty rare to need to do much with Iterat**ors**; even when you're implementing your own classes, you can typically implement [22:03] Iterat**able**, and let the Iterator methods use the default implementations. [22:05] m: class C does Iterable { has @.inner handles }; my $a = C.new: :inner[1,2,3]; say $a.map(* × 2) [22:06] er, do we not have an eval-bot in #raku-beginner ? [22:07] codesections: the eval bot still only serves from the Discord side of the bridge. [22:08] Aha, fair enough [22:20] I didn't need to _implement_ iterators but I needed to call the given interface myself [22:21] This definitely isn't a taboo in most languages I know. It's not often needed but definitely a legitimate usage. [22:23] if you have a more comfortable way to lazily diff two (essentially) csv files that are ordered in advance, please go ahead, this is the solution I could came up with for Python back in the day and so far I have nothing better