(ns clojure.examples.example (:gen-class)) (defn example [] (def myatom (atom 1)) (println @myatom) (swap! myatom inc) (println @myatom)) (example)
(ns clojure.examples.example (:gen-class)) (defn example [] (def myatom (atom 1)) (println @myatom) (compare-and-set! myatom 0 3) (println @myatom) (compare-and-set! myatom 1 3) (println @myatom)) (example)
(ns clojure.examples.example (:gen-class)) (defn example [] (def myatom (atom 1)) (println @myatom) (reset! myatom 2) (println @myatom)) (example)
(ns clojure.examples.example (:gen-class)) (defn example [] (def myatom (atom 1)) (println @myatom)) (example)
(ns example) (import java.util.Date) (defn Example [] (def date (.getTime (java.util.Date.))) (println date)) (Example)
(ns example) (defn Example [] (def date (.format (java.text.SimpleDateFormat. "MM/dd/yyyy") (new java.util.Date))) (println date)) (Example)
(ns example) (defn Example [] (def date (.toString (java.util.Date.))) (println date)) (Example)
(ns clojure.examples.example (:gen-class)) (defn Example [] (def my-map {"a" 1 "b" 2}) (let [{a "a" b "b" c "c"} my-map] (println a b c))) (Example)
(ns clojure.examples.example (:gen-class)) (defn Example [] (def my-map {"a" 1 "b" 2}) (let [{a "a" b "b"} my-map] (println a b))) (Example)
(ns clojure.examples.example (:gen-class)) (defn Example [] (def my-vector [1 2 3 4]) (let [[a b & the-rest] my-vector] (println a b the-rest))) (Example)
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more