100 questions
1 vote
1 answer
108 views
How can I avoid declaring full generic parameters when storing a custom typed object, while keeping type safety at compile time?
I've created a small library called StreamX, which acts like a type-safe, index-aware zipper to enable parallel streaming over multiple lists. It supports functional operations like forEach, map, ...
1 vote
1 answer
225 views
How to create Tree Zipper using Rust?
I am trying to create a Tree Zipper using Rust. It is inspired by this answer but I am using struct fields instead of Vec for the childs. I want to have a tree of nodes, e.g.: 7 / \ 4 11 / ...
1 vote
1 answer
186 views
Traverse a rose tree until some condition is met, then modify tree
I have two rose trees in Haskell of m and n nodes, respectively. I want to replace the ith node of the first tree with the jth node of the second tree. e.g. tree 1: R ...
10 votes
1 answer
376 views
Derivatives of data structures in Agda
I am currently implementing derivatives of regular data structures, in Agda, as presented in the One-Hole Context paper by Conor McBride [5]. In implementing it straight out of the OHC paper, which ...
1 vote
4 answers
333 views
How to get the part of a Clojure zipper already visited in depth-first traversal?
When you iterate through an arbitrarily nested Clojure zipper in a depth-first fashion via z/next, can you get or reconstruct the already visited part of the zipper, preserving its structure? For ...
1 vote
1 answer
112 views
Why is the second type of a Zipper a list of data not not pure data?
I made my way thru the Tutorial available at Learn your Haskell and I ask myself why the Author uses a list as the second type for the implemented Zipper? Here is the relevant Code: type Name = ...
2 votes
3 answers
580 views
How to obtain paths to all the child nodes in a tree that only have leaves using clojure zippers?
Say I have a tree like this. I would like to obtain the paths to child nodes that only contain leaves and not non-leaf child nodes. So for this tree root ├──leaf123 ├──level_a_node1 │ ├──leaf456 ├...
0 votes
1 answer
180 views
Clojure Zippers - Associating meta-data with a specific node?
I'm using Clojure's zippers to implement what I thought wouldn't be particularly challenging but it seems I may be missing something. Essentially what I want to do is, given some data structure as a ...
0 votes
1 answer
75 views
A better way of transforming a nested clojure data structure
I have a clojure map that looks like this: {"l1" [{"name" "s1", "url" "something", "coordinates" {"latitude" 100, "longitude" 200}} {"name" "s2", "url" "something", "coordinates" {"latitude" ...
1 vote
3 answers
259 views
Clojure zipper to remove all right siblings
I want to write a function for a zipper that removes all right siblings of a node while staying at the same location. (defn remove-all-rights-1 [loc] (if (zip/right loc) (recur (zip/remove (...
2 votes
2 answers
167 views
How to move zipper to left/right node in clojure?
I'm writing a tree ( business process decision tree ) in clojure data structure . (require clojure.zip :as z) (z/vector-zip [ :billed? [:yes [:check-bank-account] ...
1 vote
2 answers
305 views
Clojure parse nested vectors
I am looking to transform a clojure tree structure into a map with its dependencies For example, an input like: [{:value "A"} [{:value "B"} [{:value "C"} {:value "D"}] [{:value "E"} [{:...
5 votes
0 answers
220 views
Zippers in the wild [closed]
I am currently searching for implementations of Huet's Zipper ``in the wild''. So far, I have found: The agda compiler (correct me if I'm wrong) uses the zipper for the eliminator of call-by-need ...
0 votes
1 answer
302 views
visit clojure.zip tree by path pattern
Say I have a tree where I want to visit - and that should include the possibility to modify the visited items - all items that match the path (def visit-path [:b :all :x :all]) where I use :all as a ...
1 vote
1 answer
114 views
Ways to (refine? is it?) type variables to concrete types in Idris? For a dependently typed HOAS Zipper
I have the following: data Expr : Type -> Type where Lift : a -> Expr a Add : Num a => Expr a -> Expr a -> Expr a And : Expr Bool -> Expr Bool -> Expr Bool Cnst : Expr ...