Giter VIP home page Giter VIP logo

zip-viewer's Introduction

Clojure.Zip Viewer

Usage

Live Version of the Clojure.Zip/Viewer

This is an online application that allows you interactively manipulate a tree (really any clojure data structure) with clojure.zip. I made this to help with my understanding of the clojure.zip namespace.

Constructor

Upon clicking the above link, you will be presented with a list of clojure.zip constructors. Paste the data structure in the appropriate constructor. As an example, try pasting [1 2 [3 4] 5] in the (vector-zip nil) constructor's input. The section will turn blue to indicate that it may be clicked. Go ahead and click on (vector-zip [1 2 [3 4] 5]).

Actions

The view will transform to the functions that view/move/modify a clojure.zip loc. There is a history at the bottom that shows the functions that have been called. The currently selected history row is bold. You can change the currently selected history by clicking upon a row (undo/redo). You can also view the raw loc by clicking the chevron on the left of each row.

That's about it, hope it helps with visualizing clojure.zip functionality.

Contributions

Pull Request are welcome.

Every function in clojure.zip is supported except for (edit) & (zipper) (see Issue #3). There is also an issue with using (seq-zip) as the reader will not read quoted values (see Issue #2). Any help on these problems is greatly appreciated as it would allow full coverage of the clojure.zip namespace.

Also, if you have ideas about how to make the UI better (or any ideas in general), I appreciate constructive feedback.

Thank you.

Development

This project uses figwheel.main for development. Assuming that is setup then clone this project and cd into it.

>> git clone [email protected]:samedhi/zip-viewer.git
>> cd zip-viewer

Then proceed using either the console or emacs.

Console

>> clj -m figwheel.main -b dev

Emacs

emacs src/zip-viewer/core.cljs

From within emacs, type M-x cider-jack-in-cljs and then Enter. figwheel-main is your environment and dev is your build.

Result

After a little time a browser will open with the app loaded within it. Editing any of the files under /src or the resources/public/css/style.css file should cause those files to be live-reloaded upon save. For more information please read the figwheel.main docs (they are quite good).

License

MIT

zip-viewer's People

Contributors

samedhi avatar

Stargazers

Bobbi Towers avatar Burin Choomnuan avatar Don Jackson avatar

Watchers

 avatar James Cloos avatar

Forkers

clojure-land

zip-viewer's Issues

Try to restrict parsable input to fully valid strings.

The way that cljs.reader/read-string works means that it reads the first valid clojure expression from the string. However, it will read a string with additional information even if that additional information is not valid. So it will read this
[1 2 3]
But it will equivalently read all of the following
[1 2 3]]
[1 2 3] [4]
[1 2 3] xyz
[1 2 3] 0.0.0.0
I would like the strings with extra data past the [1 2 3] to be rejected by cljs.reader/read-string. I would like to make cljs.reader/read-string be strict in that the whole string must be made out of 1 and only 1 parsable piece of data.

Can't support clojure.zip/edit & clojure.zip/zipper until we have clj in cljs

zipper needs to take 3 functions as arguments. edit has a signature similar to swap!. Both need to be able to take functions (including lambdas) and have those functions+arguments applied and evaluated.

My understanding is that I would need to be able to compile clojurescript code in order to use these functions. This seems to imply that I would need clojurescript compilation in clojurescript itself.

I do not know how to proceed on this front. I would really appreciate anyone either submitting a PR to this code adding clojurescript compilation support or messaging me ( @samedhi ) about how this can be done.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.