This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-24
Channels
- # admin-announcements (1)
- # aws (3)
- # beginners (52)
- # boot (150)
- # braid-chat (1)
- # braveandtrue (5)
- # bristol-clojurians (2)
- # cider (21)
- # cljs-dev (1)
- # cljsfiddle (1)
- # cljsjs (5)
- # cljsrn (4)
- # clojars (3)
- # clojure (236)
- # clojure-berlin (2)
- # clojure-czech (1)
- # clojure-madison (1)
- # clojure-russia (164)
- # clojure-sdn (1)
- # clojure-sg (2)
- # clojure-uk (64)
- # clojurescript (149)
- # core-async (31)
- # cursive (33)
- # datomic (2)
- # devcards (5)
- # funcool (3)
- # hoplon (142)
- # immutant (27)
- # juxt (7)
- # lein-figwheel (6)
- # liberator (6)
- # off-topic (4)
- # om (46)
- # onyx (26)
- # parinfer (5)
- # perun (56)
- # proton (6)
- # re-frame (19)
- # reagent (1)
- # remote-jobs (12)
- # ring-swagger (17)
- # slack-help (2)
- # spacemacs (11)
- # specter (1)
- # untangled (11)
- # yada (3)
Anaphoric macros is prob what you're thinking of
I'm running into some trouble getting an integration test for an app built around compojure-api. I wrote a custom exception handler which is invoked just fine if I trigger the error using curl or the swagger interface.
However, when I call the handler inside my test, I know the exception is thrown, but instead of my error response, I just get nil.
Any ideas would be much appreciated. I've been staring at this for a couple hours and am at a total loss.
do you have a catch all 404 style handler in your routes? if you do and no other route matched you would get that response, not nil, if you don't you definitely could be getting nil because a route is matching like you think it should
@hiredman: Thanks, I'll doublecheck routing.
@hiredman: Yep, that was it. Thank you very much! Hopefully next time it won't take me this long to notice the missing "/". :face_with_rolling_eyes:
I will definitely do that.
i've just taken a job at a shop that has a "NO JAVA ALLOWED" rule. that means no jvm either, and that means no clojure.
they also frown on node too, so no clojurescript either.
and no CLR
so i suppose my options to use clojure at all are maybe cljs on v8
@kenrestivo: …so what do they use? PHP?
python and erlang
I’d like to see Clojure on the Erlang virtual machine. But I’ve said that for many years. Just ask @bridget. 😛
it would not be a small project, i expect. elixir might be interesting once it matures though.
but clojure on the BEAM would be very nice indeed
may be a chance to play with lisp flavored erlang http://lfe.io/ 😉
What I mean by “it’s not Clojure” is this: one of the biggest value proposition for CLJS is that you can write common libraries that can be used by both Clojure and CLJS simultaneously. That kind of code reuse isn’t possible for LFE (to my knowledge), so.
In the same way that a Big Feature of having JS libraries in npm is that the code is usable both in Node and for frontend stuff via Webpack/Browserify/etc.
@kenrestivo: there is also https://github.com/hylang/hy
wait, wasn't that tim's project?
the guy who wrote the go macro in clojure?
This is another one: https://github.com/pixie-lang/pixie
that's the one that tim did, thanks. both look interesting, will try, thanks
e.g attempting to run lein bikeshed on lein bikeshed gives me errors regarding not finding my local (on disk) of lein bikeshed in clojars
are you sure you have a copy of lein bikeshed on disk? are you using a snapshot version?
@hiredman: Because I keep getting Could not find artifact lein-bikeshed:lein-bikeshed:jar:0.3.1-SNAPSHOT in clojars
Ok this is what’s up. I cloned this https://github.com/dakrone/lein-bikeshed
This is in my profiles.clj
{:user {
:plugins [[cider/cider-nrepl "0.11.0"]
[refactor-nrepl "2.2.0"]]
:dependencies [[org.clojure/tools.nrepl "0.2.11"]]
}}
I wonder whether it’s causing a conflict because of:
lein deps :tree
Warning: refactor-nrepl requires org.clojure/clojure 1.7.0 or greater.
Warning: refactor-nrepl middleware won't be activated due to missing dependencies.
Warning: refactor-nrepl requires org.clojure/clojure 1.7.0 or greater.
Warning: refactor-nrepl middleware won't be activated due to missing dependencies.
Possibly confusing dependencies found:
[org.clojure/tools.nrepl "0.2.11"]
overrides
[cider/cider-nrepl "0.11.0"] -> [org.clojure/tools.nrepl "0.2.12" :exclusions [org.clojure/clojure]]
Consider using these exclusions:
[cider/cider-nrepl "0.11.0" :exclusions [org.clojure/tools.nrepl]]
[cider/cider-nrepl "0.11.0"]
[org.tcrawley/dynapath "0.2.3" :exclusions [[org.clojure/clojure]]]
[clojure-complete "0.2.4" :exclusions [[org.clojure/clojure]]]
[org.clojure/tools.cli "0.3.1"]
[org.clojure/clojure "1.4.0"]
[org.clojure/tools.namespace "0.2.6”]
[org.clojure/tools.nrepl "0.2.11”]
Does REPL bind results of recent evaluations to some symbols? Something like $3
to refer to the result of evaluation three commands back.
So
(future (Thread/sleep 1000) (println (/ 1 0))
never throws an exception if you don't deref the future. Is there an easy, fire-and-forgot abstraction like a future that triggers the default exception handler? I don't care about the result of the call.hi, can someone help me with a wrong namespace in my clojure? I'd like clojure-update-ns to put the correct ns in.
I run leiningen 2.6.1, SpaceMacs and am trying some code in an new empty project created with lein new app
no, just an empty project. had trouble auto setting the ns in another project so just started a new one to test this.
I open a new file in src/app/main.clj and add (ns bla), run clojure-update-ns and get: (ns ......Repositories.clojure.myapp2.src.myapp2.main)
@jiyinyiyong: there's a #C053K90BR channel
@jiyinyiyong: can you share your build.boot?
looks like you're passing something to an option that expects something diffferent
there's a syntax error in the file
Anybody has any clojure project that needs maintaining? I couldn't find any channel for people who wants to contribute(Perhaps it's a good idea to start one?)
List of active projects looking for contributors: http://open-source.braveclojure.com/
Hi everyone! We're planning on moving our Rails app to Clojure and would want to keep our Rails templates during the transition time. Is there a way to render Rails templates in Clojure (or Java)? The reason we need this is because templates will probably change at the same time as transition happens and we don't want to update them in two different places/templating languages. Eventually we'll switch to Clojure templating library completely, of course. Or it isn't worth the effort and we should just rewrite templates to Clojure from the beginning and deal with duplication? Thanks for your thoughts.
I'm getting "Wrong number of args (-1) passed to:" when calling a declared macro from a function. Smallest case I can replicate with is this: https://gist.github.com/petterik/dfe3d7de04c3bf770b26 Using Clojure 1.8. Has anyone else seen this? What can be done?
@petterik declare the function, and define the macro first, then the function. Declaring a macro does not seem to work, I have no idea why.
declaring a macro doesn't make sense. macroexpansion happens at compile time, you can't retroactively macroexpand
@petterik That's not a macro, is it ? Macro's take their parameters and generate a list of code that's executed afterward
(declare fail) (defn fail* [m] (if (map? m) (fail 1) m)) (defmacro fail [m] `(if (map? ~m) (fail* ~m) ~m)) (fail 1)
wrt the -1
arity exception, that's actually a known bug http://dev.clojure.org/jira/browse/CLJ-1279
could someone explain why these lines are needed https://github.com/ninjudd/classlojure/blob/master/src/classlojure/core.clj#L81L86 ? I tried to return just result (not a java core class) and it worked
In lein project.clj files, is there a way to refer to parts of the project map that is transparent to plugins? Specifically; I’m trying to get @weavejester’s lein auto
to also watch resources/
. By default it only watches Clojure source paths, Java source paths and test paths. However, I would prefer to specify that I only want to add the resources path, and, if that is not possible, at least specify a reference to some value in the project map so I don’t repeat e.g. the resource path several times in project.clj
lein auto does this manually: https://github.com/weavejester/lein-auto/blob/master/src/leiningen/auto.clj#L59-L62
also you might wanna close http://dev.clojure.org/jira/browse/CLJ-1078
keymone: And if you don’t really want blocking but maybe want fake blocking, my favorite async lib is manifold
@lvh: would something like :auto {:default {:paths [:source-paths :java-source-paths :test-paths "resources/"]}}
work?
or whatever task you're using
java.lang.IllegalArgumentException: No implementation of method: :as-file of protocol: #' found for class: clojure.lang.Keyword
lvh: Just to be clear… you want lein-auto to refer to paths already set in the project file?
weavejester: Well, ideally I want lein auto to refer to the paths already set in the project map, i.e. correctly work with profiles
weavejester: What I really want to accomplish is for lein auto to start watching my resources path 😉 but ideally my lein auto configuration doesn’t duplicate where sources live, java sources live, &c
So you’ve got it working, but the problem is that you’re duplicating data?
Specifying the paths in both :resource-paths
and :auto {:paths …}
, for instance?
lvh: Ah, I see the problem.
I think I’d accept a patch where keywords would be substituted for their equivalent values.
For speed of development and for building a crud website with server side rendered pages (form, databases, use auth), would any of you really choose Clojure instead of something like nodejs ? (or even rails)
I know Clojure’s web libraries fairly well, so personally I’d be faster with them simply due to familiarity.
However, someone who already knows Rails, and is only concerned about getting something out as quickly as possible, is going to be faster with Rails I suspect
I see Clojure’s strength as being able to marathon rather than sprint.
The problems I’ve had writing web apps hasn’t come at the beginning
But in the middle when the code is getting twisted up and complected.
@lockdown: there is this… http://www.luminusweb.net but I personally like building my stuff one component at a time
I like component as well, which is why I put together Duct
oh nice! this is my cup of tea @weavejester
new to the ecosystem but I'll give a small project a try, I guess for small stuff it doesn't really matter much, but as all of you said, you get more flexibility with time
lockdown: I’m being pretty conservative with it so far. I don’t want to add something, then later change my mind about it, because templates are hard to change after they’ve been used.
We’ve used a mix of CFML and Clojure very successfully for web applications — CFML for the framework / Controller / View portion and Clojure for the Model. We’re moving to Clojure Controllers at this point and, where we’re not generating complex views, we’ll move to Clojure full stack over time.
lockdown: So maybe eventually, but there’s a lot I want to do before then.
lockdown: Well, the generators need an overhaul. I think I might just make them into functions, since Duct is designed to have a REPL open anyway, and running a function in a REPL is faster and possibly more convenient.
lockdown: I also want to add some .dirlocals.el file to the locals generator, so that ClojureScript and Reloaded works with Cider out of the box.
lockdown: And I’m thinking about formalising my ideas around “boundary protocols”.
weavejester: nice stack, all the web libraries I have hear from Cloure, all by you , comparing it to luminus looks more simple and organized to me
Luminus I think is simpler to get started with, maybe?
Duct uses Ring, which isn’t natively async, but you can use servers like http-kit which have async support.
I’m working on an application that uses websockets heavily. It doesn’t use all of Duct, but a good deal of the components I developed for Duct I share with this app.
weavejester: from your readme I could see what duct does pretty quickly from luminus not so much
Thanks for the vote of confidence in the docs.
weavejester: oh I see, do you have plans for an async Ring or you want to leave to other web servers?
Well… I started writing Ring-CPS, which is async with continuation-passing-style. But then I realised there’s no common async I/O between webservers, except maybe with callbacks.
So I’d essentially need to write an NIO abstraction
So I shelved the project for now. I might come back to it later.
I tend to be sporadic in which projects I work on.
On the subject of Duct, I have a presentation I need to link from the README: https://skillsmatter.com/skillscasts/7229-duct-covered
@lockdown: CFML = ColdFusion Markup Language — which is really a misnomer these days since it’s more a compile-on-demand dynamic scripting language (like JS but on the JVM). We’ve used a FOSS implementation for years (Lucee, formerly Railo).
lockdown: My view is that async just complicates most applications. If you don’t need async, blocking is easier to reason about.
lockdown: http-kit
Back in 2009, I wrote a lightweight MVC framework for CFML (that became one of the two most popular MVC frameworks in CFML) and I ported it to Clojure and that’s what we’re using at World Singles — both the CFML and Clojure versions 😸
weavejester: so with ring/jetty, jetty just spawn multiple threads and one connection per thread is used right?
lockdown: Right.
Yeah, there’s a threadpool.
weavejester: cool, is compojure more oriented towards server side rendered pages than for a http api?
lockdown: Compojure doesn’t care. It just handles routing.
I like how Clojure is fast, so for this computationally intensive little project will suit better than ruby or nodejs
nothing really serious, I'm new to all this stuff, having know scheme, clojure is attractive 😉
weavejester: I asked about compojure because found this compojure-api lib while search for compojure
compojure-api is build on top of compojure and made for building restful APIs
I didn’t develop it, though.
Or have used it before
So I can’t tell you much about it.
@lockdown: If you have questions about Compojure-api we have channel #C06GSN6R2 for talk about Compojure-api and other libs using Ring-swagger. Also you can just ask here as me and Tommi have highlight set to "compojure-api".
lockdown: I guess because it’s useful, particularly for APIs that place a lot of emphasis on URLs.
@lockdown: I don't know how to answer to that 😄 Maybe because we could?
Routes in Compojure-api have metadata so we can use that metadata to give a name to a route and use that for "reverse routing"
weavejester: deraen: ok, I'll study this further instead asking dumb questions, new to web stuff, and studying my alternatives 😉 was just wondering why one had this feature and on the other not
deraen: I guess this helps with hypermedia stuff I have been reading of lately right?
Compojure doesn’t because I don’t like leaky abstractions. I’d explain more… but I need to go now, I’m afraid
No problem. Bye!
@lockdown: Yes, if will be helpful if you want to create urls to other routes inside your backend app. Honestly, it is not something I have used much myself.
@lockdown: Compojure-api should work with any Ring compatible server. At Metosin we are using aleph, http-kit and jetty.
@lockdown: Yes. Mostly with SPAs, but often the backend also exposes some routes for third party applications for integrations.
so after having experience with those three servers, do you have a preference one way or another?
Not much. Mostly the differences are with using websockets. Aleph and Http-kit are nice both.
Aleph has its own abstraction over websockets right?
Is there anything that uses core async channels to talk over websockets?
Chord works with Http-kit and Sente should work with multiple servers
thanks, I will check both of those out
is it possible to use/require all the dynamic variables in a ns but not the functions? (without explicitly listing them)
how can I get documentation like http://clojure.github.io/core.async/ served up locally when I'm offline?
you could write a function to do it - but you'd have to require that then call it
cider is great for search for docs of a function I know, but not browsing what's available
the use case is that I'm learning clojure and I want to be able to explore the stdlib and the key libs I'm depending on
@fommil: well, I was suggesting you could clone your dependencies and run autodoc on them
@rickmoynihan: cool, this is interesting
there is also clojure.repl/apropos
(which is included by default when you spin up cider)
user> (apropos "transact")
(datomic.api/transact
datomic.api/transact-async
datomic.connector/create-transactor-hornet-connector
datomic.coordination/lookup-compatible-transactor-endpoint
datomic.coordination/lookup-transactor-endpoint
datomic.memory/aws-transactor-settings
datomic.memory/transactor-cache-bytes
datomic.memory/transactor-settings
datomic.peer/transact
datomic.peer/transact-all
datomic.peer/transactor-endpoint
datomic.peer/transactor-unavailable)
@fommil: the documentation is in your ~/.m2 folder. you can browse jar files with emacs just fine
@bostonaholic: I did (apropos "async")
and it found some obscure methods with async in the name, didn't pick up on the package
@fommil: also there is Dash. I don't use it a lot, but I just started it and found I have some core.async docs in there. https://www.dropbox.com/s/llsy922v8f7e7rr/Screenshot%202016-03-24%2021.12.43.png?dl=0
dash is nice
@borkdude I have that too, but it's not doc browsing. The usecase is about sitting back and seeing *what* is available, not how it does it.
OK. Then ~/.m2, Dash or this: https://www.httrack.com/
being able to see the ns broken down and letting me browse the functions, that's very useful. Even better if package / jar -level docs are available to explain a thing. I suspect I'll struggle with midje when I'm offline
@borkdude: How does that compare with using wget -M? That's what I usually use for offline mirroring.
@nkraft: that's what httrack does for me, with rewriting of relative urls if needed, those kinds of things I guess
@borkdude: Wget does all that, and a lot more. wget --help is a good rundown. I've been using it to mirror sites, converting links along the way. It can also take a regex to exclude or include urls. It's pretty cool, especially in scripts. I'll have a look at httrack too to see what else it might do.