Skip to content

Instantly share code, notes, and snippets.

@rohitn
Forked from judofyr/fun.rb
Created October 1, 2013 23:41
Show Gist options
  • Save rohitn/6786926 to your computer and use it in GitHub Desktop.
Save rohitn/6786926 to your computer and use it in GitHub Desktop.
class Symbol
def | other
-> arg { other.to_proc[arg.send(self)] }
end
def call(*args)
-> arg { arg.send(self, *args) }
end
end
class Proc
def | other
-> arg { other.to_proc[call(arg)] }
end
alias < call
end
p :split.("->") | :flatten | :size | :chr < File.read($0)
p :split | :take.(10) | :reverse < File.read($0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment