Skip to content

Instantly share code, notes, and snippets.

@ab5tract
Created October 28, 2014 17:32
Show Gist options
  • Select an option

  • Save ab5tract/5b65a86e7a1926079187 to your computer and use it in GitHub Desktop.

Select an option

Save ab5tract/5b65a86e7a1926079187 to your computer and use it in GitHub Desktop.
experiments in lookup inlining - perl 6
> (@words Z 1 xx @words.elems).hash
"does" => 1, "go" => 1, "how" => 1, "it" => 1
> $message.split(' ')
it go
> (@words Z 1 xx @words.elems).hash
"does" => 1, "go" => 1, "how" => 1, "it" => 1
> (@words Z 1 xx @words.elems).hash<$_> for @words
> (@words Z 1 xx @words.elems).hash<$_> for $message.split(' ')
> say (@words Z 1 xx @words.elems).hash<$_> for $message.split(' ')
(Any)
(Any)
> (@words Z 1 xx @words.elems).hash
"does" => 1, "go" => 1, "how" => 1, "it" => 1
> (@words Z 1 xx @words.elems).hash<does>
1
> say $_ for $message.split(' ')
it
go
> my %hash = (@words Z 1 xx @words.elems).hash
"does" => 1, "go" => 1, "how" => 1, "it" => 1
> say "{$_} in {%hash<$_>} yup it is" for $message.split(' ')
use of uninitialized value %hash of type Any in string context in block <unit> at <unknown file>:1
in yup it is
use of uninitialized value %hash of type Any in string context in block <unit> at <unknown file>:1
in yup it is
> %hash
"does" => 1, "go" => 1, "how" => 1, "it" => 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment