This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-03
Channels
- # adventofcode (107)
- # announcements (1)
- # asami (14)
- # babashka (67)
- # beginners (89)
- # calva (34)
- # cider (17)
- # clj-kondo (5)
- # cljs-dev (2)
- # clojure (57)
- # clojure-europe (52)
- # clojure-india (1)
- # clojure-italy (1)
- # clojure-losangeles (2)
- # clojure-nl (6)
- # clojure-uk (39)
- # clojurescript (40)
- # community-development (3)
- # conjure (3)
- # cursive (17)
- # datomic (11)
- # docker (13)
- # events (3)
- # figwheel-main (3)
- # fulcro (12)
- # graalvm (7)
- # holy-lambda (7)
- # honeysql (9)
- # introduce-yourself (5)
- # malli (9)
- # minecraft (3)
- # missionary (21)
- # nextjournal (7)
- # off-topic (52)
- # pathom (3)
- # polylith (11)
- # portal (3)
- # re-frame (21)
- # reagent (34)
- # reclojure (7)
- # reitit (1)
- # reveal (11)
- # shadow-cljs (68)
- # tools-build (12)
- # tools-deps (5)
- # vim (4)
- # xtdb (9)
Morning. So whoβs paying the bill for Pro Slack Access? π΅π΅π΅π΅π΅π΅π΅π΅π΅π΅π΅π΅π΅π΅π΅π΅
@paulspencerwilliams Per #announcements Slack have given us a complimentary Pro subscription for a year and we can apply for an extension each year.
@robert-stuttaford (one of the admin team) reached out to the head of Slack on Twitter and asked about it since we were in a free trial period of Pro, and this morning he and I were on an email thread with Slack's Chief of Staff for Customer Experience (what a great title) sorting out the details. We have reminders in place to reach out to Slack again in November '22 to ask for an extension.
Has your sanity survived working with CSS?
Thatβs great news - itβs nice to have history in Slack for our community. Haha, Iβm just about clinging on. My woes yesterday were really more about build pipelines etc than the css per se.
My sanity takes a hit every time I have to dive into CSS π Same with JS. What little hair I have left just starts falling out every time I have to debug anything beyond the most basic JS.
The language, the context, the ever changing landscape. I find front end stuff so tiring.
i've just re-implemented the non-view part of re-frame for the backend - i'm sure you'd love it π¬
it's actually really nice - i did it for the evented logic in a data-oriented game, but after programming with it for a while i'm thinking of rolling it out for our APIs too
Morning.
heh, can't find any emails with the zoom links, and I can't join discord... everything is broken >.<
Does anyone know an idiomatic way to treat a list of vectors like a matrix, i.e. carry out operations on the columns represented by the positions in the vectors?
e.g.
([\a \b \a \a]
[\b \a \a \a]
[\a \b \a \b])
how could I count \a in the columns?
Or, am I better off creating new data-structures from each position in the listed vectors, i.e. transforming the above to this:
([\a \b \a]
[\b \a \b]
[\a \a \a]
[\a \a \b])
I don't know whether what you have is an actual matrix or you just want to treat it like one. If it's the former, maybe have a look at Neanderthal, that is the only thing that comes to mind for matrix operations in Clojure
Thanks @conor.p.farrell I will take a look
If it's just a list of things that you want to do a column sum on, it's no different than working with any sequence of data, I think - the Kotlin equivalent would be myData.chunked(rowSize).map { it[column] }.sum()
@conor.p.farrell - Basically I have a list of vectors (all the same length). I need to count the number of instances of a specific value in each of the columns represented by the positions in the vectors, and I have no idea how to do that.
So, in my first snippet above, I need to know how many \a there are in the notional column that is represented by (get % 0) if mapping over the list
Which is why I asked if I am simply better off turning the list through 90-degrees (so to speak) and simply making a new list of vectors that has a row for each "column"
(not that I have the first clue how to do that in an idiomatic fashion either, fwiw)
Sorry, my brain is in Kotlin mode so I'm going to have to give code snippets that way.
val l = listOf(
listOf(1, 1, 2, 2),
listOf(2, 2, 1, 2),
listOf(1, 2, 1, 2),
)
val rowSize = l.first().size
val numColumnsMatching = (0 until rowSize).map { col -> l.map { it[col] }.count { it == 2 } }
Is that the kind of thing you're trying to do (replacing 'seeing if the value is 2' with your predicate?Clojure feels like a language that should be able to do these things easily, but I have never had to do them before and I now realise that I haven't the first clue about how to do them.
(defn col [n m] (map #(get % n) m))
(defn count-col [n val m] (->> m (col n) (filter #(= val %)) count)
(->> (range 0 3) (map #(count-col % \a m)))
(ps: ^ probably won't work or even compile - i just typed it straight into slack π¬)
Thanks @mccraigmccraig - I will give it a try / tweak
@mccraigmccraig - This ^^ is EXACTLY what I needed, thank you !
also if you have a collection of rows you can (apply map vector rows)
to transpose it into columns