[Haskell-cafe] Re: Looking for practical examples of Zippers

2009-04-02 Thread GüŸnther Schmidt
David, guys, sorry, this all started with a misconception on my behalf of what a Zipper is and what it is good for. In the days that followed my post this became much clearer though and I now realize my original question was pointless. It seems you spotted that and yes, "generalized trie" i

Re: [Haskell-cafe] Re: Looking for practical examples of Zippers

2009-04-01 Thread wren ng thornton
David Menendez wrote: On Tue, Mar 31, 2009 at 11:44 PM, wren ng thornton wrote: > Another tricky thing for this particular example is answering the question > of what you want to call the "focus". Usually zippered datastructures are > functors, so given F X we can pick one X to be the focus and

Re: [Haskell-cafe] Re: Looking for practical examples of Zippers

2009-03-31 Thread David Menendez
On Mon, Mar 30, 2009 at 3:46 PM, Gü?nther Schmidt wrote: > Thanks Don, > > I followed some examples but have not yet seen anything that would show me > how, for instance, turn a nested Map like > > Map Int (Map Int (Map String Double) > > into a "zipped" version. > > That is presuming of course th

Re: [Haskell-cafe] Re: Looking for practical examples of Zippers

2009-03-31 Thread David Menendez
On Tue, Mar 31, 2009 at 11:44 PM, wren ng thornton wrote: > Another tricky thing for this particular example is answering the question > of what you want to call the "focus". Usually zippered datastructures are > functors, so given F X we can pick one X to be the focus and then unzip the > F aroun

Re: [Haskell-cafe] Re: Looking for practical examples of Zippers

2009-03-31 Thread wren ng thornton
Gü?nther Schmidt wrote: Thanks Don, I followed some examples but have not yet seen anything that would show me how, for instance, turn a nested Map like Map Int (Map Int (Map String Double) into a "zipped" version. You can't. Or rather, you can't unless you have access to the implementat

[Haskell-cafe] Re: Looking for practical examples of Zippers

2009-03-31 Thread Heinrich Apfelmus
Cristiano Paris wrote: > On Tue, Mar 31, 2009 at 10:13 PM, Dan Weston wrote: >>> What I've learned: Zippers are "structured collections[1] with a >>> focus". Through a Zipper you can O(1) change the value of the focused >>> element: that's the fundamental property. In addition, you can change >>>

Re: [Haskell-cafe] Re: Looking for practical examples of Zippers

2009-03-31 Thread Cristiano Paris
On Tue, Mar 31, 2009 at 10:13 PM, Dan Weston wrote: > >> What I've learned: Zippers are "structured collections[1] with a >> focus". Through a Zipper you can O(1) change the value of the focused >> element: that's the fundamental property. In addition, you can change >> the focus through a series

Re: [Haskell-cafe] Re: Looking for practical examples of Zippers

2009-03-31 Thread Dan Weston
> What I've learned: Zippers are "structured collections[1] with a > focus". Through a Zipper you can O(1) change the value of the focused > element: that's the fundamental property. In addition, you can change > the focus through a series of "moving" functions. To clarify: there is no magic tha

Re: [Haskell-cafe] Re: Looking for practical examples of Zippers

2009-03-31 Thread Ryan Ingram
Perhaps an example will help. Here's a useful operation on lists: > grab :: [a] -> [(a, [a])] > grab [] = [] > grab (x:xs) = (x, xs) : [ (y, x : ys) | (y,ys) <- grab xs ] This takes a list and gives you a new list with one element extracted from the original list: ghci> grab [1,2,3,4] [(1,[2,3,

Re: [Haskell-cafe] Re: Looking for practical examples of Zippers

2009-03-31 Thread Cristiano Paris
On Mon, Mar 30, 2009 at 9:46 PM, Gü?nther Schmidt wrote: > Thanks Don, > > I followed some examples but have not yet seen anything that would show me > how, for instance, turn a nested Map like > > Map Int (Map Int (Map String Double) > > into a "zipped" version. > > That is presuming of course th

[Haskell-cafe] Re: Looking for practical examples of Zippers

2009-03-30 Thread Gü?nther Schmidt
Thanks Don, I followed some examples but have not yet seen anything that would show me how, for instance, turn a nested Map like Map Int (Map Int (Map String Double) into a "zipped" version. That is presuming of course that this use is feasible at all. Günther Don Stewart schrieb: xmonad