about summary refs log tree commit diff stats
path: root/gemini.tlv
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-03-19 16:59:30 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-03-19 16:59:30 -0700
commitfddbe08fc896e09d0fec2773977341d72103ff90 (patch)
treedddd6d116c1acdf7df9a54688ee0cc15a579c6fd /gemini.tlv
parent7859317ece5477862e8924657298c3595dd8a8e9 (diff)
downloadteliva-fddbe08fc896e09d0fec2773977341d72103ff90.tar.gz
graphviz: for basic stats, show all nodes ordered
The ordering is topological; nodes come before their dependencies.

Also some more helpful functions in the template for new apps.
Diffstat (limited to 'gemini.tlv')
-rw-r--r--gemini.tlv49
1 files changed, 49 insertions, 0 deletions
diff --git a/gemini.tlv b/gemini.tlv
index e4fbb21..96a7b03 100644
--- a/gemini.tlv
+++ b/gemini.tlv
@@ -249,6 +249,45 @@
     >  return result
     >end
 - __teliva_timestamp: original
+  union:
+    >function union(a, b)
+    >  for k, v in pairs(b) do
+    >    a[k] = v
+    >  end
+    >  return a
+    >end
+- __teliva_timestamp: original
+  subtract:
+    >-- set subtraction
+    >function subtract(a, b)
+    >  for k, v in pairs(b) do
+    >    a[k] = nil
+    >  end
+    >  return a
+    >end
+- __teliva_timestamp: original
+  all:
+    >-- universal quantifier on sets
+    >function all(s, f)
+    >  for k, v in pairs(s) do
+    >    if not f(k, v) then
+    >      return false
+    >    end
+    >  end
+    >  return true
+    >end
+- __teliva_timestamp: original
+  to_array:
+    >-- turn a set into an array
+    >-- drops values
+    >function to_array(h)
+    >  local result = {}
+    >  for k, _ in pairs(h) do
+    >    table.insert(result, k)
+    >  end
+    >  return result
+    >end
+- __teliva_timestamp: original
   append:
     >-- concatenate list 'elems' into 'l', modifying 'l' in the process
     >function append(l, elems)
@@ -257,6 +296,14 @@
     >  end
     >end
 - __teliva_timestamp: original
+  prepend:
+    >-- concatenate list 'elems' into the start of 'l', modifying 'l' in the process
+    >function prepend(l, elems)
+    >  for i=1,#elems do
+    >    table.insert(l, i, elems[i])
+    >  end
+    >end
+- __teliva_timestamp: original
   all_but:
     >function all_but(x, idx)
     >  if type(x) == 'table' then
@@ -520,6 +567,8 @@
 - __teliva_timestamp: original
   main:
     >function main()
+    >  Window:clear()
+    >  Window:refresh()
     >  init_colors()
     >  local lines = {}
     >  local url = ''