summaryrefslogtreecommitdiff
path: root/lib/utils.fnl
blob: 917f4af0805a604b52ad121190566e9cce0829b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
(fn must [...]
  (local (ok? result) ...)
  (if ok? result (error result)))

(fn measure [what f]
  (local start (must (luna.time.now)))
  (local res (table.pack (f)))
  (print (.. what ": " (/ (- (must (luna.time.now)) start) 1e6)))
  (values (table.unpack res)))

{: must : measure}