specter

Latest version: 1.1.3
phreed 2018-01-11T22:35:27.000222Z

Is there a way to do mutual navigation? A use would be to update one structure with data from another.

nathanmarz 2018-01-11T23:15:37.000437Z

@phreed do you have an example of a transformation of this sort?

phreed 2018-01-11T23:35:52.000325Z

The general idea is seen in the 'reduce' macro where one navigation is done over the collection and the reducing function navigates over and updates the accumulator. If the accumulator were implemented as a zipper the position would persist. In the large, assume I have a database for which I have just received a message on a relevant topic with which I want to update my database. I will navigate the message and use the information found there to navigate the database. There would be some collect object shared between the two navigators. The database could be a graph.

nathanmarz 2018-01-11T23:43:57.000226Z

@phreed you can use collect and collect-one to collect additional information about the data structure during navigation

nathanmarz 2018-01-11T23:44:17.000090Z

either as additional arguments to the transform function or returned with the navigated values in select

nathanmarz 2018-01-11T23:45:04.000017Z

there's an example of doing that with a recursive data structure here: https://github.com/nathanmarz/specter/wiki/Using-Specter-Recursively#find-the-index-route-of-a-value-within-a-data-structure