Skip to content

Instantly share code, notes, and snippets.

@kccqzy
kccqzy / SimpleSub.hs
Created October 23, 2024 13:54
Quick implementation of SimpleSub (please see the paper "The Simple Essence of Algebraic Subtyping")
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import Control.Monad.Trans.Class
import Control.Monad.Trans.Except
import Control.Monad.Trans.State
import Control.Monad.Trans.Writer.CPS
import Data.Foldable
import qualified Data.IntMap as IM
@kccqzy
kccqzy / unsure_calc.py
Created April 15, 2025 19:49
The unsure calculator inspired by https://filiph.github.io/unsure/
import numpy as np
import re
NUMBER = re.compile(r'[0-9]+(\.[0-9]+)?')
def tokenize(s):
orig_str = s
while len(s) > 0:
m = NUMBER.match(s)
if m: