Fork me on GitHub

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.

Sam Ferrell00:06:16

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?

Alex Miller (Clojure team)00:06:05

Prob not worth worrying about

👍 4

Is 'user=>' ever used in a .clj file ? or only in a terminal ?


It's just the default prompt in the basic REPL. It shows the namespace you are in.


seanc@DESKTOP-QU2UJ1N:~/clojure$ clj
Clojure 1.10.0
user=> (ns
nil> *ns*
#object[clojure.lang.Namespace 0x1f38957 ""]> (in-ns 'user)
#object[clojure.lang.Namespace 0x518cf84a "user"]
user=> *ns*
#object[clojure.lang.Namespace 0x518cf84a "user"]


Is this right ?


In Clojure we use kebab-case for identifiers, not snake_case, so 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 def / defn).


If you had

  (my-square 2))
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).


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 ?


You evaluated the whole comment form instead of just the expression inside it.


(comment ,,,) evaluates to nil (it didn't "fault").


I dont know. looks good to me

Rick Hanson03:06:07

Now, line 11 has a misplaced right paren and also needs an extra right paren.


Should be

(= (rem n 2) 1) "odd")
-- move the ) to the right of the "odd"


hi when I try to have new javascript object like this I got an error>


in js it looks like this->


isn't it same (def xxx (js/myobject)) and let xxx = new myobject

Vincent Cantin16:06:33

I guess the problem is the new

Vincent Cantin16:06:15

try something like (js/PIXI.Application. #js {}) to call the constructor.

Vincent Cantin16:06:25

notice the . at the end

Vincent Cantin16:06:21

@m373h4n also, you may use a let inside a lambda instead of a def


thank you Vincent it fixed the problem. now I am now watching the video ^^


I have started learning Clojure 🙂

aw_yeah 8
😂 8
👍 16
clj 8
cljs 4
sharkdance 4
Norman Eckstein20:06:48

Hi 👋:skin-tone-3: