roles-and-lists-on-steroids

Run Settings
LanguageRaku
Language Version
Run Command
#!/usr/bin/env raku # Lists in Raku have many usefull methods already: https://docs.raku.org/type/List # But you can attach some more usefull stuff you see on youtube: https://www.youtube.com/watch?v=LvFTyvYM-ds # by mixin in Roles: https://docs.raku.org/language/objects#Mixins_of_roles # such that it is easy to re-use these custom enhancements # by just putting the Role definition in a module and use it anywhere. role My-Mighty-List { method is-sorted( --> Bool) { ?self.&{$_ Z<= .skip}.all } method is-sorted-until( --> UInt) { self.&{$_ Z .skip}.map({.[0] <= .[1] || last}).sum } method adjacent-difference { self.&{$_ Z- .skip} } }; my @a does My-Mighty-List = 1, 2, 3, 3, 4, 6, 5; say @a; say @a.is-sorted; say @a.is-sorted-until; say @a.adjacent-difference;
Editor Settings
Theme
Key bindings
Full width
Lines