Skip to content

Instantly share code, notes, and snippets.

~/scowl-6/final % egrep -h '([^s]s|z|j)ure$' * | sed 's/[sz]ure$/jure/g' burke@zaphod (18:09)
Rajure
Yurujure
enjure
meajure
clojure
expojure
injure
leijure
pleajure
irb(main):001:0> require 'archive/tar'
/opt/local/lib/ruby1.9/gems/1.9.1/gems/archive-tar-0.9.0/lib/archive/tar/reader.rb:17: warning: else without rescue is useless
SyntaxError: /opt/local/lib/ruby1.9/gems/1.9.1/gems/archive-tar-0.9.0/lib/archive/tar/reader.rb:15: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
when IO: parse(@source, full); @source.rewind
^
/opt/local/lib/ruby1.9/gems/1.9.1/gems/archive-tar-0.9.0/lib/archive/tar/reader.rb:34: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n'
when :file: File.open(path, 'w') { |fio| fio.write(body) }
^
/opt/local/lib/ruby1.9/gems/1.9.1/gems/archive-tar-0.9.0/lib/archive/tar/reader.rb:35: syntax error, unexpected keyword_when, expecting keyword_end
when :directory: FileUtils.mkdir(path)
@burke
burke / mclj
Created February 16, 2009 23:31
#!/usr/bin/env ruby
# -*- mode: ruby -*-
# Copyright Burke Libbey 2009, MIT License.
HOME_DIR = "/Users/burke" # Home directory
SVN_DIR = "#{HOME_DIR}/src/clojure/svn" # Clojure SVN checkout path
BRANCHES_DIR = "#{SVN_DIR}/branches" # Clojure SVN branches path
TRUNK_DIR = "#{SVN_DIR}/trunk" # Clojure SVN trunk path
INSTALL_DIR = "#{HOME_DIR}/lib/clj" # Path to managed jar symlinks
lambda{|n| n.zero? ? 1 : n * self.call(n-1)}
fac = lambda{|n| n.zero? ? 1 : n * fac.call(n-1)}
# Ruby 1.8.7
lambda{|n| (fac=lambda{|n| n.zero? ? 1 : n * fac.call(n-1)}).call(n) }
# Ruby 1.9
->(n){(fac=->(n){n.zero? ? 1 : n * fac.(n-1)}).(n)}
def Y
lambda { |f| f.call(f) }.call(
lambda do |g|
yield(lambda { |*n| g.call(g).call(*n) })
end)
end
Y { |this| lambda { |n| n == 0 ? 1 : n * this.call(n - 1) } }.call(12)
#=> 479001600
(λ f. f 3) (λ x. x + 2)
# Ruby 1.8.7
lambda{|f| f[3]}[lambda{|x| x+2}]
# Ruby 1.9
->(f){f.(3)}.(->(x){x+2})