02:28 arkiuat left 02:30 arkiuat joined 02:35 arkiuat left 02:46 arkiuat joined 02:51 arkiuat left 03:20 arkiuat joined 03:26 arkiuat left 03:46 arkiuat joined 07:08 arkiuat left 07:21 arkiuat joined 07:30 arkiuat left
disbot6 <rcmlz> Can I change the default implementation of e.g. arrays? Lets say, I import a Role and instead of every time I am creating a new Array like „my @a does SomeRole = 1,2,4;“ I change it once at the beginning of my script such that „my @a = 1,2,3,4“ is enough to get my improved List implementation? 07:40
07:43 arkiuat joined
disbot6 <nahita3882> augment? 07:44
<nahita3882> web.archive.org/web/20221130232332...ax/augment 07:45
<rcmlz> Ideally I can attach two Roles, one containing my collection of „nifty tricks“ and one Role for specific stuff only needed for the task at hand, like „my @a does (SomeRole, SomeOtherRole) = 1,2,4;“
<rcmlz> @nahita3882 thank you - let me check 07:46
07:48 arkiuat left
disbot6 <nahita3882> in Rakudo's source, they use it for new language version additions, for example github.com/rakudo/rakudo/blob/main...ps.rakumod 07:50
08:00 arkiuat joined
disbot6 <rcmlz> That is what I was looking for - thank you. As I am the only user of my tools I can safely ignore the warning, I guess. „… this means modifying global state, which is strongly discouraged. For almost all situations, there are better solutions.“ 08:00
08:05 arkiuat left 08:34 arkiuat joined 08:39 arkiuat left 09:05 arkiuat joined 09:10 arkiuat left 09:15 dakkar joined 09:16 librasteve_ joined 09:34 dakkar left
disbot6 <rcmlz> Oh, that is very cool. glot.io/snippets/hdl0juei53 Follow up question (but maybe that is than only possible in RakuAST). How would I ensure that I can chain my custom methods say @a.adjacent-difference.is-sorted-until; Is that something I can solve already? 09:41
09:41 lizmat_ left 09:42 lizmat joined 09:48 arkiuat joined
disbot6 <rcmlz> Found it by Trial and Error. Now I am very pleased and can start to get some actual work done ;-) 09:53
09:54 arkiuat left
disbot6 <rcmlz> use lib '.'; use My-Roles; role Project-Specific-List-Enhancements does Generic-List-Enhancements { method is-sorted-until( --> UInt) { self.&{$_ Z .skip}.map({.[0] <= .[1] || last}).sum } method adjacent-difference(--> List(Seq)) { |($_ Z- .skip given self) does Project-Specific-List-Enhancements } }; my @a does Project-Specific-List-Enhancements = 1, 2, 3, 3, 4, 6, 5; say 09:54
@a.adjacent-difference.is-sorted-until;
10:20 arkiuat joined 10:25 arkiuat left 10:49 arkiuat joined 10:54 arkiuat left 11:08 arkiuat joined 11:13 arkiuat left 11:17 sibl joined 11:22 sibl left, sibl joined 11:26 arkiuat joined 11:35 arkiuat left 11:51 arkiuat joined 11:56 arkiuat left 12:02 sibl left 12:16 librasteve_ left 12:19 arkiuat joined 12:23 arkiuat left 12:51 arkiuat joined 12:56 arkiuat left 13:07 arkiuat joined 13:12 arkiuat left 13:38 arkiuat joined 13:43 arkiuat left 14:03 swaggboi left 14:05 arkiuat joined 14:14 arkiuat left 14:19 swaggboi joined 14:33 arkiuat joined 14:41 arkiuat left 14:53 arkiuat joined 14:58 arkiuat left 15:12 arkiuat joined 15:17 arkiuat left 15:18 arkiuat joined 16:17 arkiuat left 16:20 arkiuat joined 17:06 mahlay left 17:08 mahlay joined 19:19 arkiuat left 19:25 arkiuat joined 19:33 arkiuat left 19:52 arkiuat joined 21:20 social joined 21:21 social left, social joined 21:24 social left 21:36 social joined, social left 23:23 librasteve_ joined