about summary refs log blame commit diff stats
path: root/lil/play.lil
blob: 70ed9e3102c5e878c5a8c860615274336bbcec8c (plain) (tree)
1
2

                                                          
















                                                   
                                         





































                                                                                                    
# all lifted from <https://beyondloom.com/decker/lil.html>

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 (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 =)