module Kernel
Ruby♯ = '☠ ☢ ☹'
alias λ proc
alias ⚠ raise
#Arabic-Indic digits
#There's some RTL stuff going on here, but they're actually
#in the right order
%w(١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩).each_with_index do |digit,index|
define_method digit do |*nxt|
this = index+1
nxt = nxt.empty? ? nil : nxt.first
if nxt
this * (10 ** (1 + (Math.log10(nxt).floor))) + nxt
else
this
end
end
end
#Roman
%w(Ⅰ Ⅴ Ⅹ Ⅼ Ⅽ Ⅾ Ⅿ ↁ ↂ).zip([1,5,10,50,100,500,1000,5000,10000]).each do |numeral,value|
define_method numeral do |*nxt|
value + nxt.inject(0){|s,n| s+n }
end
end
#Sum args
def ∑(*args)
args.inject(0){|sum,arg| sum+arg }
end
#Sq. root
def √(n)
Math.sqrt(n)
end
def ∞
1/0.0
end
def π
Math::PI
end
alias ℼ π
def Ω
0.5671432904097838729999686622
end
def ε
Float::EPSILON
end
def ␀ #NUL
nil
end
def ♻
GC.start
end
end
class Proc
alias ❪❫ call
end
#These probably belong in Set instead of Array
class Array
alias ∋ include?
alias ∩ &
alias ∪ |
def ∌(element)
!include?(element)
end
def ⊂(array)
size < array.size && all?{|e| array.include?(e) }
end
def ⊅(array)
size > array.size && array.all?{|e| include?(e) }
end
def ⊆(array)
all?{|e| array.include?(e) }
end
def ⊇(array)
array.all?{|e| include?(e) }
end
def ⊄(array)
!⊂(array)
end
def ⊅(array)
!⊂(array)
end
def ⊈(array)
!⊆(array)
end
def ⊉(array)
!⊇(array)
end
def ∑
inject(0){|sum,n| sum+n }
end
end
[Fixnum,Float].each do |klass|
klass.class_eval do
alias ⩽ <=
alias ⩾ >=
end
end