Skip to content

Instantly share code, notes, and snippets.

@colomon
Created November 16, 2010 16: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 colomon/702012 to your computer and use it in GitHub Desktop.
Save colomon/702012 to your computer and use it in GitHub Desktop.
our %not_curried;
INIT {
%not_curried{'&infix:<...>'} := 1;
%not_curried{'&infix:<..>'} := 1;
%not_curried{'&infix:<..^>'} := 1;
%not_curried{'&infix:<^..>'} := 1;
%not_curried{'&infix:<^..^>'} := 1;
%not_curried{'&prefix:<^>'} := 2;
%not_curried{'&infix:<xx>'} := 2;
%not_curried{'&infix:<~~>'} := 2;
%not_curried{'&infix:<=>'} := 2;
%not_curried{'&infix:<:=>'} := 2;
%not_curried{'WHAT'} := 2;
%not_curried{'HOW'} := 2;
%not_curried{'WHO'} := 2;
%not_curried{'WHERE'} := 2;
}
sub whatever_curry($/, $past, $upto_arity) {
if $past.isa(PAST::Op) && %not_curried{$past.name} != 2 && $past<pasttype> ne 'call' {
if ($upto_arity >= 1 && (($past[0].returns eq 'Whatever' && !%not_curried{$past.name})
|| $past[0].returns eq 'WhateverCode'))
|| ($upto_arity == 2 && (($past[1].returns eq 'Whatever' && !%not_curried{$past.name})
|| $past[1].returns eq 'WhateverCode')) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment