Commented set, map, jar, jug, queue arms. Added jet tag to ++ fac

This commit is contained in:
John Dulin 2014-06-01 18:31:32 -07:00
parent 9b523d1767
commit c037d463cc

View File

@ -480,7 +480,8 @@
$(a (sub a b), c +(c))
::
++ fac :: factorial
|= a=@ :: This should be jetted.
~/ %fac
|= a=@
^- @
?: =(0 a)
1
@ -1323,7 +1324,7 @@
++ in :: set engine
~/ %in
|/ a=(set)
+- all
+- all :: logical AND
~/ %all
|* b=$+(* ?)
|- ^- ?
@ -1331,7 +1332,7 @@
&
?&((b n.a) $(a l.a) $(a r.a))
::
+- any
+- any :: logical OR
~/ %any
|* b=$+(* ?)
|- ^- ?
@ -1339,7 +1340,7 @@
|
?|((b n.a) $(a l.a) $(a r.a))
::
+- del
+- del :: b without any a
~/ %del
|* b=*
|- ^+ a
@ -1356,7 +1357,7 @@
[n.l.a l.l.a $(l.a r.l.a)]
[n.r.a $(r.a l.r.a) r.r.a]
::
+- dig
+- dig :: axis of a in b
|= b=*
=+ c=1
|- ^- (unit ,@)
@ -1366,7 +1367,7 @@
$(a l.a, c (peg c 6))
$(a r.a, c (peg c 7))
::
+- gas
+- gas :: concatenate
~/ %gas
|= b=(list ,_?>(?=(^ a) n.a))
|- ^+ a
@ -1374,7 +1375,7 @@
a
$(b t.b, a (put(+< a) i.b))
::
+- has
+- has :: b exists in a check
~/ %has
|* b=*
|- ^- ?
@ -1386,7 +1387,7 @@
$(a l.a)
$(a r.a)
::
+- put
+- put :: puts b in a, sorted
~/ %put
|* b=*
|- ^+ a
@ -1406,13 +1407,13 @@
[n.a l.a c]
[n.c [n.a l.a l.c] r.c]
::
+- rep
+- rep :: replace by tile
|* [b=* c=_,*]
|-
?~ a b
$(a r.a, b $(a l.a, b (c n.a b)))
::
+- tap
+- tap :: list tiles a set
~/ %tap
|= b=(list ,_?>(?=(^ a) n.a))
^+ b
@ -1420,7 +1421,7 @@
b
$(a r.a, b [n.a $(a l.a)])
::
+- wyt
+- wyt :: depth of set
.+
|- ^- @
?~(a 0 +((add $(a l.a) $(a r.a))))
@ -1438,12 +1439,12 @@
::
++ ja :: jar engine
|/ a=(jar)
+- get
+- get :: gets list by key
|* b=*
=+ c=(~(get by a) b)
?~(c ~ u.c)
::
+- add
+- add :: adds key-list pair
|* [b=* c=*]
=+ d=(get(a +>) b)
(~(put by a) [d c])
@ -1451,17 +1452,17 @@
::
++ ju :: jug engine
|/ a=(jug)
+- get
+- get :: gets set by key
|* b=*
=+ c=(~(get by a) b)
?~(c ~ u.c)
::
+- has
+- has :: existence check
|* [b=* c=*]
^- ?
(~(has in (get(+< a) b)) c)
::
+- put
+- put :: adds key-set pair
|* [b=* c=*]
^+ a
=+ d=(get(+< a) b)
@ -1471,7 +1472,7 @@
++ by :: map engine
~/ %by
|/ a=(map)
+- all
+- all :: logical AND
~/ %all
|* b=$+(* ?)
|- ^- ?
@ -1479,7 +1480,7 @@
&
?&((b q.n.a) $(a l.a) $(a r.a))
::
+- any
+- any :: logical OR
~/ %any
|* b=$+(* ?)
|- ^- ?
@ -1487,7 +1488,7 @@
|
?|((b q.n.a) $(a l.a) $(a r.a))
::
+- del
+- del :: delete at key b
~/ %del
|* b=*
|- ^+ a
@ -1504,7 +1505,7 @@
[n.l.a l.l.a $(l.a r.l.a)]
[n.r.a $(r.a l.r.a) r.r.a]
::
+- dig
+- dig :: axis of b key
|= b=*
=+ c=1
|- ^- (unit ,@)
@ -1514,7 +1515,7 @@
$(a l.a, c (peg c 6))
$(a r.a, c (peg c 7))
::
+- gas
+- gas :: concatenate
~/ %gas
|* b=(list ,[p=* q=*])
=> .(b `(list ,_?>(?=(^ a) n.a))`b)
@ -1523,7 +1524,7 @@
a
$(b t.b, a (put(+< a) p.i.b q.i.b))
::
+- get
+- get :: grab value by key
~/ %get
|* b=*
|- ^- ?(~ [~ u=_?>(?=(^ a) q.n.a)])
@ -1535,18 +1536,18 @@
$(a l.a)
$(a r.a)
::
+- has
+- has :: key existence check
~/ %has
|* b=*
!=(~ (get(+< a) b))
::
+- mar
+- mar :: add with validation
|* [b=_?>(?=(^ a) p.n.a) c=(unit ,_?>(?=(^ a) q.n.a))]
?~ c
(del b)
(put b u.c)
::
+- put
+- put :: adds key-value pair
~/ %put
|* [b=* c=*]
|- ^+ a
@ -1568,13 +1569,13 @@
[n.a l.a d]
[n.d [n.a l.a l.d] r.d]
::
+- rep
+- rep :: replace by product
|* [b=* c=_,*]
|-
?~ a b
$(a r.a, b $(a l.a, b (c n.a b)))
::
+- rib
+- rib :: transform + product
|* [b=* c=_,*]
|- ^+ [b a]
?~ a [b ~]
@ -1584,13 +1585,13 @@
=+ f=$(a r.a, b -.e)
[-.f [n.a +.e +.f]]
::
+- run
+- run :: turns to tuples
|* b=_,*
|-
?~ a a
[[p.n.a (b q.n.a)] $(a l.a) $(a r.a)]
::
+- tap
+- tap :: listify pairs
~/ %tap
|= b=(list ,_?>(?=(^ a) n.a))
^+ b
@ -1598,7 +1599,7 @@
b
$(a r.a, b [n.a $(a l.a)])
::
+- uni
+- uni :: union, merge
~/ %uni
|= b=_a
?@ b a
@ -1607,7 +1608,7 @@
b (~(uni by l.b) r.b)
==
::
+- wyt
+- wyt :: depth of map
.+
|- ^- @
?~(a 0 +((add $(a l.a) $(a r.a))))
@ -1626,17 +1627,17 @@
$(a [n.r.a $(a [n.a l.a l.r.a]) r.r.a])
a
::
+- dep
+- dep :: max depth of queue
|- ^- @
?~ a 0
+((max $(a l.a) $(a r.a)))
::
+- gas
+- gas :: insert list to que
|= b=(list ,_?>(?=(^ a) n.a))
|- ^+ a
?~(b a $(b t.b, a (put(+< a) i.b)))
::
+- get
+- get :: head-tail pair
|- ^+ [p=?>(?=(^ a) n.a) q=a]
?~ a
!!
@ -1648,27 +1649,27 @@
[n.a l.a q.b]
[n.q.b [n.a l.a l.q.b] r.q.b]
::
+- nap
+- nap :: removes head
?> ?=(^ a)
?: =(~ l.a) r.a
=+ b=get(+< l.a)
bal(+< ^+(a [p.b q.b r.a]))
::
+- put
+- put :: insert new head
|* b=*
|- ^+ a
?~ a
[b ~ ~]
bal(+< a(l $(a l.a)))
::
+- tap
+- tap :: adds list to end
|= b=(list ,_?>(?=(^ a) n.a))
^+ b
?~ a
b
$(a r.a, b [n.a $(a l.a)])
::
+- top
+- top :: produces head
|- ^- (unit ,_?>(?=(^ a) n.a))
?~ a ~
?~(r.a [~ n.a] $(a r.a))