#clojure logs

2014-11-19

00:23azriHi guys i am trying to use this namespace "clojurewerkz.ogre.vertex" but i am getting "#<CompilerException java.io.FileNotFoundException: Could not locate clojurewerkz/ogre/vertex__init.class or clojurewerkz/ogre/vertex.clj"
00:24azrii've added this "[clojurewerkz/ogre "2.5.0.0"]" to project.clj and lein deps
00:24azriany other things i forgot to do
00:30TEttingerazri: did you get the error requiring it?
00:32TEttingerazri: when you run "lein deps" , do you get any errors or warnings shown?
01:02FriedBobI'm trying to use edn-config in a project. I've setup a dev, test and prod profile with appropriate config/<profile>/config.edn files. I have the :require in place as per the docs. When I run (println (:config-version env)) all I get is nil. I have tried "lein run" and "lein with-profile <profile> run" for each of the profiles, but justget nil. My google-fu is faiing me.
01:02FriedBobIs there a doc I am missing, or some debug trick I don't know that can help me sort this out and figure out what I am donig wrong?
01:06justin_smithFriedBob: does env have any content?
01:08FriedBobI did (:require [edn-config.core :refer [env]]) and was trying to follow the examples at https://github.com/yogthos/edn-config
01:09FriedBobWhcih shows "(println (:dev env) (:db env)))"
01:09justin_smithFriedBob: what happens if you do (pr-str env)
01:09FriedBobLet me check
01:11FriedBobI may have done this wrong, but nothing. I added (pr-str env) after my println section, but the output I got was the same. Or does that need to in the println ?
01:12justin_smithFriedBob: no, pr-str just unambiguously prints its argument
01:12justin_smith&(pr-str nil)
01:12lazybot⇒ "nil"
01:12justin_smithahh
01:12justin_smithwait
01:12justin_smith&(pr nil)
01:12lazybot⇒ nilnil
01:12justin_smithyou want pr
01:12justin_smithmy bad!
01:12justin_smithor prn actually
01:13justin_smith&(prn nil)
01:13lazybot⇒ nil nil
01:13FriedBobOk, one sec
01:13FriedBobThough, adding (pr-str env) the println did get me a ton of output
01:14justin_smithOK, so that should let you know what you actually have available to work with from your config
01:15FriedBobWhich means my edn-config may not be merging properly
01:15FriedBobBut I'llneed a bit to parse this
01:16justin_smithFriedBob: clojure.pprint/pprint will produce a more readable result
01:16justin_smithbut the result of pr-str is valid for pasting into the repl
01:16justin_smithand getting the same result back
01:16justin_smith(though you may need to quote it with ')
01:18FriedBobWell, it pulled the config/test into the class path like it was suppsoed to
01:21justin_smithFriedBob: I like using -> / ->> / type / keys / nth to interactively find results in data via the repl?
01:21justin_smithoops, out of place question mark there
01:22justin_smith&(-> {:a [0 1 2 {:b "c"}]} :a (nth 3) :b)
01:22lazybot⇒ "c"
01:23FriedBobThe keys I set in my config.edn aren't in the env list.
01:24justin_smithnot even nested anywhere in the result?
01:24FriedBobI dumped the output to a text file and searched it.
01:24justin_smithOK
01:24justin_smiththis is the entire source code to that lib https://github.com/yogthos/edn-config/blob/master/src/edn_config/core.clj
01:25justin_smiththe one suspicious thing I see is the catch
01:25FriedBobThe three keys I used were :config-version, :source-data-dir and :graph-data-dir
01:25justin_smithif there are any errors in your file, it will fail to load anything from it
01:25FriedBoband "-data" was nowhere to be found
01:25FriedBobGive my level of nooishness, that may very well be the case, though AFAIk it's vaild edn
01:26justin_smithFriedBob: what happens when you run (read-string (slurp (clojure.java.io/resource "config.edn")))
01:26justin_smiththat will actually show the error, if any
01:26FriedBobOne sec, let me remember how to jack in to my repl rather than doing a lein run all the time
01:26justin_smith"lein repl"
01:27justin_smithFriedBob: the repl is really crucial to clojure development
01:27FriedBobM-x cider-jack-in
01:28justin_smithwell you can do that if you really want to
01:28justin_smithbut for a new user that just adds complexity imho
01:28FriedBobI'm more comfortable in emacs. Just had to remember the command.
01:30FriedBobYeah, that got me a stack trace
01:30justin_smithif you don't understand what the error means, feel free to share it via eg. refheap
01:32FriedBobI get what it means - it's essentially a null pointer type error, which tells me my edn is screwed up but not much else
01:33justin_smithno line number? no indication of what it was doing when it got that null pointer?
01:35FriedBob"No implementation of method: :make-reader protocol: #'clojure.java.io/IOFactory found for class: nil"
01:35FriedBobAll the line numbers are from source in the stack, not related to my files
01:35justin_smithFriedBob: ok, that means config.edn is not on your class path
01:35FriedBobOh, probably because this is in the repl, not being ran from lein with-profile
01:36FriedBobSO I need to load the profile, which adds that tothe class path
01:36justin_smithFriedBob: you can use lein with-profile ... repl
01:36justin_smithFriedBob: like I said, cider just makes this more complicated than it should be
01:36justin_smithjust use the command line
01:36azriTEttinger: sorry didn't notice someone replied:)
01:37azriTEttinger: No error no warnings
01:39FriedBobThat causes a different stacktrace due to "no nREPL dependency detected", so let me fix that and try again
01:41justin_smithFriedBob: wait, what is the exact command line that gets you that error?
01:42FriedBob"lein with-profile test repl"
01:43justin_smithweird, I have never seen that error
01:44FriedBob"lein with-profile test,default repl" seems to have worked though
01:44justin_smithtry "lein with-profile +test repl"
01:44justin_smithahh, yeah, that would do the same thing
01:44TEttingerazri: take a look in your maven cache maybe, are you on windows or what OS?
01:47FriedBobjustin_smith: Found the error - forgot to quote a version string 'number'
01:48justin_smiththat would do it!
01:53azriTEttinger: im on lubuntu
01:55azriTEttinger: yeah i can the ogre folder in ~/.m2 file
01:55FriedBobI fixed the file on disk, but it's still showing the old version. Is there a way to force it to relaod?
01:55TEttingerazri, hm...
01:55TEttingerso in ogre, what versions does it have?
01:56TEttinger2.5.0.0 present?
01:56azriyes
01:56justin_smithFriedBob: for lein run? lein do clean, run
01:56TEttingerI might try this out
01:56TEttingerazri, would I need a tinkerpop db to test this?
01:56FriedBobI'm currently in the lein repl, though 'quit' and relaunch didn't help
01:57azrihmm
01:57azriim using titanium
01:57azrititanium db
01:57justin_smithFriedBob: yeah, env is defonce, so you're kinda stuck
01:57azrii mean titan
01:57justin_smithI guess you could unbind edn-config.core/env and then :reload the ns
01:58justin_smithbut easier to just restart the repl
01:58FriedBobI guess I could use the refresh-env thing that the libnrary uses in its tests
01:58TEttingerah, that's why, azri: it was added after 2.5.0.0 https://github.com/clojurewerkz/ogre/commits/master/src/clojure/clojurewerkz/ogre/vertex.clj
01:58TEttingerthe 2.5.0.0 tag was sep 27
01:59TEttingeryou can use 3.0.0.0-SNAPSHOT, maybe
02:00TEttingernope, snapshot seems not updated
02:00TEttingertry to find earlier docs if possible
02:00azrii see
02:02TEttingerit probably had a different name before the current revision
02:02FriedBobjustin_smith: And now getting a new error, butit's 0100 here and my scotch glass is empty, so bed time. Thanks for the help, should be able to get this working tomorrow. At least enough for me to move on to the next issue
02:02azriyeah it's likely so
02:02azrii'll find the correct doc
02:02azrithats TEttinger
02:02azri*thanks
02:04TEttingerit used clojurewerkz.archimedes.vertex before, azri
02:04TEttingera different project that just got merged
02:06azriI see
02:06azrii will check on archimedes
02:07TEttingergood luck, hope it's not too different
02:07TEttingerit seems like the API barely changed, if at all
02:07azrithanks again
02:07TEttingerno prob!
02:07azrijust out of curiosity
02:07azriare familiar with titanium?
02:08azriare you using it
02:08TEttingerno, never heard of it
02:08azriok
02:08TEttingerI had heard of tinkerpop's graph db stuff before
02:08TEttingerbut ages ago
02:08dysfunthe tinkerpop stuff is alright
02:08dysfunit's the officially recommended orientdb library
02:56kenrestivoum, any ideas how to turn a manifold stream into a plain ol' core.async channel?
03:32nonubyI want a test a string against 4 seperate regexes, so I initially think cond, but I'd also like to use the matches of re-matches output too, without calling it twice, once for truthy test and once for matches, any idiomatic ideas?
03:37TEttingernonuby: does it have to match all regexes?
03:37TEttingeror just one?
03:39nonubyjust one.. I think im going with (let [[match type match-result] (or [:name-match (re-matches re1 s)] [:telephone-match (re-matches re2 s)] [:age-match (re-matches re3 s)])] (case match-type
03:40nonubyunless any better ideas
03:40TEttingeruh, that won't work
03:41TEttinger,(or [:name-match (re-matches #"A" "world")] [:telephone-match (re-matches #"B" "world")])
03:41clojurebot[:name-match nil]
03:41nonubyhow come it short-circuits? (or [:name (println "1")] [:age (println "2")])
03:41nonubyah yeah
03:42TEttingerit will always be true because a vector with anything in it that's truthy is truthy
03:42nonubyit will always shortcircuit
03:42TEttingeractually...
03:42nonubygrrr
03:42nonubyhmmm... back to drawing board
03:43TEttinger(doc if-let)
03:43clojurebot"([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"
03:44TEttingernonuby, do you have some sample regexes and data?
03:44TEttingerjust one line or whatever?
03:46nonubyits a search box on crm that i want to run against specific fields if it matches a pattern (i.e. is it a telephone number or a name)
03:46nonubysimiplified but I think this works
03:46nonuby (or (if-let [re (re-matches #"^[a-z]+$" "0100")] [:name-match re])(if-let [re (re-matches #"^\d+$" "0100")] [:phone-match re]))
03:46nonuby (or (if-let [re (re-matches #"^[a-z]+$" "max")] [:name-match re])(if-let [re (re-matches #"^\d+$" "max")] [:phone-match re]))
03:46nonubybut seems very verbose
03:49nonubywith the name I'd have groupings to extract first mid? last etc.. hence why need to reuse the matching (best rename m vs re)
04:35jonathanjis there a way to deref something in non-blocking fashion?
04:35jonathanjeg. Promise.when() / Deferred.addCallback()
04:38clgvjonathanj: (future (f (deref your-ideref))) ?
04:39clgvjonathanj: maybe there are something like watchers as well.
04:39pyrtsacore.async?
04:39clojurebotcore.async is not Go
04:47rurumatein this line, what is &env ? https://github.com/clojure/core.async/blob/master/src/main/clojure/clojure/core/async.clj#L384
04:50the_freyhi, is there any way of modifying which Exception a pre- condition in a function throws?
04:50luxbockrurumate: it's a map of local bindings
04:50the_freyas in, instead of AssertionError it throws say IllegalArgumentException
04:51the_freythough I'd settle for adding a message to explain _why_ the validation has failed
04:51luxbockthe_frey: I don't really know but I recall someone asking about this earlier and I think the answer was that it's impossible
04:51the_freyah that's a shame
04:52rurumateluxbock: is the &ampersand a reader macro?
04:52the_freythanks luxbock!
04:53rurumate,&env
04:53clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: &env in this context, compiling:(NO_SOURCE_PATH:0:0)>
04:53luxbockrurumate: nope, it's just an unnamed argument that's available inside defmacro
04:53luxbockthere's also &form
04:54rurumateis it documented somewhere>
04:54rurumategot it thanks
04:54clgvrurumate: it is an implicit argument that every macro gets
04:55rurumatehalp I'm falling down the macro rabbit hole
04:56dysfunrurumate: simplify!
05:00clgvrurumate: why?
05:07rurumatewell, with &env it seems in macros you can do more than I thought
05:09rurumateyou can see the surrouding local bindings in the macro
05:10rurumatecan you also see vars that are defined above?
05:11clgvrurumate: you can query the vars of the current namespace without a macro e.g. via `ns-publics`
05:13rurumateyup, but can I access the caller's namespace in the macro, just as I can inspect the caller's local vars with &env?
05:14rurumateI want to find out if and where the scope of a macro ends. To see what is _not_ possible in a macro
05:16clgvrurumate: yeah, you can access the namespace of the caller via *ns*
05:17rurumatefor instance, let's assume I have a (def secret "mysecret101") in my and I call an unknown macro below that line. Let's say I don't have access to the source code of the macro (might be hostile code), and I don't want it to see the value of secret. Is it safe to call it?
05:17rurumate*in my namespace
05:51fairuz1Hi guys. I have { ... :type String } in my edn file. I use in a method who expect a java.lang.Class. But when I use (:type data), I get this error: ClassCastException clojure.lang.Symbol cannot be cast to java.lang.Class. Any suggestion? Thanks
05:53fairuz1I tried `(:type data) and (-> data :type quote) but still no success
05:55TEttinger,(def edn {:content "Hello!" :type String})
05:55clojurebot#'sandbox/edn
05:55TEttinger,edn
05:55clojurebot{:content "Hello!", :type java.lang.String}
05:55TEttinger,(:type edn)
05:55clojurebotjava.lang.String
05:56TEttingerhow are you using the (:type data), fairuz1?
05:56fairuz1TEttinger in a let. Something like (let [type (:type data)] ... )
05:57TEttingeroh, that might be why, since...
05:57TEttinger,type
05:57clojurebot#<core$type clojure.core$type@1bf7527>
05:57TEttingeris already defined
05:57fairuz1I thought so, I changed to property-type and same thing
05:57TEttinger,(let [type (:type edn)] type)
05:57clojurebotjava.lang.String
05:57TEttingerhow are you reading your edn?
05:57fairuz1(read-string (slurp "my.edn"))
05:58TEttingerok, let's try that
05:58TEttinger,(def edn-str "{:content \"Hello!\" :type String}")
05:58clojurebot#'sandbox/edn-str
05:59TEttinger,(read-string edn-str)
05:59clojurebot{:content "Hello!", :type String}
05:59TEttinger,(:type (read-string edn-str))
05:59clojurebotString
05:59TEttingerah, it isn't namespaced
05:59TEttinger,(type (:type (read-string edn-str)))
05:59clojurebotclojure.lang.Symbol
05:59TEttinger,(type (:type (eval (read-string edn-str))))
05:59clojurebotjava.lang.Class
06:00fairuz1ohhhhhhhh
06:00TEttingerthere you go
06:00fairuz1:)
06:00TEttingerthat's an odd one, hope that helps!
06:00fairuz1Is it better to just eval this small part that has :type String? or the whole data coming from edn?
06:01TEttingereval should resolve any namespace stuff if the issue is it can't find it with just "String" but... hm
06:01TEttinger,(type (:type (read-string "{:content \"Hello!\" :type java.lang.String}")))
06:01clojurebotclojure.lang.Symbol
06:01TEttingerhuh
06:01TEttingeryeah it does need eval
06:02TEttingerif you don't know where types are in the data, just eval the whole thing, be advised that it's a security hole since any code in the data will be executed
06:02TEttingerbut!
06:02fairuz1I know where it is
06:03TEttingerif you know where the types are, you can eval only the field, and only if it's (not evaled) a symbol
06:03fairuz1oh ok
06:03TEttingerif it's a list, it could be code, but if it's a symbol, it's something you probably want as a class
06:04TEttinger,(type (:type (eval (read-string "{:content \"Hello!\" :type (println "U H4V3 B33n HaXxX0R3D")}"))))
06:04clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: U in this context, compiling:(NO_SOURCE_PATH:0:0)>
06:04TEttinger,(type (:type (eval (read-string "{:content \"Hello!\" :type (println \"U H4V3 B33n HaXxX0R3D\")}"))))
06:04clojurebotU H4V3 B33n HaXxX0R3D\n
06:05fairuz1wew
06:05TEttingerthe check there is...
06:07hey-lu,(type (resolve (:type (read-string "{:content \"Hello!\", :type String}"))))
06:07clojurebotjava.lang.Class
06:07TEttinger(inc hey-lu)
06:07lazybot⇒ 1
06:07TEttingerI knew there was something I was missing
06:07fairuz1I suppose resolve is better?
06:07fairuz1:)
06:07TEttinger(doc resolve)
06:07clojurebot"([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"
06:07TEttingeryeah that does it
06:07hey-luTEttinger: thanks. :)
06:07fairuz1(inc TEttinger)
06:07lazybot⇒ 29
06:08fairuz1(inc hey-lu)
06:08lazybot⇒ 2
06:08fairuz1Nice it works. Thanks!
06:08hey-lufairuz1: resolve is a bit safer, with eval someone could put code inside in your edn, which is very likely not what you want
06:09hey-lu,(read-string "{:oops (+ 3 4)}")
06:09clojurebot{:oops (+ 3 4)}
06:09hey-lu,(eval (read-string "{:oops (+ 3 4)}"))
06:09clojurebot{:oops 7}
06:12clgvrurumate: nope. global accessible values are never save from access, neither macros nor functions
06:44ffwacom,(read-string "/quit")
06:44clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: /quit>
06:45clgvffwacom: you mean the following? ##(System/exit 0)
06:45lazybotjava.security.AccessControlException: access denied ("java.lang.RuntimePermission" "exitVM.0")
06:45clgv;)
06:45ffwacomheh
06:46ffwacom,(prn "asdf")
06:46clojurebot"asdf"\n
06:46ffwacom,1
06:46clojurebot1
06:46ffwacom,"/quit"
06:46clojurebot"/quit"
06:46ffwacomdamn
06:47clgvare you trying to be the badboy disconnecting the bot?
06:47ffwacom,(pr "asdf")
06:47clojurebot"asdf"
06:47ffwacomyeah
06:47clgvyou won't make friends that way ;)
06:47clgvbut you are unlikely to succeed anyway
06:48ffwacomonly started clojure today so my odds of success are fairly low haha
06:48clgvit's running in a "sandbox"
06:48TEttingerespecially since irc actions are only triggered by /quit or the like by something in your IRC client, not part of the message that inherently means quit
06:48ffwacomTIL
06:49TEttingeruntil recently you could have opened up desktop windows on my lazybot's hosting computer, but that loophole has since been plugged
06:49trxrritoch
06:50ffwacomheh
06:50TEttinger(not on freenode)
06:50clgvTEttinger: hehe, did you need to forbid swing?
06:50clgv,(doto (JFrame. "bla") (.setVisible true))
06:50clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: JFrame, compiling:(NO_SOURCE_PATH:0:0)>
06:51clgv,(doto (javax.swing.JFrame. "bla") (.setVisible true))
06:51clojurebot#<CompilerException java.lang.ExceptionInInitializerError, compiling:(NO_SOURCE_PATH:0:0)>
06:51rritochIs there a cleaner way to filter the content of atoms other than passing in partial filters? Which is the cleanest I've come up with so far ##(let [a (atom [1 2 3])] (swap! a (partial filterv (fn [x] (not= x 2)))))
06:51lazybot⇒ [1 3]
06:52clgv,(try (doto (javax.swing.JFrame. "bla") (.setVisible true)) (catch Throwable e (println (.. e getCause getMessage))))
06:52clojurebotclgv: Cool story bro.
06:52clgv:(
06:52TEttinger&(try (doto (javax.swing.JFrame. "bla") (.setVisible true)) (catch Throwable e (println (.. e getCause getMessage))))
06:52lazybotjava.lang.SecurityException: You tripped the alarm! catch is bad!
06:52TEttingerlol
06:52clgvhaha
06:52TEttinger&(doto (javax.swing.JFrame. "bla") (.setVisible true))
06:52lazybotjava.awt.HeadlessException:
06:53clgvthought so ;)
06:53clgvheadless jre
06:53TEttingerof course lazybot is headless, but mine wasn't
06:53clgvTEttinger: so you could tweak that via permissions?
06:53TEttingerthe headlessness?
06:54clgvopening windows. I am not sure if it is possible to forbid that on a desktop jre
06:54TEttingerI changed lazybot's source to do better filtering of the default clojail permissions
06:54TEttingerof course I handed the changes along to Raynes :)
06:58clgvTEttinger: ah there is AWTPermission - did you use that one?
06:59TEttingerI used a number of them
06:59TEttingerthere's a whole list on the sun/oracle site
06:59clgvTEttinger: I only saw "grant" is there also blacklisting?
07:00clgvor was it granted accidentally?
07:00TEttingerhttps://docs.oracle.com/javase/7/docs/technotes/guides/security/permissions.html
07:00TEttingereverything is granted by default with lazybot
07:00TEttingerallpermission
07:01TEttingerthen it blacklists specific things
07:01clgvhuh? the jvm security disables everything by default
07:01TEttingeryes
07:01clgvbut lazybot overrides that?
07:01TEttingerbut to run anything in the sandbox, it needs a permission file
07:02TEttinger$google raynes lazybot
07:02lazybot[Raynes/lazybot · GitHub] https://github.com/Raynes/lazybot
07:02TEttingerhttps://github.com/Raynes/lazybot/blob/master/example.policy
07:02clgvah and you used the example.policy? :D
07:02clgv:P
07:02TEttingerIMPORTANT: If you load the clojure plugin, you must rename and move "example.policy" to "~/.java.policy" to avoid some troublesome security errors!
07:02TEttingerit's very challenging to get the policy correct otherwise
07:03clgvwell, you should upload your example somewhere :)
07:04TEttingerit should already be in lazybot, I think
07:04clgvwhere?
07:04clojurebotwhere is amalloy to explain it
07:05TEttingerhuh, it isn't here https://github.com/Raynes/lazybot/blob/master/src/lazybot/plugins/clojure.clj#L35-L48
07:05TEttingerpull request!
07:06clgvnone open ;)
07:06TEttingerI know justin_smith's fork blocked it, with anybot
07:07clgvwhere is your fork?
07:11H4nsi have trouble understanding "CompilerException java.lang.IllegalStateException: to-local-date-time already refers to: #'clj-time.local/to-local-date-time in namespace: clojure.contrib.humanize" when :require'ing 'clozure.contrib.humanize. can anyone explain what's going on?
07:14TEttingerH4ns, you probably shouldn't use ":refer :all" there
07:15H4nsTEttinger: but i don't. :require [clojure.contrib.humanize :as humanize] is what i do
07:15TEttingerclgv, I haven't cleaned it up yet
07:15TEttingerhuh
07:26paparentHi there! clojure newbie here.. I'm looking for web development. Found some interesting lib to get started.. using like compujure, hiccup. But i've some question about DB layer! I've hard time to find some good info.
07:27paparentDunno what's best DB for it.. but I like MongoDB (using it in other project). So I looked for Monger, but I've some question about it, maybe because i'm not used to it. Am I at the right place?
07:28TEttingerthere are probably some people who use monger here, though other DB may be more reliable with large amounts of data
07:28TEttingerI used congomongo for a bit, it's ok
07:29TEttingerI imagine monger is better, it's certainly better documented
07:30paparentWith latest version of Monger, you have to pass the db as first param (the db connection)... I'm just not used to that. Should at each request to the database, we must create a new connection? I'm not able to find some real world project, or samble to help me figure it out! hehe
07:31paparentTEttinger: what kind of other DB are you thinking? :)
07:33TEttingereh? you can just get the connection and store it in a def, can't you?
07:33daniel___paparent: i think there is a way of defining the connection and having all subsequent calls use it automatically
07:33daniel___can't remember off the top of my head
07:34daniel___passing the db each time makes testing easier
07:34TEttingerI don't know much about mongodb or its competitors, I know people like datomic as a clojure thing and there is a free version of that
07:34TEttingerpostgresql is apparently rather reliable
07:34daniel___mongodb is pretty easy to use from clojure
07:34clgvI didnt like datomic - just so you know there are different opinions ;)
07:34daniel___i find relational databases harder to deal with than in other languages, because there isnt really a good migration solution
07:35daniel___not like south (django) or activerecord (rails) anyway
07:35daniel___but you can always use standalone activerecord or something in the project to migrate the db
07:35paparentdaniel___: Hm, so if I have a def with the db stuff it there.. even if i access it multiple time, then it will be evaluated once, so share the same DB connection (TCP i mean)
07:35daniel___then actually querying is easy
07:36clgvpaparent: you'll regret less if you just pass it as param
07:36daniel___paparent: i think db is a pooled connection, yeah
07:36noididaniel___, what about flyway and dbmaintain?
07:36daniel___not sure tbh
07:37daniel___noidi: not that familiar with them, but those are from the java world i believe?
07:38noidiyes, but they're trivial to call from Clojure or the command line
07:39daniel___flyway uses plain sql?
07:39noidiyes
07:39paparentclgv: So, I pass it as 1st param.. doing a (def ...) somewhere to define my connection settings.. ?
07:39daniel___dunno, im used to very db agnostic DSLs to handle this sort of thing, always feels like a bit of a pita after using activerecord
07:40daniel___but i admit i havent researched every option thoroughly
07:41paparentdaniel___: What are you using on your side? mongo, or maybe other db that play nice with clojure? :)
07:41nonubyanyone familiar with monger, how does one specifiy case sensitive for simple string matches
07:41daniel___paparent: mongo mostly, but i dont do any serious work in clojure, as much as i'd want to
07:42clgvpaparent: in case you need multiple dbs you are always screwed with a single db def
07:42paparentdaniel___: using monger?
07:42paparentclgv: yeah got that.
07:42clgvpaparent: usually you have some entry point in your program where you can just (let [db (create-db ...)] ...) and then pass it along to the functions that need it
07:43daniel___yeah, but not enough to remember anything off the top of my head
07:43daniel___the documentation is pretty good
07:43clgvpaparent: or you could use the "component" approach
07:43paparentI guess main question is how to get that db connection settings.. In ring plugin you have that init function.. I saw something on stackoverflow to put the db into an atom.
07:44clgvpaparent: you can load it from a local configuration file or specify through environmen variables...
07:44clgvpaparent: or even commandline parameters
07:50dysfunis reduce lazy?
07:51Ember-,(type (reduce + [1 2]))
07:51clojurebotjava.lang.Long
07:51dysfunis there a lazy equivalent?
07:51Ember-not built-in
07:51Ember-imho
07:52engblompaparent: If you want more functional programming, use a table for keeping the state and pass it forward with each function. You can easily look up what you want from the state table: ({:one 1 :two 2 :three 3} :two) => 2
07:52Ember-I may be wrong though
07:52Ember-ah
07:52Ember-,(reductions + [1 2 3])
07:52clojurebot(1 3 6)
07:52Ember-,(type (reductions + [1 2 3]))
07:52clojurebotclojure.lang.LazySeq
07:53Ember-not exactly the same thing but...
07:53Ember-,(last (reductions + [1 2 3]))
07:53clojurebot6
07:53Ember-,(reduce + [1 2 3])
07:53clojurebot6
07:53Ember-so you can imitate lazy reduce via last + reductions
07:53clgvdysfun: how can an aggregation be lazy?
07:54wiruzxHi everyone
07:54clgvdysfun: you could be interested inintermediate results then "reductions" works
07:55wiruzxI'm newbie in Clojure, and i don't understand something: what the difference between ` and '?
07:55clgvEmber-: but then it is not lazy anymore since last forces the complete calculation :P
07:55Ember-yeah :)
07:56paparentengblom: ok thanks! that kinda give me an idea.. (sorry, totally new).. since i'm using ring, and composure, I guess I could setup db connection as a ring middleware or something.
07:56Ember-but reduce doesn't return a seq (or well, it can but in usual scenario)
07:56clrndwiruzx, 'a is just (quote a)
07:56Ember-and seqs can be lazy in clojure
07:56clgvdysfun: Ember-: you could use a `delay` to have it computed on demand
07:56Ember-and of course plain ol' functions
07:56Ember-so the "lazy reduce" should be just a function
07:56wiruzxclrnd: and what is `?
07:56Ember-clgv: yeah, true
07:57Ember-or wrap it inside a function and return that
07:57Ember-both work
07:57dysfunclgv: i've thought of another way to solve it now, but thanks
07:57clrndwiruzx, in a macro `a expands to (quote full_name/a)
07:58clrndit's for avoiding conflicting names in a macro
07:58wiruzxoh, now I see
07:58wiruzxThanks a lot!
07:58clrndno problem :)
08:03clgvdysfun: `map`?
08:03rritochdysfun: Wrapping it in repeatedly seems to work well, and its resuable
08:04clgvwiruzx: syntax quote, e.g. ##`map
08:04lazybot⇒ clojure.core/map
08:04dysfunheh. i'm interested in the intermediate results
08:04rritoch,(take 1 repeatedly (partial reduce + [1 2 3]))
08:04clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core/take>
08:04rritoch,(take 1 (repeatedly (partial reduce + [1 2 3])))
08:04clojurebot(6)
08:04clgv:P
08:05rritochI guess you still end up using first though to unwrap it
08:05clgvrritoch: sorry but that is no solution to anything
08:06dysfunwhat i actually want is a sliding window over a list
08:06rritochclgv: It makes the processing lazy, so it doesn't run immediately
08:08clgvrritoch: and therefore it is simple to consider a lazy-seq? `delay` is the much better choice for that
08:10rritochclgv: That would depend on the usage, if it isn't a calculation that is expected to produce the same result each time, delay would be useless.
08:10clojure_beginnerHello! I have a quick question, can I have a let_fn binding inside let binding scope ?
08:11clojure_beginnerOh, nevermind..
08:11clgvrritoch: well you have to solve the given problem ;)
08:12rritoch,(let [x (delay (rand 10))] (into [] [@x @x @x]))
08:12clojurebot[5.510419246941022 5.510419246941022 5.510419246941022]
08:13clgvrritoch: what's the connection to the asked "lazy reduce"?
08:13rritochclgv: Wrapping the reduction into a repeatedly makes the processing lazy, that's the point.
08:14clgvrritoch: I don't question the existence of `repeatedly`, just that it's totally weird to use in the above problem
08:14dysfunclgv: if you're interested, here's what i actually wanted (first draft)
08:14dysfun,(butlast (take-while seq (map (partial take 2) (iterate next [1 2 3 4 5 6]))))
08:14clojurebot((1 2) (2 3) (3 4) (4 5) (5 6))
08:15clgvdysfun: ##(partition 2 1 (range 1 7))
08:15lazybot⇒ ((1 2) (2 3) (3 4) (4 5) (5 6))
08:15rritochclgv: repeatedly makes it lazy so if there is control logic where an expensive calculation isn't always needed, you can use repeatedly to perform the calculation only on an as-needed basis.
08:15dysfunclgv: brilliant, thanks
08:16dysfuni think so often these problems are rooted in not knowing the word to use
08:16clgvrritoch: if you calculate a single value with recude its nonsense to wrap it into repeatedly to "make it lazy", that's a use case for `delay`
08:16Glenjamin(doc repeatedly)
08:16clojurebot"([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it"
08:16clgvdysfun: better ask your real problem from the start
08:16dysfunclgv: i had to realise what my real problem was first :)
08:17Glenjaminrepeatedly + closure could get a similar effect to lazy-reduce?
08:17clgvdysfun: you can describe it in small examples of input and output
08:17Glenjamini suppose you'd need an atom or something, which makes it a bit weird
08:17rritochclgv: He only asked to make it lazy, he didn't say why. I'm simply providing real world cases where wrapping it in repeatedly to make it lazy is useful.
08:18clgvrritoch: do what you like. I provided the information that was asked for ;)
08:18rritochclgv: But yes, you wouldn't wrap a reduce like that with a small number of values, but if you have thousands of records to process it can make a big difference
08:20rritochclgv: I was simply attempting to help dysfun with his problem. I seriously don't know what your problem is
08:22rritochI have received a lot of help in this room, and I return it by sharing from my 30+ years programming experience. Dysfun in particular has helped me with some issues. I have no interest in the ego games that go on here because I don't need a name for myself, I already have one.
08:23Glenjaminrritoch: it's not clear to me how you would convert a (reduce) into use of (repeatedly) that gives an equivalent sequence
08:24dysfunuh-oh, it's the "30+ years of programming experience card
08:24Bronsa:|
08:25clgvrritoch: well, it is a relevant information that the pattern (let [v (repeatedly (reduce f anything)))] ... (first v)) is nonsense, just use (let [v (delay (reduce f anything))] ... @v) for on-demand calculation
08:25clgvmissing a #
08:25Bronsaclgv: he left
08:25clgvthen for dysfun ;)
08:29dysfunoh wow. he just said some rude things to me in /query
08:30clgvdysfun: he probably confused us then, right?
08:30dysfunno, i think he didn't like my dripping sarcasm
08:30dysfunapparently we went on ego trips
08:30clgvah right. but now I recall him vaguely from that "30+ years .." comment. not the first time
08:31Bronsadysfun: just /ignore the guy
08:31Glenjamin(let [red (atom [initial coll]), iterator (fn [] (swap! red (fn [[m [v & coll]]] [(f m v) coll]))] (repeatedly f))
08:31dysfuni imagine it's more fun to keep winding him up in /query actually
08:32Glenjaminsort-of-lazy-reduce-using-repeatedly. i wouldn't have said "just wrap" though
08:32rritochGlenjamin: Sorry I didn't get a chance to answer you before, but synergy crashed my X server again...
08:32Bronsathere's no point in using repeatedly
08:32Bronsajust use lazy-seq
08:32Glenjaminoh right
08:33Glenjaminis there a way to do it without the atom?
08:33Glenjamini guess not, because the progress of the iterator has to live out-of-band
08:33clgvGlenjamin: maybe you should first define what "lazy reduce" shall mean. one interpretation is "having intermediate results as lazy-seq and decide until which intermediate results you want to realize" that's `reductions` then
08:34Glenjaminah right, i was thinking of reduce as a loop, but it isn't really
08:34Bronsait's nonsense to ask for a lazy reduce
08:34clgvGlenjamin: `map` with some accumulator state would be a different possibility
08:35clgvBronsa: as term yes - but as a vague description of what is desired in lack of a better explanation, it is a starting point
08:42andyfBronsa: I believe you mentioned once that tools.reader had some feature where comments could optionally affect the values read somehow. Am I imagining that?
08:42Bronsaandyf: yes :)
08:42andyfwell at least my imagination is still pretty active, then :)
08:43Glenjaminandyf: i watched that annex talk you recommended, some really cool ideas in there
08:43Glenjamincheers for the pointer
08:43andyfyou are welcome. The speaker definitely seems somewhat ambitious in his desires.
09:09nonubytaking a look at yesql, how are you meant to test .sql files in say pgadmin which doesnt seem to support ?
09:24dysfunis there a variant of sum that rejects only nils?
09:24dysfunsome* rather
09:24Glenjamin(doc keep)
09:25clojurebot"([f] [f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects. Returns a transducer when no collection is provided."
09:25dysfunthat would require (first (keep ...))
09:26Glenjaminoh right, i didn't check some properly
09:26clojurebotexcusez-moi
09:26dysfuni could live with it in this case, but i'm curious if there's a builtin
09:28Glenjamin(def coalese (comp first (partial apply keep)) ; or something i guess
09:29Glenjaminoh, keep needs a predicate
09:29Glenjaminthere's some dicussion here: http://stackoverflow.com/questions/4086889/clojure-coalesce-function
09:41dysfunGlenjamin: brilliant, thanks
09:42sdegutisIs it bad practice to use a bare name when creating a top-level namespace, like 'foo?
09:44clgvsdegutis: collisisions are likelier if you do that a lot, hence the library name is often used as prefix
09:44sdegutisMaybe I can avoid that with a shorter name, like 'f
09:44clrndwhy not just use a real descriptive name?
09:45clgvsdegutis: is there a reason that you do not want to use a common prefix for that project?
09:45sdegutisIs it possible to rebind *ns* inside a (load-reader) call from outside the call?
09:45sdegutisclrnd, clgv: It's not a project.
09:45clgvsdegutis: a script?
09:46clgvin that case just use the flat namespace, if any at all
09:55sdegutisclgv: It's for .clj view files.
09:57sdegutisclgv: You would have "src/views/something.clj" that just contains [:div "whatever"] and you would (render-view "something") which would return "<div>whatever</div>" or something.
09:57sdegutisclgv: And inside something.clj, I want to set the namespace to 'v from outside the call to (render-view ...)
09:57sdegutisI could just put (ns 'v) at the very top of every src/vies/*.clj file, but I'm hoping to find another way.
09:58Glenjaminsdegutis: can you just have render-view resolve it?
09:59clgvsdegutis: sounds pretty complicated - are you sure you dont want to use vanialla clojure namespaces?
10:00sdegutisclgv: I want to be able to have access to some convenience functions and variables that are defined in other places.
10:02clgvsdegutis: just make sure you really have net benefit from that construction
10:03schmiris it possible to deliver a throwable instance to a promise such that deref on the promise throws the exception?
10:06clgvschmir: you coud wrap the actual promise with (reify IDeref ) that derefs the actual promise and throws if needed
10:28sdegutisI found the source of my problem. I was using with-redefs instead of binding to temporarily redefine *ns*.
10:52CookedGryphonUgh, thought I'd fixed this. Is anyone else trying to use clojure on android in Lollipop?
10:53CookedGryphonit's really insistent that the bytecode generated by clojure's with-locking macro is invalid
10:54ustunozgurhi all, in cider, when I switch namespaces (C-c M-n), the required/referred things are not visible. any idea how to solve this?
10:54ustunozgurI have something like [datomic.api :as d] in my namespace, but typing d in repl causes "Unable to resolve symbol: d in this context"
10:54ustunozgurI can still do C-M-x in my source file though
10:55ustunozguronly the repl doesn't work when I type manually
10:55sdegutisustunozgur: d is not a symbol
10:55sdegutisustunozgur: it's just a namespace; Clojure doesn't have first-class namespaces
10:55sdegutisustunozgur: using "d" is only valid in the form "d/foo"
10:56sdegutisustunozgur: well technically Clojure does have first-class namespaces, but they're cumbersome to use directly
10:56ustunozgursdegutis: Oh, right.
10:56ustunozgurbut if I referred symbols, I would be using them, right?
10:57clgvustunozgur: you can get the namespace via (the-ns 'my.ns)
10:57sdegutisRight.
10:57ustunozgurOK, thanks.
11:02sdegutisWhy is that a very simple hello world Clojure app takes 1.02 seconds to run?
11:06clgvsdegutis: Clojure startup is not the fastest - there is research on accelerating it
11:07FriedBobBecause it has to start up a jvm
11:07micryptsdegutis: Perhaps this might help, http://nicholaskariniemi.github.io/2014/02/25/clojure-bootstrapping.html
11:07clgvFriedBob: JVM is relatively unproblematic in comparison to clojure itseld
11:07clgvmicrypt: good link!
11:07clgv(inc micrypt)
11:07lazybot⇒ 1
11:10engblom,seen hiredman
11:10clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: seen in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:12sdegutis$seen weavejester
11:12lazybotweavejester was last seen quittingQuit: weavejester 17 hours and 34 minutes ago.
11:12sdegutisah, good old quittingQuit
11:12EvanRwhats so slow about clojure program startup?
11:13sdegutisIs there a way to determine the namespace of the calling function?
11:14clgvEvanR: http://nicholaskariniemi.github.io/2014/02/25/clojure-bootstrapping.html (linked by micrypt before)
11:15engblomHopefully we one day have the same fast startup as clisp or sbcl...
11:17sdegutis,((fn f [a] [a (f (inc a))]) 1)
11:17clojurebot#<StackOverflowError java.lang.StackOverflowError>
11:17Bronsasdegutis: what would you have expected that to do?
11:18sdegutisOverflow.
11:18sdegutis(The stack.)
11:18Bronsathen what was the point?
11:18sdegutisTo create a named "anonymous" function!
11:18sdegutis:D
11:18sdegutisI should use them more oft.
11:28engblomIs there a ready made short circuit for (map)? Given a sequence of numbers [0 0 3 2 0 4] I want the first non-zero to be decreased. The result would thus be [ 0 0 2 2 0 4]. It would be trivial to decrease all non-zero values with map.
11:29engblomThis could be done with loop...recur, but I am wondering if there is a better solution.
11:31sdegutisengblom: You might be able to do it with some kind of filter+map+juxt combination.
11:31clojure_beginnerAnyone using fireplace plugin in VIM ?
11:31engblomclojure_beginner: I am.
11:31clojure_beginnerI get this strange behaviour when I try to eval some lazy seqs
11:32sdegutisengblom: Or, split the seq based on the first (even?), map the first element, and re-join them.
11:32clojure_beginnerI have this fibonaci function (defn fibo [] 153 (map first (iterate (fn [[a b]] [b (+ a b)]) [0 1])))
11:32EvanRclgv: seems absurd
11:32clgvEvanR: what exactly?
11:32clojure_beginnerwithout the 153 part..sorry don't know how i managed to paste thath
11:33EvanRclgv: the startup time and the reasons behind it
11:33clojure_beginnerthen I do (def lots-of-fibs (take 1000000 (fibo)) and then (nth 1000 (fibo)) It halts..
11:33clgvEvanR: not ideal for scripting but anything else usually takes some time to load
11:33sdegutisengblom: like ##(split-with (comp not zero?) [0 0 3 2 0 4])
11:33lazybot⇒ [() (0 0 3 2 0 4)]
11:34sdegutisengblom: or maybe ##(split-with (comp zero? not) [0 0 3 2 0 4])
11:34lazybotjava.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.Number
11:34EvanRreminds me of php frameworks doing a huge batch of "class loading" on each request, which actually is way faster than this
11:34clojure_beginnerbut only in vim, if i do it in repl directly all is fine
11:34clgvEvanR: one second is not that long for programs you use at least 5 minutes ;)
11:34EvanRclgv: right, "think photoshop or maya"
11:34EvanRyou get a nice splash and a progress bar
11:35clgvEvanR: afair there is research in progress how to improve clojure startup times
11:35clojure_beginnerDamn Im gonna have to learn emacs
11:35sdegutisclojure_beginner: don't do it!
11:35sdegutisit's a trap!
11:36clgvclojure_beginner: emacs is not the only option you have apart from vim ;)
11:36EvanRclojure_beginner: im using vim right now and its ok
11:36clojure_beginnerYea I knwo, it's evil
11:36mindbender1What's the real difference between an interface and a protocol?
11:36EvanRclojure_beginner: its easier for me to have all these functions already defined in a text file that i can run from vim rather than typing out new definitions in an interactive way
11:37clojure_beginnerclgv: Yea I know about ight table..but...
11:37mindbender1That's from a general programming point of view.
11:38clojure_beginnerEvanR: But I am running vim with fireplace plugin, so I can connect to repl, move cursor on the function definition and hit ctrl + e to eval and see the result
11:38EvanRclojure_beginner: me too
11:38engblomThe only thing I am using Emacs for is as an IRC-client. I need a spell checker and there is no other console irc client including a spell check if I want to use openbsd.
11:38EvanRonly i use cpp
11:38dopamean_i like cpp as well
11:39clojure_beginnerbut lazy sequence realizations take long time or halt my vim..
11:39EvanRclojure_beginner: er, im not having this problem
11:39engblomI am also quite often use :Require! followed by cqc and testing all I want.
11:39engblom(for vim)
11:40EvanRi rebound local leader r for re-require
11:40EvanRstill a lot of key presses to retry something after changing code, but not nearly as bad as moving the mouse over to the reload repl button(s) in intellij
11:41clojure_beginnerEvanR: The problem was In my code
11:41clojure_beginnersorry :D
11:41clojure_beginnerNow works fine :)
11:41winkengblom: yeah. first thing I associate with emacs: irc client with spell checker on openbsd :)
11:42EvanRalso you can look at backtraces in lop, and the last chunk of output is available in the quickfix window
11:42EvanRlop, the locations window
11:43clojure_beginnerEvanR: Locations window, on emacs ?
11:43EvanRno i was talking about vim/fireplace
11:45clojure_beginnerJust found out there is this https://github.com/ctford/vim-fireplace-easy/
11:45clojure_beginnerit automatically connects to repl if you are inside clojure project
11:46EvanRyes fireplace does that
11:46EvanRwell, if you have ~/.nrepl-port
11:48engblomclojure_beginner: Do you know pathogen? With pathogen you very easily install these packages: vim-fireplace, vim-clojure-static, supertab, rainbow_parentheses.vim
11:48engblomclojure_beginner: vim-fireplace will automatically connect to a running repl. Just do 'lein repl' before starting vim.
11:49clojure_beginnerenglob, yes I know pathogen, i already have clojure-static, fireplace and rainbow parenthesis installed
11:49clgvclojure_beginner: there is also cursive and counterclockwise ;)
11:49clojure_beginnerclgv, Ill check those too.
11:50EvanRclojure-static comes with vim now
11:50EvanRand the latest version of vim has a bugfix for lispwords, also built in
11:50EvanRthough ubuntus vim is not the latest ;(
11:56justin_smithTEttinger2: I kind of caught the context in scrollback, but what's the deal with the sandboxing and awt?
11:57clgvEvanR: ppa then ;)
11:58EvanRppa?
11:58justin_smithEvanR: unofficial sources, often more up to date
11:58justin_smith$google ubuntu ppa
11:58lazybot[Personal Package Archives : Ubuntu - Launchpad] https://launchpad.net/ubuntu/+ppas
11:58justin_smith$google ubuntu ppa vim
11:58lazybot[Personal Package Archives : Ubuntu - Launchpad] https://launchpad.net/ubuntu/+ppas?name_filter=vim
11:59EvanRnice ill check that out
11:59justin_smithtop package on that second list may just be what you want
11:59justin_smithwait, no, not uploaded since 2009..
12:00justin_smithhttps://launchpad.net/~sylvain-pineau/+archive/ubuntu/vim this looks decently up to date
12:36engblomI have reached the level where I get most of the functions I want done, but I still think I would need to develop a bit of skill in making clean looking functions. I quite often end up with chains of let ... if ... let ... if. How would you clean up the function new-heaps in this paste: http://pastebin.com/7UywPRGY
12:38sdegutisIs (->> coll (drop-while pred) (first)) the best way to get the first item of coll that matches pred?
12:39technomancydrop-while or remove
12:40sdegutisI suspect drop-while will be a little more efficient if it's a long (or lazy) list.
12:40Bronsasdegutis: that'll get you the first item of coll that _doesn't_ match pred
12:40sdegutisyeah I meant (comp not ...)
12:40gfredericksIf you've ever gotten nondeterministic failures from an nrepl plugin, you might want this: https://github.com/gfredericks/nrepl-53-monkeypatch
12:41sdegutisI can't just use take-while though because it might not ever get to the first result.
12:41technomancysdegutis: hm; there could be a difference for chunked seqs
12:41Bronsasdegutis: do you want the first element that matches then?
12:41sdegutisYes.
12:41Bronsasdegutis: if so use (comp first filter)
12:41sdegutisI want Ruby's coll.find{}
12:41sdegutisBronsa: That could be inefficient if it's a {big,lazy} coll.
12:42Bronsano
12:42Bronsafilter is lazy
12:42sdegutisOh nice!
12:42sdegutisThanks :)
12:42sdegutisIn fact, now that you mention it, I do filter/first elsewhere.
12:42sdegutisDunno how I forgot ;)
12:42sdegutis*:)
13:06sdegutisWhat are some libs that enhance the Lein Test Experience?
13:06danielcomptonsdegutis: humane test output
13:07danielcomptonsdegutis: https://github.com/technomancy/leiningen/wiki/Plugins#testing
13:18sdegutisI was hoping to garner some opining based on personal experience.
13:19technomancyhumane-test-output is great
13:24sdegutispjstadig: nice work
13:28sdegutisI'm surprised it doesn't colorize the output or have an option to.
13:29arrdempulll requests accepted I'm sure :D
13:30sdegutisMaybe there could be another plugin that just colorizes the output of this?
13:30sdegutisI dunno if that's possible in a clean way though.
13:31clgvsdegutis: midje has color output
13:31sdegutisI remember hearing that midje's author was deprecating it?
13:31clgvhuh? where?
13:31sdegutisOr that somehow he wasn't satisfied with it but didn't have time to fix the things he didn't like about it?
13:31sdegutisI don't remember.
13:32technomancydifftest has colorized output and works with clojure.test
13:37TimMcclgv: They said "Technikern" is fine. Do you suppose it's a dialect or regional difference?
13:40octane--ach.
13:43clgvTimMc: no in general "Ingenieur" would be more fitting but usually the keep the job title in English here as well "Software Engineer" is common
13:45TimMc*shrug* I don't know German so I won't try to push it. :-P
13:47clgvTimMc: I just mentioned it since it sounded very funny ;)
13:48TimMcWhoever they're using for translation doesn't think so, which is interesting. That's why I was wondering about regionalisms.
13:52mi6x3mhey Clojure, when using pprint generating a multiline output from '(ns blabla [] ... [])
13:52mi6x3mis there a way to make ns and blabla stay on the same line?
13:55technomancymi6x3m: check out how slamhound does it
13:56clgvTimMc: he probably choose just one of the translations listed and does not want to change anything now ;)
13:57clgvor she
13:57mi6x3mtechnomancy: I found some example which uses code-dispatch as the dispatcher
13:57mi6x3mthis does it :)
13:58arrdemfipp has a better pretty printer for code than core's
13:58arrdemfwiw
13:58mi6x3mah, well I have a simple usecase :)
14:07TimMcclgv: Prolly. :-)
14:09pandeiroare there examples anywhere of jetty log configuration when using lein ring uberwar to run clojure apps as servlets? how does one get request logs, or log to stdout, for example?
14:13clgvpandeiro: if you set the logging level to "debug" jetty is pretty chatty :/
14:16pandeiroclgv: yeah i am searching for some kind of reasonable default i guess - what i have now is too little
14:17clgvpandeiro: you could just add a ring middle ware that logs every request on "info" level for example
14:18larhat1Hi folks! This snippet: `(doseq [r [(range)]] (doseq [i r]))` is eating all my memory over time. Shouldn't it just burn my cpu, like `(doseq [r (range)] )` does?
14:19gfrederickslarhat1: presumably it's holding the head for some reason
14:19gfredericksI don't know enough about the compiler internals to say why, but it doesn't surprise me too much
14:19gfredericks,(macroexpand-1 '(doseq [i r]))
14:19clojurebot(clojure.core/loop [seq_27 (clojure.core/seq r) chunk_28 nil count_29 ...] (if (clojure.core/< i_30 count_29) (clojure.core/let [i (.nth chunk_28 i_30)] (do) (recur seq_27 chunk_28 count_29 (clojure.core/unchecked-inc i_30))) (clojure.core/when-let [seq_27 (clojure.core/seq seq_27)] (if (clojure.core/chunked-seq? seq_27) (clojure.core/let [c__4649__auto__ (clojure.core/chunk-first seq_27)] (recur ...
14:19larhat1gfredericks: http://clojuredocs.org/clojure.core/doseq says `Does not retain the head of the sequence`
14:20gfredericksdoseq itself might not but that doesn't mean some other aspect of the code isn't
14:21justin_smithlarhat1: it doesn't promise not to hold the head of any element of it's input - the inner doseq handles range properly, the outer may not
14:21gfredericksI don't see anything suspicious though
14:21pandeiroclgv: sure that works
14:21pandeiro but it feels like something that should just be handled via jetty configuration, but i don't get how to configure it - if i have to write java code, a 'properties' file, etc
14:22pandeirothis is where one feels the pain of using clojure w/o much java know-how
14:22technomancyhttps://twitter.com/ieure/status/535113259242627072
14:24justin_smithpandeiro: you can use a properties file (they aren't super complex), and/or one of the clojure wrappers like clj-logging-config https://github.com/malcolmsparks/clj-logging-config
14:24pandeirotechnomancy: doesn't bode well for me ey
14:24larhat1justin_smith: gfredericks so, is there any way to avoid this mem leak?
14:24technomancyIME jetty should just dtrt without config
14:25technomancyoh, if you're embedding it anyway
14:25technomancycontainers are going to be a whole new can of worms
14:25pandeirotechnomancy: containers meaning uberwars?
14:26justin_smithpandeiro: a container is a thing that hosts an uberwar
14:26justin_smithbut configuring the container will be editing some xml - it stinks, but it still isn't like you need to write java
14:26gfrederickslarhat1: depends on what your actual code looks like; (doseq [i (apply concat [(range)])]) would be equivalent, right?
14:26pandeirojustin_smith: so if i have a couple different projects that produce uberwars and run in one jetty instance - i would stick that clj-logging code in one of the projects?
14:26justin_smithor if you're lucky, a properties file instead of xml
14:27justin_smithpandeiro: not sure that works, I think it's the container that will configure the logging
14:27preporgfredericks justin_smith ok, how about this snippet https://www.refheap.com/307eee40179e65666ae5f91ae ?
14:27pandeirojustin_smith: container = the single jetty instance running multiple wars, right?
14:27justin_smithright
14:27pandeiroso yeah, if so, that is what i want to configure
14:29pandeirohttp://www.eclipse.org/jetty/documentation/current/configuring-logging.html
14:29preporgfredericks: there are no doseq's, just plain loops. and it leaks
14:29pandeiroand i start to resemble technomancy's tweet
14:29sdegutisGiven ##'foo.bar/quux how do you return the function it refers to (even if foo.bar hasn't been required yet)?
14:29lazybot⇒ foo.bar/quux
14:30justin_smithsdegutis: ##(deref #'+)
14:30lazybot⇒ #<core$_PLUS_ clojure.core$_PLUS_@5b4ef688>
14:30arrdemyou can't do that if foo.bar hasn't been loaded yet
14:31sdegutisSorry no, I only have a symbol.
14:31justin_smitharrdem: yeah, of course you can't access code that hasn't been loaded
14:31sdegutis'foo.bar/quux
14:31justin_smithsdegutis: or ##(resolve 'clojure.core/+)
14:31lazybotjava.lang.SecurityException: You tripped the alarm! resolve is bad!
14:31justin_smithsdegutis: the above will work in your code
14:31sdegutisThanks.
14:31sdegutisSo I need to do require first then resolve?
14:31justin_smithit will fail if somehow that thing did not get resolved
14:32justin_smithwell, the thing needs to be defined *somehow* before the resolve gets called
14:32justin_smithbut the compiler doesn't care when
14:32gfredericksprepor: well that one leaks because of what (repeat (range)) does; you probably want (repeatedly range)
14:32justin_smithsdegutis: it's the go-to ugly hack for circular dependencies, and the real fix is to have a better namespace structure
14:33preporgfredericks: my real code is https://www.refheap.com/9bc27b5809133db3a1e8b2503. and it leaks
14:33justin_smith*namespace dependency structure
14:33gfredericksprepor: btw have you tried using two clauses in a single doseq instead of two doseqs?
14:34justin_smithgfredericks: prepor: yeah, I was about to suggest doing that too
14:34gfredericksprepor: and if this is your real code you might just use count and for instead of doseq
14:34gfredericks(i.e., you wouldn't need the atom either)
14:35justin_smithoh yeah, that's the right way to do it
14:35preporgfredericks ok that isn't my ALL real code ) but why it leak. even without doseq's https://www.refheap.com/252852b208e240cebf8045f89
14:35justin_smith(inc gfredericks)
14:35lazybot⇒ 107
14:36justin_smithprepor: there is no point in using with-open there
14:37justin_smithor is there, actually, never mind
14:37gfredericksprepor: did you try a doseq with 2 clauses yet?
14:38sdegutisI see that ##(name 'foo.bar/quux) will give "quux" kind of like a "basename" function. Is there an equivalent to "dirname" that would give "foo.bar"?
14:38lazybot⇒ "quux"
14:39aperiodicsdegutis: namespace
14:39justin_smith&(namespace 'clojure.core/+)
14:39lazybot⇒ "clojure.core"
14:39preporgfredericks justin_smith yourkit tells me that something inside `first` (!) hold link to the first element of collection. so it leaks because that. is this ok? )
14:39justin_smithprepor, you ask for the first item, and then you make a local binding for it, so it will be held onto until the scope is gone
14:40justin_smithusing a two clause doseq, you would avoid this problem
14:40preporgfredericks: ok (doseq [r [(range)] i r]) also leaks
14:40preporjustin_smith no
14:40sdegutisaperiodic: You win, thanks.
14:40gfredericks,(doseq [r [(range)] i r])
14:41clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
14:41preporgfredericks ooops :)
14:41gfredericks,(doseq [i (apply concat [(range)])])
14:41clojureboteval service is offline
14:42gfredericks&(doseq [i (apply concat [(range)])])
14:42preporgfredericks it will be ok
14:42justin_smithgfredericks: oh yeah, your apply concat suggestion from before
14:42lazybotExecution Timed Out!
14:43gfrederickswelp I don't get it
14:44amalloygfredericks: i don't get it, what are you trying to show? (apply concat [x]) is just x (provided that x is sequential), so this is just (doseq [i (range)] ...)
14:44preporgfredericks its just infinite loop, but not leaks
14:44gfredericksamalloy: why does (doseq [r [(range)] i r]) hold the head?
14:44preporgfredericks: see macroexpand
14:45gfredericksamalloy will get to the bottom of this
14:45preporgfredericks https://www.refheap.com/75866d7cd10339e9a458fdeee
14:45amalloygfredericks: my guess is the chunked seq on the vector [(range)] keeps a pointer to the original vector
14:45gfredericks~amalloy
14:45clojurebotThat's *the* amalloy to you
14:46gfredericks,(doseq [r (list (range)) i r])
14:46preporgfredericks (recur (next seq_3788) nil 0 0)
14:46clojurebot#<OutOfMemoryError java.lang.OutOfMemoryError: Java heap space>
14:46gfredericksamalloy: ^ no chunking there
14:47preporgfredericks i understand wgy doseq isn't working (but i think this is problem of lang), but i don't understand why by examples with plain loops leaks
14:48preporjustin_smith: "it will be held onto until the scope is gone" as i know this is not how GC works
14:49visofhi guys
14:49havenwoodhi
14:50justin_smithprepor: it can't be gc'd if there is something that can access it. The scope determines this. Though clojure also does some fancy manual locals clearing.
14:50zarkonehello all! Situation: i write a program with repl and cider and consider to use core.match. I include it into project.clj deps. How can i load it to repl on fly? (use '[clojure.core.match :only (match)]) errors "Couldn locate class"
14:50zarkone
14:51visofwhat is the best way to convert this [{"hello" "world"} {"good" "year"} {"hello" "foo"} {"good" "nothing"} {"else" "there"}] to {"hello" ["world" "foo"] "good" ["year" "nothing"] "else" ["there"]} ?
14:51preporjustin_smith not scope determines this, but references, isn't it? )
14:51zarkonei'm qute new to clojure and jvm..
14:51visofi can do this with atom and change it using swap!
14:51amalloygfredericks: https://www.refheap.com/e87e3120df06173bce7734fd9 is a trimmed down version of the macroexpansion. i've removed most of it, since it doesn't look like it's actually relevant and it's really distracting
14:52visofis there a good functional solution ?
14:52justin_smithprepor: the scope determines where those references can be.
14:52preporjustin_smith: its not ARC, it's GC. GC know nothing about lexical scopes.
14:52amalloyit looks like next isn't called on [(range)] until it's time to recur, so the outer loop is holding onto (seq [(range)]) while the inner loop runs
14:53preporamalloy yes!
14:54preporamalloy in case of doseq. but i also have leak withou doseq, with plain loops. https://www.refheap.com/307eee40179e65666ae5f91ae
14:54justin_smithprepor: same thing, you have a loop binding to the collection while iterating on its first item, the binding prevents gc
14:55justin_smiththe first item is accessible, via the outer loop, thus cannot be collected
14:55amalloyjustin_smith: i don't think it's that simple. prepor is only saving a binding to (rest coll), not to coll
14:55amalloyprepor: i think you might fix this just by replacing rest with next
14:55justin_smith(let [category (first categories) ..])
14:56justin_smiththat holds onto the head of category
14:56amalloyjustin_smith: doesn't matter
14:56justin_smithOK
14:56amalloycategory isn't actually *used* in the outer loop after initializing the inner loop
14:56preporamalloy, no i can't fix it by this way
14:56amalloyso the compiler un-references it, making it available for gc
14:56justin_smithamalloy: OK, the locals-clearing thing, got it
14:58aperiodicvisof: (group-by (comp first keys) ...) gets you most of the way there
14:59gfredericksjustin_smith: the first item in a seq isn't the same as the head...
14:59amalloyvisof: (apply merge-with into (for [m ms, [k v] m] {k [v]}))
14:59gfredericksoh nm I think I Misread
15:00sdegutisThank you justin_smith for all your help.
15:00justin_smithgfredericks: the first item of the outer loop is the head of the inner loop
15:00justin_smithsdegutis: np
15:00bbloomd'oh. am i on a 10 minute delay somehow again?
15:01bbloom,(do (defmacro m1 [] 1) (m1))
15:01clojurebot1
15:01bbloom&(do (defmacro m1 [] 1) (m1))
15:01lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
15:01amalloyspecifically, ##(let [ms '[{"hello" "world"} {"good" "year"} {"hello" "foo"} {"good" "nothing"} {"else" "there"}]] (apply merge-with into (for [m ms, [k v] m] {k [v]})))
15:01lazybot⇒ {"else" ["there"], "good" ["year" "nothing"], "hello" ["world" "foo"]}
15:01justin_smithgfredericks: but as amalloy points out, it isn't held onto thanks to locals clearing
15:01bbloom&(let [_ (defmacro m2 [] 2)] (m2))
15:01lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
15:01bbloom,(let [_ (defmacro m2 [] 2)] (m2))
15:01clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: sandbox/eval52/m2--53>
15:02bbloomi guess the do expression compiles the forms separately, evaluating them in sequence,
15:02amalloybbloom: yes
15:02bbloombut the let seems to compile them all at once
15:02justin_smith,(let [_ (defmacro m2 [] 2)] (m2 nil nil)) ;; bbloom
15:02clojurebot#<CompilerException clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox/eval52/m2--53, compiling:(NO_SOURCE_PATH:0:0)>
15:02justin_smitherr
15:03amalloyjustin_smith: that's calling bbloom's version
15:03bbloomuse m3
15:03amalloybecause the let is all compiled as one form
15:03justin_smith,(let [_ (defmacro m4 [] 2)] (m4 nil nil))
15:03clojurebot2
15:03amalloythat's a funny little quirk, justin_smith
15:04justin_smithindeed
15:04amalloythe defmacro creates a var at macroexpansion time (by expanding to def), but doesn't set the metadata on it or define it
15:04preporamalloy do you have any ideas why this snippet with tho loops leaks? And do you think that its ok that (doseq [r [(range)] i r]) leaks? :)
15:04bbloomi've been wondering about dynamic definitions of macros, macrolet, etc
15:04bbloomracket jumps through lots of hoops to make macro defining macros and the like
15:05amalloyprepor: i wasn't able to reproduce your memory leak easily. as for doseq, i think it has to choose between two bad behaviors, and the one it picked seems as good as anything else
15:05bbloombut to some extent it has to b/c the compilation unit is a whole module, where as in clojure each top level is it's own compilation unit
15:05bbloomso a macro can be valid in the next compilation unit only
15:05bbloomseems much simpler :-P
15:06preporamalloy: this snippet doesn't leak for you https://www.refheap.com/307eee40179e65666ae5f91ae ?
15:06amalloyprepor: it might leak eventually, but it was taking a long time and i need my repl
15:08preporamalloy: it leaks very fast for me https://www.dropbox.com/s/uc0ih6ywcmmyrs0/Screenshot%202014-11-20%2004.06.48.png?dl=0
15:27sdegutisIs there a way to pass additional arguments only if the function you're calling happens to handle them, and otherwise omit them, so that it doesn't throw a "too many args" exception?
15:27sdegutisThe only way I can conceive of is by defining it as (defn my-function [{:keys [foo bar quux]}] ...) and calling it as (my-function {:foo 1 :bar 2 :quux 3 :zizzle 4})
15:27danielcomptonsdegutis: you can make a variable number of args with &, or write a function with several different signatures
15:28sdegutisThe goal is to make it just as convenient to write a function that takes all the args as to write one that only takes some.
15:29sdegutisObviously it would be more ideal to write (defn my-function [foo] ...) because it's shorter, and then just call (my-function 1 2 3 4)
15:29sdegutisBut that would throw exceptions.
15:29justin_smithsdegutis: (defn f [& [a b]] ...) takes any number of args, but only tries to use the first two
15:29sdegutisjustin_smith: That might just do the trick!
15:30justin_smithyou're giving up on some basic error checking there of course
15:30justin_smithbut it is super flexible
15:33sdegutisjustin_smith: Thanx :)
15:34sdegutisAfter further consideration, I think requiring the user to memorize ordinal positions is probably not the best.
15:34justin_smithtaking a map is nice for that
15:36danielcomptonsdegutis: :or destructuring is quite nice if you want to allow default values from the user http://blog.jayfields.com/2010/07/clojure-destructuring.html
15:36sdegutisThanks.
15:36danielcomptonsdegutis: I mean allow the user to call the function without specifying default values
15:38sdegutisFor some context, I'm writing an abhorrent and horrendous library that all Clojurians will unite to denounce and despite.
15:38danielcomptonsdegutis: what's it do?
15:38danielcomptonsdegutis: rewrite your code into scala?
15:39sdegutisIt's a web framework.
15:49sobellibrary or framework?
15:50FriedBobA library for frameworks.
15:51sdegutisFramework.
15:51sdegutis/cc sobel
15:53winkclojure on curbs
15:54sobelheh
15:55gfredericksClojure off a Cliff
15:55sobelmy first (reflexive) interpretation of 'on rails' way back in the day was: like, up on blocks?
15:55sobellike that broken-down old camaro
15:55sobelClojure in the Cloister
15:55gfredericksClojure with a Claw
15:57gfredericksClojure on a Clothesline
15:57gfredericksClojure in the Clover
15:58danielcomptonClojure like Clockwork
15:59amalloyhah, on the topic of fixing bugs in open-source projects: "but you'd need to find someone to code it who cares as strongly as you do. 10 times out of 10 that is you and also like 1 time out of 1000 that is someone else"
16:00winkbullshit
16:00brainproxyClojure Full Exposure
16:00winkwith reasonably popular projects and maintainers that are open and active, those numbers are way off
16:01dbaschClojure on Clouds
16:02brainproxyProgrammers Inside Parentheses
16:07danielcomptonI'm wanting to partition a byte array n ways, i.e. 0,3,6,9.. elements go into one byte array, 1,4,7,10th go into another and so on. What would be the most efficient way of doing this? It seems like amap is my best option here, but I'm not quite sure. Maybe an array of byte-arrays would be better?
16:09danielcomptonI mean, making an array of byte arrays would be better than having several single arrays
16:10justin_smithdanielcompton: is just passing the byte array and relevant indexes an option? because that will perform better
16:10justin_smithoh wait, never mind that
16:10danielcomptonjustin_smith: I guess so, I need to process each partition separately, there's no real reason to copy them out except my existing code works on contiguous arrays
16:11pyramalloy: hi! around ?
16:11justin_smithdanielcompton: I didn't quite register the interleaving at first
16:11amalloypyr: sure, ¿que pasa?
16:12pyramalloy: small worries with lein protobuf
16:12mi6x3many way to print out 2 defns with pprint/write without calling it 2 times?
16:12justin_smithdanielcompton: what about using areduce to partition? or writing a shuffle algorithm so that you get the mapping [0 3 6 9 .. 1 4 7 10 ...]
16:13justin_smithdanielcompton: because the shuffle should be able to just work in a simple loop
16:13amalloypyr: i don't think i ever did much with lein protobuf. i don't even have a single commit in it. i did do some work on clojure-protobuf, but the lein plugin isn't mine
16:13pyramalloy: oh, nm then, sorry
16:13danielcomptonjustin_smith: I think this is what they call a teachable moment, I'll have a go at a few options and time which one comes out fastest
16:13pyramalloy: i thought you handled both
16:13amalloypyr: ninjudd and raynes did the plugin
16:14justin_smithdanielcompton: I think the shuffle would be it - no allocation!
16:14justin_smithall other options require allocation
16:14dbasch&(group-by #(mod % 3) (range 20))
16:14lazybot⇒ {0 [0 3 6 9 12 15 18], 1 [1 4 7 10 13 16 19], 2 [2 5 8 11 14 17]}
16:14danielcomptonjustin_smith: can you explain the shuffle a bit further?
16:14dbaschdanielcompton something along those lines?
16:15dbaschyou’d need a map-indexed or something before, etc.
16:15justin_smithdanielcompton: for any two orderings of the elements of an array, there is an algorithm that will rearrange the contents without needing more than a few state bindings and a container for two items being swapped
16:16danielcomptondbasch: and then in the array processing, just aget each element?
16:16justin_smithdanielcompton: that may be more optimized than you need though (given the extra complexity of getting that algorithm right)
16:17dbaschdanielcompton: yeah, for example
16:17danielcomptonjustin_smith: it's a pretty tight loop so it might be worth it
16:17dbaschor you could iterate over the array with a counter and populate the n outputs by mod
16:19dbaschthat would be more time-efficient if you use arrays and preallocate them to the calculated size
16:19dbaschreordering in place is more space-efficient but probably slower
16:19justin_smithdanielcompton: dbasch: you could likely use a single preallocated array, and fill it in the way dbasch describes
16:20justin_smithdbasch: good point, yeah
16:20danielcomptonusing an array of byte arrays would be quite elegant because I can just use mod and quot of the index to address the array
16:20amalloydanielcompton: if you're talking about a tight loop, allocating more byte arrays and copying stuff among them doesn't sound great
16:23justin_smithdbasch: I wonder, depending on the size, the extra CPU cycles of a shuffle in place may be cheaper than the cache pressure of using two arrays. I would expect a cyclical comparison where for certain sizes one approach is faster, and then past some barrier the other wins
16:24dbaschyes, it’s the kind of thing worth trying for fun (but probably doesn’t matter much if you’re doing this in clojure)
16:24justin_smithheh, fair enough, yeah
16:26justin_smithdbasch: I assume you've seen this https://gist.github.com/jboner/2841832
16:28dbaschjustin_smith: yeah, I think it was posted on HN at least once
16:29justin_smithI wonder if there is a version that also has like "integer add" and "floating point add" and "floating point multiply"
16:30justin_smithAHA http://norvig.com/21-days.html#answers the original source
16:30dbaschjustin_smith: http://www.eecs.berkeley.edu/~rcs/research/interactive_latency.html
16:30dbaschwith extrapolation until 2020
16:31danielcomptonI think this is my favourite, because it translates it into human understandable time scales https://twitter.com/rzezeski/status/398306728263315456
16:31dbascha google recruiter once asked me to put a subset of those in order over the phone
16:32danielcomptondbasch: and then reverse it
16:32justin_smithdanielcompton: yeah, that one is nice
16:32danielcomptondbasch: what happens if we drill a hole through the centre of the earth, how does that change it? what if the speed of light was 10x faster?
16:34dbaschwhat if interviewers asked questions based on scientific evaluations of what works and what doesn’t?
16:39dbaschdanielcompton: how would you build a computer that executes programs using nickels as 0s and dimes as 1s?
16:39danielcomptonjustin_smith: does your shuffle algorithm have a special name? Shuffle algorithm doesn't seem to be what I'm after
16:39gfrederickswell interview questions are this self-referential thing
16:40justin_smithdanielcompton: sorry, I forget proper nouns sometimes...
16:40gfredericksonce you settle on something people try to specialize in it
16:40dbaschgfredericks: how would you improve this interview question?
16:40gfredericksI don't know anything about interviewing
16:41gfredericksit seems really hard
16:41danielcomptonDuring his own Google interview, Jeff Dean was asked the implications if P=NP were true. He said, "P = 0 or N = 1." Then, before the interviewer had even finished laughing, Jeff examined Google’s public certificate and wrote the private key on the whiteboard
16:41dbaschanswer: “I would improve that question by removing the self-reference and making it about something other than itself”
16:41mi6x3mwhen working with pprint (code-dispatch). is there a way to keep the namespace aliases?
16:41mi6x3mthey get expanded to the full ns name
16:42justin_smithdanielcompton: in-place deinterleave
16:42justin_smithdanielcompton: basically a matric transform
16:42justin_smith*matrix
16:43danielcomptonjustin_smith: yeah I was thinking this sounds a bit like a matrix transform
16:45justin_smithdanielcompton: synonym of deinterleave is deinterlace
16:51sdegutis"clomb" is a real word.
16:52danielcompton(inc justin_smith) (inc dbasch)
16:52sdegutisquick someone name a Clojure library "clojmb"
16:52danielcompton$karma amallaoy
16:52lazybotamallaoy has karma 0.
16:52danielcompton$karma amalloy
16:52lazybotamalloy has karma 196.
16:52sdegutis$karma sdegutis
16:52lazybotsdegutis has karma 6.
16:52sdegutisI'm 3% as helpful as amalloy.
16:53edwThe Karma thing, that is a joke, right?
16:54tbaldridgeedw: Karma is never a joke. Talk to your kids about Karma today.
16:54amalloyedw: it's an informal way of estimating how helpful someone is in here
16:54tbaldridge$karma tbaldridge
16:54lazybottbaldridge has karma 12.
16:54danielcompton$karma richhickey
16:54lazybotrichhickey has karma 0.
16:54TimMcamalloy: Or how many stupid jokes they make.
16:54tbaldridgeyep, 'about right
16:55amalloy$karma rhickey
16:55lazybotrhickey has karma 9003.
16:55amalloytbaldridge:
16:55edwamalloy: That's insane. Anyone ever noticed that karma made Hacker News insufferable, that it attracts and breeds a mentality?
16:55TimMc(inc edw_
16:55TimMc(inc edw)
16:55lazybot⇒ 2
16:55edwThanks, TimMc.
16:55mi6x3mtechnomancy: any idea how to supress clojure.core/ outputs in Fipp?
16:55TimMctechnomancy: Spammer: kikati
16:56edws/TmMc/TimMc/
16:56tbaldridgemi6x3m: you might ask bbloom that
16:56mi6x3mbbloom: I ask you that
16:56TimMcedw: I don't know if I agree with you, it was just performance art.
16:57mi6x3mhow can I disable clojure.core/ in symbol output?
16:57TimMcedw: It helps that lazybot has occasionally lost its karma database.
16:57tbaldridgeedw: no, karma has nothing to do with anything on this irc. It's just a way of counting how many times someone has said +1 to someone
16:57edwTimMc: it's all fun and games until someone starts saying something in to inc their karma.
16:58sdegutisedw: Yep, it's a fact, HN is a dump
16:58bbloommi6x3m: i'm not sure what you're asking
16:58amalloyTimMc: i remember something being lost once, but i don't think it was the whole thing
16:58sdegutisYou know, our (inc foo) system is broken.
16:58mi6x3mbbloom: when I pprint with fipp symbols are prepended clojure.core
16:59dbaschthis is a good blog post on karma, in fact the whole book is pretty good http://buildingreputation.com/writings/2010/02/on_karma.html
16:59sdegutisIt doesn't take into account the fact that (inc ...) returns a value but *doesn't actually mutate anything*.
16:59bbloommi6x3m: fipp does not do symbol resolution. it just prints what you give it. if it's printing qualified symbols, that's what you gave it
16:59sdegutisThe new value is literally garbage collected immediately.
16:59mi6x3mbbloom: probably because of https://github.com/brandonbloom/fipp/blob/master/src/fipp/clojure.clj#L176
17:00bbloommi6x3m: nope, that's not resolving symbols that's matching against symbols
17:00edwsdegutis: My karma was abysmal on HN, so I spent a week making anodyne b.s. comments. Result: 500+ karma.
17:00amalloysdegutis: incredibly, you are not the first person to say that
17:00bbloommi6x3m: fipp's clojure printer does not do any analysis of environments
17:00sdegutisedw: I did the same and got about 1400 karma.
17:00sdegutisedw: It's a complete joke.
17:00bbloommi6x3m: it's checking against some well known symbol names, both qualified and unqualified forms
17:00sdegutisamalloy: why is that incredible, sir/gentleman/scholar?
17:00bbloommi6x3m: it's not adding qualifiers at all
17:00mi6x3mbbloom: *duh* it's my bad, I was using syntax quote instead of quote, sorry
17:01mi6x3mbtw, fipp is really amazingly fast
17:01amalloyit's not. also, please stop saying sir/gentleman/scholar at me
17:01sdegutisIf anything it should be (inc #'sdegutis), assuming we redefined inc to have side-effects and to mutate a var.
17:01edwsdegutis: I have StackCareers recruiters call me once in a while and I try to explain how I would prefer to use their list of highly-ranked of people as a recruiting blacklist.
17:01bbloommi6x3m: and achieves that speed while being functionally pure! w00t algorithms & data structures
17:01sdegutisOr we could just do (alter sdegutis inc)
17:01sdegutisAnd assume that we're each refs.
17:02sdegutisedw: ouch
17:02sdegutisedw: but yeah HN is a terrible place
17:02amalloyedw: i can't help but feel that, if your goal is to make sure #clojure stays a welcoming and helpful community, you would make better progress saying welcoming and helpful things than by complaining about other online communities
17:02sdegutisAlso "cloture" is a real word and it derives directly from the word "closure".
17:03sdegutisSo someone should get on making a lib called Cloture.
17:03mi6x3mbbloom: absolutely :) I am very happy with the speed
17:03mi6x3mpprint was really giving me a headache
17:03sdegutisedw: ignore amalloy he's just always overly strict about staying on topic
17:03amalloyyou can't ignore me! i have 196 karma! i reign supreme!
17:03sdegutisedw: that said he's usually pretty helpful too, so take it for what grains of salt it's worth
17:04sdegutisor something
17:04sdegutis(inc amalloy)
17:04lazybot⇒ 197
17:04edwamalloy: There are many ways to make a place better.
17:04sdegutisamalloy: i gave you that one just to prove that $karma is a scam thus invalidating all the other 196
17:04amalloy*chuckle*
17:04sdegutisamalloy: the reasoning is, if one is proven illegit, none can be trusted
17:04edw(dec edw)
17:04lazybotYou can't adjust your own karma.
17:05edwDamn.
17:05{blake}The system works.
17:05bbloommi6x3m: i'm glad it's working for you!
17:05amalloy{blake}: the karma system? i don't think it's really relevant; people would continue to be helpful without it
17:06mi6x3mbbloom: yeah, I am generating small leiningen projects dynamically from some GUI examples. I'll show you soon
17:06sdegutisoh!
17:06sdegutisI forgot all about this!
17:06sdegutisI came up with a riddle! Who wants to hear it?
17:06edwI think IRC worked before karma.
17:06edwI mean, there's was this non-gamified thing called karma.
17:06mi6x3mbbloom: I would appreciate perhaps if, when printing maps, key and value are on the same line
17:06{blake}amalloy: I was channeling Homer Simpson. I thought it was funny edw was thwarted in his attempt to dec himself.
17:06amalloyah
17:07dbaschamalloy conveniently omits the rich hickey cardboard cutout rewards
17:07danneuor the rich hickey wig
17:07sdegutisWhat did the inquisitive alphabet declare aloud after inspecting the ambiguous insect?
17:07edwI'm holding out for food pellets. Will be polite for food.
17:07sdegutisNobody can guess it. Nobody.
17:08sdegutisIt's too good of a riddle!
17:08bbloommi6x3m: as far as i know, they should be
17:08sdegutisOr maybe it's a joke. I don't know the difference.
17:08{blake}sdegutis: Because seven eight nine?
17:08sdegutisclose
17:09mi6x3mbbloom: wait let me show you
17:09dbascha may bee
17:10winkI find these really hard as a non-native speaker
17:10sdegutisdbasch: what?
17:10winknot necessarily get them, but come to think of them in the first place.
17:11amalloywink: such riddles are not really made to be guessable. you're supposed to say "jeez i give up, what is it", and then the riddle presenter smugly tells you it was obvious
17:11dbaschsdegutis: a may bee is an ambiguous insect
17:11sdegutisdbasch: Ah clever. Nope.
17:11winkamalloy: I know, but sometimes you can guess them, if you're into puns.
17:11sdegutisamalloy: Well it's half riddle, half joke.
17:11dbascha jiddle
17:11sdegutiswink: Yeah we tell some pretty punny riddles around our house.
17:12amalloysdegutis: I C U R A B? those are letters that sound like words
17:12sdegutisO, I C.. U R A B!
17:12sdegutisYep :) You win!
17:12winkoh my
17:12dbaschOU812
17:12sdegutis(inc amalloy)
17:12lazybot⇒ 198
17:13winkbut reminds me of this :
17:13{blake}At 200, amalloy turns into a being of pure functionality.
17:13wink[18:18:36] (Ose) Æ e i a æ å
17:13wink[18:19:11] (Ose) ^is a correctly pronounced sentence in a certain norwegian dialect
17:13sdegutisThat's probably the only good one I ever came up with. I have another one that involves a shaggy dog riding a car, and the answer is "car-pet", but it's meh.
17:13metellusobviously you'd tell that one as a feghoot
17:14metellusthe more tortured the setup for the pun, the better
17:14amalloyas a what now?
17:14sdegutisMy son read one in a book: What's brown and sticky?
17:14sdegutisamalloy: my thoughts precisely
17:14metellusamalloy: http://en.wikipedia.org/wiki/Feghoot specific type of shaggy dog story
17:14dbaschsdegutis: a stick
17:14sdegutis(inc dbasch)
17:14lazybot⇒ 18
17:14TimMcamalloy: FEGHOOT
17:14amalloydbasch: also acceptable: a stick insect
17:15sdegutisI think he got that from a book of riddles.
17:15dbaschI feel so helpful
17:15FriedBobA TCP packet walks into a bar and says to the baretender, "I'd like a beer." The bartender says, "You'd like a beer?". The TCP Packet says "Yes, I'd like a beer." Then the bartender gives him a beer.
17:15sdegutisLOL
17:15sdegutis(inc FriedBob)
17:15lazybot⇒ 1
17:15sdegutisBut that's not so much a riddle, as just a joke.
17:15FriedBobTrue.
17:15sdegutisStill good tho.
17:15winkA horse comes into a bar. The bartender asks: Hey, why such a long face?
17:15dbaschthat’s like the UDP joke I just told
17:15amalloydbasch: i didn't get it
17:15sdegutis(inc wink)
17:15lazybot⇒ 2
17:16sdegutisOh my, it rhymes!
17:16dbaschonly amalloy got it
17:16FriedBobTwo men walk into a bar. The third one ducked.
17:16sdegutisdbasch: HA!
17:17sdegutis(inc dbasch)
17:17lazybot⇒ 19
17:17winkFriedBob: took me a few seconds. :)
17:17amalloydbasch: by the way, when someone tells you a horrible TCP joke, here is a response i have formulated. you stare at them for a while, and then announce "ACK 0"
17:17FriedBobwink: That's pretty much my favorite bar joke.
17:17danneuAn IPv6 packet walks into a bar. Nobody talks to him
17:17sdegutis(inc danneu)
17:17lazybot⇒ 2
17:17sdegutisHilarious!
17:18sdegutisOkay but these aren't riddles.
17:18amalloysdegutis: another point in their favor
17:18sdegutis(dec amalloy)
17:18lazybot⇒ 197
17:18clojurebotHuh?
17:18sdegutis!! Did clojurebot just become sentient!?
17:18sdegutisIs it finally happening??
17:18lazybotsdegutis: Definitely not.
17:19danielcomptonkarma |is| welcome to #clojure, where everything's made up and the karma doesn't matter
17:19danielcompton,karma |is| welcome to #clojure, where everything's made up and the karma doesn't matter
17:19clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: karma in this context, compiling:(NO_SOURCE_PATH:0:0)>
17:19sdegutis~karma
17:19clojurebotkarma is just another source of imaginary internet points
17:19sdegutisSounds like technomancy wrote that one.
17:19winkkarma, oooooh. didn't mean to make you cry.
17:20mi6x3mbbloom: try this http://pastebin.com/gmLX4Br3
17:20mi6x3mthe map keys/values are on separate lines here
17:21FriedBobIs 3 fingers of scotch to ~50 lines of code a reasonable ratio for a noob?
17:22dbaschFriedBob: depends on the scotch
17:22winkFriedBob: well the 2nd 50 lines will surely be different
17:22FriedBob12 year old MacCallan
17:23dbaschFriedBob: Macallan 12 goes well with perl perhaps
17:23FriedBobwink: That was total comsumption and output
17:23FriedBobdbasch: It was hat or 120 proof moonshine
17:23justin_smithFriedBob: reminds me of a joke. 26 mathematicians go to a bar. The first one orders half a drink. The second one orders 1/4 of a drink. The third one order 1/8 of a drink. Fed up, the bartender declares "come on guys, you should know your limits" and pours a beer.
17:24FriedBobI like that.
17:25amalloyjustin_smith: the number 26 there makes the joke really weird
17:25justin_smithamalloy: yeah, should have said "x mathematicians"
17:25amalloyyou kinda have to make it infinite, or one guy who wanst a half a drink, then a quarter, then an eighth...
17:26edwA lazy infinite sequence of mathematicians...
17:26winkjustin_smith: there's a better version: "an infinite number of mathematicians walk into a bar. first one says: 1 shot, second one says: 1/2 a shot, etc. the bartender pours 2 shots and says: you're all idiots"
17:26sdegutisrsi pinky emacs
17:26justin_smithamalloy: 2^(1/26) is smaller than the reliable epsilon of bartender pour
17:27justin_smithwink: but that doesn't get to the "limit" pun
17:27mi6x3mbbloom: could you reproduce it?
17:27FriedBobQA Engineer walks into a bar. Orders a beer. Orders 0 beers. Orders 999999999 beers. Orders a lizard. Orders -1 beers. Orders a sfdeljknesv.
17:27winkjustin_smith: yeah well, different punchline, but I like it better :)
17:27sdegutisFriedBob: LLOL
17:27sdegutis(inc FriedBob)
17:27lazybot⇒ 2
17:28amalloyhah, that's the first new one i've heard today
17:28edwYeah this karma thing is a brilliant idea.
17:28justin_smithamalloy: it was going around on twitter not long ago
17:28sdegutis(dec edw)
17:28lazybot⇒ 1
17:28edwsdegutis: Thank you.
17:28sdegutisedw: you were being sarcastic right?
17:28edwYes.
17:28edwWait, to which?
17:28amalloyjustin_smith: not exciting enough to make me want back on twitter
17:28FriedBobTwitter is where I got it from. https://twitter.com/sempf/status/514473420277694465
17:29sdegutisedw: s/brilliant/
17:29TimMcFriedBob: "Orders ८० beers..."
17:29edwSaracatic with the "good idea," genuine with the thanks.
17:29kenrestivoin schema is there a way to have an or? i.e. {:foo (or s/Keyword [s/Str])} ?
17:29justin_smithkenrestivo: my intuition would be to try {:foo #{s/Keyword s/Str}}
17:30sdegutisedw: +1
17:30edwsdegutis: More like it. Ephemeral.
17:30kenrestivooh cool, a set. nice.
17:30sdegutisbrb modifying the mac os x registry
17:30justin_smithkenrestivo: modulo my leaving out [] of course
17:30sdegutisedw: what? no i was just trying to say +1
17:30edwRight.
17:30nooniani think theres an s/either in schema
17:30TimMc&(.getPort (java.net.URL. "http://www.example.com:८५/&quot;))
17:30lazybot⇒ 85
17:30TimMc&(.getPort (java.net.URL. "http://www.example.com:८५/&quot;))
17:30lazybot⇒ 85
17:31TimMcerr... ah
17:31TimMc,(.getPort (java.net.URL. "http://www.example.com:८५/&quot;))
17:31clojurebot#<MalformedURLException java.net.MalformedURLException: denied>
17:31hellofunkwhy do i need to run (clojure.core/refer 'clojure.core) for some clojure.core functions to be referred (like "refer" itself) while others also in clojure.core are already referred into a new namespace
17:31justin_smithTimMc: wert
17:31edwsdegutis: Just sayin' I prefer the genuine but not instrumentally useful over the calculated.
17:31kenrestivoaha, yes, it's s/Either. i was searching for or... obviously not an easy grep to S/N
17:31nooniankenrestivo: yeah, theres an either fn in schema that takes n schemas
17:31sdegutisinc edw
17:31TimMcjustin_smith: Because why not specify ports in Devanagari numerals?
17:32justin_smithwhy not indeed
17:32TimMc...thought the original Java developers
17:32noonianEither is the record, the fn to use is either
17:33dbaschbtw, nobody should use ever use java.net.URL unless they have a good reason for it (and I’d like to hear it)
17:33winkhm, wasn't there some stuff that needs it?
17:33winktoo lazy to grep my 10 years of java code now...
17:33tbaldrid_dbasch: what would you suggest instead?
17:34dbaschtbaldrid_: URI
17:34tbaldrid_ah yeah, okay
17:34winkcos that is a pretty broad statement :P
17:34tbaldrid_I'd agree with that
17:34sdegutisNSURL improved on that
17:34justin_smithwink: comparisons on URL do dns lookup
17:34sdegutisexcept in naming.
17:35winkjustin_smith: maybe I am mixing them up.
17:35TimMc,(.getHost (java.net.URI. "http://localhost:८४४३&quot;))
17:35clojurebotnil
17:35TimMc,(.getAuthority (java.net.URI. "http://localhost:८४४३&quot;))
17:35clojurebot"localhost:८४४३"
17:35winkmaybe it was something with file:// and jars?
17:36TimMcI'm not clear on whether URI behaves ideally in that situation either.
17:36winkthis must be years aho, my memory fails me
17:36justin_smith&(= (java.net.URI. "http://www.example.com&quot;) (java.net.URI. "http://www.example.org&quot;))
17:36lazybot⇒ false
17:37justin_smith&(= (java.net.URL. "http://www.example.com&quot;) (java.net.URL. "http://www.example.org&quot;))
17:37lazybot⇒ false
17:37justin_smither... (true locally..)
17:37sdegutisOh!
17:38winkoops
17:38sdegutisI can just do (-> f meta :arglists first) to get the list of vars it takes as symbols!
17:38winkI did use it
17:38wink (:import (java.net URL URLConnection HttpURLConnection UnknownHostException)
17:38amalloyhellofunk: because if *nothing* is referred in a brand-new namespace, you won't be able to get your repl out of it, or refer anything else
17:38sdegutisThen I can use select-keys to map them to the actual args I should pass!
17:38octane--justin_smith: .com / .org intended?
17:39hellofunkamalloy so only some parts of clojure.core are referred automatically, but not all in that namespace?
17:39justin_smithoctane--: yeah, that is the point - it resolves, and sees they are the same host
17:39sdegutisThus given (fn [foo bar] ...) you can call it with {:foo 1, :bar 2} and it'll just work!
17:39TimMcjustin_smith: lazybot forbids network lookups, I think
17:39justin_smithoctane--: which is why (when you have net access) it returns true
17:39justin_smithTimMc: right, as it should :)
17:39amalloyhellofunk: right, a very small number of things are usable if you just write (in-ns 'some.new.ns)
17:39octane--justin_smith: ah, right.
17:39octane--carry on :)
17:39amalloyin-ns, probably require, i dunno
17:39sdegutisWhat is this weavejester/canon?
17:40winkdbasch: I think my reason for https://github.com/winks/battlenet/blob/master/src/battlenet/network.clj#L8-L18 was: It reads from there and afaik there is no "java.net.httpuriconnection"
17:40justin_smithamalloy: you can still use fully qualified names
17:40winkdbasch: but I'd love to hear why it's bad there and how to improve :)
17:40justin_smithamalloy: https://www.refheap.com/93657
17:41dbaschwink: why do you use 0 and 1 for return values?
17:42winkdbasch: come to think of it, probably because it was my first clojure project ever? :)
17:42wink1 is truthy enough!
17:42hellofunkamalloy if i have added a dependency for core.log in project.clj then opened a lein repl on that, shouldn't I be able to refer or use 'clojure.core.logic at that point with no problems?
17:42amalloyit's a C library, just made to look like clojure via clever cpp macros
17:42dbaschwink: you don’t need an if there
17:44justin_smithdbasch: what if you connected, but it returned with a 500?
17:44{blake}wink: 0 is truthy, too, tho'.
17:44justin_smith,(if 0 :yes :no)
17:44clojurebot:yes
17:45dbaschjustin_smith: I mean, that statement is the same as (= 200 …)
17:45kai3x5did anyone here learn clojure as a first language ?
17:45justin_smithdbasch: if 0 were false it would be
17:45dbaschjustin_smith: that’s my point, he didn’t need to make it 0 or 1
17:45winkdbasch: {blake}: I do check (= 1 in the test
17:45winkbut please ignore my 2y old bad code.
17:45dbaschespecially because the test checks 1 only
17:46winkand focus on HTTPURLConnection :)
17:46justin_smithdbasch: ahh, I misunderstood you
17:46dmitrygusevwink: btw, you have two same (defn read-remote-perks methods declared there
17:47winkdmitrygusev: hehe thanks.
17:48hellofunkamalloy ah nevermind -- sometimes a repl restart seems necessary to get dependencies working on a new project (even if the repl was started after those dependencies were listed and saved in project.clj)
17:48amalloyhellofunk: not sometimes, always
17:48technomancyno, if the repl was started after they were added to project.clj you don't have to restart
17:49technomancymodulo AOT/defrecord nonsense
17:49hellofunkamalloy - no i mean, you list some dependencies in a new project's project.clj file, *then* you start cider, and sometimes those dependencies are still not working.
17:49sdegutisWhat's an amazing way to get [1 2] given {:a 1, :b 2} and [:a :b] ?
17:49amalloyoh, i see, i misread
17:49amalloysdegutis: map
17:49amalloy,(map {:a 1 :b 2} [:a :b])
17:49clojurebot(1 2)
17:49justin_smith,((juxt :a :b) {:a 0 :b 1})
17:49clojurebot[0 1]
17:50sdegutisOh!
17:50sdegutisamalloy: I have to consider how/why this even works.
17:50justin_smith,((apply juxt [:a :b]) {:a 0 :b 1}) ; if it has to be a vector
17:50clojurebot[0 1]
17:50technomancyhellofunk: I've never seen that happen; please open a bug report if you can confirm it
17:50justin_smithsdegutis: but if it has to be a vector, map is actually better
17:51sdegutisamalloy: Ah, clever, you're using the hash-map as a function on each key!
17:51sdegutisThat's... clever.
17:51amalloy_well, it's hardly an original invention of mine
17:52TimMctechnomancy: Thanks.
17:53justin_smith&(let [a [1 2 1 2 3] b [4 3 4 2 4 1 0]] [(map a b) (map b a)])
17:53lazybot⇒ [(3 2 3 1 3 2 1) (3 4 3 4 2)]
17:53sdegutishttps://gist.github.com/sdegutis/b376cf100e337941d826
17:53sdegutisGo ahead, swap testfn's params... I are you.
17:53sdegutis*dare
17:54sdegutisIt's hideously unforgiving to typos though.
17:54sdegutisAnd it only allows one arity, although in this use-case that's fine.
17:55justin_smithsdegutis: that is certainly clever
17:55sdegutisjustin_smith: Oh right, now that I think about it, this could be a solution to the question I was asking earlier!
17:56justin_smithsdegutis: for extra credit, you could search for the arglist with matching arg count
17:56sdegutisI'm very sleepy, sorry, it's easy to completely forget all context.
17:56sdegutisjustin_smith: Ahh, clever!
17:56hellofunksdegutis check out 4clojure.com if you want to learn lots of other "clever" tricks (which you also have amalloy to thank for that site)
17:56dbaschwink: btw, you check if a url is readable by reading it? :)
17:57sdegutishellofunk: thx
17:57sdegutishellofunk: that site sounds familiar, I wonder...
17:57winkdbasch: well the comment is useless, I agree
17:59winknaming is off, but to be fair, together with read-url it still makes sense
17:59winkhaven't run or even touched the code for 2 years it seems.
18:01sdegutisSo I looked up "rapid" in the thesaurus in hopes of coming up with a name for my web framework (which encourages rapid development) and one synonym is "pretty damn quick"
18:01justin_smithwink: welcome to #clojure, where you *will* get your incomplete, short attention span code review, whether you like it or not
18:01sdegutisIt rolls off the tongue, but I can't think of where to put a "j" in it to make it into a library name.
18:01justin_smithsdegutis: pdq
18:01sdegutisjustin_smith: pdjq
18:01winkjustin_smith: I wouldn't mind if my quesion would've been answered ;)
18:01sdegutistoo hard to type
18:02{blake}sdegutis: jdq - just damn quick
18:02sdegutiscljdq
18:02technomancypdq4j
18:02dbaschwink: in that particular case there’s nothing wrong with using a url, although you don’t need that function really
18:03sdegutistechnomancy: nooooooooooooooo.com
18:04dbaschforjay4j
18:06sdegutis(inc dbasch)
18:06lazybot⇒ 20
18:08sdegutisweb-frajmework ?
18:09sdegutisam i doing this rite
18:09justin_smiththe-endless-font-of-enterprise-ready-webapps
18:13noonianis the no button supposed to do anything?
18:13sdegutishttps://github.com/sdegutis/clover
18:13sdegutisnoonian: turn your volume up a little
18:14nooniansdegutis: ah, thanks
18:18tpopeso I am seeing vast differences in memory usage between os x and linux and wondering what the hell to do about that
18:18tpopelike even a bare, projectless lein repl is taking 100mb on os x and 400mb+ on linux
18:18danielcomptontpope: same JVM?
18:19justin_smithtpope: what are you using to show mem usage? some linux tools are not fully accurate to what you would expect
18:19nooniantpope: yeah, are you using openjdk on linux and oracle on macos?
18:19technomancy64-bit vs 32-bit could do it too
18:20technomancy32-bit defaults to a really low Xmx
18:20tpopeRES from top
18:20technomancyyeah also http://www.linuxatemyram.com/
18:20tpopetechnomancy: I started down this path when my newly deployed app maxed out a heroku dyno. then maxed out a 2x dyno
18:21technomancytpope: did you have an -Xmx value?
18:21tpopeit's openjdk indeed
18:21tpopetechnomancy: no, should I?
18:21technomancytpope: you should get it out of the box, but if you change your procfile you could lose it
18:22tpopeno procfile currently
18:22technomancyhm; then it should get it from $JVM_OPTS
18:22technomancyis that set?
18:22tpopetechnomancy: yeah -Xmx400m -Dfile.encoding=UTF-8
18:23technomancytpope: does heroku ps show that config value being referenced?
18:24tpopetechnomancy: no
18:25tpope=== web (2X): `lein with-profile production trampoline run` web.1: up 2014/11/19 15:30:58 (~ 2h ago)
18:25technomancyoh, lein should pick it up though
18:25tpopeyeah I would assume
18:25technomancycan you log out your max memory on boot?
18:26tpopehow do get that information
18:29tpopefwiw that JVM_OPTS shows up in heroku run bash but it's not in my config proper
18:31sdegutisThis is part of my idea: https://github.com/sdegutis/clover
18:34tpope(.maxMemory (Runtime/getRuntime)) seems to do the trick. I'll deploy and check
18:37sdegutisjustin_smith: this is the monstrosity you unwittingly helped me to begin building
18:40winkok, code review comments applied. thanks all :P
18:41TEttingersdegutis, nice, Copyright © 2014 FIXME
18:41sdegutis:)
18:41winkTEttinger: copyright of champions
18:41sdegutisTEttinger: afaik only slip up :D
18:43tpopetechnomancy: 401997824, which seems right?
18:43sdegutisTEttinger: Fixed.
18:43technomancytpope: yeah. that only affects the heap though.
18:44technomancyyou can still have memory consumed by buffers and native code
18:44winkit's "abusing #clojure for it's native speakers' density" time again - do you always say "to give a talk/lecture" in English? "hold a talk/lecture" sounds wrong, but Google has a lot of hits
18:44dbaschif I start a company called FIXME I can claim ownership of most Clojure projects from now on
18:44technomancyhttps://devcenter.heroku.com/articles/java-memory-issues
18:45winkdbasch: I'm not sure even American copyright law works that way :P
18:45nullptrdbasch: i'm from TODO Inc, your takedown notice is in the mail!
18:45dbaschnullptr: sorry, XXX TODO called first
18:45nullptrbah, foiled again
18:46winkmy publicly traded company "DOMAIN INC" will sue you.
18:46tpopetechnomancy: ehhhh that's a lot of buffers and native code
18:47sdegutiswink: I say give
18:47sdegutisSo, anyone want to offer feedbacks on my web framework idea?
18:48sdegutisOh nice, ##:404 is legit.
18:48justin_smithwink: "give a talk" is more common, but "hold a talk" is valid, and is for when you are referring to the ones hosting, not the speaker being hosted
18:48sdegutis,:404
18:48clojurebot:404
18:48winkjustin_smith: sdegutis: thanks
18:49sdegutis,(= :404 (keyword "404"))
18:49clojurebottrue
18:49justin_smith,(= :404 (keyword 404))
18:49clojurebotfalse
18:50wink(= :404 (keyword "404"))
18:50winkRuntimeException EOF while reading
18:50winkI should go to bed I think.
18:50justin_smithwink: smartquotes?
18:50winklein repl.
18:50noonian,(= :404 (keyword "404"))
18:50clojurebottrue
18:51wink (= (keyword "404") :404)
18:51winktrue
18:51winkok, THAT Is weird now :)
18:52amalloy_a keyword whose contituent characters are all numbers is rarely a great thing to have
18:53justin_smithamalloy: but it means you don't have to use "get", which is of course worth it
18:54wink,(keyword ",")
18:54clojurebot:,
18:54winkyou think?
18:54justin_smithwink: ##(keyword "In the course of human events...")
18:54lazybot⇒ :In the course of human events...
18:54sdegutisI wrote down some goals: https://github.com/sdegutis/clover#goals
18:55winkjustin_smith: yeah, reminds me of http://search.cpan.org/dist/Lingua-Shakespeare/lib/Lingua/Shakespeare.pod
18:55winkanyway, gnight
18:55justin_smithnigth
18:58{blake}Input validation on web forms. I'm using Bootstrap, so it looks like I'm going to have to shoehorn some stuff into JQuery's $(document).ready(). Advice? Should I just shove it in there with Hiccup?
19:14sdegutisNoted.
19:14sdegutisThanks for the feedback.
19:24technomancyconj attendees: your mission is to beat rubyconf https://twitter.com/rubyconf/status/535219643431268352
19:25godd2Maybe that's just how much they made and they didn't notice cause they thought the garbage would just collect the excess
19:27justin_smithtechnomancy: if I ran the brainfuck twitter, I would just do a s/coffe/glue and post the same tweet
19:27justin_smith*coffee
19:28justin_smithwell, maybe s/drank/huffed, but I would leave the "and tea"
19:29godd2huffing tea doesn't sound like a good idea
19:29justin_smithnot at all, no
19:29justin_smithhuffing * dousn't sound like a good idea
19:37TimMcjustin_smith: swearjureconf
19:37TimMc4 buckets of lead paint chips consumed
19:38godd2goto conf wins best name though. the propoganda is right in the name!
19:38justin_smith(inc TimMc)
19:38lazybot⇒ 83
19:44TEttingergodd2: a conference on spaghetti code? count me in
19:45justin_smithI wonder if anyone has ever prepared "refactored spaghetti"
19:45TEttingerLua 5.2 and LuaJIT added goto and labels to the language features so that they make more valid compiler/translator targets, which is relevant because luajit performs so well
19:45justin_smithit would be spaghetti, but you straighten each noodle into a line, in parallel, before serving
19:46TEttingerjustin_smith, I am sure an avant garde restaurant has tried it
19:46justin_smithTEttinger: if java had proper goto, we would have tail recursion, and maybe even first class continuations too
19:46TEttingerjava does have labels
19:46TEttingerbut that's for named break
19:47justin_smithTEttinger: and the bytecode has goto, but it is only allowed method scope
19:47BronsaI didn't know about named breaks
19:48BronsaTIL
19:49TimMcWhere would you like to break to today?
19:51TEttingerhttp://stackoverflow.com/a/886979
19:51TEttingerI'm not even sure what the right name for this is
19:51TEttingerlabeled break?
19:53bja_random project for a rainy day: lisp that outputs java source compiling everything to labeled while/breaks
19:55TEttingerbja_: all in one method, keep in mind the method length limit
19:56bja_tbh, didn't know that java had a method length limit
19:56TEttingerI've hit it with auto-generated stuff before, at least the statement length limit
19:56bja_64k
19:56bja_hmm
19:57bja_hmm, SO suggests that the JIT won't touch methods over 8k in side
19:57TEttingerthis is too large https://dl.dropboxusercontent.com/u/11914692/weapons-map-too-large.clj
19:58TEttingerthat tries to get loaded as one statement by clojure, I think, since it's all one literal
19:59bja_meh, 64k code should be enough for anyone!
19:59bja_(at least anyone writing toy preprocessors)
20:05bja_hmm, I guess the bug for the 64k method size limit isn't available anymore? http://bugs.sun.com/view_bug.do?bug_id=4262078
20:21sdegutisOkay I've commented some of my hypothetical API: https://github.com/sdegutis/clover
20:35TimMcbja_: A victim of the oraclopalypse, perhaps.
20:36TimMcthe sound of a thousand thousand links breaking
20:41wsmoakbja_: here, the wayback machine has it http://web.archive.org/web/20110817141114/http://bugs.sun.com/view_bug.do?bug_id=4262078
20:42TimMcIt's gone now; a search for the sample phrase "generating scientific code, not JSPs" turns up nothing.
20:42TimMcSometimes Oracle is such an unprofessional outfit.
20:45akkadis openjdk not advised over the Oracle jre?
20:46sdegutisWhat's a good license to make a new open source Clojure library?
20:47TimMcakkad: I think it's basically the same thing as of 7.
20:48TimMcsdegutis: EPL, same as Clojure.
20:48TimMcsdegutis: Although given your proclivities, might I suggest the WTFPL?
20:49sdegutisTimMc: I still don't understand what you mean.
20:50TimMcIt seems like a thing you might roll towards.
20:50TimMcApparently. I'd never looked up the etymology before.
20:51TimMcsdegutis: http://wtfpl.org/
20:53TimMctechnomancy: In case you haven't seen it already: http://imgur.com/gallery/HfqUF1v
20:59sdegutisuhh
21:16tuftis there a negated version of "when"? i.e. "unless"?
21:17justin_smithwhen-not
21:17justin_smiththough I would prefer unless
21:17tuftnice thanks
21:19sdegutisjustin_smith: (defmacro unless [& body] `(if-not ~@body))
21:21sdegutis(intern 'clojure.core #'unless)
21:22justin_smiththat's not how intern works
21:23sdegutisSomething like that
21:23sdegutisAnyway, https://github.com/sdegutis/slim-cljm
21:23justin_smithsdegutis: (intern 'clojure.core 'unless @#'unless)
21:23sdegutisRight!
21:23sdegutisjustin_smith: Excellent.
21:24justin_smithI can figure out how to do it, but that doesn't make it a good idea
21:29arrdemah it's just another var in core what's the worst that could happen
21:31amalloyjustin_smith: that shouldn't actually work, for a macro
21:50justin_smithamalloy: I'm happy to hear that
22:30sdegutisI'm going to port http://slim-lang.com/ to Clojure.
22:30sdegutisIs that unreasonable?
22:40TimMc"Automatic HTML escaping by default" -- yay!
22:45sdegutisTimMc: Can't tell if serious.
23:08gfrederi`I'll bet he's serious
23:38TimMcSerious.
23:38TimMcgfrederi`: Hey, I like your haircut.
23:39TimMcVery butch.