Skip to content

Instantly share code, notes, and snippets.

@dimovich
Created January 17, 2023 13:46
Show Gist options
  • Save dimovich/161c0ee8dfdedbd7c3fcf6f11024f6f4 to your computer and use it in GitHub Desktop.
Save dimovich/161c0ee8dfdedbd7c3fcf6f11024f6f4 to your computer and use it in GitHub Desktop.
{:deps {org.clojure/clojurescript {:mvn/version "1.11.60"}}}
;; CLJ REPL
(require 'my.core)
(read-string (pr-str (my.core/circle 3)))
;;=> #my.core.Circle2{:p [0.0 0.0], :r 3}
;; CLJS REPL
(require 'my.core
'cljs.reader)
(cljs.reader/read-string (pr-str (my.core/circle 3)))
;;=> #my.core.Circle2{:p [0 0], :r {:p [0 0], :r 3}}
{my.core.Circle2 my.core/circle}
(ns my.core)
(defrecord Circle2 [p r])
(defn circle
([] (Circle2. [0.0 0.0] 1.0))
([r] (Circle2. [0.0 0.0] r))
([p r] (Circle2. [p p] r))
([x y r] (Circle2. [x y] r)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment