#clojure log - Jan 14 2015

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:47 munderwo: Hi all. how do people filter a map based on the value instead of the key>

0:48 luxbock: munderwo: when you filter a map, the filtering function receives a map entry which is like a vector of key to value, so you can use a function like (fn [[k v]] ...) and just use the v only

0:49 munderwo: ahh cool. thanks. that helps

0:49 luxbock: &(filter (fn [[k v]] (even? v)) {:a 1 :b 2 :c 3 :d 4})

0:49 lazybot: ⇒ ([:b 2] [:d 4])

0:49 luxbock: if you want a map back, you have to use (into {} ...)

0:53 TEttinger: (inc luxbock)

0:53 lazybot: ⇒ 3

0:53 TEttinger: that was very thorough!

0:53 luxbock: :)

6:38 nautilo: I just started learning clojure as my 1st programming language. I already did some basic tutorials and now I want to move to web dev. What framework do you guys advise for a beginner?

6:38 the_frey: nautilo: (caveat - only do systems/data stuff in clj) but my impression is very much that you roll your own using a few libraries like ring

6:38 daniel`: nautilo: clojurians generally shun frameworks in favour of libraries

6:39 some examples:

6:39 the_frey: there's no rails/django for clj that I know of

6:39 daniel`: compojure/ring (routing), liberator (REST api), monger (mongodb client), om (frontend/clojurescript), secretary (frontend routing)

6:39 nautilo: found this http://www.luminusweb.net/

6:40 daniel`: yes, that provides some structure

6:40 nautilo: unless im missing something it's says web framework

6:40 daniel`: but actually its more a collection of libraries than a framework

6:40 but it does provide some initial setup help and dir structure

6:41 nautilo: you're also interested in clojurescript/frontend or just the backend?

6:41 nautilo: before i choose clojure I did the basic sinatra(ruby) and flask(tuts)

6:42 the_frey: those are def libraries rather than frameworks too, I'd say

6:42 nautilo: but clojure syntax made more sense to me

6:42 clgv: nautilo: you should probably start with reading intros to ring & compojure and move on from there

6:43 daniel`: agreed, ring/compojure is usually the foundation

6:43 i like starting with https://github.com/plexus/chestnut as a base

6:43 nautilo: daniel: thanks for the clojurescript. Didn't know that one

6:43 daniel`: not very opinionated but gets you up and running with a good setup

6:43 clgv: daniel`: but for a beginner that is probably too much ;)

6:44 realmavbozo: nautilo: there's a book https://pragprog.com/book/dswdcloj/web-development-with-clojure

6:44 clgv: I'd not start with client-side clojurescript before the server-side is understood

6:44 nautilo: I have a solid html/css background

6:45 my goal is to add clojure and javascript to my tool box

6:45 clgv: nautilo: I meant the server-side clojure libs ;)

6:45 nautilo: And that clojurescript things seems like a godsend to me

6:46 clgv: nautilo: better go for clojure and clojurscript (instead of javascript) ;)

6:46 daniel`: clgv: i dunno, if you try and understand it peace by peace, you'll end up with a good idea of how all the parts fit together

6:46 clgv: daniel`: but there are too many moving parts to confuse if you start with the complete CLJS+CLJ setup and even include Om ;)

6:46 daniel`: always good to know javascript, but i agree that clojurescript is much nicer and can even have performance benefits when combined with reactjs over plain js

6:47 realmavbozo: nautilo: just curious, what text editor do you use?

6:47 daniel`: clgv: maybe, i think my first attempt at a clojure web app was using noir with no cljs

6:47 nautilo: clgv: I do not know js but clojurescript seems to be clojure + some modifications

6:47 supersym: I think some JavaScript knowledge reallly comes in handy when tinkering ClojureScript

6:49 daniel`: supersym: definitely, more so than java/jvm knowledge helps with clojure i would say

6:49 nautilo: realmambozo: mostly textwrangler/sublime text before clojure

6:49 supersym: interop syntax/sugar is different, something that took me a while to grok

6:49 daniel`: agreed

6:51 luxbock: I like naming maps and functions that act like them as foo->bar, but then I have a lot of functions that create these maps and I get stuck trying to name them

6:52 does anyone have a convention for this?

6:52 supersym: haha naming... the biggest challenge to any programmer

6:52 luxbock: indeed

6:52 nautilo: I did the js "lesson" at http://www.codecademy.com/ to get familiar with the language

6:53 supersym: my biggest 'problem' is the JS libs are so not structured like Java API/projects

6:53 nautilo: but now I have the felling that if i don't set a path to my learning, it will fail (or at least be a much harder journey)

6:54 supersym: and since cljs allows you use (and LT to use) properties/methods that dont exist, you'll want to learn and read those projects to see what arguments are accepted, what objects are returned, to get a good grip on some e.g. node.js and cljs interop

6:54 luxbock: nautilo: the best way to learn (for most people I dare say) is to learn by doing

6:55 just think of something you want to do, and then brake it down into smaller and smaller pieces until they become something you can start chewing

6:55 supersym: nautilo: it is always good to have a learning goal but i try to make my path not too rigid

6:56 realmavbozo: nautilo: JavaScript The Definitive Guide and JavaScript: The Good Parts books will help you in your journey mastering javascript

6:56 nautilo: luxbock: Agree 100% . I have a couple of designs and I would like to transform them into real web apps as a learning purpose

6:57 and please excuse my bad english :)

6:58 supersym: I think the Americans are sleeping now ;)

6:58 luxbock: I think I like map-foo-bars as my naming convention

6:58 supersym: even if they were speaking actual English :P

6:59 nautilo: :)

7:00 supersym: nautilo: what kind of designs? frontend js or backend?

7:02 nautilo: supersym: I meant photoshop designs

7:02 mavbozo: luxbock: i'm having trouble understanding your phrase "maps and functions that act like them"

7:02 nautilo: sorry if I like the right terminology for this stuff

7:02 mavbozo: luxbock: can you give me a example?

7:03 daniel`: mavbozo: a map is a function

7:03 supersym: https://kanaka.github.io/clojurescript/web/synonym.html

7:03 daniel`: ,({:a 1 :b 2} :a)

7:03 clojurebot: 1

7:05 daniel`: i thought he meant e.g. response->code ,({:success 200 :fail 400} :success)

7:05 Glenjamin: the term `map` is complected

7:05 supersym: very true

7:05 Glenjamin: (not technically correct use of complected)

7:08 mavbozo: the term map in our community is shorthand for hash-map right?

7:08 supersym: ambiguous?

7:08 daniel`: unless you're talking about the map function

7:09 supersym: I'm a native dutchie :) I wouldn't know either

7:09 btw..this evening first Amsterdam Clojurans meetup I'll be attending, 22 people RSVP :)

7:09 mavbozo: daniel`: yeah, that's an exception

7:09 supersym: *excited*

7:10 Glenjamin: overloaded is probably a more accurate term

7:12 supersym: Glenjamin: indeed ^^ another thing learned "semantic overload"

7:12 nice

7:13 clgv: In a Clojure ring + compojure application what exactly is the reason for: "The page isn't redirecting properly"

7:15 ah right, friend is used and is causing a redirect to the "/login" route

7:22 justin_smith: luxbock: clearly you want FooBarMappingFactorySingleton

7:23 hyPiRion: FooBarMappingFactorySingletonProxy*

7:23 justin_smith: (please don't sctually do that)

7:27 clgv: justin_smith: AbstractDisposableProfileTimeoutImpl ? (http://www.classnamer.com/index.html?generator=spring)

7:27 :D

7:38 luxbock: if I use keys on a sorted-map, are the keys quaranteened to come out in the order that they were in the map?

7:41 pyrtsa: luxbock: In a sorted-map m, the keys will be in the order equal to (sort (keys m)).

7:42 luxbock: pyrtsa: so I should use sort with keys just to be sure?

7:47 dsevilla: hi

7:48 I updated cider from melpa and now the window of the repl does not show anything

7:49 it says "connected", but no new window appears, but the buffer is created. When I switch to it, the buffer is empty

7:50 luxbock: dsevilla: I had that problem but it went away after I restarted Emacs

7:50 dsevilla: luxbock: ah, restarted several times without luck

7:52 luxbock: dsevilla: maybe try recompiling the .elc files in your cider folder

7:52 justin_smith: luxbock: no, keys are guaranteed to be in sorted order

7:52 luxbock: alright thanks

7:52 dsevilla: luxbock: I'm going to reinstall the cider package again, let's see

7:55 oh, well...

7:55 pyrtsa: luxbock: What justin_smith said. It's good to know sorted-map is actually about being sorted by a comparator, which is different from being an "ordered map" that preserves the insertion order.

7:55 dsevilla: deinstalling cider and installing it again worked...

7:55 it may have to do with older installation of nrepl

7:55 OK, thanks anyway

7:56 luxbock: pyrtsa: yeah, sorted-map works for my use case, but I often wish ordered-map was part of the core

8:02 jack_: Any idea about gsoc 2015 projects?

8:03 clgv: jack_: there was no discussion on the ML so far

8:03 jack_: Oh, thanks :)

8:03 clgv: jack_: but you can ask there - maybe you trigger a discussion ;)

8:04 pyrtsa: luxbock: Yeah, it would be useful. https://github.com/amalloy/ordered works in the meantime. (I doubt it would end up in the core before someone invents a way of avoiding the explicit compacting needed when there are lots of removals.)

8:04 jack_: clgv: Good idea indeed! ;)

8:04 clgv: How many slots were allotted last year?

8:05 clgv: jack_: wake them from winter sleep :D

8:55 daniel`: say i have (def selectors [:ul.test [:li {:a :b :c :d} [:a {:a :b :c :d}]]])

8:55 im struggling to find a nice recursive definition to end up with [[:ul.test] [:ul.test :li] [:ul.test :li :a] [:li] [:li :a] [:a]]

8:56 actually, thats the wrong result

8:56 with [[:ul.test] [:ul.test :li] [:ul.test :li :a]]

8:56 treating it like a tree, finding all the possible combinations up until the end of each branch

9:03 https://gist.github.com/danielstockton/d2a0671088543452e8f9

9:08 martinklepsch: when deploying via uberjar how do you supply things like bouncycastle that can't be packaged w/ the uberjar?

9:35 clgv: martinklepsch: do you mean the crypto library "bouncycastle"? why shouldn't that be packagable with the uberjar?

9:36 martinklepsch: clgv: as far as I understood it's signed in some special way that will check jar signature when the lib is loaded

9:36 clgv: martinklepsch: I use [org.bouncycastle/bcpkix-jdk15on "1.50"] as normal dependency

9:38 martinklepsch: we're using [org.bouncycastle/bcprov-jdk15on "1.50"] — not sure what the actual difference is

9:39 clgv: martinklepsch: I get that one transitively as dependency. I use BC to generate certificates. maybe you do not need the generating part and that is what separates the two

9:40 martinklepsch: clgv: my sources for the above were basically this: http://www.raynes.me/logs/irc.freenode.net/leiningen/2013-11-08.txt

9:41 so maybe it's wrong. although it did the trick for us. we now just -cp the bouncycastle jar and uberjar

9:43 clgv: martinklepsch: did you run into an actual problem, yet?

9:43 martinklepsch: the problem we had was that the provider was not available in our uberjar

9:47 kaiyin: https://gist.github.com/kindlychung/1cc5897b4e3b28af67d1 what does #(% numbers) mean here?

9:48 martinklepsch: #(/ 1 %) is an anonymous function

9:48 clgv: kaiyin: first argument of the lambda function, in this case it will be one of the functions provided to map

9:49 ,(read-string "#(% numbers)")

9:49 clojurebot: (fn* [p1__27#] (p1__27# numbers))

9:49 clgv: kaiyin: ^^

9:50 kaiyin: clgv, oh, now i see.

9:50 cool.

9:50 llasram: ,`#(% numbers)

9:50 clojurebot: (fn* [p1__50__51__auto__] (p1__50__51__auto__ sandbox/numbers))

9:51 kaiyin: The same as (map (fn [f] (f numbers)) [count sum avg])

9:52 clgv: kaiyin: indeed

9:53 kaiyin: do not use the shortcut #() too much, there are a lot of cases where a proper (fn ..) with named parameters ia a much better documentation

9:54 kaiyin: clgv, thanks.

9:54 clgv: kaiyin: in the above example it is ok, I'd say

9:56 puredanger: whoever mentioned the messed up core.async api docs yesterday, they are fixed

9:56 kaiyin: Cool. Another question, Java usually performs very well, especially with numerics, it can perform nearly as well as C. What is your impression on the performance of clojure?

9:57 tcrayford____: kaiyin: clojure can compile to the same bytecode as java. Often for how clojure is typically used, it's slower, but it doesn't have to be

9:58 clgv: kaiyin: depends on the implementation as everywhere else. it is possible to get fast idiomatic code, e.g. via macros that hide ugly low level stuff. you can have a look at zach tellmans github repo - he has some libraries from that category

9:59 kaiyin: on a related note - you are easily able to use mutable data structures in clojure when you java performance in some bottleneck, but you should make sure that the mutability does not leak out ;)

10:00 +need

10:01 kaiyin: cool.

10:06 ToxicFrog: kaiyin: I further note that, even if you can reach parity with Java in runtime performance, startup performance is going to be dramatically worse. It's better for long-running processes.

10:07 tcrayford____: ToxicFrog: a great point - I'm so used to just thinking of clojure as for server stuff

10:07 puredanger: "dramatically"?

10:07 SagiCZ1: about twice as slow in my experience

10:08 puredanger: where "twice" is 2 seconds vs 1?

10:08 ToxicFrog: puredanger: depending on circumstances, 2-6x slower

10:08 Although on a system with slow disks I've seen 20+ seconds

10:09 puredanger: does that include time for things like lein (which has its own overhead)?

10:09 ToxicFrog: Sorry, did I say 2-6x slower? I mean 6-35x: http://nicholaskariniemi.github.io/2014/03/19/solving-clojure-boot-time.html

10:10 kaiyin: ToxicFrog, even if the application is already compiled to a jar file?

10:10 puredanger: yes, so the absolute value difference in that blog for example was 1.7 s

10:10 hyPiRion: kaiyin: yes.

10:10 kaiyin: hyPiRion, curious. Why so?

10:11 clgv: kaiyin: if you are not building command line tools, don't be scared by ToxicFrog's statement ;)

10:11 puredanger: I admit the Clojure adds startup time, but I wish people would speak less hyperbolically about it and also consider the time for clojure vs lein or other things in the mix

10:11 hyPiRion: kaiyin: Just look at the url ToxicFrog posted. I think that has some explanation of why

10:12 clgv: yeah, it's only "bad" for the ones working with CLIs (or would like to do some clj-scripts for w.e. reason)

10:12 puredanger: also, clojure 1.7 has some improvements for things like avoiding class loads for imported classes and class checks during compilation

10:13 I think dnolen has made some great improvements in the CLJS+node path for script usage and we will continue working on startup time in Clojure 1.8

10:13 ToxicFrog: kaiyin: the URL I linked has the details, but basically it's because loading all of the clojure core libraries and language runtime is really expensive, even if everything is precompiled and uberjarred.

10:13 * clgv is still waiting for the static functions ;)

10:14 ToxicFrog: puredanger: that's good to know

10:14 puredanger: the fastload branch of Clojure implements lazy loading and is significantly faster to start up

10:14 ToxicFrog: I would actually like to use clojure for little script-y things, but I generally end up going with python because it starts up so much faster, and just using clojure for daemons.

10:14 puredanger: with the downside that every var invocation after startup is about 50% slower

10:14 ToxicFrog: Ouch,.

10:15 puredanger: because adding a volatile thunk check in there hurts inlining

10:15 invokedynamic is I think a potentially excellent solution to this problem

10:15 clgv: the direct branch of Clojure implements static linking (also leaves dynamic linking)

10:16 clgv: puredanger: that what I meant. :)

10:17 puredanger: however, this is a choice that can potentially be made at every call site and it is quite easy to find circumstances where you want some dynamic / some static or even different answers in prod vs dev

10:17 there need to be some code-level tools to say what should happen and that's going to require some research and exploration

10:17 clgv: puredanger: yes. hmm is "primitive higher order function invocation" a goal of the "direct" branch?

10:18 puredanger: no

10:18 but also of interest

10:18 clgv: puredanger: this is also something, that can be decided at callsite

10:18 puredanger: interestingly, I found that because var invocation is almost never the hot spot in an application, it didn't actually help make most programs faster

10:18 although admittedly direct branch does not implement static self calls which would have helped some of the cases I looked at

10:19 protocol invocation can never be static though so for example core.matrix is helped not at all by static

10:19 clgv: puredanger: you need some very algorithmical or mathematical problems to have it as bottleneck

10:19 puredanger: yes, I tested some of the Alioth tests for that

10:20 clgv: puredanger: usually, I go with :inline in these cases

10:20 puredanger: hacked to run longer since those are so short

10:20 most of the alioth programs don't even have var invocation in the hot loop as that's already been optimized out either by implementation or macros

10:21 some required self calls - those would have been helped

10:21 mpenet`: anyone remembers the name of that clojure transpiler via python (hy*something) ?

10:21 puredanger: mpenet`: it's just Hy isn't it?

10:22 mpenet`: I dont think so

10:22 puredanger: https://hy.readthedocs.org/en/latest/ ?

10:22 mpenet`: ah yeah

10:22 thanks

10:22 puredanger: you might also like Tim's Pixie lang though https://github.com/pixie-lang/pixie

10:23 mpenet`: I love it already yes, kicked the tires and all. But I wanted to have a deeper look at Hy this time

10:26 clgv: puredanger: I hope that pixie does not converge too much from clojure - then it could be used to run those algorithms in production but develop them on clojure with all of the jvm libs that are needed for analysis and co ;)

10:26 diverge*

10:26 :/

10:27 lpaste: sdf pasted “sdfsdfsdf” at http://lpaste.net/7608104634342703104

10:27 Foxboron: mpenet`: feel free to drop by #hy ^^

10:27 clgv: oh there is pixie dust as well... :D

10:28 arohner: is anyone else having trouble with cider buffers in 0.8.2?

10:29 mpenet`: clgv: pixie is already looking very good for a 1 man, super recent project, really impressive

10:29 arohner: cider seems to create a new emacs buffer for each connection, it doesn't close the buffer when the connection dies, and it sometimes behaves strangely if I try to make a second connection to a second jvm

10:31 clgv: mpenet`: you should check the github stats - "one man" is pretty unfair ;) https://github.com/pixie-lang/pixie/graphs/contributors

10:32 mpenet`: right, missed that

10:38 ToxicFrog: I keep looking at these "clojure, but fast" projects and being excited, but I never actually get around to using them for anything because clojure is just so convenient to develop in.

10:38 Mostly thanks to lein.

10:39 AdmiralBumbleBee: is anyone aware of any progress in using clojure with netbeans 8.x?

10:43 clgv: AdmiralBumbleBee: has there been any attempt?

10:43 AdmiralBumbleBee: there is Cursive on IntelliJ and CCW on Eclipse

10:43 AdmiralBumbleBee: clgv: as far as I can see, there's plenty of 'we'll fix it'...

10:44 ItelliJ does not work for me at all, quite literally

10:44 mpenet`: ToxicFrog: the jvm still has some downsides, runtime size, startup time, pixie could help there, also it's ffi seems promising.

10:44 ToxicFrog: mpenet`: oh, for sure

10:44 AdmiralBumbleBee: I would love to use cursive otherwise

10:44 clgv: AdmiralBumbleBee: one other option remaining ;)

10:44 AdmiralBumbleBee: clgv: no there isn't ;)

10:44 I'm trying to avoid saying mean things

10:44 don't ruin this for me! :D

10:44 ToxicFrog: My point is more that I look at, say, cursive, and think "that looks really neat, but I actually have to install and set it up, and cross-platform deployment is nonobvious"

10:44 Er

10:44 at pixie

10:44 I've never looked at cursive

10:45 Whereas with clojure proper it's just "lein new, write code, lein uberjar, done"

10:45 clgv: AdmiralBumbleBee: for work with clojure these "mean things" would probably be unwarranted anyways

10:45 mpenet`: yeah, it's still young for sure

10:45 ToxicFrog: Also, lein makes depending on other libraries totally painless.

10:45 Which is huge.

10:45 AdmiralBumbleBee: clgv: well, I use eclipse for 'work' (embedded c/asm)... and I have plenty of gripes with it

10:46 ToxicFrog: So my hope is that one of these fast-clojure projects will reach the point where it's as painless to use and deploy.

10:46 AdmiralBumbleBee: clgv: I also rather use something else simply due to the fact that I stare at eclipse most of the day as it is

10:46 mpenet`: ToxicFrog: hopefully "dust" will help with this

10:46 AdmiralBumbleBee: I suppose I could ask here, since I've tried everywhere else... anyone else have issues with IntelliJ's UI being extermely sluggish? (I've asked pretty much everwhere else, no good info)

10:46 mpenet`: ToxicFrog: https://github.com/pixie-lang/dust

10:46 clgv: AdmiralBumbleBee: sounds like programming on hands and knees :P

10:47 ToxicFrog: mpenet`: oh, that is nice

10:47 AdmiralBumbleBee: as it is, I do all my clojure stuff in emacs.. but I'm trying to modernize a bit

10:48 Glenjamin: heresy!

10:49 clgv: AdmiralBumbleBee: you want to stop asking questions "does cider ... for anyone else ..." ;)

10:49 AdmiralBumbleBee: clgv: that's actually the exact information I'm looking for though

10:49 clgv: that way I know I'm not on a wild-goose chase

10:50 clgv: AdmiralBumbleBee: I use CCW for at least 3 years now

10:50 AdmiralBumbleBee: I know the propensity of people to ask that question when they want specific help... but that's ont what I'm looking for right now :)

10:51 clgv: AdmiralBumbleBee: some nasty bugs happened there as well, but overall it gets the job done - some bleeding edge features might be missing...

10:51 vioz: what is (= ...)

10:51 clgv: a sad smiley?

10:51 vioz: it looks like a cute, backwards smiley

10:53 clgv: ,(doc =)

10:53 clojurebot: "([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison."

11:10 zilti: Did they throw (:refer-clojure :exclude [blah blah]) out of Clojure 1.7? I get the "already refers to"-warnings even with that.

11:10 kaiyin: In this even number generator, https://gist.github.com/kindlychung/7aaf44ba3ecb60a0d5fd , the second pattern [n] is kind of dangerous, I mean if you pass an odd number to it, then you will get a sequence of odd numbers. How do you solve this problem?

11:12 llasram: kaiyin: Rename it to `every-other-integer` ?

11:12 hyPiRion: kaiyin: (defn even-numbers [] (iterate #(+ 2 %) 0)) ?

11:12 Or just hide the even-numbers with arity 1 somehow.

11:12 kaiyin: hyPiRion, how do you hide an arity?

11:13 hyPiRion: kaiyin: You can't hide it directly, but you can refactor to do so. E.g. you can use letfn

11:14 hellofunk: what about something like (filter even? (range)) (not at repl to try)

11:16 andyf: zilti: I'm not aware of any changes in that area. What symbols in particular are you getting the "already refer to" warnings about? There are 15 new Vars in Clojure 1.7, including 'update' and 'cat', that are names used in some other libs as well.

11:18 zilti: andyf: The usual ones I exclude for core.typed, that is, atom doseq let fn defn ref dotimes defprotocol loop for.

11:19 andyf: zilti: You mean the "already refers to" warnings are about names like atom, even though you explicitly exclude atom ?

11:19 zilti: andyf: Exactly. That used to only happen when I didn't exclude them.

11:20 andyf: But, in contrast to what happened in earlier versions, loading the same file again into the repl only shows the warnings again instead of throwing around exceptions

11:22 andyf: zilti: I just tried a tiny sample Leiningen project that defn'd a function atom in a namespace. without (:refer-clojure :exclude [atom]) I saw the warning. With that line, there was no warning.

11:22 with Clojure 1.7.0-alpha5

11:23 zilti: andyf: Oh, is that in maven already? I'll try with that. Or maybe it has something to do with boot or core.typed.

11:25 andyf: zilti: There have been a few changes with AOT compilation in 1.7.0-alpha5, and core.typed apparently includes some AOT'd libs like core.cache and core.memoize in it. Not sure if that would be related.

11:26 clgv: zilti: or maybe you loaded the namespace without :exclude added the :exclude but did not restart the repl ;)

11:27 zilti: clgv: Nah, definitely not :)

11:28 ticking: hugod: hey, could you give me a hint on what the :sample value in criterium actually represents?

11:53 vioz: what is (= ...) in https://github.com/jakemcc/exercism-solutions/blob/master/clojure/bob/bob.clj#L8

11:53 ToxicFrog: vioz: the equality operator?

11:53 ,(= 1 1)

11:53 clojurebot: true

11:53 ToxicFrog: ,(= 1 2)

11:53 clojurebot: false

11:53 llasram: (doc =)

11:53 clojurebot: "([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison."

11:54 hiredman: hah, equals(), how quaint

12:02 justin_smith: vioz: to be even more clear ##(= (.toUpperCase "hello") "HELLO")

12:02 lazybot: ⇒ true

12:13 vioz: thank you

12:16 I know nothing about Java, where can a find a listing of class methods available to clojurists?

12:16 .toUpperCase e.g.

12:16 Bronsa: ,(use 'clojure.reflect)

12:16 clojurebot: nil

12:17 Bronsa: ,(:members (reflect String))

12:17 clojurebot: #{#clojure.reflect.Method{:name replaceAll, :return-type java.lang.String, :declaring-class java.lang.String, :parameter-types [java.lang.String java.lang.String], :exception-types [], ...} #clojure.reflect.Field{:name CASE_INSENSITIVE_ORDER, :type java.util.Comparator, :declaring-class java.lang.String, :flags #{:public :static :final}} #clojure.reflect.Method{:name indexOf, :return-type int, :de...

12:17 justin_smith: vioz: all methods are available via clojure, the official javadoc is pretty straightforward to browse through

12:17 there is also that :)

12:17 Bronsa: vioz: ^ you can use clojure.reflect/reflect to inspect classes at runtime or just javadoc

12:18 justin_smith: vioz: there is a chrome / firefox extension called "javadoc search pane" that is very helpful too

12:18 or sometimes, even bean

12:18 ,(bean (java.util.Date.))

12:18 clojurebot: #<ExceptionInInitializerError java.lang.ExceptionInInitializerError>

12:18 justin_smith: err...

12:19 &(bean (java.util.Date.))

12:19 lazybot: ⇒ {:day 3, :date 14, :time 1421255874085, :month 0, :seconds 54, :year 115, :class java.util.Date, :timezoneOffset 0, :hours 17, :minutes 17}

12:25 clgv: vioz: http://docs.oracle.com/javase/7/docs/api/

12:32 arohner: vioz: https://github.com/timmc/handy/blob/master/src/org/timmc/handy/repl.clj

12:34 Beamed: Has Clojure's error reporting improved as late? I know it's a foolish thing to ask, but I was warned away from it for that reason.

12:35 SagiCZ1: Beamed: who warned you away from such a cool language?

12:35 Beamed: Just a thread I was reading about LISP-oriented languages

12:36 SagiCZ1: Beamed: I think you started from the wrong end.. i think error reporting is fine, it's just hard to understand what the error means and how to fix it at first..

12:37 luxbock: Beamed: cider for Emacs has a nice stacktrace-mode that helps

12:37 Beamed: Does IntelliJ's Clojure plugin have a decent stacktrace? I could give that a shot, I've used it before.

12:37 justin_smith: Beamed: in my experience, having used other lisps, learning to interpret Clojure errors is an annoyance, and it's a hurdle to really mastering the language, but it's worth it for the other things Clojure offers.

12:38 SagiCZ1: Beamed: it has a stacktrace.. i dont know what features do you expect but it does show a stactrace with clickable row links

12:38 justin_smith: Beamed: the issue most people have is that the stack trace is a jvm stack trace, which thanks to pervasive use of laziness, may not look like your code to you

12:39 [blake|: That's funny. I would have said beyond the initial shock, the error reporting was mostly a minor impediment.

12:39 Beamed: justin_smith: So it's not something that would hold me back from building larger programs with it?

12:39 SagiCZ1: [blake|: i am still having a hard time finding some errors..

12:39 justin_smith: no, interpreting the stack traces is in my experience a hassle, and a skill you need before mastering the language, but not something that prevents bigger things being made

12:40 Beamed: Okay, that's not so bad then. The way it was told to me implied that eventually you reached a point where it was difficult to really maintain larger software with it because of it.

12:40 SagiCZ1: Beamed: quite the opposite actually.. clojure offers many features and ideas that make maintaining projects easier!

12:40 clojurebot: Cool story bro.

12:41 [blake|: Heh. My father told a story of people who would pore over the error output (back in the punched card days) and he asked on old timer why he didn't do that. "Because the error's in my code."

12:41 justin_smith: Beamed: there is a bright side - the fact that the stack traces are a bit weird is a small drawback that comes with something much cooler - the fact that Clojure is very "close to the metal" of the jvm, which means a lot for efficiency and power in the long run

12:41 SagiCZ1: [blake|: yeah but where.. haha

12:42 [blake|: SagiCZ1: It's the place you're not looking. =P

12:42 SagiCZ1: [blake|: always..

12:42 Beamed: Alright, thanks for the input guys; I'll hop on 4clojure after lunch and give this a shot.

12:42 [blake|: As I tell my son. And you see this a lot when programmers are having trouble, they come to you and explain all the reasons there code is PERFECT.

12:42 er, their

12:42 mavbozo: the stacktrace sucks but if it is the price I have to pay for many great features.

12:42 Beamed: Is invoking Clojure from Java as simple as invoking Java from Clojure?

12:42 [blake|: Beamed: Welcome aboard. It's a great language.

12:43 Beamed: |blake|: thanks :)

12:43 justin_smith: also, a language with an excellent (and very helpful) community, in my experience

12:43 SagiCZ1: Beamed: no it's not as simple..

12:44 justin_smith: i second that

12:44 mavbozo: but the stacktrace and error reporting become less sucky overtime

12:45 i started clojure from 1.3 and i feel that the error reporting become much more helpful as clojure version increases

12:46 vioz: wow, that was a lot more help than i expected

12:46 justin_smith: mavbozo: agreed, interpreting them is a kind of literacy imho

12:46 vioz: thank you all!

12:46 justin_smith: mavbozo: ahh, we may disagree about reasons it becomes easier :)

12:46 [blake|: There is an embarrassment of riches here, help-wise, vioz. =P

12:49 mavbozo: for example, the line position where error occurs is more accurate in 1.6 than 1.3

12:52 justin_smith: mavbozo: that's true, but to me the improvements since 1.3 (my first version as well) are less than the difference made by learning to read the stack traces and pull the information out of the noise

12:52 SagiCZ1: justin_smith: how does one learn something like that

12:52 luxbock: first version of my general expander is ready: https://gist.github.com/luxbock/c76a848e933618e5ae51

12:53 I think it will fail if the expanded form contains locals that override the fn argumeny symbols

12:53 I'm not sure how to get around that yet

12:54 Bronsa: luxbock: is there a reason why you didn't use something like tools.analyzer or riddley for that?

12:55 luxbock: ah, I see that you're "expanding" function bodies

12:55 luxbock: Bronsa: yeah my use case for this is for debugging purposes, so that I can see what the function I'm trying to invoke is doing, and also evaluate sub-expressions inside the expanded form

12:56 I'm going to bind this to a key in Emacs so that it replaces the preceding form

12:57 justin_smith: SagiCZ1: I think by learning how things are implemented (for example recognizing the methods on lazy-seqs so you recognize lazy evaluation in your stack trace), and generally being more familiar with what typical stack traces for Clojure programs look like.

12:57 kaiyin: Is this kind of code common in the clojure community? https://gist.github.com/kindlychung/3ff3b591a74af81d4124 Multiple layers of mapping and anonymous functions are very difficult to read.

12:58 SagiCZ1: kaiyin: check out this article if you wonder why clojure can appear to be harder to read http://www.brandonbloom.name/blog/2013/06/24/code-density/

12:58 luxbock: kaiyin: that's far from the worst code I've seen

12:58 or far from the most unreadable Clojure code I've seen

13:00 ssideris1: kaiyin: that's relatively readable :-)

13:00 kaiyin: although I think it could be simplified a lot

13:01 llasram: kaiyin: I think the verbosity makes it more difficult to follow. More compact version: https://gist.github.com/llasram/a94f85ac31b5ad8c1d5c

13:02 ssideris1: kaiyin: the zipmap function could be useful in this case

13:02 llasram: Oh yeah, zipmap

13:02 kaiyin: ok, I understand code density must be higher in a more expressive language, but why make it more difficult by all the nesting? For example, I would write the same function like this: https://gist.github.com/kindlychung/0601a2821fe346888e7f

13:03 ssideris1: kaiyin: even shorter: https://gist.github.com/stathissideris/be2201ecff7cb42a328e

13:04 llasram: kaiyin: You could, yes? You can always factor out parts into their own functions to improve legibility

13:05 luxbock: sometimes factoring out parts can make code less readable as well, because now your brain has to do more context switching to understand it

13:05 ssideris1: luxbock: agreed, I tend to leave more things in-place these days

13:06 SagiCZ1: ssideris1: me too i hate the idea of splitting every little bit of code into more and more parts.. like what the author of Clean Codes suggests to do in java.. basically one line methods are best he thinks

13:08 ssideris1: SagiCZ1: the thing is that sometimes you get a very neat little function that can be named in a very descriptive way to match the rest of the code. In such cases I will factor it out. In some other cases the function will have an awkward name that does not describe well what it does and factoring out will obfuscate the code...

13:08 SagiCZ1: ssideris1: oh okay.. i see your point..

13:09 asonge: also, if you're really naive about the 1-line method calls or something like that, you're going to end up with people making spaghetti code in a small set of flat classes where things fly around in god knows what order

13:10 my biggest thing i want to understand when i first get into a piece of someone else's code is control flow

13:10 SagiCZ1: clojure always has just one way the code flows because it encourages immutable data

13:10 in other languages the code can flow many different paths that can be difficult to see

13:11 ssideris1: an example of good things to factor out IMHO is predicates, it's more readable to say (filter has-name? coll) instead of (filter #(or (:name %) (:display-name %)) coll)

13:12 exaptic: yeah there is such a thing as "over factored" imo

13:12 under factored is just as bad though, heh

13:15 justin_smith: kaiyin: #(get headers->keywords %) can be replaced with headers->keywords

13:15 ,(map {:a 0 :b 1} [:a :b :a :b :a :c])

13:15 ssideris1: relevant: http://number-none.com/blow/john_carmack_on_inlined_code.html

13:15 clojurebot: (0 1 0 1 0 ...)

13:15 kaiyin: justin_smith, good to know.

13:16 justin_smith: kaiyin: in clojure, like in formal mathematics, a mapping is a function :)

13:16 kaiyin: cool. What's your opinion "clojure for the brave and true"?

13:16 +on

13:17 SagiCZ1: kaiyin: good for beginners.. too corny in places to the extent of being annoying sometimes

13:18 i recommend 4clojure, clojure koans and Clojure Programmin

13:18 kaiyin: ok.

13:19 noonian: i think its a great resource, also good for getting a dev environment setup with emacs which is a barrier for some people (you don't have to use emacs though)

13:19 justin_smith: alongside those, I also like "clojure from the ground up" by aphyr, personally

13:20 noonian: in fact, I, as a longtime emacs user, gave up on the integration and just use inferior lisp with "lein trampoline repl" as my lisp command

13:20 I got tired of all the fidly bits not quite working

13:21 noonian: yeah, i just use lein repl outside of emacs, but I found clojure for the brave and true helpful to get a base emacs install and understand enough of it to tweak it

13:21 ssideris1: justin_smith: cider 0.8.0 is way more stable

13:22 justin_smith: ssideris1: that's good to hear, next time I feel like mucking with my config all day I may try it

13:22 ssideris1: haha, good point

13:22 SagiCZ1: noonian: i would personally never recommend anyone to learn both emacs and clojure together.. seems like a very big step.. there are easier editors/IDEs for Clojure

13:23 iwilcox: ssideris1, llasram: I'm not yet sold on preferring HOFs over anonymous fns in cases like that github mapify. Doesn't seem to be any more or less readable to me, but HOFs tend to be a bit longer. Why do you find you prefer HOFs?

13:23 noonian: SagiCZ1: yeah, I'm a glutton for punishment :P but I had also tried emacs in the past and never stuck with it. Once you know some clojure emacs lisp becomes much more accessible also.

13:24 justin_smith: iwilcox: it makes a big difference in stack traces

13:24 iwilcox: ssideris1, llasram: If there's already a well-aged debate on this elsewhere, do feel free to bash me over the head with it. :)

13:24 ssideris1: iwilcox: sorry, I don't get it, are you comparing higher order functions with anonymous ones?

13:24 justin_smith: iwilcox: a good compromise (fn has-x [m] (or (:x m) (:the-x m)))

13:25 ssideris1: yeah that gives you the name in the stack trace!

13:25 :-)

13:25 justin_smith: ssideris1: you always get a name, but sometimes the name sucks and means nothing

13:25 :)

13:26 iwilcox: ssideris1: I'm comparing building those fns with HOFs versus just putting them inline with anons.

13:27 Stack trace clarity is a fair point. I've not done enough Clojure at a scale where that has mattered for me, yet.

13:27 ssideris1: well it depends, for example (partial) makes for very unreadable stacktraces

13:27 justin_smith: ie. compare the stack trace for (#(/ 1 0)) to the one for ((fn derp [] (/ 1 0)))

13:28 iwilcox: I've heard small anons called a "code smell", and wondered what bad habits it might be leading me towards.

13:28 noonian: (filter some-pred? things) is much more readable to me than an anonymous function that I'll have to read to understand whats going on especially if i'm just skimming the code

13:28 iwilcox: noonian: With you there. Where there's anything to understand, I move the predicate out to its own fn.

13:29 It's just these (comp f g) and (partial f a) ones where I don't see the compelling reasons (either way)

13:29 ssideris1: iwilcox: I basically agree with you, see my example with has-name?

13:31 justin_smith: iwilcox: one thing to consider, with comp or partial you don't generate as many classes

13:32 and that can add up (depends on jvm, not as relevant for 1.8)

13:35 iwilcox: justin_smith, ssideris1: OK thanks.

13:36 Oh. Hmm. I forget how to $mail.

13:36 justin_smith: $mail iwilcox like this

13:36 lazybot: Message saved.

13:37 iwilcox: Failing that: Thanks ssideris_ :)

13:46 exaptic: i like small anons for partial function applications where arg ordering isn't quite lining up

13:46 especially with the threading macros

13:47 Glenjamin: anyone know a way to find futures i've lost in the repl?

13:47 justin_smith: exaptic: also check out as-> for that

13:48 ,(->> [1 2 3] (mapv inc) (as-> x (x 0)))

13:48 clojurebot: #<CompilerException java.lang.Exception: Unsupported binding form: (x 0), compiling:(NO_SOURCE_FILE:0:0)>

13:48 justin_smith: errm ...

13:48 amalloy: Glenjamin: unless they happen to be in *1/*2/*3 it's pretty hard

13:48 justin_smith: ,(-> [1 2 3] (->> (mapv inc)) (as-> x (x 0)))

13:48 clojurebot: 2

13:48 Glenjamin: whoops

13:49 presumably it should be possible to get them via the thread-pool somehow?

13:49 jmccune: We just noticed this issue with downloading lein: curl: (22) The requested URL returned error: 403 trying to retrieve https://leiningen.s3.amazonaws.com/downloads/leiningen-2.3.4-standalone.jar

13:49 justin_smith: Glenjamin: you could iterate through all threads / all threads in the pool maybe, yeah

13:49 Glenjamin: i could just restart the repl, but that would be admitting defeat

13:49 jmccune: Was there a permission change on S3 maybe?

13:49 justin_smith: jmccune: any particular reason to be using 2.3.4?

13:50 llasram: jmccune: You might try #leiningen -- looks like technomancy is there but not here ATM

13:50 amalloy: Glenjamin: maybe. look at clojure.lang.Agent/soloExecutor

13:50 that's the pool the futures live in

13:50 justin_smith: jmccune: latest stable is 2.5.1

13:50 jmccune: justin_smith: Lots of CI tooling yet to be updated. I tried hitting https://leiningen.s3.amazonaws.com/downloads/leiningen-2.5.1-standalone.jar as well, to the same result.

13:51 llasram: Thanks, I'll check in there.

13:51 justin_smith: jmccune: OK, I just successfully upgraded to that version

13:51 jmccune: so it may be something on your end?

13:51 amalloy: but honestly i don't see anything in http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ExecutorService.html that allows you to query this stuff

13:51 jmccune: justin_smith: may be, but doubtful given that Amazon is returning the 403.

13:52 hiredman: jmccune: I think there have been some changes to all of that lately (that may not be the place to download anymore or something)

13:53 justin_smith: Glenjamin: maybe something with Thread/enumerate (which fills an array with all active threads in the current group)

13:53 hiredman: the lein script downloads zip files from github these days

13:53 Glenjamin: #<ThreadPoolExecutor java.util.concurrent.ThreadPoolExecutor@687641a2[Running, pool size = 8, active threads = 7, queued tasks = 0, completed tasks = 176]>

13:54 seems promising

13:54 jmccune: hiredman: Thanks, I'll investigate further.

13:54 hiredman: (I think technomancy is closing out his s3 account or something, which the leinigen s3 bucket was tied to)

13:54 justin_smith: Glenjamin: getting all their stack traces should tell you which one you want

14:07 hyPiRion: jmccune, hiredman, justin_smith: http://librelist.com/browser/leiningen/2015/1/3/downloads-bucket/

14:17 Frozenlock: Is clojure.xml slow, or is it just the speed one can expect when parsing xml?

14:22 amalloy: i haven't profiled clojure.xml but i would be totally unsurprised to find it is appallingly slow

14:23 kaiyin: I understand it's easy to use java object in clojure like this (.method obj args). What about the reverse, is it easy to call clojure functions in Java?

14:24 hiredman: clojure.xml/emit will also blow the stack if you look at it funny

14:24 SagiCZ1: kaiyin: it is possible but not as simple

14:24 llasram: kaiyin: It's fairly simple

14:24 There's even an API!

14:25 amalloy: it's pretty simple to *call* a clojure function: it's just clojure.lang.IFn.invoke

14:25 it's a little tedious to *get* a clojure function out of a var out of a namespace, but not difficult

14:25 llasram: Not too tedious anymore: https://github.com/clojure/clojure/blob/master/changes.md#21-java-api

14:25 mi6x3m-alt: is xyz-swt a suitable name for a Clojure wrapper?

14:26 amalloy: llasram: i know. still tedious

14:26 mi6x3m-alt: where xyz are separate words

14:26 or x-y-z-swt?

14:26 llasram: amalloy: Ok, well. Not much more tedious than anything else in Java :-p

14:26 amalloy: *chuckle* perhaps

14:28 jmccune: hyPiRion: Thanks!

14:28 Frozenlock: I think the xml parser is fetching the dtd every time... that would explain the atrocious time taken to parse the string.

14:29 puredanger: that's not an uncommon problem - you can usually wrap your xml parser and circumvent its lookup mechanism by caching it

14:29 it's been a few years since I've done it so I'm hand-waving the details

14:30 hiredman: https://github.com/clojure/clojure/blob/master/changes.md#21-java-api "Most IFns in Clojure refer to functions. A few, however, refer to non-function data values." gross and wrong

14:32 amalloy: Frozenlock: have you looked at clojure.data.xml? clojure.xml is this like...tiny little proof-of-concept rich wrote when he was new to clojure

14:33 Frozenlock: amalloy: I'll take a look, thanks

14:34 amalloy: a thought i just had: POC could be proof of concept, or something altogether more derogatory. coincidence? perhaps not

14:34 [blake|: hiredman: Wrong as in "bad" or "incorrect"?

14:35 amalloy: [blake|: compare to: Most rectangles are shapes. A few, hoever, are non-shape "square" objects.

14:36 SagiCZ1: amalloy: how was rich ever "new to clojure" ?

14:36 hiredman: the api seems to be creating a fictionalized notion of clojure to expose for interop, which won't help anyone

14:37 hyPiRion: amalloy: POC = piece of clojure

14:37 hiredman: because for, example, for max performance, you don't want to call .invoke on what is returned by Clojure.var, you'll want to deref it outside your loop and then invoke the derefed value

14:38 [blake|: amalloy: Oh. OK. Ick.

14:39 amalloy: hiredman: i think it's actually just a mistake though, in context, not intentional

14:39 should read "Most vars in Clojure refer to functions. A few, however, refer to non-function data values."

14:39 hiredman: amalloy: if you look at the jira issue, when whoever designed the api designed it, they explicitly wanted to hide vars

14:40 dev.clojure.org/jira/browse/CLJ-1188

14:40 the great thing is, read rich's comment here http://dev.clojure.org/display/design/Improvements+to+interop+from+Java

14:41 "encouraging a lookup on every use? Wait for the reports that Clojure interop is slow." which is *exactly* what the api and the readme encourage!

14:42 puredanger: why?

14:42 clojurebot: puredanger: because you can't handle the truth!

14:43 hiredman: clojurebot: botsnack

14:43 clojurebot: Thanks! Can I have chocolate next time

14:43 puredanger: don't encourage it

14:43 hiredman: puredanger: I am wrong, it isn't exactly

14:43 puredanger: rich is, I guess, talking about var lookup

14:43 puredanger: the docs are written specifically to break apart IFn lookup and invocation to encourage 1-time lookup, then many-time invoke

14:44 hiredman: puredanger: I am thinking of var derefing

14:44 puredanger: which is reading of a volatile field, which isn't fast

14:44 puredanger: that's what clojure does too

14:46 if you want to have the ability to modify the var state, you need some way safely modify

14:46 hiredman: sure, I understand the deal with vars

14:47 I guess I just think refering to what you get back from Clojure.var as an IFn, which forces you to write sentences like "Most IFns in Clojure refer to functions. A few, however, refer to non-function data values." is terrible

14:48 since IFn is an interace with a bunch of invoke methods, and derefing and refering to things have nothing to do with it

14:50 puredanger: sure. it's a compromise with trying to commit to as small an API as possible.

14:50 seancorfield: I tried to rewrite my CFML/Clojure bridge in terms of the new API and had to give up. I couldn't get it working in a way that was equivalent to the old RT approach (and I specifically rely on being able to get derefable vars from Clojure).

14:51 hiredman: seancorfield: I dunno about that, it seems like you should be able to use the new API

14:51 seancorfield: I may have another go at it at some point but it certainly wasn't a good experience and the new API is much worse - for my use case - than working with RT

14:51 puredanger: I wasn't part of that API discussion (pre-dated my involvement slightly). but that's probably interesting feedback. I think Stu did most of the work on it.

14:51 hiredman: seancorfield: Clojure.var actually does return the var, and you can invoke deref on it

14:52 seancorfield: Well, yes, I _should_ be able to - but it did not fit with the model I'd developed for the CFML/Clojure bridge and we have a huge amount of code relying on that... I don't remember exact details but I ran into a number of problems and just decided to continue to rely on RT for now

14:53 If the RT interface changes or goes away, obviously I'll have to rethink the integration - or just not update Clojure any more ;)

14:53 puredanger: there are no plans to change RT

14:53 hiredman: anyway, it isn't like I write a lot of java code that is calling clojure, I just happened to be writing some at the time when I ran across the issue in the jira

15:12 echo-area: cider-nrepl by default loads many middlewares, as listed https://github.com/clojure-emacs/cider-nrepl And these seems not removable, i.e. I can't disable any one of them. Now I want to disable wrap-stacktrace to enable full stack trace dump, how could I do that?

15:13 alpheus: Is there ever a good reason to store an atom in an atom?

15:13 justin_smith: echo-area: you at least have the option of running (.printStackTrace *e) after an error

15:14 aaelony_: silly regex question... I think my regex is correct, but re-seq is only showing me the last match rather than all the matches... https://www.refheap.com/96109

15:14 echo-area: justin_smith: Yes that's true. But are you implying that it's impossible to disable it?

15:14 amalloy: .* is greedy

15:15 aaelony_: maybe .+ ?

15:15 will tinker

15:15 amalloy: replacing all the * with *? would be the easiest solution, but pretty gross

15:17 aaelony_: that works.. thanks. will try to improve on it

15:17 amalloy: removing the excess .*s around the main thing you're interested in would be a big help

15:18 aaelony_: ok. I need to match unicode-isms (not sure what they are called...

15:18 )

15:22 this is probably gross too, but seems to work: (into [] (for [v (re-seq #".?(<U+.*?>).?" "0<U+202D>7923 567978<U+202C>")] (last v)))

15:27 eriktjacobsen: If you don’t have to worry about escaped “>”, then “<U+[^>]*>” is an option as well

15:29 solussd: anyone know if it is possible to express “exactly one of these keys must be present” in prismatic schema?

15:31 justin_smith: echo-area: I really don't know how much (or even whether) cider repl middleware can be customized

15:31 aaelony_: eriktjacobsen: yeah, that seems to fail for me

15:32 echo-area: justin_smith: Thanks, I'm reading source codes

15:33 noonian: solussd: i think you can do {(s/either :foo :bar) s/Any} assuming schema.core assuming s refers to schema.core in the current ns

15:34 solussd: noonian: exactly what I was looking for, thanks!

15:34 noonian: np

15:35 eriktjacobsen: aaelony_: they are functionally equiv and the greedy is more efficient in most implementations of regex engines

15:36 solussd: ah, doesn’t work like that— either takes a schema

15:36 eriktjacobsen: aaelony_: might be how you are using it elsewhere? “[^>]*” is just a character class of every char besides >

15:36 It should work the same as “.*?>” with less backtraces

15:39 solussd: noonian: for historical purposes, this works: (s/validate {(s/either (s/eq :a) (s/eq :b)) s/Keyword} {:a :x})

15:39 noonian: solussd: ah makes sense, thanks

15:40 aaelony_: eriktjacobsen: interestingly, emacs will syntax highlight #".?(<U+.*?>).?" recognizing it as a regex, but it fails to do so for regex #“<U+[^>]*>” what ever is causing this to happen also causes it to throw an "error in process filter: Wrong type argument: integerp, nil" error with that formulation.

15:41 eriktjacobsen: emacs believes that an ] is unmatched...

15:42 eriktjacobsen: Sorry if that wasn’t clear, you’d still need the “.?” wrapping and parens if you need grouping. so #”.?(<U+[^>]*>).?” as complete one. I’m a VIM guy ;)

15:44 aaelony_: eriktjacobsen: perhaps those [] need to be escaped, that again fails with that formulation.

15:45 eriktjacobsen: I'm quite comfortable with vim too..

15:49 echo-area: Okay, what I wanted is actually `:caught clojure.stacktrace/e`. What cider-nrepl has provided is pretty nice. It's me who want uniform behaviors everywhere, hence my own trouble.

15:56 eriktjacobsen: Works for me aaelony_ : (re-find #"<U([^>]*).*>" "<Uasdf434> <asdfaf> asdfasdf")

15:58 gfredericks: we have bots for this: ##(re-find #"<U([^>]*).*>" "<Uasdf434>

15:58 <asdfaf> asdfasdf")

15:58 &(re-find #"<U([^>]*).*>" "<Uasdf434> <asdfaf> asdfasdf")

15:58 lazybot: ⇒ ["<Uasdf434> <asdfaf>" "asdf434"]

15:59 aaelony_: eriktjacobsen: that does as you say, but it's not what I was after, and not the same as before. I appreciate the effort though.

16:01 eriktjacobsen: oh I changed it for local test, I was just showing the square brackets dont need to be escaped

16:01 aaelony_: I need to use re-seq and also the results did not match what I needed with respect to the U.

16:03 eriktjacobsen: &(re-seq #".?(<U+[^>]*>).?" "d<UUUUkj234kj2342kj423>f <UU234234>”)

16:03 lazybot: java.lang.RuntimeException: EOF while reading string

16:04 kaiyin: Have you ever heard of knitr? It's a nice R package that converts a mixture of markdown and R code into a nice document (pdf, doc, html etc).

16:04 aaelony_: knitr is great

16:04 kaiyin: I am wondering if there is something similar for clojure.

16:05 aaelony_: others may have better answers, but there is markdown and other markup languages

16:07 kaiyin: aaelony_, sure, but knitr is something that combines these things into a handy tool.

16:08 aaelony_: kaiyin: I think there are some options, but I can't think of them offhand...

16:08 AeroNotix_: ,(System/gc)

16:08 clojurebot: nil

16:08 aaelony_: marginalia?

16:08 http://fogus.github.io/marginalia/

16:10 kaiyin: Not exactly what I am after, but still very cool.

16:11 aaelony_: I don't remember others right now...

16:11 kaiyin: ok, thanks.

16:18 justin_smith: just based on the name, it sounds like knitr would be based on knuths cweb

16:27 aaelony_: http://en.wikipedia.org/wiki/Knitr

16:29 https://support.rstudio.com/hc/en-us/articles/200552086-Using-R-Markdown (knitr)

16:33 mavbozo: amalloy: can i copy some of your codes from your https://github.com/flatland/useful to my proprietary, closed-source works ?

16:50 AeroNotix_: mavbozo: why don't you just use it as a library?

16:55 geront: I have a cljs/node repl open in a rum project, changed to (ns rum1.core) but still can't eval a (defc menu ..... form. I get "Error evaluating:" (defc menu ........ :as "rum1.core.defc.call(null,rum1.core.menu ....

16:55 mavbozo: AeroNotix_: in the readme, there's no further documentation about how to obtain the library, which version is stable, etc. So, I just decided to pick functions that I need and copy-paset it in my project

16:55 AeroNotix_: mavbozo: clojars.org

16:56 geront: Does the cljs/node repl permit eval of cljs forms as cljs, not js?

16:57 ... ie. pre-compiled eval?

16:58 mavbozo: AeroNotix_: in clojars, latest version is Nov 10, 2012 https://clojars.org/useful/versions/0.8.8, while in the github repo, the latest version in master currently is 0.11.3

17:00 amalloy: mavbozo: it's org.flatland/useful, and [org.flatland/useful "0.11.3"] is in clojars

17:01 we decided (apaprently in nov 2012) to stop being bad citizens and use a proper groupid

17:01 nicferrier: trying out a new emacs bootstrap for leiningen and it's got an exotic failure with cider. sigh.

17:03 mavbozo: geront: i use emacs, cider, nrepl, and piggieback to make cljs repl. the cljs repl evals cljs.

17:04 amalloy: thank you, but can i cherry pick just the functions I need? :)

17:04 geront: mavbozo: I could never get Emacs to work with Cider. I use Emacs Live! but had to switch to LightTable to get a browser repl. However, I got the impression that latest releases of cljs have improved the cljs/node repl situation.

17:05 amalloy: i'd rather you didn't, but the license provided permits you to. why would you want to do that instead of just depending on useful?

17:07 mavbozo: amalloy: my project's lein deps :tree is really full of conflicts and suggestions. I'm trying to minimize the dependencies.

17:08 geront: mavbozo: That's Emacs/Cider with cljs. Works a charm with Clojure.

17:11 mavbozo: geront: Works a charm for me if I restrict myself to stable and old packages. I still use cider-0.7.0.

17:13 cfleming: AdmiralBumbleBee: What is the problem you have with IntelliJ?

17:13 SagiCZ1: can core.async channel be used in place of java's blocking queue, or do they have a different prupose

17:15 mavbozo: geront: have you (require rumc. ...) in the cljs repl?

17:17 imanc: can require be called directly outside of (ns) ?

17:18 mavbozo: imanc: yes, (require '[clojure.string :as str])

17:19 imanc: mavbozo: ahh, thanks. I think i'm screwing up the placement of quotes

17:19 bingo, thanks!

17:32 geront: mavbozo: In a clj repl once I change to the correct namespace all the .core file's requires are available so why, after (ns rum1.core) should I need to specify any (require ?? I started the repl within the project directory after all.

17:35 justin_smith: geront: just switching to an ns does not ensure that it is loaded

17:36 geront: justin_smith: What should I be doing. When I load in a clj repl I do it from within an Emacs file but that's not possible with a cljs/node repl.

17:37 justin_smith: This cljs/node repl if from the command line via ./script/repl

17:39 justin_smith: How can I get this cljs/node repl to see all the Vars in my rum1.core file after switching to its namespace?

17:40 justin_smith: geront: the right way is to use require to ensure the ns is loaded before switching to it

17:40 though some toolx

17:40 geront: justin_smith: require what, though?

17:41 justin_smith: *tools silently do this for you

17:41 the namespace

17:41 geront: (require rum1.core) then (ns rum1.core) ?

17:42 justin_smith: *tools ??

17:42 lazybot: geront: What are you, crazy? Of course not!

17:42 justin_smith: (require 'rum1.core :reload) yesh

17:53 $mail geront sorry, my typing on this touch screen is atrocious. "use require first, but some tools do that for you"

17:53 lazybot: Message saved.

18:02 amalloy: justin_smith: typing on a touch screen is atrocious no matter who does it, or how well it's done. just the very notion is atrocious

18:02 brainproxy: should parition throw an error instead of spinning off into oblivion if the step size is <= 0

18:02 *partition

18:04 amalloy: the common mis-typing "parition" always makes me think of parishioners

18:07 brainproxy: :)

18:11 so, when using pmap I'm getting return values in the repl in a perfectly normal way, but when I invoke my program w/ `lein run`, it seems to "hang"

18:11 but if I swap map for pmap then it doesn't hang

18:12 mi6x3m-alt: can I release to clojars with dependencies not found on any repository?

18:12 brainproxy: not sure what to look for

18:15 TimMc: amalloy_: i font mow why hot would day that.

18:15 touch-screen typing is wonderful!

18:17 Hey, someone try swype-ing... I dunno, Leaves of Grass? and reading as a performance piece.

18:17 {blake}: Or maybe Howl

18:19 I save the beet memes of my generally desalinated by moldiness

18:19 justin_smith: TimMc: Finnegans Wake

18:19 {blake}: justin_smith: Could only make it more intelligible

18:20 justin_smith: thatsthejoke.gif

18:21 {blake}: youtube.com/sorry

18:21 Jabberwocky would be fun.

18:24 AdmiralBumbleBee: cfleming: re:intellij, the UI is very sluggish. even simpy typing is slow for the characters to show. It's the only software I know of on any of my systems that does this

18:24 SagiCZ1: AdmiralBumbleBee: really? what about eclipse.. haha .. anyways.. does it show "indexing" at the bottom? that slows it down for a while

18:26 AdmiralBumbleBee: SagiCZ1: no indexing. eclipse actually runs perfectly fine for me, but I use it on antoher system

18:27 SagiCZ1: AdmiralBumbleBee: wow.. well maybe cfleming will know something.. intellij way faster than eclipse on my win machine..

18:28 AdmiralBumbleBee: yeah, I've brought this up in #idea-users, #java, tried youtrack, reddit, etc...

18:28 {blake}: AdmiralBumbleBee: Do you have a lot of included namespaces? I notice that it can be slow to look things up at first.

18:29 AdmiralBumbleBee: best information I've found is that there other people who have the same issue

18:29 {blake}: blank, fresh project, freshly installed. still happens

18:29 quile: AdmiralBumbleBee: I use Idea and it’s much, much more responsive on OSX than even a vanilla Eclipse.

18:30 AdmiralBumbleBee: I am using os x 10.10.1 fwiw

18:31 {blake}: Windows and Linux variants here.

18:31 AdmiralBumbleBee: I've tried clearly the cache, -Xms/xmx to high values, aggressive ops, trying very bare projects, turning off indexing..

18:31 still even simply typing a letter takes about 0.75s for the letter to appear

18:32 auto complete takes 3-4 seconds

18:32 SagiCZ1: i would try to re-install it

18:32 TimMc: {blake}: The speech recognition version of that has been done: http://monkeybagel.com/jabberwalk.html

18:32 {blake}: Yeah, never seen that. I can hit 60wpm and the auto-complete will pop up on every word.

18:33 TimMc: Ha! I tried reading "The Raven" to Dragon back in 2010. It...wasn't pretty.

18:35 imanc: anyone know of any valid benchmarks between clojure and other langs such as python?

18:36 SagiCZ1: imanc: this shows some basic algorithms http://benchmarksgame.alioth.debian.org

18:37 i dont think it is very useful though

18:47 {blake}: Can I have a project connect to multiple REPLs? I'm running figwheel but I wanted to use Weasel, too.

18:55 nuwanda_: sure, never had a problem with that

18:56 {blake}: nuwanda_: Yeah, I couldn't see why it would matter, except that I'm going to do it wrong.

18:57 nuwanda_: :) checkout chestnut's lein template, they use both

18:59 {blake}: nuwanda_: Oh, cool. That'll help a lot, thanks!

18:59 (inc nuwanda_)

18:59 lazybot: ⇒ 1

19:00 nuwanda_: {blake}: np

19:13 justin_smith: imanc: yeah alioth tends not to reflect normal code. python will start up faster, and do things that are 100% C library call faster, in normal code clojure will perform faster for most anything else

19:15 imanc: interesting - just debating pros/cons of clojure with work colleagues and they are quick to say stuff like "it's slow", "it's only useful for async programming, not much else" etc.

19:17 {blake}: imanc: I think people just google "What's wrong with X" when they don't want X. =P

19:17 justin_smith: slow startup, great for large scale concurrency, and much better perf than average for general purpose long running codr

19:17 *code

19:18 imanc: {l

19:18 {blake}: agreed.

19:20 {blake}: The speed thing is dumb in most cases. You can always go back to "Well, why aren't we just programming in C/++ then?"

19:23 imanc: {blake}: Yeh, agreed also. Maybe even just drop into assembly language and have done with it =)

19:23 justin_smith: FORTRAN is hella fast

19:24 {blake}: justin_smith: I hear Doom 4 will be written in FORTRAN.

19:24 Well, a FORTRAN interpreter running on Javascript.

19:24 imanc: I also wonder about a default comparision between say python and clojure when python by default is constrained by the GIL, yet (presumably) clojure can fairly trivially support better usage of the underlying cpu

19:26 justin_smith: imanc: also python variables are all effectivrly volatile, including classed, so it can't even effectively pipeline operations in many cases

19:27 including *classes, I should just give up

19:27 imanc: justin_smith: is that the same for any imperative language?

19:28 justin_smith: no

19:28 imanc: ah

19:28 {blake}: Python is hella slow. I think Ruby is worse. Both, IME, are slower than Smalltalk.

19:28 imanc: yeh ruby is worse.. much worse

19:28 justin_smith: java classes are not mutable, and variabled are not by default volatile in java

19:29 imanc: ahh OK

19:30 justin_smith: think about what class mutability implies: neefing to look up methods that may have chsnged over and over...

19:32 {blake}: I think, though I haven't tested, the latest Smalltalk VMs are competitive (maybe even faster) than Java, though.

19:32 imanc: yeh, i guess part of the reason why monkey patching is so frowned upon

19:32 but i think the vast majority of teh time python programes are not written to be concurrent, so nobody cares much

19:33 justin_smith: imanc: but to have correct code you pay for that whether you use it or not

19:33 imanc: {blake}: I didn't know people still coded in smalltalk

19:34 justin_smith: the checks / lookups need ro be done, unless you can guarantee no mutation could occur

19:36 {blake}: faster than java? that's a huge claim. the set of faster vm langs is like ocaml (for some things) and... no othet lang I know of.

19:37 I guess CLR too, yeah

19:38 imanc: no other functional language? Presumably C/C++ are faster for mots things?

19:38 justin_smith: but its a very small list that even competes

19:38 imanc: vm

19:38 imanc: ahh

19:39 {blake}: justin_smith: I remember it being a goal in the late '90s and over time claims being made that the goal was hit and exceeded, but I haven't kept up enough to know for sure.

19:39 koreth_: Does the revamped REPL in the latest ClojureScript release make Austin / Piggieback obsolete?

19:39 {blake}: The UI feels snappier than most Java UIs. It certainly starts faster, which is a switch. =P

19:44 justin_smith: (But, yeah, the lookup optimizations are the critical thing.)

19:54 emaczen: how can I I use lein repl :connect to connect to a local server?

19:54 I am using the luminus stack

19:55 I believe that luminus creates an nrepl server.

19:55 cfleming: justin_smith: I think LuaJIT is competitive for some workloads, amazingly

19:55 justin_smith: As long as they're not GC heavy - the JVM GC is amazing

19:56 justin_smith: But for tight-loop numeric stuff LuaJIT can beat Java

19:56 justin_smith: At least, that was the case - LuaJIT seems to have disappeared from the shootout

19:57 justin_smith: Either way, it's really fast - it's a thing of beauty

20:00 justin_smith: cfleming: cool, I didn't realize

20:01 cfleming: justin_smith: Again, only single threaded though, like ocaml - IMO the real benefit of the JVM is that the speed is maintained across multiple threads, and the GC can handle that

20:02 emaczen: cfleming: Why are there other platforms that can compete with the JVM?

20:03 cfleming: emaczen: Different platforms are good for different things, I guess

20:05 emaczen: cfleming: I'm only really aware of the JavaVM for general purpose computing and the javascriptVM for browser-based dev

20:05 cfleimg: What else is popular?

20:05 cfleming: I guess NodeJS is pretty popular these days and that could be another javascriptVM

20:06 pdk: if its name ends in .js then "popular these days" is kinda redundant

20:06 koreth_: CLR has some fans too, and I expect it'll grow in popularity now that MS has committed to making it an open thing.

20:07 {blake}: dotNET, Flash...

20:09 echo-area: LOL there's also parrot

20:10 {blake}: I was gonna say "UCSD Pascal" but then I remembered it's not 1982.

20:11 justin_smith: {blake}: surely that wasn't a vm?

20:11 {blake}: justin_smith: 'deed it was. Is, even, I think.

20:12 I laughed and laughed when I realized Java & Javascript were reinventing that wheel.

20:24 zapho53: Someone please develop a Clojurescript compiler in Javascript. I'm at the end of my tether with the whole Clojurescript+repl+namespaces+require+compile options+google closure hairball. I want to teach this stuff to beginners :(

20:26 justin_smith: {blake}: and the wiki page for application virtual machine reminds me of forth - an early, great, and super weird vm

20:29 Tritlo: isn't forth still used by NASA?

20:36 justin_smith: I wouldn't be surprised

20:37 forth is your best bet if you need a repl in 8k of combined ram/rom

20:54 kenrestivo: didn't technomancy write an os in forth for the arduino?

20:55 holy crap. months and months of pain and suffering. and the problem was? a bug/interaction in the oracle embedded jvm vs swing and seesaw

20:56 i'm not sure whether to celebrate or stick my head in a blender.

20:57 LunarLanding: are you sure they're mutually exclusive?

20:58 kenrestivo: sure, it's party time

20:58 * kenrestivo goes to celebrate by sticking his head in a blender

22:33 koreth_: Finally! Just got a single-server-process configuration to support auto-reloading of CLJS (Figwheel) and Clojure (ring-middleware-reload) with REPL support for Clojure (nREPL) and, the part that took me by far the longest to figure out, connecting on the fly to running CLJS browser apps without having to reload anything on the client (Austin + Sente).

22:35 Now to figure out why ClojureScript's REPL code is spewing hundreds of "undeclared Var" warnings for functions in clojure.core when it first starts up.

Logging service provided by n01se.net