This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-30
Channels
- # 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?
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 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=>
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
(comment
(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
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"
I guess the problem is the new
try something like (js/PIXI.Application. #js {})
to call the constructor.
notice the .
at the end
This video is a good source of information https://lambdaisland.com/episodes/clojurescript-interop
@m373h4n also, you may use a let
inside a lambda instead of a def
Hi 👋:skin-tone-3: