This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-01-16
Channels
- # beginners (115)
- # boot (13)
- # boot-dev (13)
- # chestnut (1)
- # cider (1)
- # clara (10)
- # cljs-dev (21)
- # cljsjs (1)
- # cljsrn (2)
- # clojure (120)
- # clojure-dusseldorf (2)
- # clojure-greece (13)
- # clojure-ireland (1)
- # clojure-italy (3)
- # clojure-nlp (3)
- # clojure-russia (2)
- # clojure-spec (13)
- # clojure-uk (82)
- # clojured (5)
- # clojurescript (47)
- # core-async (2)
- # core-logic (8)
- # cursive (45)
- # datomic (2)
- # editors (1)
- # emacs (39)
- # fulcro (166)
- # graphql (1)
- # hoplon (16)
- # keechma (5)
- # off-topic (202)
- # perun (4)
- # protorepl (7)
- # re-frame (28)
- # reagent (13)
- # ring (27)
- # ring-swagger (16)
- # rum (1)
- # shadow-cljs (25)
- # spacemacs (20)
- # sql (141)
- # yada (4)
@pablore And you have your source code all under src
and your test code all under test
, yes?
I’m trying to figure out how to include react-dnd, which apparently is no longer part of cljsjs. The cljs Dependencies documentation has an example when the library code expressly sets a global variable, but it isn’t clear to me what one does in place of an import statement or a require statement because without that, there’s no name by which to refer to the library’s exports. Likewise with the “Packaging Foreign Dependencies” documentation, I don’t see where you name the global. Am I missing something?
@kara regarding the syntax, you may want to look at https://github.com/shaunlebron/ClojureScript-Syntax-in-15-minutes and http://kanaka.github.io/clojurescript/web/synonym.html
Hello Guys, if there is someone using cider+emacs, if so please just refer me how can i compile file which depend on another file and contain something like (require [ns1.hello :refer :all]), i got errors which refer all funtions from ns1.hello not defined ?
i'm new in Cider + emacs
it's working with (use)
maybe i made something wrong
if it's somebody else's file you're trying to use, have you included the correct dependency in your project.clj
file? what happens if you run lein deps :tree
on the command line - it should print out a tree structure of all your dependencies, which is a good way of checking to see if it can resolve the one you need.
If both files are yours (you've created them), are you working in the repl? I can't remember the syntax for use
(it's deprecated now), but require
looks like this (note the quote):
(require '[clojure.string :as string])
you can :refer
individual functions or :all
of them, but typically it's more idiomatic to alias the namespace using :as
(like above) and refer to the functions as (string/lower-case "BANANA")
if you're not in the repl, there's a shortcut to the ns
declaration that lets you require things, and it looks like this (note that :require
is a keyword):
(ns my-string-fns
(:require [clojure.string :as string]))
Hiii, I have a java client that returns guava ListenableFuture, and I want to wrap it up for clojure code. I tried to use (promise) and then add a callback on the java future, but I didn't find a way to set the exception on the clojure promise. Dereferencing the future works, but everyone that will want to work async will have to (reify) the callback on the future... hints?
^^ How about writing this as a multi-arity function? I.e. add an overloaded function arity with on-success, on-error callbacks. Makes sense?
This is what I came up with. WDYT?
(defn listenablefuture-handler
[lf on-success-func on-fail-func]
(-> lf
(Futures/addCallback (reify FutureCallback
(onSuccess [_ res]
(on-success-func res))
(onFailure [_ e]
(on-fail-func e)))))
lf)
(defn resolve-ip
([client ip] (.resolveAsync client ip))
([client ip on-success-func on-fail-func]
(listenablefuture-handler
(resolve-ip client ip)
on-success-func
on-fail-func)))
I can't make Leiningen work with new Clojure 1.9.0. If I create a new app with "lein new app myapp", and run "lein repl" it works just fine. But if I change the dependency "org.clojure/clojure "1.8.0"" to "org.clojure/clojure "1.9.0"" in project.clj, and then start "lein repl", it gives some odd error: Error loading cider.nrepl.middleware.test: java.lang.RuntimeException: Invalid token: ::clojure.test/once-fixtures, compiling:(cider/nrepl/middleware/test.clj:129:57) I tried to google about this but didn't find anything that could fix this issue. Any help would be appreciated. 😀
@kari.marttila what version of Leiningen?
maybe you need a lein upgrade
?
that's a cider error. i think ::clojure.test/once-fixtures
is invalid syntax in clojure versions lower than 1.9
Sorry, forget to mention that. Leiningen 2.8.1 and Java 8.
that has been valid syntax since clojure 1.0
whoops. apologies. what am i thinking of then? i thought there was a change in namespaced keys?
oh, actually using a full namespace there rather than an alias is newly invalid in 1.9!
sorry, forgot that
so prob need to upgrade cider I would guess
It's the plain project.clj template lein new app generates, there is no dependency to cider.
No, just trying "lein repl" in Linux command line. Works with Clojure version 1.8, not with 1.9.
or maybe you have something in your ~/.lein/profiles.clj ?
^ what alex said. brave and true uses and extremely outdated version of cider that requires the middleware in the lein profiles file
No. Just tried to upgrade my Clojure project from version 1.8 to 1.9. I have been using Clojure for about a year now (not total newbie anymore).
lein deps :tree | grep -i cider [cider/cider-nrepl "0.14.0"]
The double colon keyword prefix only works with namespace aliases that are set
up. In this case there is not a namespace alias `clojure.test`, so these
keywords are invalid.
a commit fixed thisThis is pretty weird. I even tried this in another LInux machine - same thing.
lein deps :why cider/cider-nrepl
lein help deps
for other tricks
- (let [frame (->> (concat (::clojure.test/once-fixtures (meta ns))
- (::clojure.test/each-fixtures (meta ns)))
+ (let [frame (->> (concat (:clojure.test/once-fixtures (meta ns))
+ (:clojure.test/each-fixtures (meta ns)))
@kari.marttila did you upgrade (or remove) that cider-nrepl dep? that's only necessary if you are using CIDER, and CIDER will inject that on its own so you should never need to set it. also possible somone in your dependency chain was a little careless
I tried to add :plugins [[cider/cider-nrepl "0.17.0-SNAPSHOT"]] => didn't work either.
Maybe I just have to continue using Clojure 1.8.0 😢
you shouldn't need to specify any CIDER dependency and we need to figure out why there's an old version laying around
@alexmiller put that in a thread but it should solve your woes. it'll tell us who our culprit is
lein deps :why cider/cider-nrepl [cider/cider-nrepl 0.14.0]
grep -i cider project.clj => nothing.
I.e. I created a new project.clj just using "lein new app myapp" earlier.
(defproject myapp "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.9.0"]] :main ^:skip-aot myapp.core :target-path "target/%s" :profiles {:uberjar {:aot :all}})
That's it. Thanks. My bad. grep -i cider ~/.lein/profiles.clj [cider/cider-nrepl "0.14.0"]
Damn, I'm in shame. 🙂
A rookie error, and now it went public. 🙂
I'll commit seppuku right after I fix this. 🙂
Just joking. But I must say that I'm really gratefull for your help.
and unless you are using cider-connect rather than cider-jack-in, there shouldn't be a need to specify CIDER's middleware
Yep. I must have added that when I started to learn Clojure, was experimenting with Emacs cider etc. Nowadays using IntelliJ IDEA + Cursive, and I must say that I'm really content with IDEA+Cursive.
and colin the author participates on cider issues as well. really great person and great product
And I also must say that I'm pretty happy with Clojure. Just implemented a micro service processing some Big data. Super cool to work with small S-expressions on a time, and Clojure is really cool to work with big data.
I must clean my ~/.lein/profiles.clj at the same time. Probably clean everything now and add later the parts I really need now.
I'm doing my humble part of promoting Clojure, see: https://medium.com/tieto-developers/clojure-first-impressions-2c6232f4b514
I have also trained a junior to use Clojure at our corporation (continued development of that micro service). Hopefully Clojure thrives - a great language.
@kari.marttila you might want to post it on #news-and-articles 🙂
@U051H0N54 Thanks for suggesting that. But I'm not a Clojure-guru, still learning. If #news-and-articles is the right place for that kind of blog articles, why not. 🙂
Guys, what's clojure way to deal with WARNING: update already refers to: #'clojure.core/update in namespace:
and so on. To have more imagination 😅?
You should namespace your function update
since clojure core already has one
No problems with that atm, but i thinks that's not good. Thought may be there are some best practices
the slight hitch is that we really want to server-render reagent components. so we either need to do everything cljs (e.g. macchiato), farm out the server-rendering to 2nd service, or re-implement reagent/react’s html rendering in clj
but aside from that, which way would ya’ll point a team building a fairly large site?
Arachne is still in alpha 🙂 Luminus is a collection of recommended libraries by the author of Luminus
I have used Compojure for routing with good success with ring, recently I've been experimenting with Pedestal which is not exactly a framework but can be used to create a backend http://pedestal.io/
:thinking_face: I’ve played with pedestal as well as ring. we are making a more “page model” app so I think that ring kind of matches our goals more. but I guess we can use any ring middleware with pedestal…
Me too and I have plans to try it more, here's using ring middle ware with pedestal - https://github.com/pedestal/samples/tree/master/ring-middleware
this is a good video about Pedestal - https://www.youtube.com/watch?v=4BMGlELVW20
I search a way to chain actions (like ->) but with "exception management", like Either (https://github.com/sanctuary-js/sanctuary#either-type).
What's the idomatic solution for that in Clojure ?
if short circuiting on nil is good enough, some->
and some->>
are great
if you need actual exception handling, you could use them as a basis and put each step in a try/catch maybe?
also the cats lib has an actual Either for clojure if you really want that
opinions on cats diverge - some think it’s great, others think it’s a waste of time
some->
is cool, but I would like to return a value.
Think to validation chaining, stopping on first error.
sounds like you do want cats either then
Cats may be used: https://github.com/funcool/cats/blob/master/test/cats/monad/either_spec.cljc#L145
cats looks like exactly what I want. Thank you !
I would like to gain experience in ClojureScript by implementing a single-page web app with it. The purpose of this comment is to gather suggestions on what JavaScript and/or ClojureScript libraries or frameworks I should consider using for it. The app is an experimental interface to certain kinds of data manipulation. The concept involves manipulating a graph where the vertices are little circles (or roundrects). When I click on a circle I would like a little window to pop up into which I can type formulas etc. Additionally, the software would automatically draw various lines between the circles. I would also like to be able to drag and drop the circles from one line to another or to reposition elements, etc. I am very vague about the details in part because I expect them to evolve as I play with prototypes. Some screenshots of something that looks along the lines of what I am thinking are in https://bergie.iki.fi/blog/noflo-jekyll/. I think that I could use Quil to do much of this (since you can draw lines and circles with it), but I am hoping that there might be higher-level libraries that already have components adapted to this domain.
@sabbatical2017 Two questions: (1) What is your current level of expertise writing webpages in any technology. (2) Do you anticipate a lot of server interaction or is most of what your doing going to be client side?
(1) I have almost no experience with writing web pages. (2) Mostly client side. Thank you!
I was a c++ programmer who left programming for a while and then came back and learned javascript. My advice: the big frameworks like re-frame and om will make things harder for you, not easier. They are designed to solve the problem of huge apps with multiple developers and introduce a lot of indirection. Because you are like me and don’t have all the experience with html, css, dom manipulation, and basic MVC concepts like how to manipulate state, my actual pedagogical recommendation is to get a few core things (like forms and maybe drag-and-drop) working with a simple react wrapper like reagent or rum.
Whether there are existing widgets you can incorporate, I’m not sure, because I’m not quite sure what you are trying to accomplish. But first you have to learn how to manage state, how to use react, how forms work, how css works, get a dev environment set up, etc.
I'm going to give the opposite advice - re-frame in particular took away a lot of those concerns for me when I first learned Clojure, and it has fantastic docs and a really solid frame for you to build something around. You barely have to understand react or reagent to get something going, and it gives you a lot of the tools you need to manage state nicely. There are also some very good videos and tutorials that you can follow to fill in the gaps for you and then fill those in as necessary.
That being said, to purely learn things about ClojureScript you've picked a pretty hard domain - so I would see if you can find similar examples already built in ClojureScript and start with the libraries they were built with. You could also start with the data model that defines what you want to do and then build the graphical parts off of that data.
from the link you provided as an example (NoFlo), you might find interesting http://www.reactive-streams.org and http://funcool.github.io/beicon/latest/ to stay in topic
Thank you very much for the advice! I will review all this and see if I can make any of it work with JointJS 😄