diff options
Diffstat (limited to 'src/catalogue/tmp.lil')
-rw-r--r-- | src/catalogue/tmp.lil | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/src/catalogue/tmp.lil b/src/catalogue/tmp.lil new file mode 100644 index 0000000..60fbb53 --- /dev/null +++ b/src/catalogue/tmp.lil @@ -0,0 +1,113 @@ +# lil includes a fun query system as well as language features for both +# functional programming and vector programming -- this invites interesting +# opportunities for applications built around little databases/datasets and +# the manipulation and querying of that data! + +# I'm not 100% certain what I'm going to build with these features, yet, but +# I will use this as a space to explore what lil has to offer. + +# people.name:"Alice","Sam","Thomas","Sara","Walter" +# people.age:25,28,40,34,43 +# people.job:"Chef","Sous Chef","Baker","Front of house","Baker" +# people:table people + +# t:select from people + +# show[t] + +# s:select where ("S%m" parse name) from people + +# show[s] + +# d:select where ("Baker" = job) from people + +# show[d] + +# a:select name where ("Alice" = name) from people + +# show[a] + +# w:update job:"Amazing Chef" where job = "Chef" from people + +# Show[w] + +# l:insert name:"John" job:"Critic" age:32 into people + +# show[l] + +# # save:writecsv[l "sis" ","] # where sis formats the column type, here string integer string -- the other option is boolean. + +# # write["test.csv" save] + +# on cons x y do +# x,y +# end + +# breakfast: insert food:("Eggs","Pancakes","Grapefruit") quantity:(3,4,1) tasty:(1,1,0) into 0 # NOTE, 0 here could also be the name of the variable, so, in this example, breakfast + +# show[breakfast] + +# needle: "apple" +# haystack: ("frog","apple","chicken","toadstool","apple","rice","fish") + +# filter:count needle take haystack +# spread_conforming:sum needle = haystack +# print[filter] +# print[spread_conforming] + + +# spent a good bit of time playing with lil and reviewing the docs. I am now +# totally smitten and excited to use lil. + +# a basic sketch of the data table at the center of the action + +# catalogue.entry_type +# catalogue.parent # not 100% certain how to reference another entry by id +# catalogue.title +# catalogue.body +# catalogue.reference +# catalogue.created_date +# catalogue.updated_date # does this matter? (sorta leaning towards "no") + +# entry_type's +# - link +# - note +# - folder + +# every item can have 1 parent +# a parent is usually a folder + +# data table wrapped in an interactive cli for adding, querying, and viewing +# input data. Input data stored as CSV between sessions + +# NOTE: if input data is stored as CSV is becomes trivial to pipe in and out +# of SQLite in the future...if that'd be desirable + +# NOTE: I'm using just 1 table so that this can be easily exported as CSV... +# if it weren't for that requirement, I'd have multiple tables + +# catalogue:table catalogue + +# alternate syntax to make a table, +# t: insert food:("Eggs","Pancakes","Grapefruit") quantity:(3,4,1) tasty:(1,1,0) into 0 + + +# validate that I can write a table to disk and read it back in +# show[catalogue] +# out:writecsv[catalogue] +# show[out] +# write["test.csv" out] + +# data:read["test.csv"] +# newtable:readcsv[data "sis "] # this column spec. syntax looks hilarious +# show[newtable] +# HUGE SUCCESS! + + +if args[2] do + url:args[2] + print[url] +else + print["\n please pass a url as an argument\n"] +end + |