Skip to content

Instantly share code, notes, and snippets.

@Whateverable
Created January 1, 2020 09:48
Show Gist options
  • Save Whateverable/43bafac6a76002f4597858f708bc7929 to your computer and use it in GitHub Desktop.
Save Whateverable/43bafac6a76002f4597858f708bc7929 to your computer and use it in GitHub Desktop.
evalable6
my $code = 「DateTime.new("2020-01-01T10:00:00").later(:5seconds-on-mars)」; my @wild-guesses = gather { for $code ~~ m:ex/^ (.+) ‘.’ (<[\w-]>+) [ [‘: ’ (.*)] | [‘(’ (.*) ‘)’]? ] $/ -> $/ { take 「(%s).^can(‘%s’).map(*.cando(\((%s), |\(%s)))).first(*.so)[0]」.sprintf: $0, $1, $0, $2 // $3 // ‘’ } }; .say for @wild-guesses
(DateTime.new("2020-01-01T10:00:00")).^can(‘later’).map(*.cando(\((DateTime.new("2020-01-01T10:00:00")), |\(:5seconds-on-mars)))).first(*.so)[0]
(DateTime).^can(‘new’).map(*.cando(\((DateTime), |\("2020-01-01T10:00:00").later(:5seconds-on-mars)))).first(*.so)[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment