silop.js
Loading...
2 3 + alert
hello q alert
world q alert
10 5 8 add3 print
a b c add3 def
a b + c +
5 f
x f def
in_f q print
x print
8 nested
y f.nested def
in_f.nested q print
x print
y print
5 x q let
x print
test
x print
6 x q let
test def
in-test q print
x print
10 x q let
x print
out-test q print
5 ref x q let
x read print
test
x read print
6 x write
x read print
test def
in-test q print
x read print
10 x write
x read print
x 1 addx
x read print
out-test q print
n=? q ? number n qlet
n 2 mod 0 eq then
even q print
else
odd q print
10 fact print
n fact def
n 1 factl
n r factl def
n 0 == then r
else n 1 - r n * factl
10 fib print
x fib def
x 1 1 fibl
x fn fn1 fibl def
x 2 <= then fn
else
x 1 -
fn fn1 +
fn fibl
Taro q 20 person p1 qlet
Jiro q 17 person p2 qlet
p1.name print
p1.show
p2.name print
p2.show
p1 open
name print
name age person def
2013 age sub birth qlet
self
person.show def
name: q print
name print
age: q print
age print
birth: q print
birth print
1 10 range each do
x qlet
1 10 range each do
y qlet
x "*" y "=" x y * array "" join print
mylib qload
5 2 10 add3 print
10 50 3 max3 print
50 3 10 max3 print
3 10 50 max3 print
self
x y z add3 def
x y + z +
a b c max3 def
a b gt then
a c gt then a else c fi
else
b c gt then b else c
self
e s stext def
e s text q call
e gtext def
e text q call
e gval def
e val q call
e n v sattr def
e n v attr q call
e n gattr def
e n attr q call
f t appendto def
f t appendTo q call
name tag def
< q name + > q + $
b f click def
b f fq click q call
jqlib qload
geomlib qload
self
stdsize def
window $ .width width qlet
window $ .height height qlet
width height Math.min dup
size
stdcv def
stdsize cvtag
body q appendto
stdctx def
stdcv cvctx
size cvtag def
size open
canvas q tag
width q width sattr
height q height sattr
cv cvctx def
cv
0 get 2d q getContext q call
ctx qlet
cv width qcall width qlet
cv height qcall height qlet
self
c cvctx.setcol def
ctx
c fillStyle q put drop
t x y cvctx.filltext def
t x y ctx .fillText drop
x y w h cvctx.fillrect def
ctx
x y w h fillRect q call drop
r cvctx.fillr def
r.sx r.sy r.width r.height
fillrect
cvctx.beginpath def
ctx beginPath qcall drop
cvctx.stroke def
ctx stroke qcall drop
x y cvctx.moveto def
ctx x y moveTo qcall drop
x y cvctx.lineto def
ctx x y lineTo qcall drop
f cvctx.font def
ctx f font qput drop
s cvctx.fontsize def
/\d+/ s ctx .font .replace
font
a b c d e f cvctx.settransform def
ctx
a b c d e f setTransform qcall
drop
x y cvctx.scale def
ctx
x y scale qcall drop
x y cvctx.translate def
ctx
x y translate qcall drop
w cvctx.linewidth def
ctx w lineWidth qput drop
ev cv singletouchstart def
cv 0 get : f ontouchstart qput
e singletouchstart.f def
e.target.getBoundingClientRect
r qlet
e .touches 0 get t qlet
t .clientX r.left sub x qlet
t .clientY r.top sub y qlet
x y point ev
cvlib qload
stdctx open
blue q setcol
20 20 100 50 fillrect
self
width height size def
self
x y point def
self
p point.op+ def
x p.x +
y p.y + point
srcp sz rect def
sz open
self
p rect.in def
p.x xrange.in
p.y yrange.in
and
rect.xrange def
srcp.x dstp.x range
rect.yrange def
srcp.y dstp.y range
p rect.op+ def
srcp p add sz rect
rect.center def
srcp.x width 2 div add
srcp.y height 2 div add
point
rect.dstp def
srcp.x width add
srcp.y height add
point
rect.sx def
srcp.x
rect.sy def
srcp.y
rect.dx def
dstp.x
rect.dy def
dstp.y
s d range def
self
p range.pitch def
s d p prange
f range.each def
f 1 pitch .each
s d p prange def
self
f prange.each def
s l
x prange.each.l def
x d lt then
x f
x p add l
x range.in def
x s ge
x d lt and
cvlib qload
self
stdgr def
stdcv graph r qlet
5 stdrange r.setrange
r
z stdrange def
z neg dup point
z 2 mul dup size rect
cv graph def
cv cvctx open
5 stdrange ref rng qlet
self
f graph.draw def
rng read r qlet
dotpitch dp qlet
r.dx dx qlet
r.sx dup f point plot
r.sx lp
x graph.draw.lp def
x dx le then
x x f point line
x dp add lp
r graph.setrange def
r rng write
1 0 0 1 0 0 settransform
1 -1 scale
0 height neg translate
r.width gw qlet
r.height gh qlet
r.srcp s qlet
r.dstp d qlet
width gw /
height gh / scale
s.x neg s.y neg
translate
dotpitch linewidth
s.x 0 point plot
d.x 0 point line
0 s.y point plot
0 d.y point line
graph.dotpitch def
rng read r qlet r.width width div
p graph.plot def
beginpath p.x p.y moveto
p graph.line def
p.x p.y lineto stroke
x y avr def
x y add 2 div
graphlib qload
stdgr open
sin draw
x sin def
x Math.sin
cvlib qload
stdctx open
0 draws
i draws def
black q setcol
0 0 300 300 fillrect
white q setcol
i i 50 5 fillrect
100 sleep
i 5 + 300 % draws
cvlib qload
stdctx open
50 fontsize
0 ref sc qlet
0 ref cnt qlet
0 1 point ref v qlet
rndr ref r qlet
g cv singletouchstart
restart
lp def
draw
move
isgov then gov
else
20 sleep
lp
draw def
"black" setcol
0 0 width height fillrect
"white" setcol
r read fillr
sc read 50 50 filltext
move def
r v read addx drop
isgov def
r read .dy height gt
gov def
"red" setcol
0 0 width height fillrect
"white" setcol
sc read 50 50 filltext
1000 sleep
restart
restart def
0 sc write
0 1 point v write
rndr r write
lp
p g def
p r read .in then
r read .sy sspd
sc v read .y int addx drop
rndr r write
rndr def
rnd width 50 - mul 0 point
50 50 v read .y add size rect
y sspd def
0
width y - width / 20 mul
point v write