This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-17
Channels
- # admin-announcements (104)
- # adventofcode (3)
- # aws (1)
- # boot (651)
- # cljs-dev (21)
- # cljsrn (12)
- # clojure (81)
- # clojure-china (1)
- # clojure-germany (1)
- # clojure-miami (2)
- # clojure-nl (8)
- # clojure-russia (19)
- # clojurescript (208)
- # core-typed (1)
- # cursive (19)
- # datavis (55)
- # datomic (57)
- # events (1)
- # hoplon (102)
- # ldnclj (12)
- # leiningen (8)
- # off-topic (11)
- # om (127)
- # onyx (21)
- # parinfer (2)
- # portland-or (3)
- # proton (2)
- # re-frame (2)
- # reagent (6)
"stuck with lein" ... whereas I want to use lein, but ambly is so nice
maybe figwheel is better. I'll experiment sometime tonight
i feel like it would be better in general if we could all agree on one build tool instead of reimplementing it several other ways, especially since lein is a fantastic build tool
My apologies, I didn’t want to hurt anyone’s feelings. Lein is a solid tool, it has its quirks and learning curve. Now I’m pretty comfortable with it after mastering checkouts, profiles and cljs-build tricks. But all the cool kids are now using boot...
haha, I'm more railing against the general CADT-ness being imported from the JS community here
no feelings hurt afaict
I just don't understand the reasoning behind reimplementing all of Clojure's tooling instead of just tweaking it. it makes it a very difficult transition to go from vanilla Clojure to cljs
and now imagine transition from javascript to cljs (without prior java ecosystem knowledge)
I mean, you still have to learn a bunch of new things, right? Wouldn't it be better if those new things you learned were a standard set of tools for all Clojure dialects?
in a perfect world, yes. but in imperfect world, we need some competition and messy situations forcing us to evolve
sure. I certainly don't want to go the route of "don't ever try to make anything better". But I think that of all the things to try and rewrite/improve on, lein is far from the lowest hanging fruit. It's really good. It's probably one of the best build tools in any language, because it's built on maven, which is also one of the best build tools in any language.
I don't even like Java, and I almost wish I used it so I could have maven
that said, cljs is still in the rapid development phase so of course lots of people will take lots of different directions. It's just frustrating to get into if you aren't paying constant attention
there are what, three? four? different ways to get cljs running on iOS now
at least we mostly agree that React is the way to go, I guess
@anisoptera: as far as “best build tools in any language”, I’m not sure what your metrics are, but in my experience, it has a lot of quirks, and coming from javascript, I wish for something simpler / more approachable
I guess I don't see how it could really get much simpler than lein
like, stick your deps in a vector, run a command and away you go
well this is my point. shouldn't the focus be on improving lein's cljs workflow, instead of just deciding to write a new build tool, with hookers and blackjack?
now we have a bunch of people working on the same problem, but they're split between two different tools; and to a newcomer, we present a less unified front. what got me started in clojure was the fact that the "getting started" story was very clear
download lein, type this command, and away you go
i'm not against trying to do it better in principle (or i'd be writing asm or C) but I just don't think it's a good use of resources to reinvent wheels because this time we'll get it 20% rounder
i haven't had any problems with lein on cljs either, which is why i'm sort of confused as to the rationale behind creating a separate, cljs-only tool
@ananthmv: very much disagree - boot is a far better build tool especially for clojurescript. Sometimes you have to take the time to think through the pain points and get to a better place. The #C053K90BR team has done that - in spades.
Just ask folks like @jaen - and many others - who switched to boot and would never go back .
so what's it offer over lein? like, is there a comparison somewhere?
maybe I'm experiencing pain and I don't even realize it, I am open to that concept
theres a nice blogpost
See http://boot-clj.com/ — and the extensive wiki : https://github.com/boot-clj/boot/wiki
speaking of, we pushed v2.5 today and i wrote a little about it - http://adzerk.com/blog/2015/12/boot-2.5-released/ we're in #C053K90BR if you have questions or problems
boot is pretty cool. the cljs tooling is a little more composable than the figwheel experience, which has its perks
ok, I'm going to swallow my initial reaction at scripted builds and see if maybe this time someone did it in a way which doesn't lead to madness
@anildigital: understood — give a solid look — I think you will be pleased with what is there. LISP can do it
@anisoptera: boot is about programming (creating) instead of configuring (filling out forms). if you like to program, i bet you'll like boot 😺
So this is using the ‘controller as’ syntax that’s why you’re not seeing the $scope. I’m testing the digest aspect now but that doesn’t appear to be it. Angular runs it’s digest loop regardless and if you mutate a value on the controller or $scope it’ll repaint
ouu fancy
only thing I can reason about is that aset only works on vars in the global namespace
because if I pass window.i = {src: 0}
it works
maybe try (set! (.-src js-var) %4)
ouu fancy
let me try
no dice
strange
I don’t think it’s a js thing because the technique of passing a object and mutating it’s prop is commonplace. I’m actually doing that for it’s current implementation using Baobab.js which is a copy of Om cursors sortof
I have a abstraction layer that takes an object and updates it on state change.
very similar to add-watch
do you have a button or something that you are tapping that swaps the atom? wanna get a good feel for what yr setup is rn
ah figured it out
it was the $scope.$digest
cool what was the knot
how so?
way I was testing it looks like it was doing it on the same frame… maybe
yeah when i did something like this i had my watcher take a cb that included the scope digest stuff
I think this would’ve been solved if I added a watcher that kicked off the digest on any change in the atom
lol but I’m hacking together the angular code in a string that’s I’m serving from a jetty server running figwheel
much harder to write js that way
so I was trynig to proof of concept with as little angular code as possible
glad you've arrived at what you were looking for
thanks man I really appreciate you taking the time to hack it out with me!
np trying to build up computer karma for my next debug session 😄
sending good vibes your way man
thanks. best of luck! heading out for the nite. be sure to update us with your progress!
will do
im following this guide https://github.com/kittykatattack/learningPixi#introduction
https://github.com/xtrntr/demo <- my code
i really don’t get an error. i’m using https://github.com/alexkehayias/chocolatier this as a guide
Always great to watch this talk again https://m.youtube.com/watch?v=LNtQPSUi1iQ Love how they show pros and cons
I would like to merge a map into a existing map, using assoc-in. Is this possible?
I realized it with let
So i get the old data, then merge it with the new and then assoc-in to the database
@danielgrosse: is this map nested inside the structure you are assoc-ing into?
{:available-sessions {12345 {:id 12355}
}}
merge 12345 with
{:name „Name“
:add-info1 „foo“ }
actually I use
(fn [db [sess-id tour-info]]
(let [curr-data (get-in db [:available-sessions sess-id])
merged-data (merge curr-data tour-info)]
(assoc-in db [:available-sessions sess-id] merged-data)))
)
@darwin: yeah, I can understand not wanting to give up hot reloading, but boot has that as well in boot-reload
. That said, I haven't used figwheel extensively (a year ago it was hard to get all those lein-cljsbuilds, austins, weasels, piggybacks and figwheels to cooperate) so it might have advantages over boot's reloading. I'll probably take a look at it when I have some time and ask around on #C053K90BR if what you've done for figwheel is easily replicated with boot-cljs-repl
and boot-reload
, since those low-level details you meantion feel pretty specific, so it might not be straightforward.
@anisoptera: out of curiosity what is CADT-ness? Is it a bit like NIH?
You could go with
(update-in db [:available-sessions sess-id] merge tour-info)
Ah, thank you
@jaen: I think it could be : https://www.jwz.org/doc/cadt.html
@nha: hah, I suppose that makes sense. Javascript certainly has it's what's-the-flavour-of-the-week phase. LISPs had too. Hopefully the Java part of Clojure's heritage will weather that down a bit.
@jaen: I did not know that for lisps, but I've experienced it first hand for Node/Js. The Java "Give me one good reason to switch" could help, although I can't help but wonder why we have so many webserver libraries now
I'm not old enough to have experienced that first-hand, but LISP seems to have this notoriety of being language of programmers that are on one hand brilliant, on the other - sick with NIH and short attention span. Something as described here - http://www.shenlanguage.org/lambdassociates/htdocs/blog/bipolar.htm
(gevents/listen js/window EventType.MOUSEDOWN
(fn [e] ...))
Where gevents
is goog.events
, and EventType
is goog.events.EventType
.In Cljs we want to make all the operations that will occur on out app-state atom in a single function. For this we said we'll write the code like: '(defn change-title [title] (try (swap! app-state #(-> % (assoc :text title) ((fn [state] update state )) (assoc :text title) (assoc :text title) (catch js/Object e (swap! errors conj e))))'
could I do something like: '(defn change-title [title] (try (swap! app-state #(-> % (assoc :text title) ((fn [state] (let [data (<! ....) (assoc state :data data))) )) (assoc :text title) (assoc :text title) (catch js/Object e (swap! errors conj e))))'
Yeah, it's pretty interesting to see what kind of programmer the power and malleability of LISP appeals to and what are the downsides to this. Well, at least from a certain viewpoint. Hopefully Clojure avoids that well enough.
@jaen I don’t think that post says as much about LISP in general as it does about the (Common) LISP community post AI-winter
is om using actual react, or is it doing stuff the way react does it? also, my real question, can i use react thingies like react-three etc with om?
it definitely does a poor job of painting prior 30 years of LISP development, and largely ignores the Scheme narrative (and eventually Racket)
In javascript, you could actually use Ramda (http://www.ramdajs.com) to compose functions and ajax calls in a promise (http://ramdajs.com/0.18.0/docs/#composeP ). How can I do something similar?
@danbunea: in ClojureScript core.async is probably the most popular way to deal with asynchrony
you can of course use JS promises in ClojureScript but it’s not very popular far as I can tell.
I'm trying to use channels, howver from what I see a go block returns the channel, not the value read from it (go (<! (somechannel))
@danbunea: conceptually how is that different from a returning a promise and not a value (since async)?
and I want to compose that func in a way that allows async code (promises, channels anything that could work)
and my point is what you’re doing in JS isn’t going to be any different in the big picture from ClojureScript
someone said to me: (go (doto app-state (swap! assoc :context "loading") (swap! assoc :data (<! (async-get ""))) (swap! assoc :context "edit") (render)))
I'm just trying to make my swaps of the app-state from one to another, completely consitent
Is there a way in JS to see where the current script has been loaded from?
@martinklepsch: not from the script no
maybe using document.currentScript
and then looking at the src
attribute will do it..
@martinklepsch: doesn’t work at all in IE so as long as you are OK with that.
@dnolen: it's in a devtools context so I guess it's an acceptable tradeoff
hi all, I just published a new tutorial of the modern-cljs series (https://github.com/magomimmo/modern-cljs) which now uses boot and related community based task instead of leiningen/cljsbuild. This tutorial try to build a TDD environment with a CLJ and CLJS REPLs as well. It uses, with some shortcoming, both boot-test and boot-cljs-test tasks on portable .cljc files/namespaces. Hopefully someone will find it useful. Here is the link: (https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-16.md)
Looks quite nice. Though any particular reason you're using src/clj
/ src/cljs
/ src/cljc
instead of something more descriptive like src/backend
/ src/frontend
/ src/common
?
I think it's better to use per filetype dirs, the file handling depends on the type and not that much about the usecase
clj and cljc files should be included in build artifact, while cljs files don't need to be included in the build artifact
And you can still use descriptive names for namespaces
for me the distinction hinges on whether app or library. for libraries i use clj/cljs, for applications i use frontend/backend
I use src/clj
and src/cljs
for apps too, and then I use backend.*
and frontend.*
for namespaces
@juhoteperi: I see; but what about the Cljs macros then? do you put them in src/clj
because they are Clojure files or in src/cljs
since they are not needed in the resulting artifact?
@jaen: Humm, I checked couple of projects and couldn't find any macros 😄 Both should work, but if it's purely cljs macro and not useful for Clojure, I would put it in src/cljs
.
I guess that's sensible. What's the reasoning behind not putting those files in the resulting artifact?
Yeah, if they are not needed it will save few KBs, probably doesn't matter a lot
@jaen: what if the backend is on cljs/nodejs? I’d probably make a different classification. At the moment I’m happy with src/clj src/cljc and src/cljs
@magomimmo: then nothing changes, backend still goes into src/backend
and frontend into src/frontend
, I think. But I kind of understand the point of view deraen explained there.
I've used to use the same directories as you, but at some point I realised that descriptive names just made more sense to me. src/cljs
tells me litte, src/frontend
somewhat more; especially considering the fact I then have frontend
/ backend
/ common
in my namespace, so I know what it pertains to.
@jaen: i don’t care to much. I like to move the gears from one side to the other and viceversa (i.e. isomorphic application)
@jaen: So in your src/backend
and src/frontend
case, is src
the source-path and backend and frontend are part of namespace?
Right. So I use the same namespaces but I have separated the filetypes to separate source-paths.
Yeah, I noticed. And I agree if you want to exclude certain files from the resulting jar that might make sense. I just never felt a need to.
@jaen: it’s very hard to explain it here, even because the idea is still in my mind. I want to be able to move a module/service or whatever want you call it from one side to the others and viceversa…in a kind of p2p architecture
has anyone tried sending a prismatic schema
to cljs
via transit
?
I'm trying the following:
(ajax.core/GET "/api/schema"
{:response-format
(ajax.core/transit-reponse-format
{:raw false
:reader (transit/reader :json-verbose
{:handlers outpace.schema-transit/read-handlers})}
But I get No protocol method IEmptyableCollection.-empty defined for type [object Object]
@magomimmo: oh, that seems to be a quite interesting idea.
I'm trying to follow along here: https://github.com/outpace/schema-transit and here: https://github.com/JulianBirch/cljs-ajax/issues/108 Not quite sure what I'm missing
hello
do you know how can I detect a plain js object in clojurescript? in JS it would be like typeof x == 'object'
found the answer looking at js->clj
source: (identical? (type x) js/Object)
Hi all, I have something that is confusing me. I have piece of clojurescript that uses recursion to traverse a set of states stored datascript. At the tail I would like to reset an atom at each state and pause for a moment playing back the states from beginngin to current. This works with prn as expected I see each state printed to console, however the atom is only getting reset once it seems. Any thoughts what might be going on?
Does anyone know how to connect to the nodejs repl started by the script/repl.clj
script in the Mies template?
@juhoteperi: you were right about :dir and :resource-root. As I have time I’ll fix the tutorials
vipaca if I had to guess I’d say it’s getting reset vs. swap’ing with something that is accumulating the data you want
but I’d have to see it to know for sure
oh, but you’re using datascript, I don’t know much about that, sorry
I'm expecting the om component to trigger event based on state change of the atom, but this assumes that the event handler changing state has completed and in fact it has not.
Also, I was able to prn the reset! and see atom state changes when no rerender was occurring in app.
Is it possible to use ClojureScript with advanced-optimization enabled inside a Clojure process without actually touching the real filesystem for any of the compilation, and end up with a single string representing the entire JavaScript program after advanced compilation?