File tree 2 files changed +44
-1
lines changed 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
7
7
warrant a full blog post. These are mostly things I learn by pairing with
8
8
smart people at [ Hashrocket] ( http://hashrocket.com/ ) .
9
9
10
- _ 419 TILs and counting..._
10
+ _ 420 TILs and counting..._
11
11
12
12
---
13
13
@@ -48,6 +48,7 @@ _419 TILs and counting..._
48
48
- [ Evaluate One Liners With lein-exec] ( clojure/evaluate-one-liners-with-lein-exec.md )
49
49
- [ Expanding Macros] ( clojure/expanding-macros.md )
50
50
- [ Get The Value Of An Environment Variable] ( clojure/get-the-value-of-an-environment-variable.md )
51
+ - [ List Functions For A Namespace] ( clojure/list-functions-for-a-namespace.md )
51
52
- [ Load A File Into The REPL] ( clojure/load-a-file-into-the-repl.md )
52
53
- [ Mapping With An Index] ( clojure/mapping-with-an-index.md )
53
54
- [ Open JavaDocs] ( clojure/open-javadocs.md )
Original file line number Diff line number Diff line change
1
+ # List Functions For A Namespace
2
+
3
+ You know that ` clojure.string ` has a function for uppercasing a string, but
4
+ you can't quite remember the name of the function. You'd remember if you saw
5
+ the name though. What you'd like to do is list all the functions in the
6
+ ` clojure.string ` namespace to see if you can pick it out.
7
+
8
+ You can do just that. There are a couple ways to do it, in fact.
9
+
10
+ You can use the ` dir ` function with Clojure 1.6+. Alternatively, you can
11
+ grab all the keys from the public intern mappings of the namespace.
12
+
13
+ ``` clojure
14
+ > (dir clojure.string)
15
+ blank?
16
+ capitalize
17
+ ends-with?
18
+ escape
19
+ includes?
20
+ index-of
21
+ join
22
+ last-index-of
23
+ lower-case
24
+ re-quote-replacement
25
+ replace
26
+ replace-first
27
+ reverse
28
+ split
29
+ split-lines
30
+ starts-with?
31
+ trim
32
+ trim-newline
33
+ triml
34
+ trimr
35
+ upper-case
36
+ nil
37
+
38
+ > (keys (ns-publics 'clojure.string))
39
+ (ends-with? capitalize reverse join replace-first starts-with? escape last-index-of re-quote-replacement includes? replace split-lines lower-case trim-newline upper-case split trimr index-of trim triml blank?)
40
+ ```
41
+
42
+ [ source] ( http://stackoverflow.com/questions/2747294/how-to-list-the-functions-of-a-namespace )
You can’t perform that action at this time.
0 commit comments