Data structures querying tool. The basic concept is the function created
from the path with
guide function from the library code, which can be called
with data structure to query. There is also the
tour convenience function that
created the quite and calls it in one go.
Eleanor is specialy designed for the mutable Janet types, eg. tables and arrays. Or better, we did not have any motivation for working with immutable types.
Path could be considered a Janet DSL akin to the peg definition, but simpler both in definition - no structs just tuples, and workings - only couple of the operations are available.
Any path must be a tuple, bracketed by tradition, and contain steps needed to traverse or transform the datastructure. Inside the tuple you need to list the steps along the way. Each step operates on the current base, which is usualy result of the traversing or transforming previous base. The first base is the provided datastructure.
There are three main kinds of steps:
geton the base
allgets all values from the base if it is a table. If the base is array values of all of its members are mapped and flattened to new array.
valsgets all the values of the base
keysget all the keys of the base
existsonly truthy members of the base are filtered
dropdrops all collected results, more about collecting later
tracetracev the current base
notnegates the next function, be it filter or parameter
ifwalks the subpath parameter, but the last function is not filtering the current base, but the base just before the
collectwalks the subpath parameter and adds the final base to the result. Then it rewinds the base to just before
collecttuple. The result of the whole path will be always last item of the resulting array
transformwalks the subpath tuple and applies the last function of it to the base. You are mutating the memebers of the datastructure with it.
viewsimilar to the
transformbut clones or splices the base before walking the subpath.
view-collectedis similar to the view, but the function will receive not only the base but also all the collected values as arguments.
notnegates the function in the subpath
So lets say we have path:
'[:clients all :projects all :task all :name]
That can be read as:
/cases directory are Judge Gen cases describing the usage. Please feel
free to refer to these for more detailed examples.
Consolidation phase of the development. All the bits and pieces are in place, we just need to polish and document them all. Stay tuned.