This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # admin-announcements (1)
- # aleph (1)
- # architecture (1)
- # bangalore-clj (14)
- # beginners (15)
- # boot (89)
- # braveandtrue (1)
- # cider (1)
- # cljs-dev (33)
- # cljsjs (1)
- # cljsrn (147)
- # clojure (149)
- # clojure-quebec (1)
- # clojure-russia (82)
- # clojure-spec (18)
- # clojure-taiwan (2)
- # clojure-uk (15)
- # clojurescript (97)
- # cursive (11)
- # datomic (22)
- # funcool (2)
- # hoplon (53)
- # immutant (16)
- # jobs-rus (8)
- # lambdaisland (1)
- # off-topic (13)
- # om (7)
- # onyx (58)
- # parinfer (6)
- # planck (19)
- # protorepl (2)
- # re-frame (17)
- # reagent (201)
- # rum (6)
- # specter (9)
- # test-check (68)
- # untangled (47)
- # yada (94)
So I want to make a clojurescript library that can eventually be used by JS programs. I've sat down and sketched out the idea and messed around a bit on a repl thinking it through and I am about to start coding. Is there a good example/lein template for starting out a project with the intention of making a cljs library vs the more general templates? I threw a couple queries at google but js interop and more generic lein examples are crowding out the search.
mies was the standard for a while, but it shifted away from cljsbuild when cljs.jar became the quick start method. and now we have tenzing template for the boot, which is an alternative to lein
any of them will work, you just need to use
^:export metadata on vars you want accessible from JS, or
goog.exportSymbol explicitly to customize the name
thanks @shaunlebron, I ended up just spinning up a figwheel lein project and I'll cut it down to the library when I've got something.
not sure how to search for it, so i would ask here: is there an equivalent of coffeescript's existential operator in clojurescript?
zip = lottery.drawWinner?().address?.zipcode
i would hope to have something similar in clojurescript, so i wouldn't need to write for example
zip = typeof lottery.drawWinner === "function" ? (ref = lottery.drawWinner().address) != null ? ref.zipcode : void 0 : void 0;
(when error (.-message error))
I remember a very useful function to convert objects into string representations that worked nicely with console.log. Does anybody know what might be the name of such function?
Darwin I'll try it later when I'm home, but the function I'm looking for was definitely a short name with two words it, such as pt-str.
Anyone know if there’s a way to make the clojurescript compiler fail on warnings?
whats the status on
spec/gen? have they been ported over to clojurescript?
I tried using them but I couldn't get them to work, but it might've been because of my setup
when I try to use
(println (s/exercise-fn 'myfunc)) (' is backtick) I get
java.lang.AssertionError : Assert failed: (symbol? sym)
Is there any "framework" or library that lets me define a back-end end-point in my ClojureScript, such that I can call a Clojure function on it, and it'll locate the corresponding Clojure function in the back-end (via RPC or something), call it, and return the result, assuming it's just EDN?
In other words, is there something that lets me call a Clojure server from a ClojureScript front-end, as if it was in the same process, but only assuming EDN arguments and return values?
@sdegutis: never used it, but I think this looks like what you’re looking for? https://github.com/hoplon/castra
Is there a cljs nrepl client available?. Tried googling , but no luck.. There is one available as a node module though...
I run into this about once every few weeks, where I want to take a nodejs example and just run it as cljs. Usually doesn’t take long to manually transform it, but still… 🙂
(the issue is older versions of my SPA are loaded on clients browsers even when a new JS file is shipped to the server)
I wanted an nREPL client in Dirac DevTools, ended up running it on server-side and opening a websocket tunnel to it from client-side: https://github.com/binaryage/dirac/blob/417b81c3959e9b156f148f9448f2935f33631658/src/lib/dirac/lib/nrepl_tunnel.clj#L13-L47
is there a way to use
@darwin: do you by any chance know if there’s anything lacking in https://developer.chrome.com/apps/sockets_tcp that would prevent me from implementing a proper nREPL client with it?
@sherbondy: no, it should be possible to use that api to implement real TCP connection to nREPL server
I needed it from a normal web app or extension, so this option wasn’t available for me
but maybe there is another option, to teach nREPL server another transport, e.g. websocket
that would require people running nREPL server to configure it and still you would have to implement clojure.tools.nrepl and bencode on client-side, which is a lot of work
maybe not bencode, I don’t remember exactly if it is part of transport protocol or not
ok, it is part of the transport, so you could use json or edn, when implementing websocket transport to make your life easier: https://github.com/clojure/tools.nrepl#transports-
Has anyone faced this issue with
clojure.spec in cljs?
clojure.lang.Compiler$CompilerException: java.lang.NoClassDefFoundError: com/google/common/base/Predicate, compiling:(cljs/closure.clj:1:1) java.lang.NoClassDefFoundError: com/google/common/base/Predicate java.lang.ClassNotFoundException: com.google.common.base.Predicate ... cljs.closure/eval7975/loading--auto-- closure.clj: 9 cljs.closure/eval7975/invokeStatic closure.clj: 9 cljs.closure/eval7975 closure.clj: 9
I am saying spec because it coincided with me introducing it in the
cljc files but it might actually be something else
false alarm, I was excluding the
guava dependency in the project for some obscure reason
(I mean yours is better)
(s/def ::timestamp #?(:clj #(instance? Long %) :cljs #(number? %)))
@dnolen: I came up with something, though it's a little quick and dirty: https://gist.github.com/Risto-Stevcev/dc628109abd840c7553de1c5d7d55608
though I've never used
core.logic yet, but I think it might be useful for that sort of thing
main utility for everyday programming seems to be when you have a bunch of conditions that need to be satisfied for some result, and when you don’t get that result you want to introspect why. with just functional programming not so easy, but with logic programming just assert the result and the set of conditions that are satisfied to get back the ones that aren't
yeah you get a little bit of that with
fdef, but it doesn't handle situations where you want to prove that your program behaves a certain way when interacting with other functions (ie transitivity)
you could use this ad-hoc type system with logic programming to prove that kind of stuff, though admittedly I've only played around with some really trivial stuff in Idris for that sort of thing