Petrik de Heus p8

View gist:6493058
1
git commit -m "Removed trailing whitespace" --author="Whitespace Remover <whitespace-remover@example.com>"
View lithp.rb
1 2 3 4 5 6 7 8 9 10
class Lisp
Fs = {
:label => lambda {|name,value| Fs[name] = lambda { value } },
:car => lambda {|sexp| sexp.first },
:cdr => lambda {|sexp| sexp.slice(1, sexp.size) },
:cons => lambda {|head,tail| [head] + tail },
:atom => lambda {|sexp| !sexp.is_a?(Array) },
:eq => lambda {|a,b| a == b },
:if => lambda {|cnd,thn,els| cnd ? thn : els }
}
View eigenclass
1 2 3 4 5 6 7 8 9
String.class_eval { def instance_method; "instance method"; end }
String.class.class_eval { def class_method; "class method"; end }
String.class.class.class_eval { def eigenclass_method; "eigenclass method"; end }
 
"a".instance_method # => "instance method"
String.class_method # => "class method"
class X < String
eigenclass_method
end # => "eigenclass method"
Something went wrong with that request. Please try again.