Skip to content

Instantly share code, notes, and snippets.

@owencorrigan
owencorrigan / Vend.idr
Last active April 30, 2021 00:00
Example of State Machine using Control.ST
import Data.Fuel
import Control.ST
%default total
{-}
Rewrite Vend.idr using Control.ST
this example was useful for some parts
https://github.com/owickstrom/fsm-your-compiler-wants-in/blob/master/src/listings/idris/Checkout.idr
@owencorrigan
owencorrigan / vend.idr
Last active April 15, 2021 21:49
example of state machine in Idris
%default total
VendState : Type
VendState = (Nat, Nat)
data Input =
COIN
| VEND
| CHANGE
| REFILL Nat
# Class for doing live plots in IPython
class LivePlot():
def __init__(self, max_width=None):
self.x = [0]
self.y = {}
self.lines, self.fig, self.axes = None, None, None
self.max_width = max_width
def update(self, losses):

Keybase proof

I hereby claim:

  • I am owencorrigan on github.
  • I am owen_corrigan (https://keybase.io/owen_corrigan) on keybase.
  • I have a public key whose fingerprint is E2E8 C38D 9DF0 2318 1B0D 4632 AA37 FE2F C72C F3CA

To claim this, I am signing this object:

{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"from matplotlib.animation import FuncAnimation\n",