#clojure logs

2015-01-14

00:47munderwoHi all. how do people filter a map based on the value instead of the key>
00:48luxbockmunderwo: 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
00:49munderwoahh cool. thanks. that helps
00:49luxbock&(filter (fn [[k v]] (even? v)) {:a 1 :b 2 :c 3 :d 4})
00:49lazybot⇒ ([:b 2] [:d 4])
00:49luxbockif you want a map back, you have to use (into {} ...)
00:53TEttinger(inc luxbock)
00:53lazybot⇒ 3
00:53TEttingerthat was very thorough!
00:53luxbock:)
06:38nautiloI 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?
06:38the_freynautilo: (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
06:38daniel`nautilo: clojurians generally shun frameworks in favour of libraries
06:39daniel`some examples:
06:39the_freythere's no rails/django for clj that I know of
06:39daniel`compojure/ring (routing), liberator (REST api), monger (mongodb client), om (frontend/clojurescript), secretary (frontend routing)
06:39nautilofound this http://www.luminusweb.net/
06:40daniel`yes, that provides some structure
06:40nautilounless im missing something it's says web framework
06:40daniel`but actually its more a collection of libraries than a framework
06:40daniel`but it does provide some initial setup help and dir structure
06:41daniel`nautilo: you're also interested in clojurescript/frontend or just the backend?
06:41nautilobefore i choose clojure I did the basic sinatra(ruby) and flask(tuts)
06:42the_freythose are def libraries rather than frameworks too, I'd say
06:42nautilobut clojure syntax made more sense to me
06:42clgvnautilo: you should probably start with reading intros to ring & compojure and move on from there
06:43daniel`agreed, ring/compojure is usually the foundation
06:43daniel`i like starting with https://github.com/plexus/chestnut as a base
06:43nautilodaniel: thanks for the clojurescript. Didn't know that one
06:43daniel`not very opinionated but gets you up and running with a good setup
06:43clgvdaniel`: but for a beginner that is probably too much ;)
06:44realmavbozonautilo: there's a book https://pragprog.com/book/dswdcloj/web-development-with-clojure
06:44clgvI'd not start with client-side clojurescript before the server-side is understood
06:44nautiloI have a solid html/css background
06:45nautilomy goal is to add clojure and javascript to my tool box
06:45clgvnautilo: I meant the server-side clojure libs ;)
06:45nautiloAnd that clojurescript things seems like a godsend to me
06:46clgvnautilo: better go for clojure and clojurscript (instead of javascript) ;)
06:46daniel`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
06:46clgvdaniel`: but there are too many moving parts to confuse if you start with the complete CLJS+CLJ setup and even include Om ;)
06:46daniel`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
06:47realmavbozonautilo: just curious, what text editor do you use?
06:47daniel`clgv: maybe, i think my first attempt at a clojure web app was using noir with no cljs
06:47nautiloclgv: I do not know js but clojurescript seems to be clojure + some modifications
06:47supersymI think some JavaScript knowledge reallly comes in handy when tinkering ClojureScript
06:49daniel`supersym: definitely, more so than java/jvm knowledge helps with clojure i would say
06:49nautilorealmambozo: mostly textwrangler/sublime text before clojure
06:49supersyminterop syntax/sugar is different, something that took me a while to grok
06:49supersymdaniel`: agreed
06:51luxbockI 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
06:52luxbockdoes anyone have a convention for this?
06:52supersymhaha naming... the biggest challenge to any programmer
06:52luxbockindeed
06:52nautiloI did the js "lesson" at http://www.codecademy.com/ to get familiar with the language
06:53supersymmy biggest 'problem' is the JS libs are so not structured like Java API/projects
06:53nautilobut 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)
06:54supersymand 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
06:54luxbocknautilo: the best way to learn (for most people I dare say) is to learn by doing
06:55luxbockjust 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
06:55supersymnautilo: it is always good to have a learning goal but i try to make my path not too rigid
06:56realmavbozonautilo: JavaScript The Definitive Guide and JavaScript: The Good Parts books will help you in your journey mastering javascript
06:56nautiloluxbock: Agree 100% . I have a couple of designs and I would like to transform them into real web apps as a learning purpose
06:57nautiloand please excuse my bad english :)
06:58supersymI think the Americans are sleeping now ;)
06:58luxbockI think I like map-foo-bars as my naming convention
06:58supersymeven if they were speaking actual English :P
06:59nautilo:)
07:00supersymnautilo: what kind of designs? frontend js or backend?
07:02nautilosupersym: I meant photoshop designs
07:02mavbozoluxbock: i'm having trouble understanding your phrase "maps and functions that act like them"
07:02nautilosorry if I like the right terminology for this stuff
07:02mavbozoluxbock: can you give me a example?
07:03daniel`mavbozo: a map is a function
07:03supersymhttps://kanaka.github.io/clojurescript/web/synonym.html
07:03daniel`,({:a 1 :b 2} :a)
07:03clojurebot1
07:05daniel`i thought he meant e.g. response->code ,({:success 200 :fail 400} :success)
07:05Glenjaminthe term `map` is complected
07:05supersymvery true
07:05Glenjamin(not technically correct use of complected)
07:08mavbozothe term map in our community is shorthand for hash-map right?
07:08supersymambiguous?
07:08daniel`unless you're talking about the map function
07:09supersymI'm a native dutchie :) I wouldn't know either
07:09supersymbtw..this evening first Amsterdam Clojurans meetup I'll be attending, 22 people RSVP :)
07:09mavbozodaniel`: yeah, that's an exception
07:09supersym*excited*
07:10Glenjaminoverloaded is probably a more accurate term
07:12supersymGlenjamin: indeed ^^ another thing learned "semantic overload"
07:12supersymnice
07:13clgvIn a Clojure ring + compojure application what exactly is the reason for: "The page isn't redirecting properly"
07:15clgvah right, friend is used and is causing a redirect to the "/login" route
07:22justin_smithluxbock: clearly you want FooBarMappingFactorySingleton
07:23hyPiRionFooBarMappingFactorySingletonProxy*
07:23justin_smith(please don't sctually do that)
07:27clgvjustin_smith: AbstractDisposableProfileTimeoutImpl ? (http://www.classnamer.com/index.html?generator=spring)
07:27clgv:D
07:38luxbockif I use keys on a sorted-map, are the keys quaranteened to come out in the order that they were in the map?
07:41pyrtsaluxbock: In a sorted-map m, the keys will be in the order equal to (sort (keys m)).
07:42luxbockpyrtsa: so I should use sort with keys just to be sure?
07:47dsevillahi
07:48dsevillaI updated cider from melpa and now the window of the repl does not show anything
07:49dsevillait says "connected", but no new window appears, but the buffer is created. When I switch to it, the buffer is empty
07:50luxbockdsevilla: I had that problem but it went away after I restarted Emacs
07:50dsevillaluxbock: ah, restarted several times without luck
07:52luxbockdsevilla: maybe try recompiling the .elc files in your cider folder
07:52justin_smithluxbock: no, keys are guaranteed to be in sorted order
07:52luxbockalright thanks
07:52dsevillaluxbock: I'm going to reinstall the cider package again, let's see
07:55dsevillaoh, well...
07:55pyrtsaluxbock: 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.
07:55dsevilladeinstalling cider and installing it again worked...
07:55dsevillait may have to do with older installation of nrepl
07:55dsevillaOK, thanks anyway
07:56luxbockpyrtsa: yeah, sorted-map works for my use case, but I often wish ordered-map was part of the core
08:02jack_Any idea about gsoc 2015 projects?
08:03clgvjack_: there was no discussion on the ML so far
08:03jack_Oh, thanks :)
08:03clgvjack_: but you can ask there - maybe you trigger a discussion ;)
08:04pyrtsaluxbock: 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.)
08:04jack_clgv: Good idea indeed! ;)
08:04jack_clgv: How many slots were allotted last year?
08:05clgvjack_: wake them from winter sleep :D
08:55daniel`say i have (def selectors [:ul.test [:li {:a :b :c :d} [:a {:a :b :c :d}]]])
08:55daniel`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]]
08:56daniel`actually, thats the wrong result
08:56daniel`with [[:ul.test] [:ul.test :li] [:ul.test :li :a]]
08:56daniel`treating it like a tree, finding all the possible combinations up until the end of each branch
09:03daniel`https://gist.github.com/danielstockton/d2a0671088543452e8f9
09:08martinklepschwhen deploying via uberjar how do you supply things like bouncycastle that can't be packaged w/ the uberjar?
09:35clgvmartinklepsch: do you mean the crypto library "bouncycastle"? why shouldn't that be packagable with the uberjar?
09:36martinklepschclgv: as far as I understood it's signed in some special way that will check jar signature when the lib is loaded
09:36clgvmartinklepsch: I use [org.bouncycastle/bcpkix-jdk15on "1.50"] as normal dependency
09:38martinklepschwe're using [org.bouncycastle/bcprov-jdk15on "1.50"] — not sure what the actual difference is
09:39clgvmartinklepsch: 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
09:40martinklepschclgv: my sources for the above were basically this: http://www.raynes.me/logs/irc.freenode.net/leiningen/2013-11-08.txt
09:41martinklepschso maybe it's wrong. although it did the trick for us. we now just -cp the bouncycastle jar and uberjar
09:43clgvmartinklepsch: did you run into an actual problem, yet?
09:43martinklepschthe problem we had was that the provider was not available in our uberjar
09:47kaiyinhttps://gist.github.com/kindlychung/1cc5897b4e3b28af67d1 what does #(% numbers) mean here?
09:48martinklepsch#(/ 1 %) is an anonymous function
09:48clgvkaiyin: first argument of the lambda function, in this case it will be one of the functions provided to map
09:49clgv,(read-string "#(% numbers)")
09:49clojurebot(fn* [p1__27#] (p1__27# numbers))
09:49clgvkaiyin: ^^
09:50kaiyinclgv, oh, now i see.
09:50kaiyincool.
09:50llasram,`#(% numbers)
09:50clojurebot(fn* [p1__50__51__auto__] (p1__50__51__auto__ sandbox/numbers))
09:51kaiyinThe same as (map (fn [f] (f numbers)) [count sum avg])
09:52clgvkaiyin: indeed
09:53clgvkaiyin: 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
09:54kaiyinclgv, thanks.
09:54clgvkaiyin: in the above example it is ok, I'd say
09:56puredangerwhoever mentioned the messed up core.async api docs yesterday, they are fixed
09:56kaiyinCool. 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?
09:57tcrayford____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
09:58clgvkaiyin: 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
09:59clgvkaiyin: 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:00clgv+need
10:01kaiyincool.
10:06ToxicFrogkaiyin: 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:07tcrayford____ToxicFrog: a great point - I'm so used to just thinking of clojure as for server stuff
10:07puredanger"dramatically"?
10:07SagiCZ1about twice as slow in my experience
10:08puredangerwhere "twice" is 2 seconds vs 1?
10:08ToxicFrogpuredanger: depending on circumstances, 2-6x slower
10:08ToxicFrogAlthough on a system with slow disks I've seen 20+ seconds
10:09puredangerdoes that include time for things like lein (which has its own overhead)?
10:09ToxicFrogSorry, did I say 2-6x slower? I mean 6-35x: http://nicholaskariniemi.github.io/2014/03/19/solving-clojure-boot-time.html
10:10kaiyinToxicFrog, even if the application is already compiled to a jar file?
10:10puredangeryes, so the absolute value difference in that blog for example was 1.7 s
10:10hyPiRionkaiyin: yes.
10:10kaiyinhyPiRion, curious. Why so?
10:11clgvkaiyin: if you are not building command line tools, don't be scared by ToxicFrog's statement ;)
10:11puredangerI 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:11hyPiRionkaiyin: Just look at the url ToxicFrog posted. I think that has some explanation of why
10:12hyPiRionclgv: yeah, it's only "bad" for the ones working with CLIs (or would like to do some clj-scripts for w.e. reason)
10:12puredangeralso, clojure 1.7 has some improvements for things like avoiding class loads for imported classes and class checks during compilation
10:13puredangerI 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:13ToxicFrogkaiyin: 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:14ToxicFrogpuredanger: that's good to know
10:14puredangerthe fastload branch of Clojure implements lazy loading and is significantly faster to start up
10:14ToxicFrogI 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:14puredangerwith the downside that every var invocation after startup is about 50% slower
10:14ToxicFrogOuch,.
10:15puredangerbecause adding a volatile thunk check in there hurts inlining
10:15puredangerinvokedynamic is I think a potentially excellent solution to this problem
10:15puredangerclgv: the direct branch of Clojure implements static linking (also leaves dynamic linking)
10:16clgvpuredanger: that what I meant. :)
10:17puredangerhowever, 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:17puredangerthere need to be some code-level tools to say what should happen and that's going to require some research and exploration
10:17clgvpuredanger: yes. hmm is "primitive higher order function invocation" a goal of the "direct" branch?
10:18puredangerno
10:18puredangerbut also of interest
10:18clgvpuredanger: this is also something, that can be decided at callsite
10:18puredangerinterestingly, 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:18puredangeralthough admittedly direct branch does not implement static self calls which would have helped some of the cases I looked at
10:19puredangerprotocol invocation can never be static though so for example core.matrix is helped not at all by static
10:19clgvpuredanger: you need some very algorithmical or mathematical problems to have it as bottleneck
10:19puredangeryes, I tested some of the Alioth tests for that
10:20clgvpuredanger: usually, I go with :inline in these cases
10:20puredangerhacked to run longer since those are so short
10:20puredangermost 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:21puredangersome required self calls - those would have been helped
10:21mpenet`anyone remembers the name of that clojure transpiler via python (hy*something) ?
10:21puredangermpenet`: it's just Hy isn't it?
10:22mpenet`I dont think so
10:22puredangerhttps://hy.readthedocs.org/en/latest/ ?
10:22mpenet`ah yeah
10:22mpenet`thanks
10:22puredangeryou might also like Tim's Pixie lang though https://github.com/pixie-lang/pixie
10:23mpenet`I love it already yes, kicked the tires and all. But I wanted to have a deeper look at Hy this time
10:26clgvpuredanger: 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:26clgvdiverge*
10:26clgv:/
10:27lpastesdf pasted “sdfsdfsdf” at http://lpaste.net/7608104634342703104
10:27Foxboronmpenet`: feel free to drop by #hy ^^
10:27clgvoh there is pixie dust as well... :D
10:28arohneris anyone else having trouble with cider buffers in 0.8.2?
10:29mpenet`clgv: pixie is already looking very good for a 1 man, super recent project, really impressive
10:29arohnercider 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:31clgvmpenet`: you should check the github stats - "one man" is pretty unfair ;) https://github.com/pixie-lang/pixie/graphs/contributors
10:32mpenet`right, missed that
10:38ToxicFrogI 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:38ToxicFrogMostly thanks to lein.
10:39AdmiralBumbleBeeis anyone aware of any progress in using clojure with netbeans 8.x?
10:43clgvAdmiralBumbleBee: has there been any attempt?
10:43clgvAdmiralBumbleBee: there is Cursive on IntelliJ and CCW on Eclipse
10:43AdmiralBumbleBeeclgv: as far as I can see, there's plenty of 'we'll fix it'...
10:44AdmiralBumbleBeeItelliJ does not work for me at all, quite literally
10:44mpenet`ToxicFrog: the jvm still has some downsides, runtime size, startup time, pixie could help there, also it's ffi seems promising.
10:44ToxicFrogmpenet`: oh, for sure
10:44AdmiralBumbleBeeI would love to use cursive otherwise
10:44clgvAdmiralBumbleBee: one other option remaining ;)
10:44AdmiralBumbleBeeclgv: no there isn't ;)
10:44AdmiralBumbleBeeI'm trying to avoid saying mean things
10:44AdmiralBumbleBeedon't ruin this for me! :D
10:44ToxicFrogMy 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:44ToxicFrogEr
10:44ToxicFrogat pixie
10:44ToxicFrogI've never looked at cursive
10:45ToxicFrogWhereas with clojure proper it's just "lein new, write code, lein uberjar, done"
10:45clgvAdmiralBumbleBee: for work with clojure these "mean things" would probably be unwarranted anyways
10:45mpenet`yeah, it's still young for sure
10:45ToxicFrogAlso, lein makes depending on other libraries totally painless.
10:45ToxicFrogWhich is huge.
10:45AdmiralBumbleBeeclgv: well, I use eclipse for 'work' (embedded c/asm)... and I have plenty of gripes with it
10:46ToxicFrogSo my hope is that one of these fast-clojure projects will reach the point where it's as painless to use and deploy.
10:46AdmiralBumbleBeeclgv: I also rather use something else simply due to the fact that I stare at eclipse most of the day as it is
10:46mpenet`ToxicFrog: hopefully "dust" will help with this
10:46AdmiralBumbleBeeI 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:46mpenet`ToxicFrog: https://github.com/pixie-lang/dust
10:46clgvAdmiralBumbleBee: sounds like programming on hands and knees :P
10:47ToxicFrogmpenet`: oh, that is nice
10:47AdmiralBumbleBeeas it is, I do all my clojure stuff in emacs.. but I'm trying to modernize a bit
10:48Glenjaminheresy!
10:49clgvAdmiralBumbleBee: you want to stop asking questions "does cider ... for anyone else ..." ;)
10:49AdmiralBumbleBeeclgv: that's actually the exact information I'm looking for though
10:49AdmiralBumbleBeeclgv: that way I know I'm not on a wild-goose chase
10:50clgvAdmiralBumbleBee: I use CCW for at least 3 years now
10:50AdmiralBumbleBeeI 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:51clgvAdmiralBumbleBee: some nasty bugs happened there as well, but overall it gets the job done - some bleeding edge features might be missing...
10:51viozwhat is (= ...)
10:51clgva sad smiley?
10:51viozit looks like a cute, backwards smiley
10:53clgv,(doc =)
10:53clojurebot"([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:10ziltiDid they throw (:refer-clojure :exclude [blah blah]) out of Clojure 1.7? I get the "already refers to"-warnings even with that.
11:10kaiyinIn 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:12llasramkaiyin: Rename it to `every-other-integer` ?
11:12hyPiRionkaiyin: (defn even-numbers [] (iterate #(+ 2 %) 0)) ?
11:12hyPiRionOr just hide the even-numbers with arity 1 somehow.
11:12kaiyinhyPiRion, how do you hide an arity?
11:13hyPiRionkaiyin: You can't hide it directly, but you can refactor to do so. E.g. you can use letfn
11:14hellofunkwhat about something like (filter even? (range)) (not at repl to try)
11:16andyfzilti: 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:18ziltiandyf: The usual ones I exclude for core.typed, that is, atom doseq let fn defn ref dotimes defprotocol loop for.
11:19andyfzilti: You mean the "already refers to" warnings are about names like atom, even though you explicitly exclude atom ?
11:19ziltiandyf: Exactly. That used to only happen when I didn't exclude them.
11:20ziltiandyf: 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:22andyfzilti: 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:22andyfwith Clojure 1.7.0-alpha5
11:23ziltiandyf: Oh, is that in maven already? I'll try with that. Or maybe it has something to do with boot or core.typed.
11:25andyfzilti: 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:26clgvzilti: or maybe you loaded the namespace without :exclude added the :exclude but did not restart the repl ;)
11:27zilticlgv: Nah, definitely not :)
11:28tickinghugod: hey, could you give me a hint on what the :sample value in criterium actually represents?
11:53viozwhat is (= ...) in https://github.com/jakemcc/exercism-solutions/blob/master/clojure/bob/bob.clj#L8
11:53ToxicFrogvioz: the equality operator?
11:53ToxicFrog,(= 1 1)
11:53clojurebottrue
11:53ToxicFrog,(= 1 2)
11:53clojurebotfalse
11:53llasram(doc =)
11:53clojurebot"([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:54hiredmanhah, equals(), how quaint
12:02justin_smithvioz: to be even more clear ##(= (.toUpperCase "hello") "HELLO")
12:02lazybot⇒ true
12:13viozthank you
12:16viozI know nothing about Java, where can a find a listing of class methods available to clojurists?
12:16vioz.toUpperCase e.g.
12:16Bronsa,(use 'clojure.reflect)
12:16clojurebotnil
12:17Bronsa,(:members (reflect String))
12:17clojurebot#{#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:17justin_smithvioz: all methods are available via clojure, the official javadoc is pretty straightforward to browse through
12:17justin_smiththere is also that :)
12:17Bronsavioz: ^ you can use clojure.reflect/reflect to inspect classes at runtime or just javadoc
12:18justin_smithvioz: there is a chrome / firefox extension called "javadoc search pane" that is very helpful too
12:18justin_smithor sometimes, even bean
12:18justin_smith,(bean (java.util.Date.))
12:18clojurebot#<ExceptionInInitializerError java.lang.ExceptionInInitializerError>
12:18justin_smitherr...
12:19justin_smith&(bean (java.util.Date.))
12:19lazybot⇒ {:day 3, :date 14, :time 1421255874085, :month 0, :seconds 54, :year 115, :class java.util.Date, :timezoneOffset 0, :hours 17, :minutes 17}
12:25clgvvioz: http://docs.oracle.com/javase/7/docs/api/
12:32arohnervioz: https://github.com/timmc/handy/blob/master/src/org/timmc/handy/repl.clj
12:34BeamedHas 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:35SagiCZ1Beamed: who warned you away from such a cool language?
12:35BeamedJust a thread I was reading about LISP-oriented languages
12:36SagiCZ1Beamed: 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:37luxbockBeamed: cider for Emacs has a nice stacktrace-mode that helps
12:37BeamedDoes IntelliJ's Clojure plugin have a decent stacktrace? I could give that a shot, I've used it before.
12:37justin_smithBeamed: 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:38SagiCZ1Beamed: it has a stacktrace.. i dont know what features do you expect but it does show a stactrace with clickable row links
12:38justin_smithBeamed: 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:39Beamedjustin_smith: So it's not something that would hold me back from building larger programs with it?
12:39SagiCZ1[blake|: i am still having a hard time finding some errors..
12:39justin_smithno, 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:40BeamedOkay, 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:40SagiCZ1Beamed: quite the opposite actually.. clojure offers many features and ideas that make maintaining projects easier!
12:40clojurebotCool 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:41justin_smithBeamed: 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:41SagiCZ1[blake|: yeah but where.. haha
12:42[blake|SagiCZ1: It's the place you're not looking. =P
12:42SagiCZ1[blake|: always..
12:42BeamedAlright, 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[blake|er, their
12:42mavbozothe stacktrace sucks but if it is the price I have to pay for many great features.
12:42BeamedIs invoking Clojure from Java as simple as invoking Java from Clojure?
12:42[blake|Beamed: Welcome aboard. It's a great language.
12:43Beamed|blake|: thanks :)
12:43justin_smithalso, a language with an excellent (and very helpful) community, in my experience
12:43SagiCZ1Beamed: no it's not as simple..
12:44SagiCZ1justin_smith: i second that
12:44mavbozobut the stacktrace and error reporting become less sucky overtime
12:45mavbozoi started clojure from 1.3 and i feel that the error reporting become much more helpful as clojure version increases
12:46viozwow, that was a lot more help than i expected
12:46justin_smithmavbozo: agreed, interpreting them is a kind of literacy imho
12:46viozthank you all!
12:46justin_smithmavbozo: ahh, we may disagree about reasons it becomes easier :)
12:46[blake|There is an embarrassment of riches here, help-wise, vioz. =P
12:49mavbozofor example, the line position where error occurs is more accurate in 1.6 than 1.3
12:52justin_smithmavbozo: 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:52SagiCZ1justin_smith: how does one learn something like that
12:52luxbockfirst version of my general expander is ready: https://gist.github.com/luxbock/c76a848e933618e5ae51
12:53luxbockI think it will fail if the expanded form contains locals that override the fn argumeny symbols
12:53luxbockI'm not sure how to get around that yet
12:54Bronsaluxbock: is there a reason why you didn't use something like tools.analyzer or riddley for that?
12:55Bronsaluxbock: ah, I see that you're "expanding" function bodies
12:55luxbockBronsa: 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:56luxbockI'm going to bind this to a key in Emacs so that it replaces the preceding form
12:57justin_smithSagiCZ1: 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:57kaiyinIs 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:58SagiCZ1kaiyin: 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:58luxbockkaiyin: that's far from the worst code I've seen
12:58luxbockor far from the most unreadable Clojure code I've seen
13:00ssideris1kaiyin: that's relatively readable :-)
13:00ssideris1kaiyin: although I think it could be simplified a lot
13:01llasramkaiyin: I think the verbosity makes it more difficult to follow. More compact version: https://gist.github.com/llasram/a94f85ac31b5ad8c1d5c
13:02ssideris1kaiyin: the zipmap function could be useful in this case
13:02llasramOh yeah, zipmap
13:02kaiyinok, 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:03ssideris1kaiyin: even shorter: https://gist.github.com/stathissideris/be2201ecff7cb42a328e
13:04llasramkaiyin: You could, yes? You can always factor out parts into their own functions to improve legibility
13:05luxbocksometimes factoring out parts can make code less readable as well, because now your brain has to do more context switching to understand it
13:05ssideris1luxbock: agreed, I tend to leave more things in-place these days
13:06SagiCZ1ssideris1: 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:08ssideris1SagiCZ1: 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:08SagiCZ1ssideris1: oh okay.. i see your point..
13:09asongealso, 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:10asongemy biggest thing i want to understand when i first get into a piece of someone else's code is control flow
13:10SagiCZ1clojure always has just one way the code flows because it encourages immutable data
13:10SagiCZ1in other languages the code can flow many different paths that can be difficult to see
13:11ssideris1an 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:12exapticyeah there is such a thing as "over factored" imo
13:12exapticunder factored is just as bad though, heh
13:15justin_smithkaiyin: #(get headers->keywords %) can be replaced with headers->keywords
13:15justin_smith,(map {:a 0 :b 1} [:a :b :a :b :a :c])
13:15ssideris1relevant: http://number-none.com/blow/john_carmack_on_inlined_code.html
13:15clojurebot(0 1 0 1 0 ...)
13:15kaiyinjustin_smith, good to know.
13:16justin_smithkaiyin: in clojure, like in formal mathematics, a mapping is a function :)
13:16kaiyincool. What's your opinion "clojure for the brave and true"?
13:16kaiyin+on
13:17SagiCZ1kaiyin: good for beginners.. too corny in places to the extent of being annoying sometimes
13:18SagiCZ1i recommend 4clojure, clojure koans and Clojure Programmin
13:18kaiyinok.
13:19nooniani 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:19justin_smithalongside those, I also like "clojure from the ground up" by aphyr, personally
13:20justin_smithnoonian: 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:20justin_smithI got tired of all the fidly bits not quite working
13:21noonianyeah, 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:21ssideris1justin_smith: cider 0.8.0 is way more stable
13:22justin_smithssideris1: that's good to hear, next time I feel like mucking with my config all day I may try it
13:22ssideris1haha, good point
13:22SagiCZ1noonian: 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:23iwilcoxssideris1, 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:23noonianSagiCZ1: 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:24justin_smithiwilcox: it makes a big difference in stack traces
13:24iwilcoxssideris1, llasram: If there's already a well-aged debate on this elsewhere, do feel free to bash me over the head with it. :)
13:24ssideris1iwilcox: sorry, I don't get it, are you comparing higher order functions with anonymous ones?
13:24justin_smithiwilcox: a good compromise (fn has-x [m] (or (:x m) (:the-x m)))
13:25ssideris1yeah that gives you the name in the stack trace!
13:25ssideris1:-)
13:25justin_smithssideris1: you always get a name, but sometimes the name sucks and means nothing
13:25justin_smith:)
13:26iwilcoxssideris1: I'm comparing building those fns with HOFs versus just putting them inline with anons.
13:27iwilcoxStack trace clarity is a fair point. I've not done enough Clojure at a scale where that has mattered for me, yet.
13:27ssideris1well it depends, for example (partial) makes for very unreadable stacktraces
13:27justin_smithie. compare the stack trace for (#(/ 1 0)) to the one for ((fn derp [] (/ 1 0)))
13:28iwilcoxI've heard small anons called a "code smell", and wondered what bad habits it might be leading me towards.
13:28noonian(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:28iwilcoxnoonian: With you there. Where there's anything to understand, I move the predicate out to its own fn.
13:29iwilcoxIt's just these (comp f g) and (partial f a) ones where I don't see the compelling reasons (either way)
13:29ssideris1iwilcox: I basically agree with you, see my example with has-name?
13:31justin_smithiwilcox: one thing to consider, with comp or partial you don't generate as many classes
13:32justin_smithand that can add up (depends on jvm, not as relevant for 1.8)
13:35iwilcoxjustin_smith, ssideris1: OK thanks.
13:36iwilcoxOh. Hmm. I forget how to $mail.
13:36justin_smith$mail iwilcox like this
13:36lazybotMessage saved.
13:37iwilcoxFailing that: Thanks ssideris_ :)
13:46exaptici like small anons for partial function applications where arg ordering isn't quite lining up
13:46exapticespecially with the threading macros
13:47Glenjaminanyone know a way to find futures i've lost in the repl?
13:47justin_smithexaptic: also check out as-> for that
13:48justin_smith,(->> [1 2 3] (mapv inc) (as-> x (x 0)))
13:48clojurebot#<CompilerException java.lang.Exception: Unsupported binding form: (x 0), compiling:(NO_SOURCE_FILE:0:0)>
13:48justin_smitherrm ...
13:48amalloyGlenjamin: unless they happen to be in *1/*2/*3 it's pretty hard
13:48justin_smith,(-> [1 2 3] (->> (mapv inc)) (as-> x (x 0)))
13:48clojurebot2
13:48Glenjaminwhoops
13:49Glenjaminpresumably it should be possible to get them via the thread-pool somehow?
13:49jmccuneWe 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:49justin_smithGlenjamin: you could iterate through all threads / all threads in the pool maybe, yeah
13:49Glenjamini could just restart the repl, but that would be admitting defeat
13:49jmccuneWas there a permission change on S3 maybe?
13:49justin_smithjmccune: any particular reason to be using 2.3.4?
13:50llasramjmccune: You might try #leiningen -- looks like technomancy is there but not here ATM
13:50amalloyGlenjamin: maybe. look at clojure.lang.Agent/soloExecutor
13:50amalloythat's the pool the futures live in
13:50justin_smithjmccune: latest stable is 2.5.1
13:50jmccunejustin_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:51jmccunellasram: Thanks, I'll check in there.
13:51justin_smithjmccune: OK, I just successfully upgraded to that version
13:51justin_smithjmccune: so it may be something on your end?
13:51amalloybut 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:51jmccunejustin_smith: may be, but doubtful given that Amazon is returning the 403.
13:52hiredmanjmccune: I think there have been some changes to all of that lately (that may not be the place to download anymore or something)
13:53justin_smithGlenjamin: maybe something with Thread/enumerate (which fills an array with all active threads in the current group)
13:53hiredmanthe lein script downloads zip files from github these days
13:53Glenjamin#<ThreadPoolExecutor java.util.concurrent.ThreadPoolExecutor@687641a2[Running, pool size = 8, active threads = 7, queued tasks = 0, completed tasks = 176]>
13:54Glenjaminseems promising
13:54jmccunehiredman: Thanks, I'll investigate further.
13:54hiredman(I think technomancy is closing out his s3 account or something, which the leinigen s3 bucket was tied to)
13:54justin_smithGlenjamin: getting all their stack traces should tell you which one you want
14:07hyPiRionjmccune, hiredman, justin_smith: http://librelist.com/browser/leiningen/2015/1/3/downloads-bucket/
14:17FrozenlockIs clojure.xml slow, or is it just the speed one can expect when parsing xml?
14:22amalloyi haven't profiled clojure.xml but i would be totally unsurprised to find it is appallingly slow
14:23kaiyinI 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:24hiredmanclojure.xml/emit will also blow the stack if you look at it funny
14:24SagiCZ1kaiyin: it is possible but not as simple
14:24llasramkaiyin: It's fairly simple
14:24llasramThere's even an API!
14:25amalloyit's pretty simple to *call* a clojure function: it's just clojure.lang.IFn.invoke
14:25amalloyit's a little tedious to *get* a clojure function out of a var out of a namespace, but not difficult
14:25llasramNot too tedious anymore: https://github.com/clojure/clojure/blob/master/changes.md#21-java-api
14:25mi6x3m-altis xyz-swt a suitable name for a Clojure wrapper?
14:26amalloyllasram: i know. still tedious
14:26mi6x3m-altwhere xyz are separate words
14:26mi6x3m-altor x-y-z-swt?
14:26llasramamalloy: Ok, well. Not much more tedious than anything else in Java :-p
14:26amalloy*chuckle* perhaps
14:28jmccunehyPiRion: Thanks!
14:28FrozenlockI think the xml parser is fetching the dtd every time... that would explain the atrocious time taken to parse the string.
14:29puredangerthat's not an uncommon problem - you can usually wrap your xml parser and circumvent its lookup mechanism by caching it
14:29puredangerit's been a few years since I've done it so I'm hand-waving the details
14:30hiredmanhttps://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:32amalloyFrozenlock: 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:33Frozenlockamalloy: I'll take a look, thanks
14:34amalloya 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:35amalloy[blake|: compare to: Most rectangles are shapes. A few, hoever, are non-shape "square" objects.
14:36SagiCZ1amalloy: how was rich ever "new to clojure" ?
14:36hiredmanthe api seems to be creating a fictionalized notion of clojure to expose for interop, which won't help anyone
14:37hyPiRionamalloy: POC = piece of clojure
14:37hiredmanbecause 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:39amalloyhiredman: i think it's actually just a mistake though, in context, not intentional
14:39amalloyshould read "Most vars in Clojure refer to functions. A few, however, refer to non-function data values."
14:39hiredmanamalloy: if you look at the jira issue, when whoever designed the api designed it, they explicitly wanted to hide vars
14:40hiredmandev.clojure.org/jira/browse/CLJ-1188
14:40hiredmanthe great thing is, read rich's comment here http://dev.clojure.org/display/design/Improvements+to+interop+from+Java
14:41hiredman"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:42puredangerwhy?
14:42clojurebotpuredanger: because you can't handle the truth!
14:43hiredmanclojurebot: botsnack
14:43clojurebotThanks! Can I have chocolate next time
14:43puredangerdon't encourage it
14:43hiredmanpuredanger: I am wrong, it isn't exactly
14:43hiredmanpuredanger: rich is, I guess, talking about var lookup
14:43puredangerthe docs are written specifically to break apart IFn lookup and invocation to encourage 1-time lookup, then many-time invoke
14:44hiredmanpuredanger: I am thinking of var derefing
14:44hiredmanpuredanger: which is reading of a volatile field, which isn't fast
14:44puredangerthat's what clojure does too
14:46puredangerif you want to have the ability to modify the var state, you need some way safely modify
14:46hiredmansure, I understand the deal with vars
14:47hiredmanI 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:48hiredmansince IFn is an interace with a bunch of invoke methods, and derefing and refering to things have nothing to do with it
14:50puredangersure. it's a compromise with trying to commit to as small an API as possible.
14:50seancorfieldI 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:51hiredmanseancorfield: I dunno about that, it seems like you should be able to use the new API
14:51seancorfieldI 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:51puredangerI 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:51hiredmanseancorfield: Clojure.var actually does return the var, and you can invoke deref on it
14:52seancorfieldWell, 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:53seancorfieldIf the RT interface changes or goes away, obviously I'll have to rethink the integration - or just not update Clojure any more ;)
14:53puredangerthere are no plans to change RT
14:53hiredmananyway, 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:12echo-areacider-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:13alpheusIs there ever a good reason to store an atom in an atom?
15:13justin_smithecho-area: you at least have the option of running (.printStackTrace *e) after an error
15:14aaelony_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:14echo-areajustin_smith: Yes that's true. But are you implying that it's impossible to disable it?
15:14amalloy.* is greedy
15:15aaelony_maybe .+ ?
15:15aaelony_will tinker
15:15amalloyreplacing all the * with *? would be the easiest solution, but pretty gross
15:17aaelony_that works.. thanks. will try to improve on it
15:17amalloyremoving the excess .*s around the main thing you're interested in would be a big help
15:18aaelony_ok. I need to match unicode-isms (not sure what they are called...
15:18aaelony_)
15:22aaelony_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:27eriktjacobsenIf you don’t have to worry about escaped “>”, then “<U+[^>]*>” is an option as well
15:29solussdanyone know if it is possible to express “exactly one of these keys must be present” in prismatic schema?
15:31justin_smithecho-area: I really don't know how much (or even whether) cider repl middleware can be customized
15:31aaelony_eriktjacobsen: yeah, that seems to fail for me
15:32echo-areajustin_smith: Thanks, I'm reading source codes
15:33nooniansolussd: 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:34solussdnoonian: exactly what I was looking for, thanks!
15:34nooniannp
15:35eriktjacobsenaaelony_: they are functionally equiv and the greedy is more efficient in most implementations of regex engines
15:36solussdah, doesn’t work like that— either takes a schema
15:36eriktjacobsenaaelony_: might be how you are using it elsewhere? “[^>]*” is just a character class of every char besides >
15:36eriktjacobsenIt should work the same as “.*?>” with less backtraces
15:39solussdnoonian: for historical purposes, this works: (s/validate {(s/either (s/eq :a) (s/eq :b)) s/Keyword} {:a :x})
15:39nooniansolussd: ah makes sense, thanks
15:40aaelony_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:41aaelony_eriktjacobsen: emacs believes that an ] is unmatched...
15:42eriktjacobsenSorry 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:44aaelony_eriktjacobsen: perhaps those [] need to be escaped, that again fails with that formulation.
15:45aaelony_eriktjacobsen: I'm quite comfortable with vim too..
15:49echo-areaOkay, 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:56eriktjacobsenWorks for me aaelony_ : (re-find #"<U([^>]*).*>" "<Uasdf434> <asdfaf> asdfasdf")
15:58gfrederickswe have bots for this: ##(re-find #"<U([^>]*).*>" "<Uasdf434>
15:58gfredericks <asdfaf> asdfasdf")
15:58gfredericks&(re-find #"<U([^>]*).*>" "<Uasdf434> <asdfaf> asdfasdf")
15:58lazybot⇒ ["<Uasdf434> <asdfaf>" "asdf434"]
15:59aaelony_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:01eriktjacobsenoh I changed it for local test, I was just showing the square brackets dont need to be escaped
16:01aaelony_I need to use re-seq and also the results did not match what I needed with respect to the U.
16:03eriktjacobsen&(re-seq #".?(<U+[^>]*>).?" "d<UUUUkj234kj2342kj423>f <UU234234>”)
16:03lazybotjava.lang.RuntimeException: EOF while reading string
16:04kaiyinHave 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:04aaelony_knitr is great
16:04kaiyinI am wondering if there is something similar for clojure.
16:05aaelony_others may have better answers, but there is markdown and other markup languages
16:07kaiyinaaelony_, sure, but knitr is something that combines these things into a handy tool.
16:08aaelony_kaiyin: I think there are some options, but I can't think of them offhand...
16:08AeroNotix_,(System/gc)
16:08clojurebotnil
16:08aaelony_marginalia?
16:08aaelony_http://fogus.github.io/marginalia/
16:10kaiyinNot exactly what I am after, but still very cool.
16:11aaelony_I don't remember others right now...
16:11kaiyinok, thanks.
16:18justin_smithjust based on the name, it sounds like knitr would be based on knuths cweb
16:27aaelony_http://en.wikipedia.org/wiki/Knitr
16:29aaelony_https://support.rstudio.com/hc/en-us/articles/200552086-Using-R-Markdown (knitr)
16:33mavbozoamalloy: can i copy some of your codes from your https://github.com/flatland/useful to my proprietary, closed-source works ?
16:50AeroNotix_mavbozo: why don't you just use it as a library?
16:55gerontI 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:55mavbozoAeroNotix_: 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:55AeroNotix_mavbozo: clojars.org
16:56gerontDoes the cljs/node repl permit eval of cljs forms as cljs, not js?
16:57geront... ie. pre-compiled eval?
16:58mavbozoAeroNotix_: 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:00amalloymavbozo: it's org.flatland/useful, and [org.flatland/useful "0.11.3"] is in clojars
17:01amalloywe decided (apaprently in nov 2012) to stop being bad citizens and use a proper groupid
17:01nicferriertrying out a new emacs bootstrap for leiningen and it's got an exotic failure with cider. sigh.
17:03mavbozogeront: i use emacs, cider, nrepl, and piggieback to make cljs repl. the cljs repl evals cljs.
17:04mavbozoamalloy: thank you, but can i cherry pick just the functions I need? :)
17:04gerontmavbozo: 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:05amalloyi'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:07mavbozoamalloy: my project's lein deps :tree is really full of conflicts and suggestions. I'm trying to minimize the dependencies.
17:08gerontmavbozo: That's Emacs/Cider with cljs. Works a charm with Clojure.
17:11mavbozogeront: Works a charm for me if I restrict myself to stable and old packages. I still use cider-0.7.0.
17:13cflemingAdmiralBumbleBee: What is the problem you have with IntelliJ?
17:13SagiCZ1can core.async channel be used in place of java's blocking queue, or do they have a different prupose
17:15mavbozogeront: have you (require rumc. ...) in the cljs repl?
17:17imanccan require be called directly outside of (ns) ?
17:18mavbozoimanc: yes, (require '[clojure.string :as str])
17:19imancmavbozo: ahh, thanks. I think i'm screwing up the placement of quotes
17:19imancbingo, thanks!
17:32gerontmavbozo: 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:35justin_smithgeront: just switching to an ns does not ensure that it is loaded
17:36gerontjustin_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:37gerontjustin_smith: This cljs/node repl if from the command line via ./script/repl
17:39gerontjustin_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:40justin_smithgeront: the right way is to use require to ensure the ns is loaded before switching to it
17:40justin_smiththough some toolx
17:40gerontjustin_smith: require what, though?
17:41justin_smith*tools silently do this for you
17:41justin_smiththe namespace
17:41geront(require rum1.core) then (ns rum1.core) ?
17:42gerontjustin_smith: *tools ??
17:42lazybotgeront: What are you, crazy? Of course not!
17:42justin_smith(require 'rum1.core :reload) yesh
17:53justin_smith$mail geront sorry, my typing on this touch screen is atrocious. "use require first, but some tools do that for you"
17:53lazybotMessage saved.
18:02amalloyjustin_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:02brainproxyshould parition throw an error instead of spinning off into oblivion if the step size is <= 0
18:02brainproxy*partition
18:04amalloythe common mis-typing "parition" always makes me think of parishioners
18:07brainproxy:)
18:11brainproxyso, 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:11brainproxybut if I swap map for pmap then it doesn't hang
18:12mi6x3m-altcan I release to clojars with dependencies not found on any repository?
18:12brainproxynot sure what to look for
18:15TimMcamalloy_: i font mow why hot would day that.
18:15TimMctouch-screen typing is wonderful!
18:17TimMcHey, someone try swype-ing... I dunno, Leaves of Grass? and reading as a performance piece.
18:17{blake}Or maybe Howl
18:19{blake}I save the beet memes of my generally desalinated by moldiness
18:19justin_smithTimMc: Finnegans Wake
18:19{blake}justin_smith: Could only make it more intelligible
18:20justin_smiththatsthejoke.gif
18:21{blake}youtube.com/sorry
18:21{blake}Jabberwocky would be fun.
18:24AdmiralBumbleBeecfleming: 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:24SagiCZ1AdmiralBumbleBee: really? what about eclipse.. haha .. anyways.. does it show "indexing" at the bottom? that slows it down for a while
18:26AdmiralBumbleBeeSagiCZ1: no indexing. eclipse actually runs perfectly fine for me, but I use it on antoher system
18:27SagiCZ1AdmiralBumbleBee: wow.. well maybe cfleming will know something.. intellij way faster than eclipse on my win machine..
18:28AdmiralBumbleBeeyeah, 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:29AdmiralBumbleBeebest information I've found is that there other people who have the same issue
18:29AdmiralBumbleBee{blake}: blank, fresh project, freshly installed. still happens
18:29quileAdmiralBumbleBee: I use Idea and it’s much, much more responsive on OSX than even a vanilla Eclipse.
18:30AdmiralBumbleBeeI am using os x 10.10.1 fwiw
18:31{blake}Windows and Linux variants here.
18:31AdmiralBumbleBeeI've tried clearly the cache, -Xms/xmx to high values, aggressive ops, trying very bare projects, turning off indexing..
18:31AdmiralBumbleBeestill even simply typing a letter takes about 0.75s for the letter to appear
18:32AdmiralBumbleBeeauto complete takes 3-4 seconds
18:32SagiCZ1i would try to re-install it
18:32TimMc{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{blake}TimMc: Ha! I tried reading "The Raven" to Dragon back in 2010. It...wasn't pretty.
18:35imancanyone know of any valid benchmarks between clojure and other langs such as python?
18:36SagiCZ1imanc: this shows some basic algorithms http://benchmarksgame.alioth.debian.org
18:37SagiCZ1i 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:55nuwanda_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:57nuwanda_:) checkout chestnut's lein template, they use both
18:59{blake}nuwanda_: Oh, cool. That'll help a lot, thanks!
18:59{blake}(inc nuwanda_)
18:59lazybot⇒ 1
19:00nuwanda_{blake}: np
19:13justin_smithimanc: 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:15imancinteresting - 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:17justin_smithslow startup, great for large scale concurrency, and much better perf than average for general purpose long running codr
19:17justin_smith*code
19:18imanc{l
19:18imanc{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:23imanc{blake}: Yeh, agreed also. Maybe even just drop into assembly language and have done with it =)
19:23justin_smithFORTRAN is hella fast
19:24{blake}justin_smith: I hear Doom 4 will be written in FORTRAN.
19:24{blake}Well, a FORTRAN interpreter running on Javascript.
19:24imancI 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:26justin_smithimanc: also python variables are all effectivrly volatile, including classed, so it can't even effectively pipeline operations in many cases
19:27justin_smithincluding *classes, I should just give up
19:27imancjustin_smith: is that the same for any imperative language?
19:28justin_smithno
19:28imancah
19:28{blake}Python is hella slow. I think Ruby is worse. Both, IME, are slower than Smalltalk.
19:28imancyeh ruby is worse.. much worse
19:28justin_smithjava classes are not mutable, and variabled are not by default volatile in java
19:29imancahh OK
19:30justin_smiththink 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:32imancyeh, i guess part of the reason why monkey patching is so frowned upon
19:32imancbut i think the vast majority of teh time python programes are not written to be concurrent, so nobody cares much
19:33justin_smithimanc: but to have correct code you pay for that whether you use it or not
19:33imanc{blake}: I didn't know people still coded in smalltalk
19:34justin_smiththe checks / lookups need ro be done, unless you can guarantee no mutation could occur
19:36justin_smith{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:37justin_smithI guess CLR too, yeah
19:38imancno other functional language? Presumably C/C++ are faster for mots things?
19:38justin_smithbut its a very small list that even competes
19:38justin_smithimanc: vm
19:38imancahh
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:39koreth_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{blake}justin_smith: (But, yeah, the lookup optimizations are the critical thing.)
19:54emaczenhow can I I use lein repl :connect to connect to a local server?
19:54emaczenI am using the luminus stack
19:55emaczenI believe that luminus creates an nrepl server.
19:55cflemingjustin_smith: I think LuaJIT is competitive for some workloads, amazingly
19:55cflemingjustin_smith: As long as they're not GC heavy - the JVM GC is amazing
19:56cflemingjustin_smith: But for tight-loop numeric stuff LuaJIT can beat Java
19:56cflemingjustin_smith: At least, that was the case - LuaJIT seems to have disappeared from the shootout
19:57cflemingjustin_smith: Either way, it's really fast - it's a thing of beauty
20:00justin_smithcfleming: cool, I didn't realize
20:01cflemingjustin_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:02emaczencfleming: Why are there other platforms that can compete with the JVM?
20:03cflemingemaczen: Different platforms are good for different things, I guess
20:05emaczencfleming: I'm only really aware of the JavaVM for general purpose computing and the javascriptVM for browser-based dev
20:05emaczencfleimg: What else is popular?
20:05emaczencfleming: I guess NodeJS is pretty popular these days and that could be another javascriptVM
20:06pdkif its name ends in .js then "popular these days" is kinda redundant
20:06koreth_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:09echo-areaLOL there's also parrot
20:10{blake}I was gonna say "UCSD Pascal" but then I remembered it's not 1982.
20:11justin_smith{blake}: surely that wasn't a vm?
20:11{blake}justin_smith: 'deed it was. Is, even, I think.
20:12{blake}I laughed and laughed when I realized Java & Javascript were reinventing that wheel.
20:24zapho53Someone 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:26justin_smith{blake}: and the wiki page for application virtual machine reminds me of forth - an early, great, and super weird vm
20:29Tritloisn't forth still used by NASA?
20:36justin_smithI wouldn't be surprised
20:37justin_smithforth is your best bet if you need a repl in 8k of combined ram/rom
20:54kenrestivodidn't technomancy write an os in forth for the arduino?
20:55kenrestivoholy 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:56kenrestivoi'm not sure whether to celebrate or stick my head in a blender.
20:57LunarLandingare you sure they're mutually exclusive?
20:58kenrestivosure, it's party time
22:33koreth_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:35koreth_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.