Skip to content

Instantly share code, notes, and snippets.

@JossWhittle
Created August 10, 2012 01:35
Show Gist options
  • Save JossWhittle/3310151 to your computer and use it in GitHub Desktop.
Save JossWhittle/3310151 to your computer and use it in GitHub Desktop.
BUFF = (in[i:0..3] -> out[i] -> BUFF).
The same as saying...
BUFF = (in[0] -> out[0] -> BUFF
| in[1] -> out[1] -> BUFF
| in[2] -> out[2] -> BUFF
| in[3] -> out[3] -> BUFF).
Or you can use input parameters...
BUFF (N = 3) = (in[i:0..N] -> out[i] -> BUFF).
COIN = (toss -> HEADS | toss -> TAILS),
HEADS = (heads -> HEADS),
TAILS = (tails -> TAILS).
COUNT (N = 3) = COUNT[0],
COUNT[i:0..N] = (when (i < N) inc -> COUNT[i + 1]
| when (i > 0) dec -> COUNT[i - 1]).
DRINKS = (red -> coffee -> DRINKS | blue -> tea -> DRINKS).
Trace: red->coffee->red->coffee->blue->tea->red->coffee->blue->tea->...
CHAN = (in -> CHAN | in -> out -> CHAN).
SWITCH = OFF,
OFF = (on -> ON),
ON = (off -> OFF).
Or alternatively...
SWITCH = (on -> off -> SWITCH).
on->off->on->off->on->off->...
CS-116 Notation:
oneshot = once.0
FSP Notation:
oneshot = (once -> STOP).
const N = 1
range T = 0..N
range R = 0..2*N
SUM = (in[a:T][b:T] -> TOTAL[a+b]),
TOTAL[s:R] = (out[s] -> SUM).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment