workspace
stringclasses
4 values
channel
stringclasses
4 values
text
stringlengths
1
3.93k
ts
stringlengths
26
26
user
stringlengths
2
11
clojurians
clojure
think about what you are actually feeding a chan for instance when you provide a xf argument
2017-11-07T21:36:40.000017
Evelin
clojurians
clojure
you are giving it a function that is composed of transducers (other functions)
2017-11-07T21:36:53.000034
Evelin
clojurians
clojure
it has to be composed of transducers, nothing else
2017-11-07T21:37:01.000124
Evelin
clojurians
clojure
you can't for instance, give it just a general expression that expects a value in a particular place and can use any function ("transducible" or otherwise)
2017-11-07T21:37:45.000179
Evelin
clojurians
clojure
you also can't just give it any old function
2017-11-07T21:37:57.000022
Evelin
clojurians
clojure
and expect it to work, even if the dimensionality and data types match up
2017-11-07T21:38:13.000044
Evelin
clojurians
clojure
atleast not as exepcted
2017-11-07T21:38:18.000138
Evelin
clojurians
clojure
IF the transducible process had the macro capability to look inside what you gave it
2017-11-07T21:38:41.000101
Evelin
clojurians
clojure
THEN it could decide for itself what it can do, whether it has to break up some things or rearrange others into what we are calling "transducible process"
2017-11-07T21:39:04.000082
Evelin
clojurians
clojure
it could even rearrange things or break things up in more particular ways that are specific to the thing being worked on
2017-11-07T21:39:21.000142
Evelin
clojurians
clojure
chan in this instance
2017-11-07T21:39:26.000011
Evelin
clojurians
clojure
this is what async/go actually does
2017-11-07T21:39:48.000160
Evelin
clojurians
clojure
it breaks up your s-expression and creates a state machine out of it
2017-11-07T21:40:00.000134
Evelin
clojurians
clojure
transducers were a great way to follow DRY, but i feel like it was a missed opportunity to just fix the real issue
2017-11-07T21:40:34.000103
Evelin
clojurians
clojure
can you give an example of what you would like the code to look like?
2017-11-07T21:41:08.000070
Jonas
clojurians
clojure
i feel like it’s hard to be more concise than `(chan 1 (map inc))`,
2017-11-07T21:42:14.000129
Jonas
clojurians
clojure
i'd like to say `(map dec (filter even? (reduce conj [] (foo bar (xan zoo WHATEVER)))))` and have clojure know how to optimally unravel it so that it doesn't create more intermediate sequences than necessary, can do what is effectively known as a "transducible process" (doing things in one pass) on either side of the reduce, and can even do things in parallel if it can use the runtime to judge that doing so doesn't alter the semantics of what you are doing (it can't if you are just using immutable values) and if doing so would result in faster computation even after taking into account the overhead involved with concurrency.
2017-11-07T21:45:04.000039
Evelin
clojurians
clojure
in other words, the details exposed to us in the transducer api shouldn't really have to be exposed to us-- if that is how things need to work between "transducible processes" well ok, but why should i be bothered with it?
2017-11-07T21:45:40.000259
Evelin
clojurians
clojure
that sort of thing belongs in the implementation of eval
2017-11-07T21:45:51.000009
Evelin
clojurians
clojure
the fact that making new transducers means they have to do this and this and that, why do i care?
2017-11-07T21:46:17.000058
Evelin
clojurians
clojure
can't eval look at what i'm giving it and verify that i've done these things?
2017-11-07T21:46:27.000136
Evelin
clojurians
clojure
if i want to express the idea of a computation without the thing being computed, i can just say `(map dec (filter even? (reduce conj [] (foo bar (xan zoo)))))`
2017-11-07T21:47:02.000163
Evelin
clojurians
clojure
notice the lack of WHATEVER
2017-11-07T21:47:06.000069
Evelin
clojurians
clojure
i just pass it as an s-expression and someone can inject whatever they want into it and then evaluate it
2017-11-07T21:47:30.000103
Evelin
clojurians
clojure
imho transducers just don't feel very lispy
2017-11-07T21:47:41.000257
Evelin
clojurians
clojure
they work well for what they try to do, but it sort of misses the point of lisp
2017-11-07T21:48:01.000050
Evelin
clojurians
clojure
Verify that I've done these things is different than doing them automatically, though.
2017-11-07T21:48:10.000007
Giovanna
clojurians
clojure
Imho what you're describing sounds more haskelly than clojurey
2017-11-07T21:48:31.000030
Giovanna
clojurians
clojure
it would be cool if the compiler would take my clojure code and optimize/parallelize it for me, but that seems like a separate issue than the design of transducers
2017-11-07T21:49:44.000042
Jonas
clojurians
clojure
yeah its sort of a bigger issue
2017-11-07T21:49:57.000031
Evelin
clojurians
clojure
i guess i tend to think that ideally programs should just say what it is, semantically, that you want to do
2017-11-07T21:50:56.000043
Evelin
clojurians
clojure
the question of how that is done or how to make it performant is a completely separate and orthogonal concern
2017-11-07T21:51:12.000013
Evelin
clojurians
clojure
usually best solved in the complier or evalutor
2017-11-07T21:51:23.000104
Evelin
clojurians
clojure
i don't like it when programming languages ask you to make them faster by instructing them on how to do the compiler's job
2017-11-07T21:51:45.000086
Evelin
clojurians
clojure
I think that's kind of not the clojure way, though. Like the difference between `last` and `peek` on a vector.
2017-11-07T21:52:17.000223
Giovanna
clojurians
clojure
Semantically they're the same, but one's way faster
2017-11-07T21:53:29.000081
Giovanna
clojurians
clojure
yeah i guess i just have a different opinion on the matter
2017-11-07T21:53:47.000103
Evelin
clojurians
clojure
you are right it probably isn't the clojure way
2017-11-07T21:53:51.000226
Evelin
clojurians
clojure
heck it probably isn't even a very popular view on things
2017-11-07T21:54:01.000036
Evelin
clojurians
clojure
oh well i'll stop ranting
2017-11-07T21:54:06.000011
Evelin
clojurians
clojure
thanks for hearing me out though
2017-11-07T21:54:11.000123
Evelin
clojurians
clojure
Hmm, I couldn't find that in the transcript <https://github.com/matthiasn/talk-transcripts/blob/master/Hickey_Rich/EffectivePrograms.md>
2017-11-07T21:54:34.000134
Daniell
clojurians
clojure
Yeah, I remember hearing/reading it longer ago than the conj.... I have a crappy memory though, so you never know ¯\_(ツ)_/¯
2017-11-07T21:56:22.000210
Giovanna
clojurians
clojure
I think it's very valid to question things :slightly_smiling_face: Rich is not a messiah and blindly following him is not good for anyone.
2017-11-07T22:02:38.000087
Giovanna
clojurians
clojure
What you're saying about a sufficiently smart compiler/macro really reminds me of both criticism and praise about haskell though. Where it can do some really cool optimizations, but that makes it hard to reason about perf.
2017-11-07T22:02:40.000196
Giovanna
clojurians
clojure
Re: writing your own transducing functions -- I wrote one that turned flat sequences of maps into sequences of threaded sequences of maps (based on certain fields acting as keys and back references). It turned out to be a very elegant solution to creating threaded conversations out of raw sequences of messages between members. It hid the complexity of the problem and it was easily composable with any other processing I wanted to do on messages (before transformation) or conversations (after transformation).
2017-11-07T22:07:24.000065
Daniell
clojurians
clojure
<@Evelin> there's a lot of compiler tech out there that does this sort of thing. PyPy does it out-of-the-box at runtime, infact PyPy actually runs transducers over int arrays faster than Clojure. ClojureScript does as well. Clang can do this sort of stuff but it would require all your pipelines to be defined up-front and fully static
2017-11-07T23:43:04.000201
Sandy
clojurians
clojure
The beauty of the Clojure model, is that none of this took compiler support. It just works as a library.
2017-11-07T23:43:52.000132
Sandy
clojurians
clojure
That's the problem with a lot of these approaches. PyPy took 3-4 people 10 years to engineer. The JS JITs took less time, but larger teams. Transducers were mostly designed in about 3 weeks by one person.
2017-11-07T23:44:35.000034
Sandy
clojurians
clojure
And you'll see that pattern throughout Clojure, never over-engineer. If you can accomplish what you need with your existing tools, do it that way.
2017-11-07T23:45:11.000031
Sandy
clojurians
clojure
Not saying these other methods aren't valid, but they are much more complicated.
2017-11-07T23:45:38.000046
Sandy
clojurians
clojure
And for anyone here interested, here's pretty much the state-of-the-art for this sort of thing. From the Scala world, but the paper goes over Lisp and the like as well: <https://infoscience.epfl.ch/record/180642/files/EPFL_TH5456.pdf>
2017-11-08T00:08:00.000094
Sandy
clojurians
clojure
That's a big paper! Won't start it tonight :slightly_smiling_face:
2017-11-08T00:09:44.000136
Bibi
clojurians
clojure
yeah the first 50 pages or so are an overview of why we need this thing
2017-11-08T00:10:50.000197
Sandy
clojurians
clojure
<@Sandy>: can you tell <https://www.youtube.com/channel/UC6yONKYeoE2P3bsahDtsimg/videos> to create a video walkthrough of the paper, step by step, implementing a minimal setup in clojure ?
2017-11-08T00:15:37.000068
Berry
clojurians
clojure
Heh, most of it leans really heavily on static typing. How to adapt it to more dynamic languages is still a WIP
2017-11-08T01:00:38.000128
Sandy
clojurians
clojure
Were Clojure's transducers only able to be made so quickly because of the way the language is, or does putting them in the compiler just take longer? Since it's lispy i'm just curious if impossible to do it the library way in other languages.
2017-11-08T01:03:07.000203
Janette
clojurians
clojure
It would be nice if there was something like defmacro that did not evaluate its arguments but that could return a value instead of code that gets evaluated. Is such a thing possible?
2017-11-08T02:05:02.000013
Alix
clojurians
clojure
<@Alix> well, it is possible as long as the value can be expressed as code... Isn't this what `comment` does ? ``` (defmacro comment [&amp; body] nil) ```
2017-11-08T03:48:57.000264
Danyel
clojurians
clojure
Could anybody help me with fuzzy multi-method dispatching? Say, I have maps with `:os` and `:version` fields. Basically, I need to dispatch them by OS, but for some specific versions I need to perform some other logic. What I’m trying to reach is: ``` ;; let's say my dispatcher function is (juxt :os :version) [:mac &lt;any-version&gt;] ==&gt; the standard iOS algorithm [:win &lt;any-version&gt;] ==&gt;&gt; the standard Windows algorithm ;; but! [:mac :11.22.33] == &gt; some Mac-specific algorithm for version 11.22.33 ``` So once I’ve got some another buggy version, I just add another `(defmethod...)` definition for that case. Probably, later I’ll need to add more minor keys to dispatch, say, browser name or something else. I’ve tried a bit `derive` and custom hierarchies but without success.
2017-11-08T04:02:05.000036
Verna
clojurians
clojure
<@Verna> <http://clojuredocs.org/clojure.core/defmulti#example-57558046e4b0bafd3e2a0474>
2017-11-08T04:07:31.000336
Randee
clojurians
clojure
yes I’ve seen that example but cannot understand it completely so it prevents me from using it.
2017-11-08T04:08:32.000039
Verna
clojurians
clojure
<@Verna> What's the question? I wrote that example :slightly_smiling_face:
2017-11-08T04:08:49.000380
Randee
clojurians
clojure
Basically: 1. If no 100% match, find the default method in the `:default` fallback. 2. Add this fallback to the defmulti
2017-11-08T04:09:34.000315
Randee
clojurians
clojure
<@Randee> makes sense. Another solution might be to derive any version over `::default` value once I’ve got that map.
2017-11-08T04:12:26.000044
Verna
clojurians
clojure
sorry, i was mistaken - it's the Inside Transducers talk
2017-11-08T04:54:41.000063
Evan
clojurians
clojure
&gt;&gt;&gt;Who knows what the semantics of reduce are when you call it with a collection and no initial value? [Audience response] No one, right. No one knows. It's a ridiculous, complex rule. It's one of the worst things I ever copied from Common Lisp was definitely the semantics of reduce. It's very complex. If there's nothing, it does one thing. If there's one thing, it does a different thing. If there's more than one thing, it does another thing. It's much more straightforward to have it be monoidal and just use f to create the initial value. That's what transduce does, so transduce says, "If you don't supply me any information, f with no arguments better give me an initial value."
2017-11-08T04:55:36.000376
Evan
clojurians
clojure
well, transducers are very simple, language-agnostic concept - there are (library) implementations for javascript, ruby, python, and java as well
2017-11-08T05:16:48.000355
Evan
clojurians
clojure
tim's point was just that transducers were invented in a very short time, and required no compiler support at all
2017-11-08T05:18:02.000054
Evan
clojurians
clojure
<@Verna> Why not use something like this: ``` (derive :mac/high-sierra :mac/default) =&gt; nil (isa? :mac/high-sierra :mac/default) =&gt; true ````
2017-11-08T05:38:48.000320
Taina
clojurians
clojure
and derive all the os-versions from a default version.
2017-11-08T05:39:11.000541
Taina
clojurians
clojure
<@Taina> yes, it came to me afterwards. I’m going to derive version once I get a map to dispatch.
2017-11-08T05:40:07.000275
Verna
clojurians
clojure
<@Verna> :slightly_smiling_face: Happy hacking.
2017-11-08T05:40:58.000336
Taina
clojurians
clojure
<@Sonny> or other Cognitect folks -- I noticed that the instructions in the `readme.txt` in the Clojure repo are no longer complete and accurate -- I can build with ant or maven, but `java -cp clojure-${VERSION}.jar clojure.main` no longer works; it throws an exception because of the spec dependency. Maybe worth adding a note to readme that spec has to be built and installed first? Note: I'm assuming that's what has to be done to fix; I haven't actually tried it at this point. Didn't seem worth filing a ticket, since it's so minor, but a suggestion for the final 1.9 release.
2017-11-08T09:11:39.000002
Lavenia
clojurians
clojure
Just seems like it could trip up new users who are naively trying to follow the instructions in the readme.
2017-11-08T09:12:24.000397
Lavenia
clojurians
clojure
<@Lavenia> this is a known issue, and being addressed with the `clj` tool
2017-11-08T09:14:17.000311
Margaret
clojurians
clojure
it will be integrated (including the readme) when 1.9 is the stable release, is what I heard
2017-11-08T09:14:49.000184
Margaret
clojurians
clojure
Right, I'm aware of the new CLI tool -- just suggesting that the readme be updated.
2017-11-08T09:15:07.000418
Lavenia
clojurians
clojure
Cool, good to know; just wanted to be sure it hadn't been overlooked.
2017-11-08T09:15:22.000137
Lavenia
clojurians
clojure
what new CLI tool?
2017-11-08T09:51:14.000002
Lester
clojurians
clojure
the tool is called clj, it's clojure.core plus a dependency manager to bootstrap
2017-11-08T09:51:45.000389
Margaret
clojurians
clojure
since clojure.core now needs other libraries to run
2017-11-08T09:51:54.000548
Margaret
clojurians
clojure
ah, I see
2017-11-08T09:54:31.000565
Lester
clojurians
clojure
There are several things in that readme that are lagging and need updating. We don’t plan to make any more changes for 1.9 though.
2017-11-08T10:05:23.000487
Sonny
clojurians
clojure
<https://clojure.org/guides/deps_and_cli>
2017-11-08T10:05:54.000425
Sonny
clojurians
clojure
Why were those other libs not merged into `clojure.core` to make sure it could run standalone?
2017-11-08T10:07:12.000778
Mallie
clojurians
clojure
they were originally in core and we split them out to allow them to be updated independently from core
2017-11-08T10:07:46.000330
Sonny
clojurians
clojure
Fair enough
2017-11-08T10:07:59.000458
Mallie
clojurians
clojure
<https://groups.google.com/forum/#!msg/clojure/10dbF7w2IQo/ec37TzP5AQAJ>
2017-11-08T10:08:08.000215
Sonny
clojurians
clojure
Does anyone know a way how to genereate documentation out of plumatic/schema ?
2017-11-08T10:08:09.000645
So
clojurians
clojure
<@So> what kind of documentation are you looking for?
2017-11-08T10:46:01.000600
Ava
clojurians
clojure
<@So> ```user=&gt; (s/defn foo :- Bar #_=&gt; [qux :- s/Str, quux :- [s/Keyword]]) #'user/foo user=&gt; (doc foo) ------------------------- user/foo ([qux quux]) Inputs: [qux :- s/Str quux :- [s/Keyword]] Returns: Bar ```
2017-11-08T10:49:57.000057
Ava
clojurians
clojure
Yeah, `reduce` is ... weird. When I first implemented `reducible-query` in `clojure.java.jdbc` I got the no-init arity of `reduce` wrong because I assumed the semantics of `transduce`. The `reduce` docstring is very clear -- the behavior is just a bit non-intuitive.
2017-11-08T11:48:27.000894
Daniell
clojurians
clojure
How do you idiomatically spell `(is (thrown-with-msg? ...))` except also binding the exception to a name so I can `ex-data` it?
2017-11-08T12:17:15.000454
Georgianne
clojurians
clojure
@bla The first prototype I've writen as comment (see: <https://github.com/DomainDrivenArchitecture/dda-serverspec-crate/tree/development>)
2017-11-08T12:29:39.000363
So
clojurians
clojure
like ``` (def ServerTestConfig { (optional-key :netcat-test) {Keyword {:reachable? Bool}}, ; keyword is used to match test against fact (optional-key :netcat-fact) ; parsed result of "nc [host] -w [timeout] &amp;&amp; echo $?" {Keyword {:port Num, :host Str, ; may be ip or fqdn :timeout Num}}, ; timeout given in seconds (optional-key :netstat-test) ```
2017-11-08T12:30:35.000862
So
clojurians
clojure
But the datatypes described here are splittet across several modules, so we will need a way to 1. add documentation as meta to elements like 'keyword' or 'defschema' 2. a way to render documentation on schema endpoints (sth. like `explain`)
2017-11-08T12:33:09.000243
So
clojurians
clojure
quoting doc of is: ```(is (thrown? c body)) checks that an instance of c is thrown from body, fails if not; then returns the thing thrown.``` - so at the very least, thrown? lets you do that
2017-11-08T12:48:39.000192
Margaret
clojurians
clojure
<@Georgianne> - looks like it works with thrown-with-msg? too ```kingfisher.core=&gt; (clojure.test/is (thrown-with-msg? Exception #"foo" (/ 1 0))) FAIL in () (form-init2223331148129063339.clj:1) expected: (thrown-with-msg? Exception #"foo" (/ 1 0)) actual: #error { :cause "Divide by zero" :via [{:type java.lang.ArithmeticException :message "Divide by zero" :at [clojure.lang.Numbers divide "Numbers.java" 158]}] :trace ... kingfisher.core=&gt; (type *1) java.lang.ArithmeticException```
2017-11-08T12:51:07.000125
Margaret
clojurians
clojure
so the pattern would be to put the `is` in a let block so you can make other assertions about the ex-data
2017-11-08T12:51:52.000182
Margaret