Skip to content

Instantly share code, notes, and snippets.

@aaruel
aaruel / ElixirLinkedList.ex
Last active May 28, 2024 22:34
Elixir Linked List Implementation
defmodule LinkedList do
defstruct data: 0,
next: nil,
index: 0
def new(data \\ 0, index \\ 0) do
%__MODULE__{data: data, index: index}
end
def push(
@aaruel
aaruel / monad.js
Last active October 18, 2017 16:38
Javascript (kinda) Monad test
class Monad {
static ret(input) {
return {
bind: (lambda, ...args) => this.bind(lambda, input, ...args),
flatten: function*() {
yield* input;
}
};
}