Skip to content

Instantly share code, notes, and snippets.

@Mouq

Mouq/lol.diff Secret

Created July 24, 2014 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mouq/4d320515a1a718a75b22 to your computer and use it in GitHub Desktop.
Save Mouq/4d320515a1a718a75b22 to your computer and use it in GitHub Desktop.
diff --git a/src/core/array_slice.pm b/src/core/array_slice.pm
index fd36fc4..8bafa06 100644
--- a/src/core/array_slice.pm
+++ b/src/core/array_slice.pm
@@ -241,4 +241,14 @@ multi sub postcircumfix:<[ ]>(\SELF, :$v!, *%other) is rw {
SLICE_MORE( SELF, SELF.keys, True, :$v, |%other );
}
+# @a[;]
+multi sub postcircumfix:<[ ]> (\SELF is rw, LoL \keys, *%adv) is rw {
+ keys > 1 ?? SELF[keys[0].list].map({postcircumfix:<[ ]>($_, LoL.new(|keys[1..*]), |%adv)}).eager
+ !! postcircumfix:<[ ]>(SELF, keys[0].list, |%adv);
+}
+multi sub postcircumfix:<[ ]> (\SELF is rw, LoL \keys, Mu \assignee, *%adv) is rw {
+ keys > 1 ?? SELF[keys[0].list].map({postcircumfix:<[ ]>($_, LoL.new(|keys[1..*]), assignee, |%adv)}).eager
+ !! postcircumfix:<[ ]>(SELF, keys[0].list, assignee, |%adv);
+}
+
# vim: ft=perl6 expandtab sw=4
diff --git a/src/core/hash_slice.pm b/src/core/hash_slice.pm
index 592ed76..575b194 100644
--- a/src/core/hash_slice.pm
+++ b/src/core/hash_slice.pm
@@ -131,4 +131,14 @@ multi sub postcircumfix:<{ }>(\SELF, :$p!, *%other) is rw {
SLICE_MORE( SELF, SELF.keys, False, :$p, |%other );
}
+# %h{;}
+multi sub postcircumfix:<{ }> (\SELF is rw, LoL \keys, *%adv) is rw {
+ keys > 1 ?? SELF{keys[0].list}.map({postcircumfix:<{ }>($_, LoL.new(|keys[1..*]), |%adv)}).eager
+ !! postcircumfix:<{ }>(SELF, keys[0].list, |%adv);
+}
+multi sub postcircumfix:<{ }> (\SELF is rw, LoL \keys, Mu \assignee, *%adv) is rw {
+ keys > 1 ?? SELF{keys[0].list}.map({postcircumfix:<{ }>($_, LoL.new(|keys[1..*]), assignee, |%adv)}).eager
+ !! postcircumfix:<{ }>(SELF, keys[0].list, assignee, |%adv);
+}
+
# vim: ft=perl6 expandtab sw=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment