Fork me on GitHub
#clojure
<
2017-03-25
>
bradford00:03:21

Got it. Turns out I had a threadpool with a size of 1 somewhere, and that was no bueno.

seancorfield00:03:40

Oops, yeah, that would do it… Glad you figured it out!

qqq00:03:51

I'm sick of python/hy and want to move my deep learning stack back to Clojure. For the most part all I need is a fast CUDA BLAS library. Is http://neanderthal.uncomplicate.org/articles/getting_started.html the best clojure has to ofer ?

mbcev01:03:06

Getting a no suitable driver exception when using clojure.java.jdbc and I'm not sure why. I added the mysql maven dependency to my project structure via maven. Do I need to do something with my project.clj for Lein?

richiardiandrea01:03:12

Interesting question, I am in Java and I am implementing AFn and looping with map, calling Clojure from Java. Is Clojure using reflection there?

noisesmith01:03:28

no.disassemble might help you find your answer - it shows a readable disassembly of the byte code clojure generates

noisesmith01:03:41

(you could also disassemble an aot compiled clojure function with your IDE)

richiardiandrea01:03:45

The question arises because a little JMH benchmark shows that it is slower compared to .stream.map. The function is an identity basically

richiardiandrea01:03:55

true, I should look in there

richiardiandrea01:03:37

you've been party parroted for the nice suggestion, thanks!

richiardiandrea01:03:17

a Java static class that extends AFn seems faster than a AOT-ed namespace that extends AFn

noisesmith01:03:35

gen class is known to generate slow code

noisesmith01:03:48

if bronsa is around, he knows more about this

richiardiandrea01:03:11

k cool thanks I'll ask him then

noisesmith02:03:01

try comparing a defn to the other two AFn implementations

pawandubey02:03:47

Anybody here know how to "de-instrument" a function after debugging in CIDER?

bbss04:03:20

C-M-x the function again

mars0i04:03:54

@qqq I would ask that in the numerical-clojure Google group. You may encounter some disagreement, but you'll find out what the options are.

mars0i04:03:26

core.matrix might have a BLAS back end.

mars0i04:03:12

or try the core.matrix channel here, too.

rduplain17:03:47

I came across this quote in a few places: > You can reach a point with Lisp where, between the conceptual simplicity, the > large libraries, and the customization of macros, you are able to write only > code that matters. And, once there, you are able to achieve a very high > degree of focus, such as you would when playing Go, or playing a musical > instrument, or meditating. And then, as with those activities, there can be a > feeling of elation that accompanies that mental state of focus. ... which led me to track down the original source. There's a really interesting Paris Review style Q&A interview between Michael Fogus and Rich Hickey in 2011, as part of the "hackademic journal" called Code Quarterly. You can find the full text of the interview in an unofficial re-post here (Markdown and PDF): https://gist.github.com/rduplain/c474a80d173e6ae78980b91bc92f43d1

sova-soars-the-sora18:03:35

@rduplain excellent, thank you for sharing that link

tagore18:03:59

Nice quote. I'd say though, that my experience has been that writing code full of difficult incidental complexity can perhaps even more easily lead one into what I like to call "fugue" (though that has some perhaps unfortunate connotations.) I think there's an important distinction here- do I have to attain the same mental state later to understand the code I've written 😉.

tagore18:03:33

I've some to think, much as I hate to admit it, that in at least some cases enjoying myself too much when writing code can be a bad sign.

tagore18:03:22

Not to disagree at all with the quote- there is a particular pleasure in having all the pieces fall into place such that things become very simple.

rduplain18:03:06

As a matter of personal style, I would say that if code requires as much thought as you suggest, then you are not done working on it.

tagore18:03:35

@rduplain I'd agree- in fact that is to some degree my point.

sova-soars-the-sora18:03:54

"only writing code that matters" , to me, means that the code is correct, and the code does not need to be altered in the future. the more i learn about functional programming (using filter, map, reduce, apply, partial) the more i'm able to achieve functional composition of my programs, and the cleaner the code is. not only that, it is very easy to reason about in the future because all the major functional paradigms are applicable in predictable ways. i think the big hurdle is inverting ones' thinking from sequential (for loops and such) to mapping and filtering. it's kind of like riding a bicycle, where the wheels have to be spinning pretty quickly for one to be able to just balance and coast. i think a lot of pre-functional programming stuff made me think very painstakingly about how to get my bike wheels to spin at all, and then maybe get to my destination, whereas the bicycle is already full speed and now i just need to know the actual roadways with clo. /le rant

rduplain18:03:45

define:fugue via Google, the second definition which is psychiatric must be your mention of "unfortunate connotations"

sova-soars-the-sora18:03:53

hm, very interesting usage of the term. rather different than the musical connotation

tagore18:03:11

@rduplain However I think the state we call "flow" and the psychiatric condition have a lot in common. I like the term, but it is, I suppose prone to mis-interpretation.

tagore18:03:24

I think it is closely related to the musical term, actually.

rduplain18:03:47

I'm a big fan of "flow" in the Csíkszentmihályi sense.

seancorfield19:03:02

Thank you. I'd always assumed there was solid psychology behind "flow" but had never researched it. Your comment prodded me to go look that guy up and read about his work. "Learn something new every day!"

rduplain18:03:17

The loss of identity mentioned in the definition of fugue appears to be related to a disorder.

tagore19:03:06

To write a fugue you must be able to keep each melody in mind, while simultaneously bearing in mind the harmony created by the combination of the melodies. as well as observing a number of constraints about how the melodies relate to each other. To write a good fugue you must also be able to hear the entirety of your composition as a whole in your head while writing it, and sprinkle some indefinable magic on top.

tagore19:03:34

But the whole must also be transparently logical to the listener.

mobileink19:03:51

bach would have been a great (clojure) programmer. #off-topic ?

tagore19:03:39

Perhaps- I'll stop now 😉.

noisesmith19:03:42

music composition when done well is the very definition of complecting a design

fellshard19:03:03

Music composition is not inherently systematic, is it? The performance of a piece certainly is, especially non-solo performances.

fellshard19:03:03

I suppose you can construct systems around it, e.g. the kind that permits jazz players to simply jam with a shared understanding of the governing system.

noisesmith19:03:55

music theory is extremely systemic

sova-soars-the-sora20:03:47

as a musician who believes only in waves, i must humbly disagree

sova-soars-the-sora20:03:19

music theory as applied to western instruments that use 12 tones per octave is rich with patterns, but music composition is a different process that must connect what an actual sound is like and the enjoyability. composition is a subset of theory like the universe is a subset of coloring books

noisesmith20:03:24

the behaviors of waves are also systemic, to the degree of being describable with straightforward math - much more systemic than music theory is

noisesmith20:03:36

now, if you also believe in human ears - there's another can of worms there, of course

sova-soars-the-sora20:03:39

I know what I wanted to say with that originally now; Once your instrument is known to you like the grip of your mug or your spoon, then you can work unimpededly to express yourself.

sova-soars-the-sora20:03:41

And so I think that music and flow and also super-smooth-coding derive from the same principle, know your instrument; know its major buttons and keys, but also flip it over and knock on it upside-down and scratch at it and pluck funky bits.

sova-soars-the-sora20:03:37

Which of these came first? Bach's music or bach's notes on his music? 😃 However, in programming we can never be apart from the notes, for they are the music. So, sliiightly different in that regard, but still about expressivity

sova-soars-the-sora20:03:22

Part of it is that things become automatic, I don't think bach juggled things, I think he learned how to juggle so well he could be asleep and juggling, and then he started whistling, too.

noisesmith20:03:10

sova what I was getting at when I said composition done well is complecting design, is that good software design involves modularity, reducing scope and side effects and interdependencies to make an easier to understand, more reliable system; while good music composition actually amplifies side effects and scope and interdependencies - for artistic effect. My code is good if I can replace a namespace with a totally different design and nothing breaks, a composition is good if you can't change anything without ruining it.

noisesmith20:03:35

(though a fan of contemporary electronic dance music might disagree, and point to infinite remixability of a good hook as being equivalent to modular reusability of good code...)

noisesmith20:03:47

way off topic still, sorry

mobileink20:03:07

#off-topic . plus "complect" is not a word.

joshjones20:03:03

MW lists it as "obselete," but saying it's "not a word" just is not correct http://www.dictionary.com/browse/complect

noisesmith20:03:38

complect is a word Rich Hickey uses extensively to describe bad design in programming, in his talks about clojure

mobileink20:03:10

sure, i studied latin too. the only place u will every see "complect" et al. is in clojure discussions. but it's the classic case of terminological inflation. it means "complicate", no more no less. but using "complect" sounds fancier, as if it meant something more than "complicate", which is plainly not the case.

mobileink20:03:01

RH may be a sw genius; that does not make him the arbiter of English usage. quite the opposite, imho.

fellshard20:03:06

Sure, but we use it here because we share its definition. Call it 'clojurian jargon' if you'd like 🙂

noisesmith20:03:52

by using that word I refer to a set of talks that Rich Hickey has made about software design, assuming that most of the people here has read or seen them

noisesmith20:03:00

mobileink I assume you similarly object to "refactor", "design pattern", etc. ?

mobileink20:03:05

no, why? those are ordinary natural English phrases.

mobileink20:03:51

fwiw i admit it's a personal peccadilo. i absolutely hate it when tech geeks invwnt bogus new terminology when we already have perfectly adequate language. "decomplect"?? what the hell is wrong with "simplify"?

noisesmith21:03:05

because usually software that claims to simplify things does so by increasing the complexity of their implementation

noisesmith21:03:15

decomplect specifically talks about implementation rather than interface

joshjones21:03:07

I'm all for using commonplace words, and am no particular fan of "complect" -- but it means more than "complicate" ... things can be complicated without being "fused" or "merging two concepts that should be separate into one"

mobileink21:03:23

but there's a practical side to this. by using bizarre and unatural terminilogy like "complect" we make it sound like there is some kind of arcane clojure-fu going on, which is likely ro perplex the noobs. when in fact all we are talikng about is complexity v. simplicity. why fuck it all up with a bunch of stupid pseudo-neoligisms?

mobileink21:03:22

@noisesmith so? why do we need an invented term, other than to make it all more impressive.

noisesmith21:03:14

to be more precise about the meaning - as I said, there's other common usages that mean the exact opposite of what we mean

noisesmith21:03:40

so it can be clearer to use a term that isn't already in use, if your meaning is distinct

mobileink21:03:00

show me one place where "decomplect" could not be replaced by "simplify" (or similar) with no change of meaning.

mobileink21:03:01

sure but the meaning (i use the term loosely) of "decomplect" is in no way distinctive. it's just a bullshit version of "simplify".

fellshard21:03:05

You mean 'simplect', don't you? (I kid, I kid. 🙂 )

mobileink21:03:06

and i'm serious: if anybody can gove me a single example where "decomplect" adds anything to simplify, i'll eat my hat.

mobileink21:03:08

@U1YPTG4UF: ooo, that's good, why didn't i think of it?

fellshard21:03:20

I can simplify a braid by flattening it so firmly it becomes one solid piece, or I could simplify that braid by unentangling its component parts. Both make it simple, but only one decomposes it.

noisesmith21:03:37

"the library is simplified" - this could refer to the interface, the implementation, or the range of use cases supported

noisesmith21:03:13

"the library is decomplected" - it specifically is separated from other unrelated concerns (in comparison to some complected alternative which integrates the concerns without division)

mobileink21:03:27

uh huh. and this could not possibly be the case for "decomplect". rilly?

noisesmith21:03:57

in fact I can "simplify" my code by drastically reducing line count by complecting it by blindly following the api of something it builds on

noisesmith21:03:31

the resulting code is simpler - less logic, fewer lines of code; it's more complex, it assumes all the complexity of an underlying layer

mobileink21:03:28

i geuss you mean the resulting code is simplicated? (thanks, @U1YPTG4UF !)

fellshard21:03:43

oh gosh, what have I done

mobileink21:03:46

a great service, my friend! it will be much easier now to mock the "complect" crowd!

fellshard21:03:54

Simplify is generic, decomplect is specific; it refers to undoing something, untangling previously tangled concerns. Ironically, the word itself is a careful composition - de- complect 😉

mobileink21:03:37

as a highly educated native speaker of English: bullshit. i unnerstand etymology. if you want to go that way, what's wrong with "unfold", which is what "decomplect" wants to mean. except that's not really the point, is it. the pont is simplification.

mobileink21:03:46

ie "make less complicated"

noisesmith21:03:40

because, as any linguist would tell you, words have their meanings via usage in communities, and specific meanings evolve over time - the word is significant because in this context it's been used and we are all familiar with this usage (or if we aren't, it refers to a shared conversation we can catch up on)

noisesmith21:03:08

I used the term because it was used in a specific way in a talk I'd assumed people had seen

mobileink21:03:44

@noisesmith "... it's more complex, it assumes all the complexity of an underlying layer" - guess you mean "it's more complected, it assumes all the complectification of... etc."

noisesmith21:03:39

I was describing why I would use the term complected - notice I also called it more simple

noisesmith21:03:44

you hate a word, I guess that's fine but I'd prefer not to be scolded for using a word that was being used correctly in context for an audience that understands it

mobileink21:03:10

you see the problem? when you proliferate made-up terminology we do not actually need, it becomes harder to communicate. the result is that discourse becomes needlessly "complected".

noisesmith21:03:23

all words are made up, period

mobileink21:03:40

@noisesmith for the record i don't believe i ever scolded you personally. if i did i apologize, use whatever words you want.

mobileink21:03:24

my beef is with the terminology, which imo is more harmful than helpful.

fellshard21:03:10

Anti-jargon never goes well 😐

fellshard21:03:13

I'm all for using clear language and not using new words when existing ones will do, but decomplect in this case has specific connotations other words do not in the context of this community. All jargon is made for more efficient and less noisy communication.

mobileink21:03:56

ok, i agree with that. but tell me what "decomplect" expresses that cannot be expressed with the language we already have. i can't find it.

fellshard21:03:43

The best I've got is 'unentwine' or 'untangle' or 'unentangle'

mobileink22:03:06

as far as "this community" goes, i guess i thought creating a closed priestly language was a non-goal. i mean we could make up all kinds of opaque terms if we wanted to.

mobileink22:03:33

ok, but then why not just say "untangle"? what does "decomplect" add that is not alreadt there?

fellshard22:03:34

I don't think too many are made up. Most here have likely seen Hickey's talks, and that philosophy drives much of the thought of Clojure's design and the designs created by its users. So it's only natural they'd carry on its use. There aren't a bunch of other terms like it (though folks seem to jokingly introduce them at the keynotes of various Conj conferences.)

mobileink22:03:15

sure, it's already embedded in the community, bo thanks to RH worship. does not mean it's good.

fellshard22:03:22

It's a common language, therefore it's pragmatic. 😉

mobileink22:03:18

i know i'm fighting a losing battle for literacy in the clojure community. but at least i fought the good fight!

mobileink22:03:48

ps. i think it's a big (and completely unnecessary) turn-off for outsiders. but so be it .

fellshard22:03:42

I'd argue there's much bigger turnoffs for folks in Clojure and that one piece of common jargon is unlikely to be near the top of the list, and in fact might be a way to introduce folks to new concepts when they first hear it.

lxsameer20:03:03

guys, I'm looking for cool and fast test runner, any suggestion ?

tagore20:03:41

@noisesmith But.. all abstractions leak. And when you are building them you have to be aware of all the levels you're abstracting over, but also of all the leaks below those.

tagore20:03:23

Ideally, you arrive at a non-leaky abstraction, but you still have to think about what you are abstracting over while you build it.

noisesmith21:03:06

but artistic designs don't tend to aim for non-leaky abstractions - they usually aim for holism, which in software is the opposite of good design

tagore21:03:48

Sure, and that's the point 😉.

tagore21:03:46

To build that abstraction over a number of leaky layers you must mentally complect them.

tagore21:03:20

You cannot arrive at the abstract without a very firm grasp of the concrete.

tagore21:03:15

Also, your abstraction probably still leaks 😉. They generally do.

jtth21:03:32

Not sure of the right channel to ask this in, but: Is Dmitri Sotnikov’s Web Development with Clojure, 2nd Ed (https://pragprog.com/book/dswdcloj2/web-development-with-clojure-second-edition) a good guide to getting a handle on how clientside and serverside Clojure/Script works for developing web apps? (I’m mostly looking for a Clojure/Script version of Michael Hartl’s Ruby on Rails Tutorial (https://www.railstutorial.org/book/))

noisesmith21:03:15

if you specifically want to do client/server http with clojure, that's the book for you

noisesmith21:03:38

you might not end up using the exact libraries or designs, but big picture it's the best intro

jtth21:03:49

That’s what I’m looking for, a big picture (and full package) take on writing what is basically an SPA.

noisesmith21:03:49

yeah - the book has more than that, but will definitely include that, and doesn't have anything you'll regret learning if you want to know how to do a webapp with clojure and clojurescript

jtth21:03:31

Excellent, thanks! Grabbing it soon. I’m by no means a professional developer; I was learning Rails to build it, then Clojure got its hooks in me. Deep.

tagore21:03:21

@jtth Having looked at it but not read it closely I'd ask a couple of questions.

tagore21:03:00

@jtth The big one is how much you want to do with server routing, and how much you want to do with in-client routing, essentially.

jtth21:03:25

Probably more client-side.

tagore21:03:42

Then likely a good read.

jtth21:03:49

Excellent! Thanks.

tagore21:03:28

It covers both sies, but...

tagore21:03:10

For what I'm writing these days, for instance, the Luminus bits would be superfluous.

tagore21:03:20

Just a matter of approcah.

jtth21:03:22

I’ll keep that in mind. I’ve noticed the care (and minimalism) with which clojure programmers select dependencies and libraries.

sova-soars-the-sora21:03:33

@noisesmith thanks for your reply, it clears it up. lol at the complect thread xD a whole new string.

tagore21:03:05

@jth A good idea- but I think this crosses language barriers. There comes a point in some apps where you start wanting to not mix logic between server and client (gets more complicated with server-side rendering, but I'll ignore that) and you start wanting to treat servers as pure data endpoints.

tagore21:03:54

This is as true in JS as in Cloure/Clojurescript.

jtth21:03:05

@tagore That’s a trend I’ve started to notice. I (think I) like that architecture.

tagore21:03:08

But it's not the case for every app.

sova-soars-the-sora21:03:44

(Yes, Serverside Rendering basically needs a serverside glimpse of what your app shall render as, but that is a good summation @tagore)

tagore21:03:07

Sme thing are still best-written in server-side frameworks. I think the thing to be careful about is mixing the two too much...

tagore21:03:17

For instance I am working on a JS app right now that uses server-side templating to inject data into AngularJS templates. I'd avoid that if possible 😉.

jtth21:03:43

Lordy. That seems complicated. Will avoid!

sova-soars-the-sora22:03:05

Hm. That's a very interesting approach. I, for one, enjoy Frankenstein applications. Sometimes the path of least resistance down the mountain of development gets some pretty wild flows.

tagore22:03:52

It does indeed. To the degree that our angular templates us {[ thing ]} for interpolation, because they get passed through two engines, the first of which uses {{ }} for interpolation. No one bothered to explain this to me when I started working there, so on the second day, at lunch, I was like.. you seem to be using Angular syntax that is entirely new to me, and that I can't find documented anywhere... turns out I was not insane, it was just a different templating language mixed in with the Angular templating... don't do that 😉.

tagore22:03:16

Especially since we use it to inject values angular then uses...

sova-soars-the-sora22:03:44

Oh man, translating pre-processor stuff in your head...

sova-soars-the-sora22:03:04

Well it sounds like you've got a pretty good grip on the lay of the land

tagore22:03:11

Well I've been at the job for a few months now, so I know our wrinkles.

tagore22:03:24

Most places have some- this place is better than most.

tagore22:03:02

Still- I'm inclined to say that you should have one template processor per file 😉

mobileink22:03:35

sorry, didn't mean to copy the list.😱

bradford22:03:59

diving into clojure.spec, seems lit

noisesmith22:03:13

the question disappeared, but I figured it's worth showing the simple clojure.core way to do it:

(reduce (fn [keys-used e]                                                      
          (if (map-entry? e)
            (conj keys-used (key e))                                           
            keys-used))                                      
        []                                                  
        (tree-seq coll? seq                                                    
                  {:a 0                                                       
                   'foo {1 "foo"                                               
                         "2" [{Double/NaN 22                                   
                               {} nil                                         
                               nil 8}]}}))
=> [:a foo 1 "2" NaN {} nil]

noisesmith22:03:53

well - relatively simple (probably even simpler in specter)

qqq23:03:03

without using another atom, ist ehre a way to "get info out of a swap!" ? I have an atom, I arm running swap! on the atom. This produces a new value for the atom -- but I also want to get some aux info out. Currently, I have to do something like

(let [ret (atom nil)]
  (swap atm-to-modify
    (... modifies the atom, also puts stuff in ret)
    @ret))
I want to know if there is a variatn fo swap!, where instead of returning new-atom-value, I return [new-atom-value, aux-data]

joshjones23:03:35

@qqq the add-watch function allows you to attach a handler function that executes when an atom is modified. this may prove helpful

noisesmith23:03:39

qqq my preferred way to do this is with a volatile - which is only a small improvement (modifications to ret are guaranteed not to conflict if ret is bound locally (as it should be), and volatiles are faster if you can meet that guarantee)

noisesmith23:03:56

also, refs can handle this much more naturally (but you probably don't need refs)

noisesmith23:03:04

@joshjones if qqq's usage is anything like mine, I don't care about arbitrary changes to the atom, but I do care about certain aspects of the state before my alteration was made in that specific scope

noisesmith23:03:40

of course, if I only care about state after my alteration, I can just use the return value of swap! itself

tbaldridge23:03:32

@qqq I'd use compare-and-set!

noisesmith23:03:39

oh - I need to remember that one