Permalink
Browse files

Delay evaluation of available-classes-by-last-segment

No need to pay the cost on ns load. A user who never imports classes
also never needs to evaluate this.
  • Loading branch information...
1 parent 6f931a1 commit 5c101f72920676cbe7a669c8cd50ccbff18ab46e @guns guns committed Feb 5, 2014
Showing with 3 additions and 2 deletions.
  1. +1 −1 src/slam/hound/regrow.clj
  2. +2 −1 src/slam/hound/search.clj
@@ -89,7 +89,7 @@
[type missing body]
(case type
:import (into (ns-import-candidates missing)
- (get search/available-classes-by-last-segment missing))
+ (get @search/available-classes-by-last-segment missing))
:alias (set
(for [ns (all-ns)
:let [syms-with-alias (get (ns-qualifed-syms body) missing)]
@@ -174,4 +174,5 @@
(map symbol)))
(def available-classes-by-last-segment
- (group-by #(symbol (peek (string/split (str %) #"\."))) available-classes))
+ (delay
+ (group-by #(symbol (peek (string/split (str %) #"\."))) available-classes)))

0 comments on commit 5c101f7

Please sign in to comment.