最后活跃于 1741892434

capitalex's Avatar capitalex 修订了这个 Gist 1741892434. 转到此修订

1 file changed, 70 insertions

stack-lang-triangle.modal(文件已创建)

@@ -0,0 +1,70 @@
1 + <> (?0 ?1 >> `?:) (?: >>)
2 + <> (>> +) (>> `+)
3 + <> (>> -) (>> `-)
4 + <> (>> *) (>> `*)
5 + <> (>> >) (>> `>)
6 + <> (>> &) (>> `&)
7 + <> (>> =) (>> `=)
8 +
9 + <> (?x ?y >> swap) (?y ?x >>)
10 + <> (?x >> dup) (?x ?x >>)
11 + <> (?x >> drop) (>>)
12 + <> (() >> call) (>>)
13 + <> (?. >> call) (>> ?.)
14 + <> (?x ?. >> dip) (>> ?. lit ?x)
15 + <> (?x ?. >> curry) ((?x ?.) >>)
16 + <> (?. ?x >> compose) (1 () .. ?. #composer ?x ])
17 + <> (.. #composer ?.) (.. ?.)
18 +
19 + <> (?x ?y ?z >> bury) (?z ?x ?y >>)
20 + <> (1 ?t ?f >> if) (?t >> call)
21 + <> (0 ?t ?f >> if) (?f >> call)
22 +
23 + <> (>> lit ?x) (?x >>)
24 +
25 + <> (() ?x #snoc) ((?x))
26 + <> (?. ?x #snoc) ((?. ?x))
27 +
28 + <> (>> : ?x) (?x () ..)
29 + <> (?x ?. .. ;) ([edit>>] <> (>> ?x) (>> ?.) [/edit>>] >>)
30 + <> (>> [) (1 () ..)
31 + <> (.. [) (0 () ..)
32 + <> (0 ?x .. ]) (?x #snoc ..)
33 + <> (1 ?x .. ]) (?x >>)
34 +
35 + <> (?: #print) (?:)
36 + <> (.. .") (() ...")
37 + <> (..." ") (#snoc . #snoc ..)
38 + <> (..." ?x) (?x #snoc ...")
39 + <> (>> .) (#print >>)
40 +
41 + <> (>> .s) (() >>.s)
42 + <> (?x () >>.s) ((?x) >>.s)
43 + <> (?x ?. >>.s) ((?x ?.) >>.s)
44 + <> (?. >>.s) ((?.\n) #print ?. >>)
45 +
46 + <> ([edit>>]) (>< (>> ?x))
47 + <> ([/edit>>]) (<> (>> ?x) (?x >>))
48 + <> ([edit..]) (>< (.. ?x))
49 + <> ([/edit..]) (<> (.. ?x) (?x #snoc ..))
50 +
51 + [/edit..]
52 + [/edit>>]
53 +
54 + >>
55 +
56 + : 3drop drop drop drop ;
57 + : when [ ] if ;
58 + : over [ dup ] dip swap ;
59 + : 2dup over over ;
60 + : [each-int] [ 2dup ] dip bury > [ 2dup call [ 1 + ] dip [each-int] ] when ;
61 + : each-int 0 swap [each-int] 3drop ;
62 + : times [ drop ] swap compose each-int ;
63 + : with [ swap ] dip [ [ swap ] dip call ] curry curry ;
64 + : plot & 0 = [ ." *\s " ] [ ." \s\s " ] if ;
65 + : tuck swap over ;
66 + : pad 1 - [ ." \s " ] times ;
67 + : plot-row dup 1 + [ tuck - plot ] with each-int ;
68 + : sierpinski dup [ over - pad plot-row \n . ] curry each-int ;
69 +
70 + 64 sierpinski
上一页 下一页