Skip to content

Instantly share code, notes, and snippets.

@SystemFw
SystemFw / Example.elm
Created July 20, 2022 11:53
Can Stream I/O represent transformational programs?
-- The assumption here is that stream based I/O is a better fit for
-- distributed systems than monadic I/O, because there is a greater
-- separation between logic, which can be idempotent and distributed
-- via something like differential dataflow, and actions, which can
-- be represented like ports and actuators
-- We already know that stream based I/O is a good fit for reactive programs
-- but what about more "imperative" ones that fit monads well? I took an imperative
-- example and tried to express it via stream I/O
@SystemFw
SystemFw / Fib.scala
Last active December 19, 2023 19:38
Deriving tail recursive Fibonacci
/*
Here's a derivation for a tail recursive fibonacci function.
Let's start from the Maths definition:
fib(0) = 0
fib(1) = 1
fib(n) = fib(n - 1) + fib(n - 2)
*/
// Let's translate the structure, leaving the recursive case unspecified: