Skip to content

Instantly share code, notes, and snippets.

STACK_EXEC = stack exec \
--package bloomfilter \
--package bytestring \
--package cassava
corona-bloom: corona-bloom.lhs
$(STACK_EXEC) -- ghc --make $<
ghci: corona-bloom.lhs
$(STACK_EXEC) -- ghci $<
@vinoski
vinoski / sws.erl
Last active January 12, 2024 14:59
An example of a very simple HTTP 1.0 web server in Erlang.
%% Simple web server.
-module(sws).
-author('Steve Vinoski <[email protected]>').
-export([start/1, start/2]).
%% start/1 takes a handler function and starts the web server on port 8000.
%% start/2 takes a handler function and a port number. The handler function
%% takes two arguments: a TCP socket and request data. The request data is
%% a property list indicating the invoked HTTP method, the target URI, the
%% Based on Okasaki 6.2.2
-module(binomial_heap).
-export([insert/2, insert/3, merge/2, delete/1, to_list/1, take/2,esize/1]).
-record(node,{rank,key,value,children=[]}).
% Inserts a new pair into the heap (or creates a new heap)
insert(Key,Value) ->
insert(Key,Value,[]).
insert(Key,Value,Forest) ->