Skip to content

Commit

Permalink
Cosmetic changes to lib.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Berger committed Dec 14, 2009
1 parent 4c9efd4 commit 492eaf8
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions lib/notation.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# Run with -Ku

module Kernel
# Make lambda a true lambda
#
# Example:
# λ { puts 'Hello' }.call => 'Hello'
#
alias λ proc
# Make lambda a true lambda
#
# Example:
# λ { puts 'Hello' }.call => 'Hello'
#
alias λ proc

# Sigma, i.e. the sum of all elements.
#
# Example:
# ∑ [1,2,3] => 6
#
def (*args)
sum = 0
args.each{ |e| sum += e }
sum
end
# Sigma, i.e. the sum of all elements.
#
# Example:
# ∑ [1,2,3] => 6
#
def (*args)
sum = 0
args.each{ |e| sum += e }
sum
end

# Square root
#
# Example:
# √ 49 => 7.0
#
def (root)
Math.sqrt(root)
end
end
# Square root
#
# Example:
# √ 49 => 7.0
#
def (root)
Math.sqrt(root)
end
end

0 comments on commit 492eaf8

Please sign in to comment.