diff options
author | elioat <elioat@tilde.institute> | 2022-10-28 21:10:57 -0400 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2022-10-28 21:10:57 -0400 |
commit | d9a08de4d8cb47a30026c20cddb48cea04e099d4 (patch) | |
tree | d84050bafe4654021fe2fb7d13b3e286790f1862 /lil | |
parent | eac2bd0f60767a567d50f11e5e96226719acf856 (diff) | |
download | tour-d9a08de4d8cb47a30026c20cddb48cea04e099d4.tar.gz |
*
Diffstat (limited to 'lil')
-rw-r--r-- | lil/play.lil | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/lil/play.lil b/lil/play.lil new file mode 100644 index 0000000..8f83664 --- /dev/null +++ b/lil/play.lil @@ -0,0 +1,56 @@ +on mode a do + r:() + each x in a + r[x]:1+r[x] + end + extract first key orderby value desc from r +end + +m:mode[1,2,2,3,4,2,1] + +print[m] + +show[ + -(100,200)+(10,-20)/(3,3) +] + +show[ + each x in 2 cross 3 do (27,19)+x end +] + +people.name:"Alice","Sam","Thomas","Sara","Walter" +people.age:25,28,40,34,43 +people.job:"Developer","Sales","Developer","Developer","Accounting" +people:table people + +t:select from people + +show[t] + +s:select where ("S%m" parse name) from people + +show[s] + +d:select where ("Developer" = job) from people + +show[d] + +a:select name where ("Alice" = name) from people + +show[a] + + +needle: "apple" +haystack: ("frog","apple","chicken","toadstool","apple","rice","fish") + +c:0 each x in haystack if x~needle c:c+1 end end c # imperative +show[c] + +g:0 each x in haystack g:g+x~needle end g # imperative, without a conditional +show[g] + +show[extract count value where value=needle from haystack] # query + +show[count needle take haystack] # functional (filter) + +show[sum needle=haystack] # vector-oriented (spread-conforming =) |