workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
are there people that set clojure to strict type checking?
2017-11-01T06:21:16.000108
Corazon
clojurians
clojure
you mean typed clojure?
2017-11-01T06:22:32.000123
Cecilia
clojurians
clojure
excellent comparison. by the way, your avatar is incredible. always glad to meet a fellow Dead head, especially a developer Dead head :metal:
2017-11-01T07:51:48.000085
Julee
clojurians
clojure
Apart from repainting with clj colors, I've just stolen a logo with long history :slightly_smiling_face: <http://xahlee.info/UnixResource_dir/lambda_logo.html>
2017-11-01T09:28:54.000068
Eliana
clojurians
clojure
I'm trying to scrape the slack logs here `<https://clojurians-log.clojureverse.org>` for a quick analysis thing but am getting a `javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure` with slurp/http-kit/clj-http. anyone know a solution for this?
2017-11-01T09:44:30.000324
Roscoe
clojurians
clojure
in clojure, is it possible to use , in large numbers, like entering 1e9 as 1,000,000,000 ?
2017-11-01T09:48:05.000191
Berry
clojurians
clojure
<@Berry> no, commas are equal to whitespace so they would be read as separate numbers
2017-11-01T09:52:11.000052
Roscoe
clojurians
clojure
<@Roscoe>: thanks for concise explaination
2017-11-01T09:53:14.000461
Berry
clojurians
clojure
<@Roscoe> `slurp` works for me: ``` (slurp "<https://clojurians-log.clojureverse.org/>") &lt;!DOCTYPE html&gt; &lt;html&gt; ,,, ```
2017-11-01T10:01:53.000404
Terra
clojurians
clojure
that doesn’t ring any bells for me other than the :verbose flag in require. Getting that set at the right place in your code might help. There is a particularly bad exponential problem in compilation that was fixed in the 1.9 alphas - curious if you’re using a 1.9.0 beta or 1.8.0 etc?
2017-11-01T10:49:39.000280
Sonny
clojurians
clojure
is there a tool to detect unused functions in a clojure project?
2017-11-01T10:50:42.000146
Jena
clojurians
clojure
Cursive colors them a gray color by default
2017-11-01T10:57:03.000595
Sonny
clojurians
clojure
not sure if that’s reusing something public or not
2017-11-01T10:57:25.000560
Sonny
clojurians
clojure
kibit or eastwood would be good places to look
2017-11-01T10:57:49.000097
Sonny
clojurians
clojure
<@Sonny> I think Cursive uses it’s own static analysis to do that
2017-11-01T11:07:08.000515
Cecilia
clojurians
clojure
that would be my suspicion too
2017-11-01T11:07:21.000099
Sonny
clojurians
clojure
It can be harder than that too. Cursive colours them grey, but if you have a unit test exercising that function then it is 'used', even if it's only the test and nothing in the 'actual' codebase that uses it
2017-11-01T11:07:25.000521
Mallie
clojurians
clojure
i.e. Cursive won't colour a fn grey if there is a test for it
2017-11-01T11:07:50.000181
Mallie
clojurians
clojure
more incentive not to test :)
2017-11-01T11:08:05.000113
Sonny
clojurians
clojure
one could theoretically write relatively easily a tool which goes through the code and finds which parts are used and which aren’t
2017-11-01T11:08:17.000535
Cecilia
clojurians
clojure
that is effectively very close to tree shaking
2017-11-01T11:08:25.000572
Cecilia
clojurians
clojure
I think cgrand did some work on this
2017-11-01T11:08:43.000444
Cecilia
clojurians
clojure
as part of this <https://github.com/portkey-cloud/portkey>
2017-11-01T11:09:50.000274
Cecilia
clojurians
clojure
I’ve done some stuff with tools.analyzer that could answer these questions, but it’s not in a consumable form atm
2017-11-01T11:36:46.000416
Sonny
clojurians
clojure
<@Jena> As I recall from some months ago, I didn't see unused-function checking in kibit or eastwood. This extremely simple bash script was enough for me at the time: <https://gist.github.com/joelittlejohn/4729776>
2017-11-01T11:37:39.000489
Milissa
clojurians
clojure
hey guys, what’s the idiomatic clojure way to handle accessing a data source from multiple disparate points? say you had some data `db` and “features” `a` and `b` that needed to get into that data. on one hand it feels wrong to just use direct interactions like `get get-in` etc. we should be programming to an interface, no? on the other hand, an interface feels clunky if mostly all it’s doing is using `get get-in` itself. am I thinking about this incorrectly?
2017-11-01T12:44:30.000536
Jen
clojurians
clojure
<@Jen> the data type is made of a number of interfaces
2017-11-01T12:45:20.000542
Margaret
clojurians
clojure
it's considered idiomatic to put things in plain data, and access it as plain data, and not hide things with private values or accessor functions
2017-11-01T12:46:00.000307
Margaret
clojurians
clojure
i see. and the “interface” to which you are programming is just stricter rules on schema mutations? such as accretion instead of deletion?
2017-11-01T12:46:54.000434
Jen
clojurians
clojure
unless you made something mutable and have to prevent invalid operations... then you probably want to just do it the way you would in java, but seriously second guess whether it actually needs to be mutable
2017-11-01T12:47:08.000492
Margaret
clojurians
clojure
the data structure itself, eg. hash-map, implements a number of interfaces. We use those to manage the data in the map.
2017-11-01T12:47:40.000422
Margaret
clojurians
clojure
on a more abstract level there are things like spec and schema if you want to make assertions about the content and shape of the data, but honestly clojure isn't designed for making these sorts of restrictions
2017-11-01T12:48:34.000123
Margaret
clojurians
clojure
it's possible, but a bit clunky, and it's easy to make a mess if you try to program with that mindset in a clojure codebase
2017-11-01T12:49:05.000037
Margaret
clojurians
clojure
I think I understand. it’s a whole new world, coming from a different paradigm. I just can’t help but think about some sort of data access layer, or a (spooky) data access object. it allows you to aggregate things like logging/monitoring, and provides a “single door” through which everyone has to walk. leaving that behind feels uncomfortable
2017-11-01T12:49:49.000340
Jen
clojurians
clojure
if you think giving up controlling data access is scary, just try using clojure for a while then trying to go back and write code with mutable objects again - that stuff is horrifying
2017-11-01T12:50:59.000121
Margaret
clojurians
clojure
there are other languages where you both have strictness about access and types, and immutability, but they have their own trade offs too (typically clumsy and complex language design, and spending a large amount of your time trying to make the compiler happy instead of solving your problem directly)
2017-11-01T12:52:31.000518
Margaret
clojurians
clojure
<https://news.ycombinator.com/item?id=15603023> &lt;--- For those interested, we're also looking for more developers
2017-11-01T12:52:34.000548
Sherrie
clojurians
clojure
on vectors, is last guaranteed to be O(1) time and pop guaranteed to be O(log_32 n) time ?
2017-11-01T14:16:36.000317
Berry
clojurians
clojure
no
2017-11-01T14:17:39.000239
Rebeca
clojurians
clojure
last is a seq function and is O(n)
2017-11-01T14:18:04.000197
Rebeca
clojurians
clojure
and that is a feature, not a bug ^
2017-11-01T14:21:51.000278
Guillermo
clojurians
clojure
use peek for O(1) on vectors
2017-11-01T14:32:00.000588
Kareen
clojurians
clojure
changed last to peek. Can someone please explain why, on vectors, it's O(n) on purpose ?
2017-11-01T14:40:12.000548
Berry
clojurians
clojure
because using a seq is generic
2017-11-01T14:41:07.000146
Myles
clojurians
clojure
you don't want polymorphic performance
2017-11-01T14:45:15.000331
Guillermo
clojurians
clojure
Hey, Alex's tweeting has reminded me of a particular case that I find difficult to deal with in Clojure. I wonder if there's an interesting way to deal with it.
2017-11-01T16:29:31.000039
Detra
clojurians
clojure
The recent example was turning nested maps which would work for transacting to Datomic except for having reverse attributes in them, into a sequence of maps which do work because they have entities broken out with forward references.
2017-11-01T16:31:08.000165
Detra
clojurians
clojure
The part of it that's difficult (for me) to handle in Clojure is the recursion on a tree structure /and/ collecting multiple values.
2017-11-01T16:32:51.000509
Detra
clojurians
clojure
use for
2017-11-01T16:33:03.000026
Rebeca
clojurians
clojure
How would one use for?
2017-11-01T16:33:18.000076
Detra
clojurians
clojure
lemme see if I have a good gist
2017-11-01T16:33:35.000146
Rebeca
clojurians
clojure
<@Detra>anything that involves "complex thing on nested data structure" generally has me reaching for <#C0FVDQLQ5|specter> ; it'll probably still be somewhat complex though
2017-11-01T16:34:15.000204
Raul
clojurians
clojure
``` ((fn map-paths [path m] (if (map? m) (for [[k v] m i (map-paths (conj path k) v)] i) [[path m]])) [] {:a {:b 1 :c [3]} :w {:x 1}}) ([[:a :b] 1] [[:a :c] [3]] [[:w :x] 1]) ```
2017-11-01T16:36:52.000206
Rebeca
clojurians
clojure
something in that style
2017-11-01T16:36:58.000534
Rebeca
clojurians
clojure
<@Mallie> Good point: <https://github.com/cursive-ide/cursive/issues/1877>
2017-11-01T16:42:15.000662
Delois
clojurians
clojure
Hi all, I was looking for a shortcut to see whether a key in a map was present, and was mildly surprised that this didn't work: ``` (def s [{:a 1} {:a 2} {:a 1} {:a 0}]) ; I want to filter for {:a 1} ``` Using an anonymous function is trivial: ``` user=&gt; (filter #(= (:a %) 1) s) ({:a 1} {:a 1}) ``` But I sort of expected this to work just as well, and it doesn't seem to: ``` user=&gt; (filter (comp :a #{1}) s) () ```
2017-11-01T17:48:05.000453
Alayna
clojurians
clojure
`(filter (comp #{1} :a) s) =&gt; ({:a 1} {:a 1})`
2017-11-01T17:49:58.000340
Willow
clojurians
clojure
compose applies right to left
2017-11-01T17:50:15.000316
Willow
clojurians
clojure
Oh, darn it! Got the order backwards
2017-11-01T17:50:21.000124
Alayna
clojurians
clojure
`(comp fn ... f2 f1)`
2017-11-01T17:50:26.000206
Willow
clojurians
clojure
simple bugs are the best bugs :slightly_smiling_face:
2017-11-01T17:50:43.000283
Willow
clojurians
clojure
Awesome. Thanks <@Willow>!
2017-11-01T17:50:44.000461
Alayna
clojurians
clojure
just think of compose as smashing its functions into the argument provided
2017-11-01T17:51:21.000352
Willow
clojurians
clojure
1. imagine I'm editing `foo.clj` I can define a macro, and use it later in the same file 2. now, imagine I'm editing `foo.cljc` and I define a macro, say via `#?(:cljs (defmacro ...))` now, I should be able to use this macro in `foo.cljc` on the clojure side -- but is there anyway to also use it from the cljs side? or does cljs absolutely require macros come from other namespaces, that are pure *.clj files ?
2017-11-01T20:16:53.000261
Berry
clojurians
clojure
`(binding [*out* /dev/null])` Obviously /dev/null isn't a thing in Clojure, but how to supress stdout? Forgot
2017-11-01T20:28:19.000072
Kristy
clojurians
clojure
will the output overwhelm `with-out-string ` ?
2017-11-01T20:33:10.000044
Berry
clojurians
clojure
possibly not. resulting string wouln't be colossal, still I'd like to learn the cleanest pattern
2017-11-01T20:34:03.000219
Kristy
clojurians
clojure
implement your own `PrintWriter` class, which does nothing
2017-11-01T20:34:49.000039
Torie
clojurians
clojure
`(<http://clojure.java.io/writer|clojure.java.io/writer> "/dev/null")` too
2017-11-01T20:35:15.000078
Wenona
clojurians
clojure
```=&gt; (binding [*out* (proxy [java.io.Writer] [] (append [&amp; _]) (close []) (flush []) (write [&amp; _]))] (println "hello, black hole")) nil ```
2017-11-01T20:35:29.000098
Margaret
clojurians
clojure
<https://stackoverflow.com/questions/29914967/can-cljc-single-file-macro-definitions-to-work-with-clojurescript> &lt;-- does this trick still work ? I'm getting 'macro not found from my cljs compilation'
2017-11-01T22:11:07.000056
Berry
clojurians
clojure
I’m trying to find an article I read a while ago, told as a parable about a guy named Rich in the land of boxes, about how complex objects were and how simple composable tools could be more enjoyable
2017-11-01T22:30:19.000076
Deloras
clojurians
clojure
and my google-fu is failing me… so, does anyone know this piece and can remember the title?
2017-11-01T22:30:47.000158
Deloras
clojurians
clojure
<@Deloras> not referring to kingdom of nouns are you?
2017-11-02T00:32:59.000011
Aldo
clojurians
clojure
That was one of Steve Yegge's big ol' rants... <http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html>
2017-11-02T00:37:54.000075
Daniell
clojurians
clojure
no, I very specifically remember it referring to objects as some kind of blocks or boxes, and a shout-out to Rich
2017-11-02T00:56:44.000069
Deloras
clojurians
clojure
ah yeah that does sound different
2017-11-02T01:01:26.000060
Aldo
clojurians
clojure
hmm, is there a plan to have <https://github.com/clojure/brew-install> in a apt/yum repository?
2017-11-02T02:09:12.000027
Brande
clojurians
clojure
seeing great potential for JVM/Clojure command line scripting :slightly_smiling_face:
2017-11-02T02:11:03.000067
Brande
clojurians
clojure
ah, missed this: <https://clojure.org/guides/deps_and_cli#_installation_on_linux>
2017-11-02T02:15:03.000004
Brande
clojurians
clojure
hey folks - veteran c++ game engine programmer here, emacs hacker / elisp user, getting into clojure
2017-11-02T02:24:58.000091
Else
clojurians
clojure
I was thinking about trying to do some kind of music visualizer (think g-force / milkdrop / etc) - what's the best approach to get framebuffer access and / or shader access in clojure? thanks in advance!
2017-11-02T02:26:04.000032
Else
clojurians
clojure
<@Else> making a brower UI or desktop?
2017-11-02T02:34:57.000104
Cecilia
clojurians
clojure
replacing ruby with sed from install.sh and nearly there :)
2017-11-02T02:34:58.000052
Brande
clojurians
clojure
framebuffer/shader sounds like native interop
2017-11-02T02:35:44.000099
Brande
clojurians
clojure
for ClojureScript you can use <https://github.com/thi-ng/shadergraph> to get easy GLSL access
2017-11-02T02:35:49.000048
Cecilia
clojurians
clojure
<@Brande> GLSL is shader access
2017-11-02T02:36:00.000130
Cecilia
clojurians
clojure
<@Cecilia> I'm just doing this for fun to learn the language - I love Lisp and its derivatives :slightly_smiling_face:
2017-11-02T02:36:32.000089
Else
clojurians
clojure
yeah, well for ClojureScript and browsers there are several options out there, less so for Clojure
2017-11-02T02:37:04.000043
Cecilia
clojurians
clojure
maybe quil?
2017-11-02T02:37:14.000096
Cecilia
clojurians
clojure
I'll take a look - I mostly wondered if Clojure would even be capable of something like this given its immutable state
2017-11-02T02:37:24.000088
Else
clojurians
clojure
yes it can do anything, you can ask though if Clojure is the right tool for the job
2017-11-02T02:37:49.000194
Cecilia
clojurians
clojure
In this particular case I'm just doing it for fun / learning - I build game engines for a living, it's definitely not the right language for graphics, but we'll see what it can do :wink:
2017-11-02T02:38:57.000227
Else
clojurians
clojure
for the performance intensive mutable data stuff your code will end up looking an awful lot like java
2017-11-02T02:38:58.000144
Cecilia
clojurians
clojure
I remember John Carmack rewrote Wolfenstein 3D in Haskell, it was pure madness
2017-11-02T02:39:22.000064
Else
clojurians
clojure
one could write a very efficient 3d engine with immutable data structures but only if the hardware drivers and APIs supported that properly
2017-11-02T02:39:55.000184
Cecilia
clojurians
clojure
opengl etc have been written to handle this mutable state machine
2017-11-02T02:40:10.000030
Cecilia
clojurians
clojure
you can also check out <https://github.com/ztellman/penumbra>
2017-11-02T02:40:17.000236
Jonas
clojurians
clojure
which is no longer developed
2017-11-02T02:40:26.000006
Jonas
clojurians
clojure
but maybe as a way to get started
2017-11-02T02:40:52.000027
Jonas