workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
<@Daniell> sounds good. but did you have a specific agenda in chasing the bleeding edge like that? I mean 1.8 was good and stable. care to clarify the motivations for this chase? I just can't help but wonder as most people won't go that far (or fast :) I guess..
2017-12-04T14:45:52.000342
Kalyn
clojurians
clojure
<@Kalyn> there's really not a reason not to. Clojure alpha/beta versions very rarely break existing features. Most of the time I upgrade, run the test suite, and if those tests pass we're good.
2017-12-04T14:55:38.000325
Sandy
clojurians
clojure
to use either float? or double? here you’d need to do some conversion first. clojure.edn/read-string? will never return floats, only doubles
2017-12-04T14:56:09.000238
Margaret
clojurians
clojure
Last time I remember Clojure "breaking" something critical was when they changed the hashing algorithm back in 1.6. But even that wasn't Clojure's fault since order of items in sets is undefined (hence why they are unordered sets). So that was a bit painful to fix, but it was considered a code cleanup since the problem was in the code that used Clojure.
2017-12-04T14:56:41.000209
Sandy
clojurians
clojure
if what you want is to know if a string is a valid floating point number, I think the best option is `(try (Double/parseDouble %) (catch Exception _))` - it’s ugly but it works - either a number or nil comes out
2017-12-04T14:56:52.000005
Margaret
clojurians
clojure
But I can't even think of a time I've had my *correct* code break from a Clojure upgrade.
2017-12-04T14:57:07.000698
Sandy
clojurians
clojure
weren't there some issues with 1.2 -&gt; 1.3
2017-12-04T14:57:18.000439
Willow
clojurians
clojure
i wasn't around back then so i don't know but i thought i remember hearing about that
2017-12-04T14:57:29.000716
Willow
clojurians
clojure
well yeah, I'm not going that far back. and I joined Clojure right when 1.3 was released :wink:
2017-12-04T14:57:37.000754
Sandy
clojurians
clojure
That was back in 2011, lol
2017-12-04T14:58:28.000438
Sandy
clojurians
clojure
well there's a good answer then. there haven't been breaking changes in an upgrade for 6 years or so
2017-12-04T14:59:19.000208
Willow
clojurians
clojure
There are times where there were perhaps legitimate questions whether a change in a release was breaking or not, such as the hash change in 1.6 also leading to hash inconsistency between Java sets and Clojure sets that were clojure.core/= before and after, but no longer had the same hash any more.
2017-12-04T15:24:07.000170
Micha
clojurians
clojure
Which then causes sets or maps containing those things not to be clojure.core/= any more.
2017-12-04T15:25:42.000392
Micha
clojurians
clojure
Such questions usually lead to refinements in the definition of what was promised, and what wasn't.
2017-12-04T15:26:12.000252
Micha
clojurians
clojure
adding validation to the ns macro which subsequently stopped (ns foo (use bar)) being acceptable is another one of those things
2017-12-04T15:29:02.000019
Aldo
clojurians
clojure
no one said it would work, but it did, and now it doesn't. given the low number of people affected and how easy it was to fix I'm glad they went with locking it down though
2017-12-04T15:29:34.000060
Aldo
clojurians
clojure
Hmmm, ``` &gt; (println '(and "foo")) (and foo) ``` I would expect that to print `(and "foo")`. Does anyone know why it doesn't? Is there a way to include the quotes?
2017-12-04T15:35:28.000162
Henry
clojurians
clojure
prn
2017-12-04T15:35:42.000487
Rebeca
clojurians
clojure
Indeed, thanks!
2017-12-04T15:37:11.000658
Henry
clojurians
clojure
ya, println tries to be human friendly. prn is for serializing data
2017-12-04T15:38:19.000130
Aldo
clojurians
clojure
We've pretty much always used Alphas in production as they become available for over six years: because we want access to the latest features. We're using `clojure.spec` heavily in production, for example.
2017-12-04T15:38:56.000212
Daniell
clojurians
clojure
ISTR 1.4 "broke" some stuff around numeric overflow / representation? (didn't affect us) and 1.5.0 had a memory leak (fixed in 1.5.1 -- we were spared that as we were on a pre-release of 1.5 in production at the time, before the leak was introduced, and we went straight to 1.5.1 because of our release schedules at the time). And the hash code change in 1.6 didn't bite us either (I'm still not clear on how widespread that breakage was?).
2017-12-04T15:42:39.000348
Daniell
clojurians
clojure
We started with Clojure 1.3 (Alpha 7 or 8 in production) because we wanted to skip ahead of the big 1.2 -&gt; 1.3 Contrib split and the AOT compatibility issues around that. It's also how I ended up maintaining `clojure.java.jdbc` -- because `clojure.contrib.sql` needed a maintainer to bring it across the 1.2/1.3 divide :slightly_smiling_face:
2017-12-04T15:44:18.000228
Daniell
clojurians
clojure
We test our apps against Clojure's master SNAPSHOT as well as whatever version we're going to production with so we get a heads up of any breakage.
2017-12-04T15:45:28.000281
Daniell
clojurians
clojure
<@Sandy> <@Daniell> thanks for the perspectives and explanation ― I sure learned something new
2017-12-04T16:50:20.000019
Kalyn
clojurians
clojure
As someone who does not maintain a clojure core library, I might be a bit more conservative myself :slightly_smiling_face: but testing against Clojure's master snapshot sure sounds nice (especially if it doesn't break the test suite very often)
2017-12-04T16:51:49.000616
Kalyn
clojurians
clojure
One of Clojure's strengths, in my opinion, is how stable it has been across versions. The Clojure/core team are very serious about accretion rather than breakage :slightly_smiling_face:
2017-12-04T16:57:00.000666
Daniell
clojurians
clojure
Something else ― roughly one week ago I asked about writing code for stream-processing of data, which gave rise to a short discussion suggesting that although collections are sufficiently lazy (only up to 32 items may be realized under the covers at any point in time), transducers should be strictly preferred for a streaming application. In streaming I mean, mainly, processing an input file using only a constant memory footprint, rather than consuming the entire (potentially humongous) file into memory and such. Then also processing the stream forward through whatever few processing steps, in a similar way, for the same reason. Do folks here agree to that suggestion, about preferring transducers over plain lazy collections?
2017-12-04T17:17:55.000317
Kalyn
clojurians
clojure
lazy collections and transducers aren’t mutually exclusive
2017-12-04T17:23:12.000587
Jonas
clojurians
clojure
right
2017-12-04T17:23:27.000025
Rebeca
clojurians
clojure
transducers are a good option for describing and composing the individual steps
2017-12-04T17:23:39.000269
Jonas
clojurians
clojure
they also are useful for streaming because they don’t care about the source or the sink
2017-12-04T17:24:02.000324
Jonas
clojurians
clojure
in general, for streaming processing, you are going to be working with folds (a tree shaped process, the degenerate shape of which is a linear reduce)
2017-12-04T17:24:50.000668
Rebeca
clojurians
clojure
as far as processing data with constant memory requirements, you can use lazy sequences, but there are other good options as well
2017-12-04T17:25:17.000212
Jonas
clojurians
clojure
once you are working folds, using transducers and transduce is pretty much a no brainer
2017-12-04T17:26:06.000394
Rebeca
clojurians
clojure
there are also a lot of stream processing libraries to choose from that help provide a good story for how to put everything together
2017-12-04T17:26:15.000093
Jonas
clojurians
clojure
when you are using a fold like reduce (or transduce) you also get a pretty clear scope for managing resources (like closing db connections, or files, or whatever) which lazy-seqs don't really give you
2017-12-04T17:28:08.000105
Rebeca
clojurians
clojure
(interleave <@Jonas> <@Rebeca>) :slightly_smiling_face:
2017-12-04T17:37:05.000149
Bibi
clojurians
clojure
XD
2017-12-04T17:38:13.000322
Ferdinand
clojurians
clojure
<@Kalyn> I prefer transducers in this case simply beacause it's *really* hard *not* to hold onto the head of a seq with lazy seqs. And with transducers its pretty much impossible to shoot yourself in the foot this way.
2017-12-04T17:52:56.000144
Sandy
clojurians
clojure
I've built too many systems that work fine until you get about 2GB of data through them then they fall over due to some sort of lazy-seq related memory "leak"
2017-12-04T17:54:02.000186
Sandy
clojurians
clojure
Hello Everyone. Are there any good resources to learn Clojure quickly and efficiently?
2017-12-04T18:06:45.000115
Vicky
clojurians
clojure
If you don't mind paying some $, Clojure Programming is a good book: <http://shop.oreilly.com/product/0636920013754.do> There are other fine books to learn from, also.
2017-12-04T18:16:58.000416
Micha
clojurians
clojure
<@Vicky> I will also add Clojure for the Brave and true <https://www.braveclojure.com/> If you are looking for raw time to workflow, then brave clojure has the advantage there IMHO. If you want a more in depth resource, then the O'Reilly book is always a really safe bet. It just depends on where your priorities are.
2017-12-04T18:23:02.000058
Giovanni
clojurians
clojure
Or Living Clojure by Carin Meier, or Programming Clojure 3rd Edition... :slightly_smiling_face:
2017-12-04T18:30:25.000299
Daniell
clojurians
clojure
Clojure Programming is good for the basics but a little outdated now (it targets Clojure 1.5 I think?).
2017-12-04T18:31:06.000110
Daniell
clojurians
clojure
Nope, 1.4 (examples work on 1.3 and 1.4). So I'd be cautious to recommend Clojure Programming at this point (although I love it as an all-round introduction to the language and some common libraries -- it's `clojure.java.jdbc` section is outdated, due to lots of improvements in that library... I'm not sure it's example even work with recent `clojure.java.jdbc` versions).
2017-12-04T18:34:10.000315
Daniell
clojurians
clojure
<@Vicky> If you're new to Clojure, you'll find the folks in the <#C053AK3F9|beginners> channel are super helpful.
2017-12-04T18:35:21.000306
Daniell
clojurians
clojure
I'm interviewing at a company that uses Clojure and React. I'm comfortable with React, just need to increase skills with Clojure.
2017-12-04T18:36:14.000439
Vicky
clojurians
clojure
Thanks everyone for your help.
2017-12-04T18:37:41.000020
Vicky
clojurians
clojure
Cool. Good luck with the interview! Are they using Clojure on the server or ClojureScript with React on the client?
2017-12-04T18:39:08.000104
Daniell
clojurians
clojure
I think Clojure on the server? They never mentioned ClojureScript.
2017-12-04T18:40:03.000311
Vicky
clojurians
clojure
'k ... we're React on the front, Clojure on the back too ... it's a good combination.
2017-12-04T18:42:48.000257
Daniell
clojurians
clojure
Where do you work....? Haha
2017-12-04T18:44:51.000271
Vicky
clojurians
clojure
<@Daniell> Is that React without clojurescript? If so, what were the motivators for that decision?
2017-12-04T18:45:39.000111
Giovanni
clojurians
clojure
Thanks <@Sandy> <@Jonas> <@Rebeca> for the excellent feedback. I'm just not sure I get it regarding the comments about folds or fold-like reducing. Am I missing something really deep here?
2017-12-05T02:11:43.000026
Kalyn
clojurians
clojure
<https://clojure.org/guides/destructuring#_namespaced_keywords> Why does `:keys` use a keyword (`:person/name`) for destructuring namespaced keywords rather than a symbol (`person/name`)? Both work, but given this guide it seems the former is what you're expected to use.
2017-12-05T04:18:40.000392
Jodie
clojurians
clojure
<@Jodie> From the same page: "The `:keys` key is for associative values with keyword keys, but there are also `:strs` and `:syms` for string and symbol keys respectively."
2017-12-05T04:29:09.000276
Rogelio
clojurians
clojure
<@Rogelio> My question is about syntax, not about how to pull out symbols.
2017-12-05T04:30:17.000611
Jodie
clojurians
clojure
<@Jodie> using a keyword allows you to use ```(:person/name person)``` to get the name
2017-12-05T05:40:24.000096
Daine
clojurians
clojure
I believe he's talking about the distinction when using `:keys` destructuring. ``` (let [{:keys [:person/name b]} {:person/name "Name" :b 2}] [name b]) =&gt; ["Name" 2]``` vs ``` (let [{:keys [person/name b]} {:person/name "Name" :b 2}] [name b]) =&gt; ["Name" 2]```
2017-12-05T06:02:34.000240
James
clojurians
clojure
The distinction between using `:person/name` as a keyword or `person/name` (as a symbol) Why the first seems encouraged if both work and the second seems more in line with how we destructure unqualified keywords.
2017-12-05T06:04:42.000078
James
clojurians
clojure
<@Jodie> I think it might be related to auto resolving keywords, possibly? Using `::some-ns/id` would work only if `some-ns` was available in that scope, but using symbols `some-ns/id` would be happily accepted either way.
2017-12-05T06:08:35.000277
James
clojurians
clojure
alias resolving keywords is probably a good reason. I wonder if symbols are supposed to work? e.g. the same way that `(ns (require …))` worked until spec came in and caught everyone out.
2017-12-05T06:10:22.000420
Jodie
clojurians
clojure
That's a good question. I went with the flow of always using keywords according to what's in the available documentation, but I agree that it introduces a somewhat odd distinction.
2017-12-05T06:13:59.000406
James
clojurians
clojure
symbols in `:keys` are supposed to work
2017-12-05T06:26:46.000369
Kareen
clojurians
clojure
destructuring syntax is already specced btw
2017-12-05T06:27:43.000217
Kareen
clojurians
clojure
<@Kareen> Should the guide be updated to mention that `ns/name` is supposed to work?
2017-12-05T06:58:59.000303
Jodie
clojurians
clojure
:keys destructuring intentionally takes keywords to support the use of autoresolved keywords (either :: or : with an alias)
2017-12-05T08:58:47.000515
Sonny
clojurians
clojure
Symbols are preferred though if you’re not leveraging those features
2017-12-05T09:00:07.000057
Sonny
clojurians
clojure
Symbols can be either namespaced or not - the name part of the symbol is always what the bound local name will be
2017-12-05T09:00:59.000181
Sonny
clojurians
clojure
on the topic of autoresolved keywords, is there a jira ticket for being able for namespace aliases for non-existing namespaces?
2017-12-05T09:01:23.000203
Noella
clojurians
clojure
just curious :slightly_smiling_face:
2017-12-05T09:01:31.000684
Noella
clojurians
clojure
You mean as an enhancement?
2017-12-05T09:02:01.000163
Sonny
clojurians
clojure
<@Sonny> I'm not familiar with `:` being used for autoresolved keywords, what do you mean by that?
2017-12-05T09:02:06.000253
Jodie
clojurians
clojure
as an enhancement proposal, yes :slightly_smiling_face:
2017-12-05T09:02:21.000668
Noella
clojurians
clojure
Re the enhancement, we have considered it (I actually implemented it) but Rich doesn’t want to change current state, however he has some ideas for an alternative for managing keyword aliases specifically
2017-12-05T09:03:36.000056
Sonny
clojurians
clojure
Sorry I meant :: with an alias. InsufficientCoffeeException
2017-12-05T09:04:33.000004
Sonny
clojurians
clojure
cool, I’ll keep an eye out, thanks!
2017-12-05T09:04:34.000142
Noella
clojurians
clojure
That's okay! That brings me onto my next question then, does that mean the guide is wrong in suggesting the use of `:person/name` and instead `person/name` should be preferred?
2017-12-05T09:05:07.000194
Jodie
clojurians
clojure
Feel free to file an issue or a pr! <https://github.com/clojure/clojure-site>
2017-12-05T09:05:35.000084
Sonny
clojurians
clojure
Symbols are preferred in my opinion. Either should work.
2017-12-05T09:06:50.000262
Sonny
clojurians
clojure
Either is valid, I’d say symbol is preferred
2017-12-05T09:07:48.000272
Sonny
clojurians
clojure
Usually we use symbols in :keys (as they then match the created locals)
2017-12-05T09:08:24.000363
Sonny
clojurians
clojure
With qualified, it’s a little muddier
2017-12-05T09:08:38.000586
Sonny
clojurians
clojure
Yeah, until I knew about autoresolved keywords, the answer was very obvious. Now it feels like there's a special exception in `:keys`.
2017-12-05T09:15:07.000245
Jodie
clojurians
clojure
Done <https://github.com/clojure/clojure-site/issues/230> !
2017-12-05T09:19:23.000391
Jodie
clojurians
clojure
<@Sonny> I'm curious, could you give a hint as to what Rich would like this to look like?
2017-12-05T09:21:27.000097
Jodie
clojurians
clojure
Nope, I don’t know
2017-12-05T09:22:01.000206
Sonny
clojurians
clojure
what would you guys call this function? ``` (defn update-conj-vec "Takes map and adds v to the collection at k. If value at k is currently nil v is wrapped in a vector and set as k's value." [m k v] (update m k #(if (nil? %) [v] (conj % v)))) ```
2017-12-05T09:24:16.000505
Timmy
clojurians
clojure
I’m not happy with it’s name…
2017-12-05T09:24:50.000096
Timmy
clojurians
clojure
`conj-at`?
2017-12-05T09:26:29.000487
Rogelio
clojurians
clojure
<@Timmy> I've found that when I need that kind of function, I'm usually doing something wrong.
2017-12-05T09:27:59.000408
Jodie
clojurians
clojure
hmmm `conj-at` is kind of nice….
2017-12-05T09:29:09.000126
Timmy
clojurians
clojure
<@Jodie> care to elaborate? I’ve got some maps with lots of lists in that need adding too…. what gives you that feeling?
2017-12-05T09:30:21.000456
Timmy
clojurians
clojure
oh, I misread the docstring. Apologies.
2017-12-05T09:30:57.000386
Jodie
clojurians
clojure
<@Timmy> `(conj nil 1)` does work btw. Is it important that it's a vector?
2017-12-05T09:31:38.000007
Jodie
clojurians
clojure
<@Timmy> Not that you asked, but I'd write that like so: ``` [m k v] (update m k (fnil conj []) v) ```
2017-12-05T09:33:39.000666
Jodie
clojurians
clojure
"Takes a map and conj's v to the collection at k. If the value at k is currently nil, a vector will be used as the collection type" is how I would word the docstring, the "how" of wrapping the v is too precise.
2017-12-05T09:34:48.000270
Jodie
clojurians
clojure
oh `fnil` looks kind of handy. Thanks!
2017-12-05T09:36:22.000672
Timmy