Skip to content

Instantly share code, notes, and snippets.

Avatar

Michel Bøje Randahl Nielsen michelrandahl

View GitHub Profile
@michelrandahl
michelrandahl / nixos.md
Created Mar 21, 2019 — forked from martijnvermaat/nixos.md
Installation of NixOS with encrypted root
View nixos.md
View melanie_tutorial.py
# test om ipython virker...
print("hello world")
# lav en liste af værdier mellem 1 og 10
list(range(1, 10))
# lav en anonym funktion
min_funktion = lambda x: x + 3
# kald den anonyme funktion
View Option5.idr
-- Attempting to implement my own Maybe monad using the Option type naming from F#
data Option x = None
| Some x
Functor Option where
map f None = None
map f (Some x) = Some (f x)
Applicative Option where
pure x = Some x
View Option4.idr
-- Attempting to implement my own Maybe monad using the Option type naming from F#
data Option x = None
| Some x
Functor Option where
map f None = None
map f (Some x) = Some (f x)
Applicative Option where
pure x = Some x
View Option3.idr
-- Attempting to implement my own Maybe monad using the Option type naming from F#
data Option x = None
| Some x
Functor Option where
map f None = None
map f (Some x) = Some (f x)
Applicative Option where
pure = ?stuff1
View Option2.idr
-- Attempting to implement my own Maybe monad using the Option type naming from F#
data Option x = None
| Some x
Functor Option where
map = ?stuff3
Applicative Option where
pure = ?stuff1
(<*>) = ?stuff2
View Option1.idr
-- Attempting to implement my own Maybe monad using the Option type naming from F#
data Option x = None
| Some x
Applicative Option where
pure = ?stuff1
(<*>) = ?stuff2
Monad Option where
(>>=) = ?stuff
View Option0.idr
-- Attempting to implement my own Maybe monad using the Option type naming from F#
data Option x = None
| Some x
Monad Option where
(>>=) = ?stuff
View TheBadTheUglyAndTheGood.idr
-- Defining some Maybe values...
-- These could just as well have been database lookups or something else
x : Maybe Nat
x = Just 42
y : Maybe String
y = Just "hello idris"
z : Maybe Nat
z = Just 4
@michelrandahl
michelrandahl / pipe.lua
Last active Jul 9, 2016
pipeline function in Lua
View pipe.lua
function pipe(data, ...)
local n = select("#", ...)
if n == 0 then
return data
else
local funs = {...}
local f = table.remove(funs, 1)
return pipe(f(data), unpack(funs))
end
end