This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 4474 | |
seq = [[None,None,None,[0,-1],[0,0]],[1,true,2,[0,1],[2,0]],[3,false,2,[0,-1],[8,0]],[8,false,3,[1,0],[0,8]]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2 4 5 6 7] [0 true] [[[acc p] d] [[] d push acc d < p && push ] pounce] reduce uncons uncons rolldown drop drop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[6 3 8 4 5 7 2 9 1] | |
[1 0] # accumulator is a pair [acc index] the index is used to either multiply or add | |
[swap uncons uncons drop [acc i] [acc [i 2 % 0 ==] [*] [+] ifte 1 i +] pounce [] cons cons] | |
reduce |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# current limiting resistor calculator | |
# run at https://pounce-lang-show-case.netlify.app/ | |
[.05][i]compose # forward Amps from LED specifications | |
[3][Vf]compose # forward voltage from LED specifications | |
[6][Vs]compose #supply voltage | |
Vs Vf - i / Ohms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 [] [[2 + dup] dip cons] 993 times [drop] dip | |
4 [dup * dup 1 - swap / *] | |
reduce |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 4 a d f g 7 depth [[[drop] dip] dip] swap 2 - times # g 7 | |
2 4 a d f g 7 depth [[drop] dip2] swap 2 - times # same | |
2 4 a d f g 7 depth [drop] swap 2 - times # 2 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tri (N N N N N -- [(N N -- N)]) | |
[tri] [[base peak offset slew n] [[i t] [t slew + n % i offset + base + +] pounce] crouch] compose | |
[[5 4 3 .4 20 tri] [8 3 1 -.2 20 tri]] | |
[play] map | |
[animationFrame] [play] subscribe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 1 [dup2 +] 8 repeat | |
[[p t][t 0 > [p play p t 1 - repeat] [] if-else ] pounce] [repeat] compose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Church encodings for boolean logic. | |
# `T` is for true, any other word is false (e.g. `F` ) | |
# Evaluation of Church encoded logic (in pounce) will be composed as '^' | |
## if top of the stack is `T` then take the first (i.e. drop), else keep the second (i.e. swap drop) | |
[T == [drop][swap drop] if-else] [^] compose | |
# 'AND' in lambda calculus is \pq.pqp. Translated to post-fix `[p q] [p q q ^] pounce` | |
## or more simply `dup ^` | |
[dup ^] [and] compose |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Simulated interrupt handlers to test rotary position algorithms | |
features changing handles by entering (1 <enter> or 2 <enter>) into the console. | |
Todo: add more handler algorithms | |
""" | |
import board | |
from digitalio import DigitalInOut, Direction, Pull | |
import supervisor | |
# setup pins (a and b) for encoder |
NewerOlder