Skip to content

Instantly share code, notes, and snippets.

View adelzhang's full-sized avatar
🎯
Focusing

Adel Zhang adelzhang

🎯
Focusing
View GitHub Profile
@jj1bdx
jj1bdx / p3.erl
Last active March 11, 2016 19:05
Prime number generator with lazy evaluation in Erlang: See http://erlang.org/pipermail/erlang-questions/1999-March/000176.html
%%% Prime number sieve code with lazy evaluation by Joe Armstrong
%%% (very slightly modified for syntax check)
%%% http://erlang.org/pipermail/erlang-questions/1999-March/000176.html
-module(p3).
-export([from/1,filter/2,sift/2,sieve/1,primes/0, first/1]).
%% This generates a lazy sequence starting from K.
%% from(K) ->