Skip to content

Instantly share code, notes, and snippets.

View nmorse's full-sized avatar
🔮

Nate Morse nmorse

🔮
View GitHub Profile
[0] [uncons swap 0 = [1 [] cons cons] [0 1 [] cons cons cons] if-else concat] 15 times
size 2 / [uncons [[] cons ] dip] swap times
[concat] dip [concat]
dip [concat] dip [concat] dip [concat] dip [concat] dip [concat] dip [concat] dip [concat] dip [concat]
dip [concat] dip
list_module import
6 [3 8 5 7 10 2 9 1]
[[] []] dip2
dup list-length
[ uncons
[dup2 > [swap [swap [push] dip ] dip] [swap [push] dip] ifte] dip
] swap repeat drop swap
[[] cons] dip
# without linrec these are some bad factorial implimentationz
# cheapo first hack
[1 [dup 1 +] rolldown 1 - repeat fac-aux] [fac] def
[1 swap fac1 ] [fac0] def
[dup2 >= not [swap dup 1 + rolldown fac1] [drop fac-aux] ifte ] [fac1] def
[[dup 1 >] dip swap [* fac-aux] [swap drop] ifte ] [fac-aux] def
list_module import
canvas_basic_module import
canvas cb-init cb-clear
[uncons uncons rotate swap
dup2
cb-begin-path
10 - swap 16 - swap
cb-line-to
cb-end-path] [rel] def
canvas_basic_module import
list_module import
[{color:{r:255 g:163 b:27 a:0.5}} [pop] dip swap 10 * y set [pop] dip swap 10 * x set swap drop] [rec] def
canvas cb-init cb-clear
[[1 2][2 3][3 4][5 6]] [rec] map
[cb-box true] map-under
drop
var camera, scene, renderer;
var geometry, material, mesh;
var t, mode;
init();
animate();
function init() {
t = 0;
mode = true;
list_module import
[1] [mon] def
[2] [tues] def
[3] [wed] def
[4] [thur] def
[5] [fri] def
[[{name:roy avail:[mon tues]}{name:ken avail:[tues thur fri]}]] [peps] def
peps
{name:nate avail:[wed fri]} push
[uncons swap avail get [apply] map swap drop swap] [unpack] def
@nmorse
nmorse / map-v2.pounce
Last active February 13, 2019 03:34
pounce gets a better map word that allows use of the stack below, as if the accumulator was there (not clogging up the stack like the first version did)
list_module import
{
named-args:[c q]
local-words:{
init-accum:[[[ ]] [accum] local-def]
update-accum: [accum cons [] cons [accum] local-def]
destructive-first:[c pop swap [] cons [c] local-def]
maponto:[c list-length 0 >
[destructive-first q apply update-accum maponto ]
[] if-else]
canvas_basic_module import
canvas cb-init cb-clear
[dup [get 10 *] dip set] [ten*] def
[x ten* y ten* w ten* h ten*] [blocky] def
[{color:{r:64 g:0 b:255 a:0.5} x:2 y:4 w:3 h:3}
{color:{r:255 g:63 b:127 a:0.5} x:3 y:5 w:3 h:3}] [blocky cb-box] map
@nmorse
nmorse / color_start.pounce
Created February 2, 2019 23:24
a start of a color lib for pounce
[{r:0.0 g:0.1 b:0.8}] [c1] def # color 1
[{r:0.5 g:0.6 b:0.2}] [c2] def # color 2
[+ 2.0 /] [avg2] def
[+ + 3.0 /] [avg3] def
[r get swap g get swap b get [rollup] dip avg3] [?value] def
[dup
[r get] dip2 rolldown [r get] dip avg2 r set
[g get] dip2 rolldown [g get] dip avg2 g set
[b get] dip2 rolldown [b get] dip avg2 b set [drop drop] dip] [blend] def
c1 ?value