Permalink
Browse files

added most used op example

  • Loading branch information...
1 parent 8e266ee commit 5dc56e14d840314a5e9a2cfdc8c901b63785966c @jonase committed May 27, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/scape/core.clj
View
@@ -95,4 +95,19 @@
[?ret :ast.constant/type ?type]
[?ret :ast/line ?line]]
(db conn))
+
+ ;; Most used op's. Can this be combined into one query?
+ (sort-by second
+ (for [[op] (q '[:find ?op
+ :where
+ [?_ :ast/op ?op*]
+ [?op* :db/ident ?op]]
+ (db conn))]
+ [op (count (q '[:find ?e
+ :in $ ?op
+ :where
+ [?e :ast/op ?op]]
+ (db conn) op))]))
+
+
)

0 comments on commit 5dc56e1

Please sign in to comment.