Skip to content

Instantly share code, notes, and snippets.

View ahaym's full-sized avatar

Mark ahaym

  • SFBA, CA
View GitHub Profile
// Yoneda states that
// (1) f a
// is isomorphic to:
// (2) forall b. (a -> f b) -> f b
//
// You can read this as "an interface that lets me run any function on an 'a' and get its result is isomorphic to having the a itself.
// The f here is a functor, for this example we can remove generality and say `f a` is "an async computation that returns an a".
//
// So here's (1) if JS allowed me to just call async functions without handlers:
# Double Pendulum Simulation
# Run with academy.cs.cmu sandbox
from math import *
import random
g = 0.78
dt = 0.008
app.stepsPerSecond = 60
keyLabel = Label('>',100, 50, font='monospace', align='center')
def onKeyPress(key):
if key == 'backspace':
keyLabel.value = keyLabel.value[0:-1]
elif key == 'space':
keyLabel.value += ' '
elif key == 'enter':
eval(keyLabel.value[1:])
keyLabel.value = '>'
else:
include"../node_modules/circomlib/circuits/mimcsponge.circom";
template Main() {
signal private input leaf ;
signal input root ;
signal private input pathElements[2] ;
signal private input pathIndices[2] ;
signal output out ;
signal sig__temp0 ;
signal sig__temp1 ;
sig__temp0 <-- (((pathElements[0])-(leaf))*(pathIndices[0]))+(leaf);
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RebindableSyntax #-}
module Circom where
Rect(0,0,400,200, fill='skyBlue')
Rect(0,200,400,200, fill='Blue')
def drawFish(x,y):
Rect(x,y,30,10,fill='gold')
RegularPolygon(x-5, y+5, 10, 3, rotateAngle=90, fill='gold')
def drawBird(x,y):
Rect(x,y,30,10,fill='white')
RegularPolygon(x+15, y+15, 10, 3, fill='white', rotateAngle=180)