This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-21
Channels
- # beginners (201)
- # boot (125)
- # cider (3)
- # cljs-dev (21)
- # cljsrn (165)
- # clojars (8)
- # clojure (332)
- # clojure-belgium (1)
- # clojure-gamedev (8)
- # clojure-russia (75)
- # clojure-spec (25)
- # clojure-uk (96)
- # clojurebridge (2)
- # clojurescript (130)
- # code-reviews (16)
- # cursive (26)
- # datomic (20)
- # devops (6)
- # emacs (6)
- # hoplon (90)
- # jobs (9)
- # luminus (2)
- # off-topic (4)
- # om (65)
- # onyx (5)
- # pedestal (4)
- # protorepl (6)
- # re-frame (34)
- # reagent (12)
- # ring (4)
- # ring-swagger (7)
- # specter (2)
- # test-check (8)
- # untangled (2)
- # vim (1)
- # yada (6)
@pandeiro the classpath is how dependencies are resolved including dependencies between namespaces in your own source directory
years ago the compiler did build only (mostly?) from a source directory but this just a huge pain since that’s not how Java resolves resources
@chrisoakman cljs-oops[1] provides aget on steroids: [1] https://github.com/binaryage/cljs-oops
newbie question: is format
not available in ?
@esanmiguelc No it is not. There is goog.string.format though. See https://google.github.io/closure-library/api/goog.string.format.html
thanks @kenny
Is it possible to get a function off of an object? Something like this:
(let [x {:a "a"}
-lookup' (.-lookup x)])
@kenny to override a method on a deftype
use extend-type
or extend-protocol
, but that is probably not a good idea to do
@kenny if only thing you need is alias for object method, wrap it into anonymous function: (let [-lookup #(.lookup x %)])
what part doesn't work, @rb1719 ?
on-click
needs to be an anon fn, not a fn call
@pesterhazy do you mean #(swap! change (replace-value %)) because I tried that and it doesn't work either
Try starting with a known good base, they add things from there
It feels like you're doing too many things at once
Is there any way to debug this?
ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input: /home/ubuntu/project/externs/google_maps_api_v3.js at (unknown source) line (unknown line) : (unknown column)
@rb1719 , oh and it should be :on-click #(swap! tdata replace-value)
edited ^^
@pesterhazy I have tried :on-click #(swap! tdata replace-value) but when I click the button, it removes the table. Because at first the table shows YUM.N and then when you click the change button it should change YUM.N to hello. Do you have any idea why it's removing the table?
CLI arguments are correctly received using :none
or :simple
, but not :advanced
. The quickstart seems to suggest using :simple
should be enough for Node though.
I think you'll find lots of unexpected stuff when compiling code for Node in advanced
I don't think it was ever a goal to make it work
Lumo releases for example use :simple
Maybe the quickstart should discourage it a little stronger then, I’m fine with this, but as a cljs+node newbie I didn’t know this
@anmonteiro how do you develop for node, just output a new file and run it, or do you use hot reloading for node as well?
Lumo's use case is non-trivial
I just output a new file and run it
I don’t know if there is such a thing as hot reloading for node, just wondering how people use it
I think there is, and that Figwheel supports it?
let me look
@borkdude I'm aware this exists, but I've never tried it: https://github.com/bhauman/lein-figwheel/wiki/Node.js-development-with-figwheel
Can anyone give me general advice on integrating with a native JS library written in ES6 and ordinarily integrated into other JS stuff via npm and webpack? I'm a bit baffled on what the cljs equivalent of import { StyleSheetServer } from 'aphrodite';
is
@timgilbert my advice would be to package all of the external dependencies together using normal JS tools (ie. webpack)
and then either include this in your build as a :foreign-libs
or leave it out completely and just add some externs for it
I'm targeting the browser, yeah
@borkdude I've been playing with using node for isomorphic rendering and I followed that link about figwheel and it seems to work for me although I'm having to customise it a bit and a few things broke
I’ve been wondering about the preference for async in JS. In a browser I could imagine that this is done to keep things responsive. But why is the fs api in node async for example
@borkdude node is async because it only has a single thread, if you were to wait for IO you could basically only ever process one request at a time
@borkdude some of us have a preference for async everywhere - all my backend clojure is async
@borkdude fighweel does support node js hotreloading, as long as you set up your cljs project with it
i only ask b/c i’ve suffered many a bad date/time library in my career and they are kinda hard to evaluate b/c the api surface area is always so large
@bbloom I would recommend moment.js: http://momentjs.com/
yeah, i’ve foudn moment to be pretty good - was considering just using it directly via js interop
That would be my approach as well.
i think that’s what i’m gonna do - if for no other reason than i already know the api, thanks both of you
I made a cljc wrapper for clj-time and moment js, but I can’t open source the code yet. 🙂
@bbloom cljs-time mimics clj-time's API
so if you're happy with one ...
I normally find the 4 operations I need and write up a tiny wrapper around goog.closure stuff
it’s stuff like setTime, setUTCMonth, etc on the goog interfaces that i dont’ want anywhere near my code
I have to say I'm not crazy about cljs-time's API, you wind up needing to import a lot of namespaces to do simple stuff
worse than null?
moment.js’ interface is nice b/c it relies on context and dynamism for things that are contextual and dynamic - ie rather than try to enumerate all the parts of a date/time as individual vars, you can just compose some strings to specify what you want
i want nothing to do with owning a datetime lib - holy hell, that sounds like a nightmare
or we could just stop time forever, it would simplify a lot of things /supervillian
Time for me to do the last nights Advent of Code problem. I like doing these problems too much.
i’ve got a function i’ve been putting off writing all morning, if you want another finite coding challenge 🙂
i need partition-by where the partitioning comparison is relative, not equality - ie partition whenever there is a gap in time
so like bucket-by
no, just attempting to coin a name
seems like (partrition-by #(< delta (- (second %) (first %))) (partition 2 1 coll))
gets you 1/4 of the way there?
i was thinking more like partition-when plus a separate pass to compute the delta. so then (partition-when #(> (:delta %) threshold) ...
oh man, it’s been too long since i’ve done 4closure - i forgot about overlapping partitions!
throw in (map (juxt comput-delta identity))
for extra fun-times
(and mutatis mutandis on the rest, of course)
@noisesmith this doesn’t quite work b/c if you have two gaps in a row, then you won’t get partitioning b/c you’ll have true = true
ahh! - so you need a reduce I think
@bhauman: sweet! So changes worked for you? Still thinking about how to handle es6 sources