File tree 2 files changed +26
-0
lines changed 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
10
10
### clojure
11
11
12
12
- [ Splitting On Whitespace] ( clojure/splitting-on-whitespace.md )
13
+ - [ Type of Anything] ( clojure/type-of-anything.md )
13
14
14
15
### git
15
16
Original file line number Diff line number Diff line change
1
+ # Type of Anything
2
+
3
+ You can get the type of anything with the ` type ` function. Because Clojure
4
+ is built on Java, many of these types may be types you recognize form Java.
5
+
6
+ Boot up the repl to try some of these out:
7
+
8
+ ``` clojure
9
+ > (type 5 )
10
+ ; java.lang.Long
11
+ > (type 5.2 )
12
+ ; java.lang.Double
13
+ > (type 5/4 )
14
+ ; clojure.lang.Ratio
15
+ > (type (int 2 ))
16
+ ; java.lang.Integer
17
+ > (type " hello, world!" )
18
+ ; java.lang.String
19
+ > (type [1 2 3 ])
20
+ ; clojure.lang.PersistentVector
21
+ > (type '(1 2 3 ))
22
+ ; clojure.lang.PersistentList
23
+ ```
24
+
25
+ [ source] ( https://aphyr.com/posts/302-clojure-from-the-ground-up-basic-types )
You can’t perform that action at this time.
0 commit comments