Skip to content

Commit 01e138e

Browse files
committed
Add Type of Anything as a clojure til.
1 parent 342e138 commit 01e138e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
1010
### clojure
1111

1212
- [Splitting On Whitespace](clojure/splitting-on-whitespace.md)
13+
- [Type of Anything](clojure/type-of-anything.md)
1314

1415
### git
1516

clojure/type-of-anything.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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)

0 commit comments

Comments
 (0)