Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7858703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:34:05+00:00 2026-06-02T21:34:05+00:00

repl> (-> root zip/down zip/right) [{:answer-keys [5 6], :id 3} {:l [{:id 2, :answer-keys

  • 0
repl> (-> root zip/down zip/right)
[{:answer-keys [5 6], :id 3} {:l [{:id 2, :answer-keys []}], :pnodes [{:answer-keys [2 3 4], :id 1}], :ppath nil, :r ({:answer-keys [7], :id 4})}]

I see this data when I print out the zipper on the repl. I am thinking that this may be all the data I would need to serialize a zipper? Is it possible to de-serialize a zipper from the provided data?

I am looking for something like the zip/serialize and zip/deserialize function imagined below.

(def s (zip/serialize (-> root zip/down zip/right))) ;; s is a string
(def d (zip/deserialize s)) ;; d is a zipper location
;;And I can go on using the deserialized zipper d without any difficulty.

Does anyone know how to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T21:34:07+00:00Added an answer on June 2, 2026 at 9:34 pm

    the magic of zippers is they are a data structure that represents everything needed to produce arbitrarily modified versions of tree structures. zippers print and read just fine because they are proper values and don’t require any state

    you can “serialize” it with pr-str and “deserialize” it with read

    make a zipper:

    user> (zip/vector-zip [[1 [2]][3][4]])
    [[[1 [2]] [3] [4]] nil]
    user> (def s (zip/vector-zip [[1 [2]][3][4]]))
    #'user/s
    user> s
    [[[1 [2]] [3] [4]] nil]
    

    serialize it to a string:

    user> (def serialized-s (pr-str (zip/next s)))
    #'user/serialized-s
    user> serialized-s
    "[[1 [2]] {:l [], :pnodes [[[1 [2]] [3] [4]]], :ppath nil, :r ([3] [4])}]"
    

    read it back:

    user> (def deserialized-s (read-string "[[1 [2]] {:l [], :pnodes [[[1 [2]] [3] [4]]], :ppath nil, :r ([3] [4])}]"))
    #'user/deserialized-s
    

    do something with the result:

    user> (zip/root deserialized-s)
    [[1 [2]] [3] [4]]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to do this (in REPL or anywhere) (defn (symbol print-string) [k] (println
I typed this into Clojure REPL (using the enclojure Netbeans plugin): user=> hello, world
I am doing pass-by-reference like this: use strict; use warnings; sub repl { local
When I paste this code into a REPL, it works fine: (use 'clojure.contrib.seq-utils) (defn-
I'm trying out the coffee script repl inside Emacs (under ArchLinux) and I'm seeing
Did anyone set up something like this for himself using the existing node.js REPL?
I'm trying out django-template-repl for debugging a template issue and it's pretty awesome. One
The following two commands prints out the same thing in repl: user=> (println (foo
Is there a REPL (Read-Eval-Print Loop) available anywhere for Actionscript 3? I could not
At the Clojure REPL, this expression ( #(for [x %] (+ 100 (second x)))

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.