Fork me on GitHub
#beginners
<
2016-01-26
>
meow00:01:16

interesting that I've never heard of metabase before (and they have emoji in their git commit messages 🎉 )

ratnakar01:01:20

I am using metabase, and it is very simple, and one of the best out there. My users love it

gerred01:01:45

what's the difference (in a clojure internals sense) of when a symbol is evaluated versus defined?

gerred01:01:19

is it because the symbols are being defined thanks to a macro?

gerred01:01:51

(and where quote comes in and why macros are important over just pure functions)

dorab01:01:48

@gerred macros are useful (indeed necessary) if you want to delay the evaluation (or otherwise manipulate the code) without requiring the user to quote something.

gerred01:01:31

so when I (def mysymbol "foo"), or (loop <sym>), mysmbol and <sym> aren't being evaluated because those are macros.

gerred01:01:02

(i'm trying to sort this out in my own head for when I go to create my own macros, assigning things to symbols)

dorab01:01:12

Essentially yes. Macro arguments are not evaluated (unlike function arguments).

gerred01:01:24

Yeah, essentially/high level is fine for this case.

gerred01:01:36

next step is to figure out what the hell defproject in Lein is doing, since it obviously takes a map without...wrapping things in a map. 😉

dorab01:01:48

You could, in principle, have def be a function (say def-function) but then you'd have to call it as (def-function 'mysymbol "foo")

gerred01:01:23

and then that is ultimately doing the footwork to add that as part of the namespace.

dorab01:01:50

Generally, by convention, symbols that are named def<something> are macros that add symbols to the namespace.

gerred01:01:27

Where can I find information about how that works under the hood? Is there a certain function that adds to the namespace?

Alex Miller (Clojure team)01:01:32

Really, that should be "add vars"

dorab01:01:15

Thanks f or the correction.

Alex Miller (Clojure team)01:01:45

Vars are named boxes for values

Alex Miller (Clojure team)01:01:16

Namespaces store mappings from names to vars

gerred01:01:38

What (function, etc.) ultimately registers a var into a namespace though? Is a namespace just a map?

Alex Miller (Clojure team)01:01:08

Unfortunately namespaces are gross mutable Java objects

gerred01:01:27

ha, I'm fine with staying on this side of that edge.

Alex Miller (Clojure team)01:01:18

Phone is about to die, later!

dorab01:01:25

As to defproject, the reason its arguments looks like a map is the way Clojure does varargs.

dorab01:01:30

For example

(defn foo [x y & m] (println x)(println y)(println m))

dorab01:01:34

And then call foo as (foo 1 2 :a 3 :b 4)

dorab01:01:46

Gives you `1

dorab01:01:42

The m prints as (:a 3 :b 4) which can be treated as a map.

gerred01:01:10

right. ok!

meow03:01:04

@ratnakar: good to know - they need to hang out here - maybe create a metabase channel

trancehime03:01:48

I was asked to deploy a non-Immutant clojure .war to WildFly, and ended up getting this error presumably because the file it's trying to access isn't found anywhere: 2016-01-26 09:38:15,518 ERROR [io.undertow.request] (default task-20) UT005023: Exception handling request to /admin-rrs-sm/css/normalize.css: java.lang.IllegalArgumentException: No method in multimethod 'resource-data' for dispatch value: :vfs

trancehime03:01:10

Should I add handler to the undertow subsystem to fix this?

trancehime06:01:09

OK never mind. I tried this just now and it didn't work.

trancehime06:01:25

Even doing (assoc-in [:static :resources] false) in my ring defaults doesn't do anything either

trancehime08:01:30

Deploying the exploded war manually produces the same error too. ...

trancehime08:01:49

Not to mention deploying an actual application in immutant to wildfly results in 403 when accessing it. ?_?