Skip to content

Instantly share code, notes, and snippets.

@boxxxie
Created April 3, 2013 18:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boxxxie/5303742 to your computer and use it in GitHub Desktop.
Save boxxxie/5303742 to your computer and use it in GitHub Desktop.
;;rules examples
[[(findname ?person ?search) [(fulltext $ :person/firstname ?search) [[?person ?name]]]]
[(findname ?person ?search) [(fulltext $ :person/lastname ?search) [[?person ?name]]]]]
;;attempt at making some rule for searching for geohashs...
[[(findgeohash ?place ?search)
[(fulltext $ :coordinate/gehoash ?search)
[[?place ?name]]]]]
(defn pythagorean [a b c] (= (+ (* a a) (* b b)) (* c c)))
(defn within-radius [radius ?coord]
(let [ ]
(< radius (distance
)
(q '[:find ?places
:in $ $lat $long $radius
:where
[(fulltext :coordinate/gehoash (geohash-partial lat long)]
[?places :place/geometry ?coords]
[?coords :geometry/coordinate ?coord]
[(within-radius $lat $long $radius ?coord)]]
db lat long radius)
;;may be able to use d/filter function in this senario...
;;https://github.com/Datomic/day-of-datomic/blob/master/tutorial/filter.clj
@boxxxie
Copy link
Author

boxxxie commented Apr 3, 2013

i really need to test this with clojure. (just wrote this up)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment