Questions tagged [zipper]

A zipper is a technique of representing a data structure so that it is convenient for traversal and updates, especially in pure functional languages.

A zipper is a technique of representing an aggregate data structure so that it is convenient for writing programs that traverse the structure arbitrarily and update its contents, especially in purely functional programming languages.

The basic idea is that an existing list- or tree-like data structure is augmented with a representation of a "focus" on a single item in the tree in a way that permits efficient lookups and updates at the focus point.

A simple example is a zipper for a list, consisting of a pair of two lists. For example, the position of 3 in the list (1,2,3,4,5) is represented by the pair ((2,1),(3,4,5)). To insert a new item or replace 3 with another item with this representation can be done in constant time since 3 is at the head of the second list of the pair. Traversing the list is similarly easy: remove the head of either list and cons it with the other list.

You can read more about zipper in Haskell in the Haskell Wikibook.

126 questions
0
votes
5 answers

Randomly interleave/zipper flat arrays without losing element order from original arrays

I want to merge / mix two arrays together, but I want it to be randomly "mixed" however NOT shuffled. For example: $first = [1, 2, 3, 4]; $second = [10, 20, 30, 40]; Possible desired "mixes" are: [1, 10, 20, 30, 2, 40, 3, 4] [10, 1, 2, 20, 30, 3,…
Rob
  • 10,851
  • 21
  • 69
  • 109
0
votes
0 answers

Iconic.Zipper file

I am using Ionic.Zip.ZipFile to read file check if this exist but to return the code written is zip.Entries.Count where zip is object of Ionic.Zip.ZipFile. Can anyone please suggest what zip.Entries.Count will return? Thanks
Yogesh
  • 11
  • 3
0
votes
1 answer

ord function execution in loop

I have two folders, and each folde contains 196 files, they all are in ('\xae\xae\xb4\x9e\x8f\x9f\xba\xc1\xd5\xbd\xcd\xa1\xb7\') format. I am trying to read this data convert it into human readable form. I want to combine the data of both the files…
shreya
  • 297
  • 3
  • 7
  • 15
-1
votes
1 answer

How to make a zip file containing two folders inside in laravel using Chumper/Zipper?

In my program two type of members can add images to the database and locally. There is a download function which will download all images (which were added by both members) as a zip file. I need to make a zip file which contain two folders for both…
-1
votes
1 answer

Scheme Zip Function

I need to write a function in Scheme that acts as a zipper - meaning it takes two lists and creates a 'zipper' out of the two lists such that (zip '(a b c) '(1 2 3)) => ((a 1) (b 2) (c 3)) Furthermore it takes each element in the nth position and…
Nelson.b.austin
  • 3,080
  • 6
  • 37
  • 63
-2
votes
1 answer

Android Zipper Animation for unlock screen

I am currently working on zip animation to unlock android mobile screen. Changing background images is a expensive task and have not a smooth effect. I want a smooth effect in it. Any help please? Thanks
1 2 3
8
9