This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (2)
- # bangalore-clj (6)
- # beginners (33)
- # cider (4)
- # clojure (9)
- # clojure-brasil (2)
- # clojure-spec (6)
- # clojurescript (36)
- # cursive (13)
- # datomic (3)
- # emacs (1)
- # fulcro (6)
- # graalvm (2)
- # interop (4)
- # luminus (1)
- # midje (1)
- # pathom (1)
- # random (1)
- # reagent (4)
- # shadow-cljs (11)
- # tools-deps (42)
- # xtdb (10)
Clojure's typing discipline is Dynamic / Strong. I thought Dynamic is Weak, and Static is Strong.
Static/dynamic refers to when type checking is performed: compile time (static) vs. run time (dynamic). This is a completely separate notion from "strength". With weak typing, the language is not terribly strict about how it interprets things, while strongly typed languages are quite strict about enforcing the typing rules.
in general should i be worried about repeatedly calling swap! on an atom that most of the time isn't actually changing? i suppose it probably does this check on its own without needing me to wrap the call again?
It's just the default prompt in the basic REPL. It shows the namespace you are in.
[email protected]:~/clojure$ clj Clojure 1.10.0 user=> (ns foo.bar) nil foo.bar=> *ns* #object[clojure.lang.Namespace 0x1f38957 "foo.bar"] foo.bar=> (in-ns 'user) #object[clojure.lang.Namespace 0x518cf84a "user"] user=> *ns* #object[clojure.lang.Namespace 0x518cf84a "user"] user=>
In Clojure we use
kebab-case for identifiers, not
my-square would be more idiomatic.
Each file should contain a
ns declaration at the top --
(ns clojure-demo.square) should be added in this case.
It's good practice to put exploratory code (such as the actual call to the square function) in a
(comment ,,,) form so it won't be evaluated when the namespace is loaded (we generally avoid top-level expressions outside
If you had
then you can put you cursor at the start of the function call and use the "evaluate block" command to send it to the REPL -- and then you'll see the result inline in the editor (as well as in the REPL panel).
(comment (my-square 2))
If you have set up the keymap, you should be able to press
ctl-, b for evaluate block.
Not sure why the second function call faulted. I can pass in whatever arguments I want ?
This video is a good source of information https://lambdaisland.com/episodes/clojurescript-interop