This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
so nil?
isn't an option?
@noisesmith nil?
returns true
for js/undefined
oh, tricky
can you even (def x )
in Clojure?
oh nvm
it’ll be “unbound”, IIRC
right, it's a special placeholder class
clojure.lang.Var$Unbound - pretty much just exists to say something meaningful via its name in stack trace (and to check for equality to itself of course)
if I want to send emails via sendgrid (or any other mail service) I should still go through my own backend right?
otherwise I would have to put my key in the JS code
and related question, there seems to be many libraries to do HTTP calls in cljs
any suggestions on which one to use?
@andrea.crotti I’ve been using @r0man ‘s great https://github.com/r0man/cljs-http
ah cool @luchini , looks like it requires cljs spec alpha though
or maybe not might be an unrelated error sorry
So how do I use macros from clojurescript? If I have two files clj/a.clj
and cljs/a.cljs
both with namespace a
. If I defmacro
in a.cljs
, the macro should be available in cljs/a.cljs, correct?
@darwin Aha, right. But I need to be able to use the symbols in the body of the function. Is that even still in the scope of macros?
I'll be more specific about what exactly I want. Now perhaps a macro should not be used for this, but here goes:
@urbank this can be done by a macro, macros simply generate code your would want to write by hand
I just don’t follow why ‘foo and ‘bar have to be quoted, and why you even specify some names there, the generated function will not “expose” them outside
the way you wrote the examples, the macro will generate a code defining a lambda function for you, but names of parameters will be irrelevant at that point
@darwin But you have to tell the macro somehow how many arguments you want and where to put them in the get-in
vector, right?
@darwin Right, that's good, but I don't know what to use to take an arbitrary vector amount of _
s and make them correspond to arguments of a function, and then refer to them in the body of that function. If that makes sense.
So p1#
and p2#
can't be referred to directly inside the macro because you don't know in advance the number of _
s.
macro gets input code form as data and can do whatever it wants to generate a new form as data which will replace the macro “invocation” in-place - so you can use your clojure-fu to inspect input vector, process _
positions and generate code based on that
@darwin Heh, not sure what do say. Sounds obvious now that you say it. It is just clojure data structures after all. Thanks! 🙂