This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-04-29
Channels
- # admin-announcements (1)
- # aws (10)
- # beginners (76)
- # boot (53)
- # braid-chat (1)
- # cider (80)
- # cljs-edn (3)
- # clojure (65)
- # clojure-belgium (2)
- # clojure-gamedev (2)
- # clojure-nl (3)
- # clojure-poland (1)
- # clojure-russia (39)
- # clojure-uk (14)
- # clojurescript (91)
- # cursive (62)
- # datascript (1)
- # datomic (9)
- # dirac (34)
- # emacs (25)
- # error-message-catalog (8)
- # events (1)
- # hoplon (88)
- # instaparse (1)
- # jobs (2)
- # jobs-discuss (6)
- # lein-figwheel (7)
- # luminus (43)
- # mount (5)
- # off-topic (7)
- # om (28)
- # onyx (61)
- # planck (4)
- # re-frame (27)
- # reagent (3)
- # remote-jobs (2)
- # spacemacs (3)
- # untangled (136)
is there any library you guys can recommend for doing matrix algebra in cljs + clj? hopefully something that can compute determinants, eigenvalues/vectors, and row reduction
My first reaction is core.matrix
but I'm not familiar with it so I don't really know what it does 😐
thanks i’ll check it out
Hi, does anyone have experience with organizing assets like css, images, and fonts in clojurescript? In javascript, it will have module bundler like webpack taking care of that. Just wonder we have sth similar or what is the way clojurians would do?
i’m not sure if you can actually load css the way webpack does using a module system. most people tend to have a resources/public directory and inside of there you might have a css folder and a js folder etc
then you can use something like figwheel which will watch your cljs/html/css and auto reload everything when anything changes without losing application state
i would google around however, I know it is possible to break up your app into separate modules which can then be loaded as needed, because I’m guessing that why you were asking
if it is an optimization thing, then what I suggested above won’t really help you
actually, I can achieve that by using sth like webpack to do the hard work for bundling assets
read this http://swannodette.github.io/2015/02/23/hello-google-closure-modules/ also when it comes to css you can check out https://github.com/noprompt/garden with garden you can generate css using clojure data structures, and then load them as needed, so you can separate it up into only the minimal css needed for page load. then as people navigate to other pages you can inject the needed css.
I like to use garden but sometimes I just want to load the predefined css lib like bootstrap
your not a fan of using a cdn? then you could just toss a link into your html
but if you are using bootstrap that is something your whole app will need anyway right? so is the cost of just loading it upfront not worth it for you
so i think it will be fine to just download it and put it into your resources/public
if performance becomes an issue then try something more complicated
no problem
Hi all, I’m still at the beginning of my Clojure learning path. What is the recommend way to handle exception with clj-http ? From what I see in the doc, a simple try/catch is fine but as I collect the data directly within the let I’m not sure on how to do this ? Any idea ? http://pastebin.com/9cFZJQNA
@lucj06: Using slingshot’s try+
is very nice with clj-http, but it’s still a try/catch setup, which sounds heavier than you were hoping for. Just for reference, I hope you’ve read the clj-http doc about this https://github.com/dakrone/clj-http#exceptions
There may be a way to ask clj-http to not throw exceptions on error status codes (but you’ll still get exceptions for things like timeouts, those come from deeper down the call chain).
@bruceadams: yes, I saw this doc but was not sure how to handle this. Is is a good practice to use a try/catch within a let ?
I do it: try/catch within the bindings part of a let. I’m not sure if it’s good practice or not. ¯\(ツ)/¯
doing it inside the let bindings would mean you still want the code inside the let to run even if case of an exception
in fact I just want to catch the error if the data cannot be retrieved and return an error message
And yet, keeping a try
narrow avoids catching exceptions from actions other than the intended one.
i just discovered the advantages of transducers, holy shit this provides so much more flexibility!
it's like a map, or reduce, but then having the entire context at your disposal, instead of just a single item
am i correct that transducers are the preferred way to go if the transformation i'm trying to do are more complex than a typical map operation allows to do ? for example, transform a big nested structure into a "flat", denormalized object ?
Probably, yes. A big benefit is that they will transom your data in a single pass, instead of generating intermediate representations
@lucj06: note that data
will be bound with whatever value log/error
returns (maybe nil
?)
@bruceadams: hum I agree… this is bad. Any advice on how to do this ?
@bruceadams: I do not get, from the doc, how you can affect the result of the request (let’s say it’s an api that return json) to a var.
@lucj06: I’m not sure I understand what you are asking. Each catch
can contain multiple forms, can return nil
from one like this:
(catch [:status 403] {:keys [request-time headers body]}
(log/warn "403" request-time headers)
nil)
@bruceadams: in fact, I’m not sure what is the correct way to mix let and catch in my case. Should I embed try/catch in the let or the other way round ?
So, I can see that you want to log a message for failures (which makes sense). What happens next? Where do you want your program to go from here?
(In my one serious use of clj-http, my try+/catch was typically much higher up the call chain, not very near the call to clj-http. I assumed, up at that higher level, that anything with a numeric status
came from clj-http.)
I’m curious whether there are any docs that would explain the craziness that is a modern flexible clojurescript development environment
like one enters the clojure world and picks up emacs/cider because not to high learning curve and (eventually fulfilled) promises of ease of development
@puhrez: the clojure/cljs community has a lot of really awesome tools. So far I’ve just been focusing on using the ones I need at that moment and keeping aware of the general shape of tools that I don’t need so that I don’t miss a good reason to learn them. Setting up leiningen with custom profiles, and hooking it up to cider and getting emacs set up (for those of us who are not emacs-natives), etc. is a lot, and also, by the end of that list: you haven’t written any code!
So I’d say prioritize the stuff closest to writing code (figwheel, components) before the environment stuff like emacs/cider unless you have a particularly strong urge to learn those things (I’m assuming you have a meaningfully finite amount of time to spend on clojure stuff, otherwise just learn everything! lol).
@bwstearns: the thing is I’ve written clojure code, to production even! but now that I’m like let me take the full stack approach I want to maintain the same dev experience I’ve had with emacs/clojure/cider the whole figwheel stuff seems so familiar but oddly difficult to integrate
@puhrez: oh cool. I've just been using clojure for personal stuff so far so you're way ahead of me there. I think the thing is that there are just a lot of tools that all play together and it's a young enough ecosystem that there isn't a one true way yet. It might also be a touch of the lisp curse in that people can hack stuff together easily enough often enough that a lot remains in the state of solving "my 80%" of a problem instead of getting fully generalized.
:D I'm commuting or I would cite specifics but I've experienced a lot of clojuretv's videos on YouTube being helpful for tool setup because watching someone set it up can be easier than reading a howto since you can see the rest of files that may make assumptions that you weren't aware of.
@puhrez: Have you looked at https://cider.readthedocs.io/en/latest/up_and_running/ especially the section "Using the Figwheel REPL (Leiningen-only)"