Skip to content

Instantly share code, notes, and snippets.

(define y2
(lambda (c)
((lambda (h)
(h h))
(lambda (f)
(c (lambda (x y)
((f f) x y)))))))
(define make-rember
(y2 (lambda (f)
@jwhiteman
jwhiteman / gist:d254a05e82a04a64c1ff
Created July 29, 2014 19:01
ycombinator in erlang
Y = fun(C) ->
(fun(H) ->
H(H)
end)(
fun(F) ->
C(fun(X) -> (F(F))(X) end)
end
)
end.
@jwhiteman
jwhiteman / gist:079fe77fc626d49c9f8a
Created July 18, 2014 01:23
immutable means immutable
Gotcha with Erlang
➜ v-kserl-v-02-code erl
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Eshell V5.10.4 (abort with ^G)
1> VALUE = fun() -> io:format("I have value!~n") end.
#Fun<erl_eval.20.80484245>
2> K = mykey.
mykey
@jwhiteman
jwhiteman / gist:3625a7479082e245bf71
Created May 15, 2014 03:09
Trolling twitter for 2-letter handles
require 'httparty'
include HTTParty
('aa'..'zz').select { |r|
sleep 0.20
puts "trying #{r}"
self.class.head("https://twitter.com/#{r}").code == 404
}
# => ['me', 'oh']