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
0 answers

Cannot find compress while compressing build in angular

I'm trying to compress the build using this command ng build --prod --aot --build-optimizer && gzipper compress ./dist i have installed gzipper when i run this command i get error Cannot find compress ..
user3653474
  • 3,393
  • 6
  • 49
  • 135
0
votes
1 answer

Laravel Downloading multiple files using .zip

I'm having some problem when I try to download files using .zip use ZipArchive; . . . public function donwload(){ $zip = new ZipArchive; $fileName = 'documents.zip'; if ($zip->open(public_path($fileName), ZipArchive::CREATE) ===…
jhon jhon
  • 1
  • 4
0
votes
0 answers

File name with special characters( å, ä, ö ) are unable to read by ionic.zip

I'm trying to read filename with Swedish characters. When the files are being read I get the exception file not found. The same work for file names without special characters. I tried with different encoding but still the file names was not being…
Lance
  • 19
  • 7
0
votes
1 answer

I need to create .Zip file in Laravel and my code does not work

this is the 1st time I posted on StackOverflow. I need to create a zip file of multiple images. I've tried Zipper and also ZipArchive and my code still fails. $zip = new \ZipArchive(); foreach ($students as $student) { $download = 'album' .…
giangtr201
  • 11
  • 1
  • 2
0
votes
1 answer

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 list, e.g. (1 (2 3) 4)), I want to be able to…
Astronought
  • 405
  • 5
  • 24
0
votes
1 answer

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" 150, "longitude" 77.08472222222221}}]} and I want…
saga
  • 1,933
  • 2
  • 17
  • 44
0
votes
0 answers

Java Write version info in zip file attribute

I am exporting my data in form of zipping. I need to validate the version of my product, which version the file was exported. I have to validate the file version. Is there any way in java that I can write/read the version of that file in File…
Mitul Maheshwari
  • 2,647
  • 4
  • 24
  • 38
0
votes
1 answer

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 wildcard to match all child nodes. In the…
Evgeniy Berezovsky
  • 18,571
  • 13
  • 82
  • 156
0
votes
2 answers

Can't access deeply nested XML with clojure.data.zip.xml

(def testxml2 " 1 2
BWStearns
  • 2,567
  • 2
  • 19
  • 33
0
votes
1 answer

How to create backup of my directory with password protected zip file in PHP?

I want to create a weekly backup of my project directory in PHP. I need help to create a password protected zip file in php. I use the below function, but that not create a whole folder backup as well as not helping for password protected. $path…
Dhara Chauhan
  • 51
  • 1
  • 3
0
votes
2 answers

How to use usePassword method in Zipper?

Please tell me how to use 'usePassword' method for extract zip file which is password protected. $files = array_diff(scandir($zipdir), array('..', '.')); $zip = new \Chumper\Zipper\Zipper; foreach($files as $key=>$value1){ …
Jignesh Vagh
  • 122
  • 1
  • 3
  • 18
0
votes
2 answers

Using xml-> in a let

I have some code, that parses out soap data with the use of zippers. When I format it like so it works as expected for me (defn parse-data [raw-data] (let [soap-data (:body raw-data) soap-envelope (zip/xml-zip …
0
votes
0 answers

vector-zip predicate library like data.zip.xml in Clojure?

I've had great success using data.zip.xml but I find I'm in need of same for vector trees. Before undertaking creation of the equivalent of data.zip.xml for vector-zip zippers, I thought it would be good to see if something already exists.
Frank C.
  • 7,758
  • 4
  • 35
  • 45
0
votes
1 answer

XML unescaping with Zipper in Scala

Suppose I need to unescape XML escaped characters in a given string: e.g. I need to replace & with &, " with ", < with < etc. I would prefer a purely functional solution. Does it make sense to do it with scalaz.Zipper ? Zipper allows…
Michael
  • 41,026
  • 70
  • 193
  • 341
0
votes
1 answer

Haskell: Avoiding heap overflow in tree+zipper construction

I'm trying to implement a simple lexicon compression algorithm that uses Deterministic Finite Automaton as a data structure (actually it is Deterministic Acyclic Finite State Automaton, see Wikipedia entry). When I run the program against a large…
Glaukon
  • 321
  • 3
  • 12
1 2 3
8
9