(ns playground
(:require
[clojure.string :as str]))
(defn clojure-function [args]
(let [string "multiline\nstring"
regexp #"regexp"
number 100000
booleans [false true]
keyword ::the-keyword]
(if true
(->>
(list [vector] {:map map} #{'set})))))
#"\"abc\\"
"real
multiline
string"
#:person{:first "Han"
:last "Solo"
:ship #:ship{:name "Millenium Falcon"}}
#::{:a 1, :b 2}
(def some-var)
(def alternative-var "132")
(defonce ^:private another-var #"foo")
(defn- add [x y] (+ x y))
(defprotocol Fly
"A simple protocol for flying"
(fly [this] "Method to fly"))
(defrecord Bird [name species]
Fly
(fly [this] (str (:name this) " flies...")))
(defmulti service-charge (fn [acct] [(account-level acct) (:tag acct)]))
(defmethod service-charge [::acc/Basic ::acc/Checking] [_] 25)
(defmethod service-charge [::acc/Basic ::acc/Savings] [_] 10)
(defmethod service-charge [::acc/Premium ::acc/Account] [_] 0)
(defmacro unless [pred a b]
`(if (not ~pred) ~a ~b))
(unless false (println "Will print") (println "Will not print"))
(deftype Circle [radius])
(deftype Square [length width])
(defmulti area class)
(defmethod area Circle [c]
(* Math/PI (* (.radius c) (.radius c))))
(defmethod area Square [s]
(* (.length s) (.width s)))
(def myCircle (Circle. 10))
(def mySquare (Square. 5 11))