zipper Questions
1
Solved
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, whic...
Champagne asked 15/4, 2020 at 16:21
3
Solved
Inspired by the recent question about 2d grids in Haskell, I'm wondering if it would be possible to create a two-dimensional zipper to keep track of a position in a list of lists. A one-dimensional...
Drumfish asked 18/1, 2012 at 4:5
4
Solved
This is an example of using a zipper in Haskell:
data Tree a = Fork (Tree a) (Tree a) | Leaf a
data Cxt a = Top | L (Cxt a) (Tree a) | R (Tree a) (Cxt a)
type Loc a = (Tree a, Cxt a)
left :: Loc ...
Gaudet asked 28/2, 2014 at 12:16
2
How can I create a Clojure zipper for a TRIE, represented by nested maps, were the keys are the letters.?
Something like this:
{\b {\a {\n {\a {\n {\a {'$ '$}}}}}} \a {\n {\a {'$ '$}}}}
Repres...
1
I'm trying to implement something like a zipper but taking advantage of mutable references to avoid having to deconstruct and reconstruct the data structure as I move through it. I've got example c...
Turgescent asked 6/11, 2017 at 6:3
0
I (almost) fully understand the Zipper data structure for trees. However, in some publications I saw hints that it is also possible to use the Zipper idea to create immutable functional data struct...
Neckband asked 25/9, 2017 at 8:13
7
Solved
Say I have got following two case classes:
case class Address(street: String, city: String, state: String, zipCode: Int)
case class Person(firstName: String, lastName: String, address: Address)
...
Audrieaudris asked 10/10, 2010 at 12:37
1
Solved
This is a follow-up to the answer to my previous question.
Suppose I need to map each item a:A of List[A] to b:B with function def f(a:A, leftNeighbors:List[A]): B and generate List[B].
Obviously...
Counterpoise asked 3/6, 2014 at 10:55
1
Solved
In the paper titled "The Zipper" by Huet, he also mentions scars as a variation of zippers. Compared to zippers, which became pretty well known in the Haskell community, scars are pretty much unhea...
3
Solved
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveTraversable #-}
import Control.Comonad
import Data.Functor.Reverse
import Data.List (unfoldr)
First some co...
1
Solved
I'm comparing Huet's original paper with Clojure's implementation and trying to figure out why the changes were made. I'm a Clojure novice, so if I'm wrong on my interpretation of the Clojure code,...
2
Solved
The classic book The Little Lisper (The Little Schemer) is founded on two big ideas
You can solve most problems in a recursive way (instead of using loops) (assuming you have Tail Call Optimisati...
Aggressor asked 15/3, 2015 at 9:12
3
How can one create an XML request conforming to an XSD such that the request is valid?
One way would be to create the whole request and then verify it on the XSD.
Is there a way to create a reque...
1
I've bumped into an issue using zippers and lens. Consider following example:
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
import Control.Lens
import Control.Zipper
data A = AA...
Crosspollinate asked 8/1, 2015 at 16:48
1
Solved
I'm struggling with lens and zippers. Consider below code run in ghci
> import Control.Lens
> import Control.Zipper
>
> :t within (ix 1) $ zipper ([1,2,3] :: [Int])
> within (ix 1...
Pompidou asked 8/1, 2015 at 14:47
2
Solved
Given a differentiable type, we know that its Zipper is a Comonad. In response to this, Dan Burton asked, "If derivation makes a comonad, does that mean that integration makes a monad? Or is that n...
3
Solved
For any given list or array, for instance
val list = (1 to 3).toList
val array = (1 to 3).toArray
and a given function that maps from and onto the collection type, for instance
def f(v: Int): I...
Insider asked 12/9, 2014 at 4:24
3
Solved
Given any container type we can form the (element-focused) Zipper and know that this structure is a Comonad. This was recently explored in wonderful detail in another Stack Overflow question for th...
1
Solved
I want to make a binary tree zipper an instance of comonad, but I can't figure out how to implement duplicate properly.
Here is my attempt:
{-# LANGUAGE DeriveFunctor #-}
import Data.Function
imp...
1
Solved
In this presentation [2005] we read at slide 32:
The zipper datatype hides a comonad. This is exactly the comonad one needs
to structure attribute evaluation.
So it seems you can express Zipp...
1
Solved
This is a follow-up to my previous question. I can use an iterator, fold, zip, foreach and others to iterate over a list in Scala. Now I wonder if there are use cases where Zipper is most appropria...
1
Solved
Suppose I need to walk over a list or tree to read (but not modify) the data. I can use either an iterator or a Zipper. Does Zipper have any advantages aside from immutability in this case?
1
Solved
I have a tree of an unknown structure. First, I want to find a node containing a string of text, "Something". Then, after identifying the string's location in the tree, I want to update a different...
1
Solved
Every type T overloading the Traversable brings forth a Zipper T. I.e. existence of the instance Traversable T is the sufficient condition of the Zipper T.
Is there a proof that this is also a ne...
1
Solved
I wish to print a binary tree in Newick format, showing each node's distance to its parent. At the moment I haven't had an issue with the following code, which uses regular recursion, but a tree to...
Doroteya asked 17/10, 2013 at 10:33
1 Next >
© 2022 - 2024 — McMap. All rights reserved.