Skip to content

Instantly share code, notes, and snippets.

@devmachiine
devmachiine / nn.fs
Last active November 26, 2020 17:05
Neural network in F#
//------------------------------- Define Network -------------------------------
type Activation =
| Linear
| Binary
| Tanh
| ReLU
type Neuron = { Weights: float list; Bias: float }

Multiplication table

5 4 3 2 1
5 25 20 15 10 5
4 20 16 12 8 4
3 15 12 9 6 3
2 10 8 6 4 2
1 5 4 3 2 1
@devmachiine
devmachiine / closurelist.js
Last active February 27, 2019 07:47
Linked list in javascript, as a single fold function.
// Aliases h=head, t=tail, f=function, z=zero (aka identity), n=node as right fold.
let n = (h,t) => (f,z) =>
t ? f(h, t(f,z)) : f(h,z)
let p = console.log
let list = n(4, n(3, n(2, n(1))))
let factorial4 = list((a,b) => a * b, 1)