Skip to content

Commit

Permalink
Updates! Thanks @swannodette
Browse files Browse the repository at this point in the history
  • Loading branch information
mrb committed May 20, 2013
1 parent 147e067 commit d2e2308
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Expand Up @@ -115,8 +115,12 @@ end>

* Associate original jruby-parser node information as metadata to node map object, for altering and rehydrating source as ast

## Credits

* @swannodette for the amazing guidance and work on `nodeattro`, `mapo`, `filtero`, `rembero`, etc.

## License

Copyright © 2013 Michael R. Bernstein
Copyright © 2013 Michael R. Bernstein and contributors

Distributed under the Eclipse Public License, the same as Clojure.
14 changes: 14 additions & 0 deletions examples/examples.clj
Expand Up @@ -98,8 +98,22 @@
(filtero nodes
(fn [node]
(l/fresh [value]
(nodeattro node :type "DEFNNODE")
(nodeattro node :name value)
(l/!= value nil)))
nodes')
(mapo nodes' #(nodeattro %1 :name %2) q)))

;; dupeo names
(l/run* [q]
(l/fresh [nodes nodes' dupes]
(l/== nodes (parse-ruby-code ruby-code))
(filtero nodes
(fn [node]
(l/fresh [value]
(nodeattro node :type "DEFNNODE")
(nodeattro node :name value)
(l/!= value nil)))
nodes')
(mapo nodes' #(nodeattro %1 :name %2) dupes)
(dupeo dupes q)))
2 changes: 0 additions & 2 deletions project.clj
Expand Up @@ -4,7 +4,5 @@
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.5.0"]
[org.clojure/algo.monads "0.1.4"]
[org.jruby/jrubyparser "0.4.1"]
[org.clojure/core.logic "0.8.3"]
[rhizome "0.1.3"]])

0 comments on commit d2e2308

Please sign in to comment.