aoc-util.utils
Helper functions
define
macro
(define name bindings lambda-bindings & body)
Inspired from scheme to shortcut functions which return a lambda function
(define f [a] [b] (+ a b))
((f 5) 3) ;;=> 8
dijkstra
(dijkstra g start)
Computes single-source shortest path distances in a directed graph.
Given a node n, (f n), e.g. MAP, should return a map with the successors of n as keys and their (non-negative) distance from n as vals.
Returns a map from nodes to their distance from start.
line-process
(line-process input)
(line-process input parser-xf)
Process a string line by line takes a parser fn (transducer) which is used with mapv, not lazy
numbers-from-str
(numbers-from-str str)
Retrieves all numbers from a string returns a list of numbers
save
macro
(save & body)
Executes a body, if an excetption throws, catch and print stacktrace to *err*
but returns nil