Fork me on GitHub
#clojurescript
<
2017-02-18
>
andrea.crotti00:02:08

probably missing something slightly obvious

andrea.crotti00:02:21

but if I want to generate something like this [:select [:option "one"] [:option "two"]]

andrea.crotti00:02:41

where the two options are generated by a for loop

andrea.crotti00:02:55

how can I actually do it?

andrea.crotti00:02:10

I can do easily something like

(mapv (fn [v] [:option v]) [1 2 3])
[[:option 1] [:option 2] [:option 3]]

andrea.crotti00:02:17

but then can't find the right magic to compose the two things

andrea.crotti00:02:11

argh yes sorry I managed (vec (cons :select (mapv (fn [v] [:option v]) [1 2 3])))

andrea.crotti00:02:14

I doubt it's the best way though

pesterhazy00:02:56

(into [:select] (map (fn [v] [:option v]) ..))

andrea.crotti00:02:19

ah great thanks always forget about into

pesterhazy00:02:24

a proposed law: if you're looking for a coll processing fn for more than 5 min, reduce or into is probably what you're looking for

andrea.crotti00:02:42

sounds reasonable 🙂

andrea.crotti00:02:15

from all the other programming languages I've seen into is a bit of an outsider

andrea.crotti00:02:24

that's also why I always forget it

mfikes00:02:36

into is a wonderfully odd fn 🙂

pesterhazy00:02:58

think of it as a short cut: (into init xs) = (reduce conj init xs)

pesterhazy00:02:01

(looking at the source...) that's actually how it's implemented!

andrea.crotti00:02:55

ah thanks nice

andrea.crotti00:02:09

is there an easy way to just dump the app-state while debugging in clojurescript?

andrea.crotti00:02:52

should it be available in the browser console?

pesterhazy00:02:21

(js/console.log (pr-str state))

pesterhazy00:02:05

if you're using reagent, data-frisk is amazing (you can probably use it if you don't)

andrea.crotti00:02:18

I'm using reagent yes

andrea.crotti00:02:23

ok cool I'll have a look thanks

qqq01:02:57

omg; pause on exception --> jumps to cljs line --> is amazing

mss02:02:11

hey all, quick quick about how recursion vs trampoline works in cljs. building up collections via recursion that can become somewhat large (mid single digit million maps of 5-10 k/v pairs). right now I’m doing the collection buildup through a simple loop/recur, but I’m noticing serious performance degradations when I get into a collection with a few million members. I don’t know if that’s normal behavior or not. maybe I just shouldn’t be playing with collections that large. I wonder, though, if using trampoline instead of loop/recur would be more efficient. having trouble finding info about the performance characteristics of one v another, would love any insight that people can provide on that

thheller08:02:12

@mss first step would be to use transients

thheller08:02:49

but millions of things in JS will start to degrade since the GC will kick in

thheller08:02:56

but no trampoline would not be more efficient

dimovich10:02:03

greetings fellow clojurians

dimovich10:02:43

how can I approach displaying some google calendar events on a page with cljs?

dimovich10:02:30

or maybe there is another service more suitable for this?

hlolli21:02:51

how does one :cljs/quit a nodejs repl via piggyback so that the node process is destroyed as well? When I restart piggyback few time I start collecting zombie node processes.

qqq23:02:37

what is the main disadvantage of dirac (besides setting it up)? I just got dirac working, and I can'r belineve I've been doing cljs for 6 months without dirac

darwin23:02:19

when you develop a serious addiction on it and I stop updating it to work with new chrome releases, you will scream in pain, so be careful! 😉

qqq23:02:37

@darwin: lol, all this time I had no idea you were active dev behind dirac; if I were you, I'd create a kickstarter every time chrome has a new release -- and only update dirac when the ransom is paid

qqq23:02:58

^-- /sarcasm

darwin23:02:31

hehe, adding it to my long list of ideas 🙂

qqq23:02:39

the one thing that could make it better -- is that the "source *.cljs view" in dirac is wasted; id'bne nice if it could somehow comunicate with the emacs 25 running on my system -- so it jumps me into the right line in eamcs and I just edit it in emacs

darwin23:02:38

such integration would be nice, but not on my list at the moment

darwin23:02:50

maybe we should move to #dirac, ok?