Since Clojure ends up running on a Java virtual environment, it is also very possible that we can utilize some of its methods.
We can use the dot notation followed by the method we want to use, passing the parameter. Let's see an example.
(ns Project (:gen-class)) (defn func [] (println (.indexOf "Hello World","e"))) (func)
Line 3: We create a function, func
.
Line 4: We use the indexOf
method to find the index of a letter in a string, and we find the index of the letter e
.
Line 5: We call our function func
.
RELATED TAGS
CONTRIBUTOR
View all Courses