Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brandonbloom/glens
https://github.com/brandonbloom/glens
Last synced: 16 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/brandonbloom/glens
- Owner: brandonbloom
- License: epl-1.0
- Created: 2015-06-17T06:40:50.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-17T06:41:03.000Z (over 9 years ago)
- Last Synced: 2024-10-19T05:48:49.290Z (2 months ago)
- Language: Clojure
- Size: 105 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# glens
A Clojure library designed to provide something similar to lenses (or zippers)
for Graphs (hence the name: Graph+LENS). However, it's neither lenses or
zippers in the formal sense.## Usage
Don't.
But the general idea is this:
```clojure
(use 'glens.core)(-> null ; An empty graph
edges ; Accessors symbolic lens/zippers/cursors in to the graph.
(conj [:x :y] [:y :z]) ; These types implement standard interfaces.
graph) ; And you can navigate back around with them.
;=> #graph [#{:y :z :x} {:x #{:y}, :y #{:z :x}, :z #{:y}}]
; Where this is ^nodes^ and ^adjacency^, but representation will change.
```The hope is that the only extra interfaces you'll need in the general case are
`null`, `graph`, `nodes`, and `edges`; plus the usual Clojure suspects.I have no idea if this is actually a good idea; nor how far to push it. Could
get crazy, for example representing attributed graphs with metadata which is
a custom map implementation that similarly tracks being part of the graph.Let me know via Twitter if this idea is at all interesting to you.
## License
Copyright © 2015 Brandon Bloom
Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.