#clojure logs

2013-03-23

00:09eggheadholy cow technomancy this looks amazing
00:15technomancyheh; thanks
00:33nonubytechnomacy, minor suggestion, click to enlarge pics to hover to enlarge pics, I cant make out whats going on
00:41technomancythanks, but the point isn't really what's in the pictures; it's that they're the same on both screens
00:49nonubyokay found the 'About'
00:53seangrovetechnomancy: Definitely looks slick!
00:58technomancyyeah, kinda looking for more ways to make it obvious
06:07borkdudehyPiRion ivaraasen nice, I see gnuplot works okay with org-babel
08:27Glenjaminis there a better way of turning a vector into a map of key => nil than this?
08:27Glenjamin&(reduce #(assoc %1 %2 nil) {} [1 2 3])
08:27lazybot⇒ {3 nil, 2 nil, 1 nil}
08:30ejackson&(zipmap [1 2 3] (repeat nil))
08:30lazybot⇒ {3 nil, 2 nil, 1 nil}
08:30Glenjaminah, much nicers
08:30Glenjaminthanks
08:30ejacksonplsr
09:37maiois there some way to check if there are new versions my project's dependencies?
09:38hyPiRion$latest leiningen-core
09:38lazybot[leiningen-core "2.1.1"] -- https://clojars.org/leiningen-core
09:39hyPiRionNot sure if there's a way to do that with Leiningen though, perhaps check out the plugins page?
09:40maiohyPiRion: thanks :) lein-outdated List newer available versions of dependencies
09:42hyPiRionYou're welcome
12:19TimMcmuhoo: OK, cool.
12:25racycleI have a very basic question: I don't understand this clojure idiom: (def my-fun (fn [] (println "test") :done)), i don't understand how :done works ?
12:28p_lit works by returning itself?
12:28p_l,(fn [] (println "test") :done)
12:28clojurebot#<sandbox$eval35$fn__36 sandbox$eval35$fn__36@188dff6>
12:29p_lit gives you a function, as visible above
12:29p_l,:done
12:29clojurebot:done
12:29p_land as you see, :done returns itself
12:30racycleby returning itself ? that's interesting
12:30p_lracycle: self-evaluating element, in this case keyword symbol
12:30p_lbasically, whatever is the "last" is the return value of the function in lisps
12:30p_lyou could have any other literal there to return said literal, too
12:31racyclei see, so is (fn [] (println "test") a hash map that :done is the key for ? am i too far off
12:32p_ltoo far off
12:32racycleoh, the whole thing is a list
12:32racycleand the last element is returned. ok
12:32p_lit's a function defined in weird way
12:33p_lfn creates anonymous function, iirc, def will bind it to symbol my-fun
12:34p_lI don't usually use clojure, using CL instead, but the CL equivalent would be (setf (symbol-function 'my-fun) (lambda () (print "test") :done)), or so it seems to me
12:34racycleok, that helps. I'll try to wrap my head around this construct a little
12:35racyclei find these a little confusing about Clojure compared to scheme/Racket
12:35racyclethanks again
12:36p_lin scheme...
12:36p_lthat would have been (define my-fun (lambda () (print "test") :done)) ; Something like that?
12:41racyclei don't recall exactly, but the :done is not very familiar to me.
12:41borkduderacycle :done is just a value
12:41borkduderacycle not some special language construct
12:42borkdude,:foo
12:42clojurebot:foo
12:42borkdude,:done
12:42clojurebot:done
12:42racycleyou're right, for some reason, i'm always thinking that it's a key for some map etc..
12:42borkdudeyogthos I see you're writing a book, cool http://yogthos.net/blog/42?utm_source=dlvr.it&amp;utm_medium=twitter
12:43borkduderacycle you can use any value as a key in a map, but keywords are most common
12:43borkdude,{nil 1, "foo" 2, :done 3}
12:43clojurebot{nil 1, "foo" 2, :done 3}
12:43jtoy_so if i want to add testing code to clojure, is midje the way to go?
12:44racycleok thanks
12:45ravsterhey all
12:53ravsterhow do I get a number from a string (Egs. 123.456) that does not necessarily have the ".456" part?
12:55arrdemravster: well depends on the type of number you think you're trying to read.
12:55bbloom,(Double/parseDouble "123.456")
12:55clojurebot123.456
12:55bbloom,(int (Double/parseDouble "123.456"))
12:55clojurebot123
12:56arrdembbloom beat me to i
12:56arrdem*it
12:56arrdemone could also &(read-string "123.456")
12:57arrdemin which case you will get Integer, Long or Double as the Clojure reader sees fit
12:57bbloomarrdem: i didn't suggest that b/c when parsing numbers like this, it tends to be from config files & the like, which read-string isn't secure enough for :-P
12:57bbloombut i guess now we have clojure.edn/read-string
12:57arrdembbloom: where did I say it was a good idea XP
12:58ravsterarrdem: I'm hopingto get routing in a compojure route with a number in it. The problem is that I can't just do :latitude since compojure splits on '/' and '.'
12:59arrdemravster: can't you just require that a client urlencode those characters?
12:59arrdem. and / should both be taken care of by that..
12:59xumingmingvRaynes: I'am planning to host a chinese version of http://tryclj.com, is that OK?
13:00ravsterarrdem: huh. didn't think of that option. Good idea. thanks.
13:02ravsteraarrghh . '.' is an unreserved character
13:03ravsteroh nvm. I don't know what I'm talking about.
13:03arrdemlulz
13:04arrdem$version
13:04arrdem$source
13:04lazybotSource not found.
13:05arrdem!source
13:05ravsternow I need to figure out how compojure does urlencoding.
13:06arrdemravster: I believe that it splits as you were saying, then un-urlencodes the split substrings
13:06hyPiRionwhat are you trying to do arrdem?
13:06hyPiRion,*clojure-version* ;?
13:06clojurebot{:major 1, :minor 5, :incremental 0, :qualifier "RC6"}
13:06hyPiRion$google clojurebot
13:06lazybot[hiredman/clojurebot · GitHub] https://github.com/hiredman/clojurebot
13:06arrdemhyPiRion: just trying to figure out which clojurebot github repo I need to be patching for thanks messages
13:07hyPiRionah
13:07arrdemlooks like hiredman's is the only active one tho
13:07hyPiRionyeah, that's the one
13:13ryankaskhi. i'm trying to set up a test fixture that wraps the test function in a jdbc transaction and rolls it back after executing the test function. how can I do the roll back without raising an exception? the exception causes the tests not to run
13:20llambdahi all, i have a question about sharing functions between namespaces...is it all right to ask here?
13:20tgoossensI need some help
13:20tgoossens*
13:20rodnaph_does anyone have any experience with storage/query for n-dimensional datasets? (not exactly clojure related i know but i couldn't think of another place to ask!)
13:20tgoossens(sorry accidently hit enter :))
13:20arrdem!anyone
13:21hyPiRion~anyone
13:21clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
13:21arrdem(inc hyPiRion)
13:21lazybot⇒ 13
13:21squidzdoes anybody know how I can pass my sequence of nodes created by enfocus has html to my compojure routes?
13:21tgoossensi need some help with a presentation on "why clojure". http://lanyrd.com/2013/belgiumclj/scdtkk/
13:21arrdemllambda: this is #clojure so I'd hope that clojure questions are welcome..
13:22tgoossensAny tips advice on what i should tell
13:22tgoossensin what order, how detailed
13:22llambdaarrdem: :)
13:22llambdai would like to share a set of functions between two separate namespaces. i'm having trouble articulating exactly what i'm trying to do i think, so i put together a simple gist: https://gist.github.com/maxcountryman/5228259
13:22tgoossensits not a talk about "why you should use clojure"
13:22tgoossensbut rather a "why it was created"
13:23tgoossensi need some starting point :p
13:23rodnaph_squidz: i assume u just want to post the data, right? u can just .innerHTML of the topmost node maybe?
13:23arrdemtgoossens: start whith why java sucks and go from there..?
13:23arrdemor start with Lisp's awesome and sprinkle Java libraries on top?
13:24llambdabasically what i want is to require the namespace where the functions are defined, in that example, baz.clj, and then have these functions be accessible in foo.clj when foo is required in a program, like: (require '[testing.foo :as foo]) ... => (foo/qux "test")
13:24tgoossensarrdem: no :p
13:24tgoossensi was going to start with
13:24tgoossens"complexity
13:24arrdemllambda: yeah hang on there's a toolkit for this
13:24tgoossensfrom my perspective
13:24llambdathanks arrdem :)
13:24tgoossensalmost all decisions in clojure are made based on "complexity"
13:24arrdemAHAH I remember what codebase it was in..
13:25llambdai'm surprised this isn't a more common issue, so maybe i'm approaching DRY the wrong way here?
13:25arrdemllambda: https://github.com/ztellman/potemkin
13:25arrdemgimme karma XP
13:26squidzrodnaph_: okay, but im not sure how I can combine clojurescript with the normal clojure in my compojure code
13:26rodnaph_i think you've lost me sorry squidz... clojurescript is in the browser, and clojure on the server, right?
13:27squidzrodnaph_: yes correct
13:27SegFaultAXYou guys should watch "Whence Complexity?" by Michael Nygard from Conj 2012. It has absolutely nothing to do with Clojure but it's fantastically interesting.
13:27rodnaph_so u need to pass some data (some HTML by the sounds of it) from the client to the server?
13:27squidzand my i'm trying to figure out how I can use clojurescript to render different html pages when all the javascript is thrown into one file
13:27llambdaarrdem: so there's no way to do this in vanilla clojure? i'll need to pull in this library it seems like?
13:28arrdemllambda: I don't know enough about how Clojure handles namespaces to really answer that question.. some code in clojure.core actually calls the "load" fuction to eval other code in the current namespace, but that seems to be a really shitty idea
13:28llambdayeah heh
13:28squidzrodnaph_: yeah I just dont know how to make multiple pages with clojurescript
13:29llambdai was going to try load but that seems like a hack
13:29arrdemllambda: yeah that's my sense too
13:29llambdain python this would "just work" as it were
13:29squidzrodnaph_: do you know what I mean?
13:29llambdaso my expectations might be off
13:29arrdemyou sure about that?
13:29llambdai may be doing it wrong
13:29arrdemI don't think you can pull that shit in Python
13:29rodnaph_i think i do yes. enfocus seems to allow you to specify templates via remote data sources.
13:30llambdaarrdem: if you import a module, it's accessible from that module, yeah
13:30llambdai mean, from the module you import it into
13:30llambdaso if a library imports some other library, then you can access that other library from the first library directly
13:31arrdemokay sure... but if you have (in-ns a (import b)), (in-ns c (import b) (b/cc/foo))
13:31rodnaph_so you can (deftemplate some-tpl "templates/file.html" [] etc...) and the HTML will just get served from your app/server
13:31rodnaph_i've not actually used this though, just looking at the docs.
13:31rodnaph_so apologies if you've already been over this.
13:32llambdaarrdem: i'm not sure how that translates to python
13:32arrdemllambda: it isn't valid clojure, but it's the same example you gave with different names.
13:32squidzrodnaph_: no, Im also not very sure. So ill try to make the html available on a route and see if it renders with enlive
13:33arrdemhyPiRion: thoughs here? how to refer symbols from required namespace into the current namespaces such that they are accessible by any user of the current namespace
13:34rodnaph_squidz: it'll be easier to make the HTML available via a static resource (compojure.route.source "/templates")
13:34llambdaarrdem: i think something like this in python would work --> https://gist.github.com/maxcountryman/5228620
13:34rodnaph_s/source/resources/
13:34stuartsierraarrdem: Clojure does not support this directly.
13:34arrdemstuartsierra: that's what I suspected
13:34arrdemstuartsierra: but you should be able to hack it..
13:34llambdahm so what's the idiomatic way of sharing functions like this?
13:34stuartsierraYou can write a function that calls `refer` to get the symbols you want, and call that at the top of the namespace that needs them.
13:35squidzrodnaph_: yeah I have them available, I just havent tried it yet
13:35llambdais that considered a hack?
13:35arrdemstuartsierra, llambda hang on here I have a macro idea
13:35stuartsierrallambda: I do not consider calling `refer` to be a hack. Any other approach, such as re-def'ing vars in the target namespace, IS a hack.
13:36llambdayeah i do not want to re-def
13:36llambdathat just looks ugly and seems unnecessary
13:36arrdemllambda: well that's the best you're gonna get
13:36arrdemand that's what Python is doing under the covers I suspect
13:36stuartsierraNamespaces are not "modules" in the Python sense. They're flat.
13:37borkdudehmm, some code that used to work in clojure 1.4 now gives me an clojure.lang.Numbers.throwIntOverflow - is this a known thing?
13:39TimMcmuhoo: Should the return type be last?
13:39borkdudeI didn't say anything (same result in 1.3, 1.4)
13:40TimMcmuhoo: e.g. "pub st toOctalString : long -> String"
13:41llambdastuartsierra: what would that refer function look like for the simple example i posted?
13:41arrdemllambda: almost have one working hang on
13:41clojurebotexcusez-moi
13:41stuartsierrallambda: Just define a function that calls `refer`.
13:42llambdai think i did that
13:42stuartsierraThen call it.
13:42llambdabut it doesn't seem to expose the vars like i'm expecting
13:42llambda(foo/qux) doesn't work
13:43borkdude(using +' instead of + worked)
13:46stuartsierrallambda: If you want prefixed symbols then use `alias` instead of `refer`.
13:46stuartsierraBut really, all this is just making extra work for yourself.
13:47stuartsierraJust `:require` the other namespace where you want to use it.
13:47llambda:require what exactly? i want to :require foo and then have access to everything foo in turns require, ideally
13:48stuartsierraYou can't have that. :)
13:48llambda:(
13:48danlarkinnot only can't you have it, you don't actually want that
13:48llambdai want to share a common set of functions
13:48llambdaas if they were written twice
13:48llambdawithout writing them twice
13:48stuartsierraWhy?
13:48clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
13:48llambdathis seems like DRY 101 :)
13:48danlarkinso put them in myproject.utils?
13:48llambdabecause the functions are identical
13:49tgoossensdoes someone know a lisp that is OO?
13:49llambdabut they're needed in two separate namesapces
13:49danlarkinso require myproject.utils from two namespaces
13:49arrdem(inc danlarkin)
13:49lazybot⇒ 1
13:49llambdaokay but then they aren't exposed for programs requiring myproject.foo
13:50stuartsierraThat's a feature. :)
13:50arrdemyeah so?
13:50arrdemmake someone else require foo.util too
13:50arrdemnbd
13:50danlarkinthis is literally the purpose of namespaces
13:50danlarkin... to namespace functions
13:50llambdathat's not ideal for how i've written this api...
13:50jtoy_can anyine tell me why this error wouldnt be caught? https://www.refheap.com/paste/12864
13:50jtoy_im sure its something simple, but i dont see what im missing
13:50llambdai'd like to have client-a and client-b and then have the caller use them like this: (client-a/post ...)
13:51llambda(cleint-b/post ...)
13:51jtoy_do i need to do something special with java exceptions? as opposed to clojure exceptions?
13:51arrdemjtoy_: no
13:52jtoy_am i doing something wrong?
13:52llambdathe client-a and client-b namespaces define a function "request" that differs, but the wrappers for that function, get, post, ... are identical
13:53tgoossensin the clojure rationale, what is meant with "heterogeneous collections" ?
13:53arrdemjtoy_: weird.. you seem to be doing it right
13:53headshottgoossens: contains different things
13:53tgoossensok
13:54tgoossensthanks
13:54tgoossensin contrast with List<Type> then
13:54stuartsierrajtoy_: Try catching Throwable instead of Exception.
13:54headshotyes
13:54tgoossensgreat thanks :)
13:55jtoy_weird, that doesnt work either
13:58jtoy_that was ther error, Throwable, never heard of this before
13:58yogthosborkdude: yeah pretty excited about that :)
13:59danlarkinjtoy_: it means you're getting an Error, not an Exception
14:00yogthosdanlarkin: hey so looks like html escaping is in? :)
14:00jtoy_uh, ok
14:00yogthosdanlarkin: as a feature I mean :)
14:00danlarkinyogthos: I'm working on it yeah
14:00yogthosdanlarkin: awesome! :)
14:00yogthosdanlarkin: sorry my version was halfassed :)
14:01yogthosdanlarkin: I think using maps instead of strings will definitely be nice though, that way you can pass around all kinds of metadata
14:01jtoy_must be a java thing?
14:02arrdemjtoy_: in the worst case I suppose you could catch Object XP
14:02danlarkinjtoy_: http://stackoverflow.com/questions/912334/differences-betweeen-exception-and-error
14:02Glenjaminllambda: in myproject.utils, define a macro that creates the get/post/etc
14:02Glenjaminand then call that macro in client-a and client-b
14:03Glenjaminor juggle it around so its (app/post client-a …)
14:04jtoy_will Throwable also catch Exception?
14:04gfredericksyes
14:04gfredericksbecause Exception implements Throwable
14:04danlarkinjtoy_: yes, but you almost certainly shouldn't be catching Throwable
14:04danlarkinsomething is probably going wrong somewhere
14:04bbloom,(instance? Throwable (Exception.))
14:04danlarkinjson parsing shouldn't throw an Error
14:04clojurebottrue
14:04jtoy_i just want to print out my message and rethrow it
14:05llambdaGlenjamin: first option sounds pretty good :)
14:05Glenjaminmm, thats probably how i'd do it
14:06arrdemllambda: https://www.refheap.com/paste/12865 challenge completed. should work but not general and it's the redef hack.
14:06gfredericksoh throwable is a class
14:13TimMcmuhoo: I'll do some doc work (changelog, etc.) and I can get a release out today, I think.
14:14TimMcSigned, too!
14:14dsabaninhi guys
14:14dsabaninhow do I import leningen 2 project into eclipse?
14:14dsabaninsince lein-eclipse is deprecated, what's the official way?
14:15llambdaarrdem: thanks, i'll play around with this
14:18arrdemllambda: seriously tho, please rethink your API rather than use that piece of garbage. I think that Glenjamin's #2 where he proposed that clien1 and client2 be configurations for a more general client is much more elegant than anything you could get with that hack.
14:18arrdemthat said your code not mine.
14:18xeqidsabanin: there might be something in https://code.google.com/p/counterclockwise/ that could help
14:19Glenjamin(using client1 (api/get …) (api/post …)) might be a decent approach too
14:24llambdabecause i'm wrapping clj-http it'd be nice to retain the client/get client/post api
15:04Raynesarrdem: https://www.refheap.com/paste/12865
15:04RaynesIs this some kind of alias thing?
15:04RaynesThis is horrifying.
15:06gfredericksRaynes: do you periodically check /pastes just in case something is horrifying?
15:06RaynesYes.
15:07gfredericksnow I see why you made refheap
15:08arrdemlol
15:08arrdemyes it's horifying
15:08arrdemllambda didn't seem to understand that
15:13arrdemRaynes: I told llambda to use potemkin but apparently libraries are hard.
15:14bbloomthis python __all__ style topic seems to come up regularly :-P
15:14RaynesUgh, potemkin.
15:14arrdemRaynes: although now that I'm reading it potemkin does this more metadata
15:14callenbotdanlarkin: I love you.
15:15bbloomgenerally, i've managed to talk myself out of a lot of bad ideas that i've gotten stuck into my brain from past languages, but i regularly find myself wanting to decompose namespaces while preserving usage interfaces
15:15jtoy_if i have a method that just reads a file and returns its content, how should I define it in terms of with def/defonce,? I use def now and when I use load it takes too long because it seems to laod the file, i want the file loading to only happen once when the method is called
15:15jtoy_is there a way to achieve this?
15:15bbloomjtoy_: try a delay
15:16bbloom,@(delay 5)
15:16clojurebot5
15:16llambdai think i'm just going to rewrite this so there's a single "client" namespace defining these functions which you then pass a service into, like Glenjamin's suggestion
15:17llambdait means you'll have to require two namespaces, at least, but maybe that's not terrible
15:17jtoy_bbloom: ok, ill try that,is the file supposed to be read though?
15:17jtoy_in the first place i mean?
15:18bbloomjtoy_: i'm not 100% sure what you're saying you're doing, but it sounds fishy to me :-P
15:18bbloomjtoy_: generally, you should avoid doing heavy duty work on startup or file load
15:18clojurebotprofiles in clj-http is https://gist.github.com/1846759 an example of the profiles feature in Leiningen 2
15:18arrdemllambda: ^
15:18bbloomjtoy_: instead, parameterize with arguments & make loading of config files etc explicit during setup
15:19jtoy_bbloom: i have a bunch of these kinds of definitions: https://www.refheap.com/paste/12869 my code is much slower with these definitions in code
15:19bbloomjtoy_: quick fix: wrap the with-open call in a delay call
15:19bbloomjtoy_: then add @ at each reference
15:19llambdai'm not sure what you're pointing to, arrdem :)
15:19bbloomjtoy_: but better yet: stop doing this :-P
15:20bbloomjtoy_: make that into a load-males function & then use explicit arguments where males is needed
15:20jtoy_bbloom: ok, what is the better way to do this? I have tons of files I need to read in to build my models
15:20bbloomjtoy_: you can aggregate all these files into a map
15:21bbloom(defn thing-that-uses-lots-of-files [file-map] ...)
15:21bbloomand file-map can be {:males [...] :females [...]} etc
15:22jtoy_bbloom: ok, im going to test this
15:26arrdemllambda: clojurebot's clj-http profiles comment
15:27llambdawhat about it?
15:29whilocemeric__: ping
15:29arrdemif you define a (with) form and your client1/client2 values, then profiles may be the minimum thing for you to wrap for your api
15:29cemerickman, what a mangling
15:29cemerickwhilo: what's up?
15:31whilocemerick: if i add the piggieback dependency to the basic c2-demo (not actually using it) i get a weird compiler backtrace
15:31whilotake the hello-bars sample from here https://github.com/lynaghk/c2-demos
15:31whiloadd the piggieback dependency like this: http://pastebin.com/eW6NUR6B
15:32whiloclojure.lang.ExceptionInfo: Assert failed: :as alias must be unique; offending spec: [cljs.repl :as repl]
15:32whilo(not (contains? (alias-type (clojure.core/deref aliases)) alias)) at line 1 src/cljs/hello_bars/core.cljs
15:33whilonot sure what it is, maybe my fault, it still takes me time to wrap my head around clojurescript compilation problems
15:36powr-tocHey, has anyone managed to get penumbra/opengl going with a recent clojure? 1.4/1.5?
15:38arrdemso yesterday I banged out multimethod +, -, / and * just for grins, and now I'm contemplating how extending them could go wrong. Is this expected for multimethods and protocols?
15:52arrdemherm... at what point is it "kosher" to use core. for a library?
15:53amalloyarrdem: when rich tells you to
15:53arrdemamalloy: yep, sounds about right
15:57whilocemerick: can u reproduce?
15:58jasonjcknpowr-toc: no
15:59jasonjcknpowr-toc: it's no longer maintained, too bad, the author is siad he's working on cljs opengl lib
15:59cemerickwhilo: are you in irc via SMS or something? :-P
15:59cemerickwhilo: the src/cljs/hello_bars/core.cljs has two repl aliases
16:01ztellmanpowr-toc: no, but patches/new ownership welcome
16:01ztellmanalso, the webgl/cljs thing is probably not going to happen in the short term
16:02danlarkinyou've got too many projects as-is :)
16:08whilocemerick: why via SMS? right, but the sample works without the dependency. i can also push my playground project, which doesn't have this core.cljs file with two repl definitions
16:08cemerickwhilo: was just giving you a hard time about the 'u' :-)
16:09tieTYT2i have a map of maps, and I want to get the value of one of the nested keys. What's an idomatic way of doing this in clojure?
16:09whilooh, ok. :-)
16:09tieTYT2nested keys = nested maps
16:09cemerickwhilo: *does* the core.cljs file have two repl aliases?
16:11arrdem,(-> {:foo {:bar {: baz 3 }}} :foo :bar :baz)
16:11clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: :>
16:11arrdemwhat the
16:12xeqithe space between : and baz
16:12arrdemthankx xe
16:12arrdem,(-> {:foo {:bar {:baz 3 }}} :foo :bar :baz)
16:12clojurebot3
16:12tieTYT2nice, that's pretty cool
16:12arrdemhah. tieTYT2 that or get-in
16:13arrdem,(get-in {:foo {:bar {:baz 3 }}} [:foo :bar :baz])
16:13clojurebot3
16:13tieTYT2nice
16:13tieTYT2i like the latter becaus I can understand the documentation of it better :P
16:14arrdemyeah... get-in is a little clearer here.
16:14tieTYT2thanks for the help
16:14arrdembut -> is for badasses so XP
16:14tieTYT2when i learn clojure better i'll start using it
16:15hyPiRionget-in is preferable.
16:15tieTYT2i'm glad I asked because I was doing this with deconstruction: (defn post-map-to-string [{{{post-link :href} :attr} :post-link, image-links :image-links} post-map] ...
16:15Okasu,(get-in {:foo {:bar {:baz 3 }}} '(:foo :bar :baz)[])
16:15clojurebot3
16:15xeqi* destructuring
16:15tieTYT2my mistake
16:16hyPiRion,(-> {:a {:b {:c 10}}} (assoc-in [:a :d] 10) (update-in [:a :b :c] * 2))
16:16clojurebot{:a {:d 10, :b {:c 20}}}
16:17Okasu,(get-in {:foo {:bar {:baz 3 }}} ,'(,:foo ,:bar, ,:baz,)[])
16:17clojurebot3
16:19bbloomi disagree that get-in is preferable... i think it's only preferable when the key path is a parameter
16:19bbloomotherwise, -> allows for easier injection of function calls and debug print statements
16:20hyPiRion,(get-in [[:a :b] [:c [:d :e]]] [1 1 0])
16:20clojurebot:d
16:20hyPiRion,(-> [[:a :b] [:c [:d :e]]] 1 1 0)
16:20clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
16:20hyPiRionget-in should be used to lookup data, not modify it
16:20arrdemaaand this is why I lurk #clojure. That and yall answer some stupid questions for me XP
16:21amalloycan't we all just get along? let's use -> and get-in both
16:21amalloy(-> m (get-in [1 1 0]))
16:22bbloomamalloy: surely you need an eval or two in there
16:22arrdemamalloy: I'd suggest partial but then you need two more parens
16:23amalloyseriously though, that's the way i use -> most often: when functions' argument order is inconvenient. eg, suppose that m were some non-trivial expression here: (get-in (fsdokfjsfklne eif#ef #*ernfe(earf#r#t) [1 1 0]), and by the time you get to the second arg you've forgotten you're in the middle of get-in
16:23oskarth'lein new pedestal-service foo' gives error java.lang.IllegalArgumentException: No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil. Using lein2. Ideas?
16:26whilocemerick: nope. this is the actual code i have problem with piggieback in: https://github.com/ghubber/example/blob/master/src-cljs/konvex/hello.cljs
16:26whilosee the comment at the top, either i take unify out or piggieback dependency from project.clj and it will build
16:29cemerickwhilo: not sure what to say; the error message is talking about a src/cljs/hello_bars/core.cljs file
16:30cemerickI don't know how piggieback would affect that at all...
16:30whiloi tried to reproduce with the hello_bars example, but if this is a mistake in the original example code (having repl defined twice), then it is probably a different problem
16:33whiloi didn't want to push my messy code for it, but this where c2 and piggieback make my build explode with a compilation error like this: http://pastebin.com/nhUSDzJb
16:35whilocan i do something else to help pin it down?
16:35arrdemany comment on why core.matrix doesn't use multimethod +, -, * and /? https://github.com/mikera/matrix-api/blob/master/src/main/clojure/clojure/core/matrix/operators.clj
16:35oskarthNevermind my earlier question - my lein profile defaulted to the wrong version of clojure :)
16:36whilocemerick: me neither but excluding piggieback from project.clj fixes the error. maybe it is a bug in c2
16:36amalloymultimethods are slow, and i imagine core.matrix is performance-oriented
16:37arrdemamalloy: really? for type dispatch?
16:40hyPiRionarrdem: yes, use protocols instead
16:42tomojseems like if you're calling generic + in an inner loop in some matrix stuff, you already lost?
16:42cemerickwhilo: sorry, I'm not set up to dig into this at the moment. Maybe post to the clojurescript list?
16:42whilook
16:43whilothx anyway!
16:56sshackThere aren't any libraries for receiving email, are there? (I can find plenty for sending it, but I'd like my app to be able to receive and process it)
16:57arrdemsshack: you'll need to find a java smtp servlet probably.. not sure if one exists
16:57arrdemI'd be amazed if a Clojure one does
16:57sshackWhat about reading mailbox files or mailspool?
16:57TimMcsshack: https://github.com/timmc/hashflash This shitty little thing I wrote receives email and also sends.
16:58sshackTimMc: ahh. Cool.
16:59arrdem(inc TimMc) ;; a little bit impressed
16:59lazybot⇒ 35
16:59arrdem$karma technomancy
16:59lazybottechnomancy has karma 48.
17:00TimMcarrdem: You won't be impressed once you've read the source.
17:00arrdemTimMc: java wrapper?
17:00arrdemor just a mess
17:01TimMcWell... it's very specific to GMail, there's no rate-limiting, and it's just generally not very robust.
17:01akhudekThis is very cool: http://javolution.org/core-java/target/apidocs/javolution/text/Text.html
17:01arrdemcloseenough.jpg
17:01tomojit geocodes your email and sends you a geohash as in geohash.org?
17:02arrdemtomoj: wat
17:02TimMctomoj: No, geohashing, the sport.
17:02tomojah, makes more sense :)
17:03TimMcYou tell it a location and date and it tells you the coordinates. It's an email autoresponder, but you can text it if your cell provider has an SMS<->email gateway.
17:03arrdemtomoj: that's cool, didn't know ascii-printable geohashing was a thing.
17:06tomojarrdem: http://geohash.gofreerange.com/ is better to look at than geohash.org if you don't already know geohash
17:07arrdemtomoj: ascii of the bitwise merge of the two doubles?
17:11tomojyeah
17:11tomojin base 32 so you have 3+2 or 2+3 bits per char
17:23ed_ggiven a function (defn foo [a &rest [b]] (let [b (or b 'default-b)] (list a b))) is there a cleaner way to give b an default argument similar to the CL (defun foo (a &optional (b 'default-b)) (list a b))
17:24arrdemblergh. make foo vardic with the missing argument case recursive
17:24arrdem(defn foo ([ x y ] (+ x y)) ([x] (foo x 1)))
17:25arrdemed_g: does that make sense?
17:25ed_garrdem: thanks! :-) that's what I'm doing now, just wasn't sure if there was another idiom
17:28jtoy_can I create methods that generate def methods that all bind to root? so i call my_method that does "def foo.." "def bar..." ?
17:28ed_gjtoy_: create a fn and then give it a name using intern
17:30jtoy_I have to know the namespace? or can it know to bind to the current namespace?
17:31arrdemjtoy_: erm.. not sure how to get the invocation namespace but if you use a macro rather than a fn then all interns are local by default.
17:34jjttjjwhat are people's opinion on laser vs enlive these days
17:37jtoy_arrdem: *ns* i think
17:38arrdemjtoy_: probably.. I'm not very familiar with the global earmuf values
17:39edwjjttjj: Given that it takes like thirty seconds to grok laser and…I do not know how long to grok enlive, I'd vote for laser.
17:40edwI mean, enlive seems to require consistent and heavy Kool-aid drinking to sustain proficiency. It's like D3.js that way.
17:42tomojhmm, when I upgrade clojure to 1.6.0-master-SNAPSHOT, swank explodes, but 1.5.1 works fine
17:42tomojeven though there are no changes in 1.6.0-master-SNAPSHOT
17:43danneuwhat's the #1 intended usecase for enlive/laser? i've used hiccup to generate html and enlive for scraping. but their READMEs just mention "html transformation".
17:43jjttjjdanneu: html templating
17:49tomojguess something was stale
17:56devntomoj: Whoa, so swank-clojure works with 1.5.1 now?
17:56devntomoj: That wasn't the case a few months back.
17:57tomojlein-swank 1.4.5, released 26 Dec, fixed the 1.5 problems I think
17:57devntomoj: nice. I like nrepl, but swank is still way more complete
17:58arrdemdoes defrecord not support vardics? this doesn't seem to be working for me... https://www.refheap.com/paste/12873
18:02bbloomarrdem: protocols don't support variadics at all
18:02bbloomarrdem: you're creating an argument with the name '&
18:03bbloomarrdem: the common pattern is to define protocol names like -foo with the leading dash to suggest that it's an implementation detail, then you define a corresponding foo fn that calls -foo
18:03bbloomarrdem: in this case, you can write (defprotocol IAddable (-add [this]) (-add [this x]))
18:03bbloomarrdem: and then you can define the variadic version generally, so that anything IAddable will get it for free
18:04bbloomotherwise, every implementer of IAddable would need to implement it the same each time
18:04bbloomside note: (. self val) can be (.val self)
18:04arrdembbloom: hum... okay thanks for the info.
18:05arrdemand the (. self val) thing was deliberate for the record XP
18:05bbloom,(macroexpand-1 '(.foo x))
18:05clojurebot(. x foo)
18:06bbloomarrdem: they are equiv
18:06arrdembbloom: so you would only define -add in the protocol and provide a general (add) which simply invokes the appropriate protocol fn recursively.
18:06bbloomyes
18:06edwdanneu: You can read in an HTML template (as "plain old HTML") and modify it based on your model. So your designer or whoever can give you HTML and you don't need to modify it or teach them how to put {{things}} <%=in%> it.
18:07bbloomlimit protocol usage for when you need fast, type-based, open dispatch
18:07bbloomhowever, you'll quickly find that single dispatch is insufficient for numeric applications, but i'll leave you to learn that one on your own :-)
18:08arrdembbloom: single dispatch?
18:08callenbotdanlarkin: <3
18:08arrdembbloom: I know that this is gonna be shit slow but I don't know what you mean by that.
18:09danneuedw: oh, i see. yeah, feeding in html makes sense to me when scraping but that makes sense now too
18:10bbloomarrdem: read the docs on multi-methods
18:10arrdembbloom: oh. global map lookup.
18:11bbloomarrdem: ugh, not sure what you mean by that. but numerics are *hard*, bordering on impossible to model with protocols
18:11bbloomactually, maybe not even bordering
18:11dnolenarrdem: the issue is you really want it to be open, you have the problem that the other argument may not be one you know how to handle. Can maybe get around that with a coercion protoocl.
18:11edwIt's nice, because you can have HTML that has representative content in it that simply gets replaced by your Clojure code. So you can have "<span class=price>$19.95</span>" instead of "<span class=price><%=(:price product)%></span>" in there.
18:14arrdemdnolen: yeah that's what I'm running into... the ENumber is existing code I already had but I want to wind up with an ISymbolic that is also IAddable and that's gonna be a mess.
18:18bbloomarrdem: you've discovered the Expression Problem :-)
18:18bbloomarrdem: http://en.wikipedia.org/wiki/Expression_problem
18:19hiredmanI've played a little with generating something like Numbers.java from a database of information about the types, but it still isn't really open to extension
18:20hiredmanhttps://github.com/hiredman/Archimedes/blob/master/src/Archimedes/bar.clj#L164 it is kind of neat
18:20jtoy_if I only have the name of a function in a string, how do I eval it with args? this doesnt seem to work: (eval (read-string "+") 3 4)
18:21jtoy_nor do i expect it to, but im not sure how to do it
18:22Bronsa((resolve (read-string "+")) 3 4)
18:23bbloomor, more generally: @(resolve ...)
18:23bbloomhowever, this is a dubious thing to do....
18:24jtoy_thx
18:24jtoy_bbloom: im implementing what we spoke about earlier
18:25bbloomjtoy_: i'm not sure how that involves symbol resolution....
18:26jtoy_bbloom: its always a little more complicated :) but specifically im reading in a bunch of files and some of them are parsed differently, so based of the filename i know which parser to use
18:27jtoy_i hardcoded it before, but know i do it dynamically
18:27tomojhiredman: why output java?
18:27bbloomjtoy_: a map of special-name-parts to functions will be 1) safer 2) simpler 3) more flexible
18:28jtoy_bbloom: ok, let me try yours, i didnt think of it like that
18:29jtoy_although you said that earlier
18:29tomojoh, I guess using clojure instead of Numbers.java would be a c-in-c problem?
18:31jtoy_bbloom: how do i pass the function around to be used?
18:32bbloom,{"clj-parser" `read-string}
18:32clojurebot{"clj-parser" clojure.core/read-string}
18:32bbloomer rather without the `
18:34jtoy_bbloom: so calling it is the same way from earlier using @ or resolve?
18:49TimMcmuhoo: https://clojars.org/org.timmc/handy/versions/1.5.0 :-D
18:50TimMcI can't push to github yet, though.
18:50bbloomjtoy_: ##((get {"add" +} "add") 5 10)
18:50lazybot⇒ 15
18:51TimMcWhy would someone DDoS github?
18:51TimMcLike, what do they hope to gain?
18:52bbloomTimMc: might be DDosing someone hosted on github
18:52bbloomTimMc: or they could just be dicks.
18:52bbloomTimMc: a lot of people are just not very nice and have a crappy sense of humor
18:54nightflySo thats whats going on... thought it was shitty airport wifi
18:58jtoy_such a shitty error for file doesnt exist: IllegalArgumentException No implementation of method: :make-reader of protocol: #'clojure.java.io/IOFactory found for class: nil clojure.core/-cache-protocol-fn (core_deftype.clj:495)
19:01ryanfanyone have opinions about pedestal?
19:01ryanfis it polished enough to be worth trying to use for a clojure noob?
19:06bttfdont have much to say about pedestal but i thought the mobile versin of their website rocked
19:07callenbotryanf: Clojure noobs should not be using Pedestal.
19:07callenbotryanf: I would look into Luminus.
19:08ryanfcallenbot: thanks
19:09ryanfoh um
19:09ryanfthis blog post about luminus starts with "Since the retirement of Noir..."
19:09ryanfI didn't see anything on noir's website that made it look retired
19:09callenbotryanf: Noir was retired.
19:09callenbotryanf: Granger is very busy and hasn't had time to update the Noir site.
19:09callenbotryanf: do not use Noir.
19:09maiojtoy_: (: I got that same error few hours ago ... yes it sucks hard
19:09callenbotibdknox: please update/redirect the webnoir site.
19:09ryanfcallenbot: thank you
19:09callenbotibdknox: it's confusing noobs.
19:10ryanfcallenbot: you are a very sophisticated bot btw. I'm impressed
19:10callenbotryanf: yogthos is the brain trust behind Luminus, but I've hacked on it and use it from time to time. It has some good defaults for common-case stuff websites need.
19:10ryanfcool
19:11callenbotryanf: pedestal has some cool stuff I might go ghoul on and rip out, but I'm not at present recommending it to anybody. I don't think it was made by people that actually have to hack up/on websites on a regular basis.
19:12RaynesAll I can see about pedestal is that there is a pretty website with no information on it.
19:13Raynes*shrug*
19:13RaynesI'd rather see a README with sense making.
19:13callenbotRaynes: I was rummaging through the guts. Stinky offal.
19:13callenbotRaynes: lots of do-nothing silliness for hippies.
19:14jtoy_bbloom: weird, your example works, but I cant get it to work in my code
19:14bbloomjtoy_: distill a minimal repo
19:16Glenjaminthe noir deprecated thing caught me out two
19:17Glenjaminspent two evenings reading docs before i came across the announcement blog post
19:23jtoy_bbloom: I tink this is my issue: ( (get {"fn" (read-string "+")} "fn" ) 5 10) what is wrong here?
19:23bbloomjtoy_: ##(class (read-string "+"))
19:23lazybot⇒ clojure.lang.Symbol
19:24jtoy_what should it be? it should return function? im not quite sure why its different from your example
19:25bbloomsymbols implement IFn, so they are "callable", but they are not necessarily functions. you want the function that resides in the var with the symbol 'clojure.core/+
19:25bbloom'clojure.core/+ is a symbol
19:25bbloom#'clojure.core/+ is a var
19:25bbloom,(resolve 'clojure.core/+)
19:25clojurebot#'clojure.core/+
19:25bbloom,(deref #'clojure.core/+)
19:25clojurebot#<core$_PLUS_ clojure.core$_PLUS_@131f3e1>
19:26bbloomderef == @ btw,
19:26bbloom,@#'clojure.core/+
19:26clojurebot#<core$_PLUS_ clojure.core$_PLUS_@131f3e1>
19:26Glenjaminso #' is the opposite of @?
19:26bblooma symbol is a name, a var is a named place
19:26bbloomGlenjamin: no
19:27bbloom@ means deref, which means "get the current value at a given place"
19:27bbloomthink of it like dereferencing a pointer in C, only it's a more powerful pointer that can implement arbitrary dereferencing logic
19:27bbloomvars are references, but so are delays, promises, atoms, agents, etc
19:28Glenjamini see
19:30kmicuit turns blue
19:40bosie_anyone got an idea how to calculate the 2 points where the radius of two center points are crossing?
19:44amalloywikipedia, or http://math.stackexchange.com/
19:45danneubosie_: if you have equation of two circles, you equate them to eachother and find the values of the variables that make the expressions equivalent
19:46bosie_amalloy: thought the intellectual crowd in here might know ;)
19:46danneuoh nevermind, you arent asking the 7th grade geometry question i thought you were
19:46danneudamn, thought i could finally answer a question in this channel
19:46bosie_danneu: haha. dont give up quite yet ;)
19:47ivanhttp://mathworld.wolfram.com/Circle-CircleIntersection.html
19:47bosie_ivan: ah, intersection. no wonder i didn't find anything
19:48danneuis this idiomatic clojure indentation https://gist.github.com/danneu/5154e5ef758a9eef2180
19:48bosie_thx ivan
19:48danneu"conventional" rather
19:50powr-tocdanneu: looks ok to me
19:50powr-tocdanneu: at least that's how emacs indents it :-)
19:55bosie_ivan: that is a really neat trick. thx
19:56ivannp
19:57tieTYT2i think i'm doing something wrong here: (defn post-map-to-html [{post-link :post-link image-links :image-links} post-map] (map #(post-and-image-to-html-link post-link %) image-links))
19:57tieTYT2when I call that function it says ArityException Wrong number of args (1) passed to: core$post-map-to-html clojure.lang.AFn.throwArity (AFn.java:437)
19:57tieTYT2but i thought i'm defining a function here with one parameter that's a map and it gets destructured
20:02amalloythat function takes two args, and destructures the first
20:02tieTYT2so I need to remove the post-map keyword?
20:02tieTYT2err symbol
20:03danneuyeah
20:03tieTYT2ok
20:03tieTYT2i'm really confused because all the examples I see here seem to do what I did: http://blog.jayfields.com/2010/07/clojure-destructuring.html
20:03tieTYT2oh right... he's using a let
20:03tieTYT2ok I get it now, thanks
20:04danneutieTYT2: btw shortcut for {a :a b :b} is {:keys [a b]}
20:04tieTYT2ok thanks
20:07tieTYT2how do I define a symbol to be the value of a function evaluation so that it doesn't evaluate over and over again each time I use the symbol?
20:07tieTYT2(my function uses an http client)
20:12jtoy_:(
20:13_ft_tieTYT2, this may be useful: http://clojuredocs.org/clojure_core/clojure.core/memoize
20:15amalloytieTYT2: you have described the primary feature of 'let
20:25jtoy_can anyone help me get this metaprogrammign working: https://www.refheap.com/paste/12879
20:26jtoy_bbloom: im close, i read what you said, but not sure still how to do it properly
20:30tieTYT2_ft_: sounds like memoize is for something that's referentially transparent, which my function isn't
20:30tieTYT2amalloy: ok I'll use a let, I think I understand how
20:35gfredericksjtoy_: you want the effect to be as if (defn foo [] (+ 4 5))?
20:36john2xhow do I use non-Datomic datastore with Pedestal?
20:36bttfif I have ((fn [x] (:foo x) {:foo "bar"}) ... is '(:foo x)' calling a function built into keywords ?
20:37bttfmissing a parenthesis in there
20:37amalloybttf: that's an odd way to phrase it, but basically correct
20:37jtoy_gfredericks: yes
20:38gfredericksjtoy_: your third argument to intern could be (fn [] (bar (resolve (:extractor x))))
20:39bttfi meant to say that it is calling a function that every keyword has by default .. how would phrase it amalloy ?
20:39gfredericksbttf: the keyword _is_ a function
20:39amalloybttf: keywords don't have functions, they are functions
20:39bttfah right
20:45jtoy_gfredericks: like this? https://www.refheap.com/paste/12880 doesnt seem to work for me
20:47gfredericksjtoy_: ah, yeah because the extractor is a string
20:47gfrederickswrap it in a call to symbol to convert it before resolve
20:48gfredericks(-> x :extractor symbol resolve bar) would be a more readable version
20:48amalloybarf
20:48jtoy_amalloy: useful
20:49gfredericksamalloy: the ruby people will never respect us if we can't learn to programmatically intern vars willy-nilly
20:49jtoy_hah, im a metaprogramming ruby master :)
20:49amalloygfredericks: i'm not even complaining about the interning (though i hate that too), just that awful arrow form. fewer parens doesn't mean more readability
20:50gfredericksamalloy: it's more the not-backwards part
20:50Raynesjtoy_: Which is equivalent to being the drunk that can piss the farthest.
20:50amalloyif i had to write something that macroexpands the same, i'd write maybe something like (bar (resolve (-> x :extractor symbol)))
20:50jtoy_and I love metaprogramming in ruby, especially method_missing which clojure doesnt seem to have
20:51gfredericksyeah I wonder why rich forgot that
20:51jtoy_Raynes: Its actually getting late for me and i started drinking already, im sure it will be fine once i look at it again tomorrow
20:51Raynesgfredericks: You'll learn this about amalloy: he pulls -> forms out of his ass and decides at random which ways look the best. You'll never win unless you have him write it for you in the first place and then agree with him.
20:51gfredericksRaynes: yeah I didn't see any way forward in the discussion
20:53gfredericksjtoy_: has somebody already told you that macros are used for 99% of clojure metaprogramming (rather than dynamically creating vars)?
20:53jtoy_gfredericks: no, im open to try that, but i still want the vars to be created
20:56gfredericksjtoy_: what's the use case?
21:10Glenjaminis there a shorthand for defining a private macro?
21:11gfredericksno
21:13hyPiRionyou have to make a macro for that
21:13hyPiRionheh.
21:13Raynes(defmacro ^:private foo [] ..)
21:13hyPiRionRaynes: I think he meant anonymous
21:13RaynesThere should really not be any macros for it at all given the new ^ syntax.
21:14RaynesHe didn't say anonymous.
21:14amalloyhyPiRion: wat. bet you a million dollars?
21:14RaynesHe said nothing to remotely indicate anonymous, in fact.
21:14GlenjaminRaynes: ah, i tried that in the repo, but now realise i had a typo >.<
21:14gfredericksI bet all of you that he meant symbol macros
21:14Glenjamin^:private is what i was after :)
21:14RayneshyPiRion: Go to your room.
21:15hyPiRionI thought he meant something like Common Lisp's macrolet
21:15tomojwat ##(map conj {:foo 3 :bar 4} [5 6])
21:15lazybot⇒ ([:foo 3 5] [:bar 4 6])
21:15hyPiRionRaynes: I will
21:16amalloytomoj: (seq {:foo 4 :bar 4}) makes it pretty obvious?
21:16dnolentomoj: looks right to me.
21:16Glenjaminwhat does ## do?
21:16Glenjaminwhere is all of this stuff written down :(
21:16dnolenGlenjamin: eval sexp in lazybot
21:16Glenjaminoh, haha
21:16tomojyes, it looks right, I just didn't know
21:16Glenjaminthought it was yet another reader macro
21:16RaynesI'm always baffled that people don't realize that immediately. :p
21:16hyPiRionGlenjamin: It's the same a &| (println 'foo) |&, but without an ending delimiter
21:16lazybot⇒ foo nil
21:16tomojI mean I didn't know map entries were IPersistentVector
21:17hyPiRionI think they are MapEntries.
21:17amalloyhyPiRion: yes, which are IPV
21:17RaynesWhich are a lot like vectors.
21:17tomojyes, that is what I meant by "map entry"
21:17hyPiRion,(-> {:a :b} (find :a) class)
21:17clojurebotclojure.lang.MapEntry
21:17RaynesYall's brains are gonna explode in unison now.
21:18tomojthat conj on a map expects a vector, not a map entry, and that map entries print as vectors both should have suggested that map entries were vectors, but I only realized it after noticing clojure.tools.macro use vector? to catch the map entry case
21:19gfrederickswhat's weird to me is that you can conj a map onto a map
21:20hyPiRionI think that's one of the weirder things, yeah.
21:20Rayneshttp://24.media.tumblr.com/tumblr_mbqg5q5V6l1riuh2bo1_400.gif
21:20amalloyit's weird because it's awful
21:20hyPiRion,(map (partial conj {:a :b}) [[:c :d] {:c :d}])
21:20clojurebot({:c :d, :a :b} {:c :d, :a :b})
21:21Glenjamin,(conj {:a :b} [:c :d])
21:21clojurebot{:c :d, :a :b}
21:21Glenjaminbah, beat me to it
21:21gfredericks,(conj {:a :b} [1 2 3])
21:21clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Vector arg to map conj must be a pair>
21:21hyPiRionWell, the first one is an entry, the last one is the oddity.
21:24tomojhttps://www.refheap.com/paste/eb652b8816d71997fa052e5db
21:25tomoj..and (= (clojure.lang.MapEntry. :foo 1) [:foo 1])
21:25jjttjjf
21:26hyPiRion,(== 0.0M 0.00M)
21:26clojurebotfalse
21:26hyPiRionIt's all these small funny things.
21:27gfredericks,(= 0.0M 0.00M)
21:27clojurebotfalse
21:27tomojI'd like a val? and val= such that (val= a b) implies, uh (val= (f a) (f b)) for 'pure' f?
21:28tomojI think.. is that possible in clojure?
21:29gfredericksprobably depends wth you mean by "pure"
21:29tomojwell I should have just left the scare-quotes off
21:30amalloytomoj: certainly possible in a number of uninteresting ways
21:30tomojbut I guess that would basically be 'same type and =', which sucks
21:30Glenjaminif f is pure
21:30Glenjaminyou can just call it :p
21:30Glenjaminby definition there are no ill effects
21:31tomojf was supposed to be universally quantified
21:32hyPiRionGlenjamin: Well, you're kind of stuck if (f a) -> a', and (f a') -> a though.
21:32amalloyactually, the only val= i can think of for which this works is (constantly false) or (constantly true)
21:32tomojobviously my requirements were not complete :)
21:33tomojgenerally I'm just wondering how you reason about (= (f a) (f b)) given (= a b)
21:33tomoj..and the types of a and b?
21:34tomojI mean, conj is one landmine, given (and (= x1 x2) (vector? x1)), are there a bunch of landmines all over the place, or very few?
21:36arrdembbloom: very well.... I think I have an idea for solving a subset of the expression problem.
21:36amalloyconj, pop, peek, class, seq?, vector?, empty...those are functions i can think of off the top of my head that will be landmines there
21:36tomojwell, given f #(conj m %), (and (= x1 x2) (every vector? x1))
21:36amalloyget, find, contains?...
21:37arrdemah contains?
21:38tomojI guess it's better than only being able to ask = for same-typed values
21:42tomojthe equality partitions from clojure.data.diff help but still don't clear all mines, right?
21:42tomojvector? etc being considered irrelevant..
22:02Glenjaminis anyone aware of a clojure/java lib similar to https://github.com/jugyo/notify (cross platform desktop notifications)
22:30yacinif i have a string of a form e.g., "(1 2 3)", how can i convert it to the form? i.e. so it's like '(1 2 3)
22:30yacinand i can use the usual conj/first/etc. on it?
22:32yacinnvm, figured it out
22:36danneuyacin: what was it
22:38yacin,(load-string "'(1 2 3)")
22:38clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
22:38yacinah well that makes sense
22:38yacinbut yeah, load-string
22:39zakwilsonIs there a good way to get the last thing inserted with korma?
22:40groovy2shoes,(read-string "(1 2 3)")
22:40clojurebot(1 2 3)
22:40groovy2shoesyacin ^
22:42yacinthanks
22:43groovy2shoesyacin: even better to use read-string from clojure.edn if you're trying to read arbitrary strings
22:44yacinah interesting. thanks again
22:44groovy2shoesyacin: http://clojure.github.com/clojure/clojure.edn-api.html (for reasons described in the comments here http://clojuredocs.org/clojure_core/clojure.core/read )
22:50danneuhow would i go about finding out what opts i can pass into slurp? http://clojuredocs.org/clojure_core/clojure.core/slurp
22:51danneulike the available `:encoding`s supported
23:01tieTYT2i'm using windows 7 and cygwin. Every time I run "repl lein" it leaves behind a java.exe process and they just build up. Anyone know what's causing this?
23:03tieTYT2i quit with ctrl+C
23:03groovy2shoesdanneu: looks like the supported encodings are whatever encodings your JVM supports... I'd imagine Oracle's supports many
23:03ivantieTYT2: perhaps mintty's inability to handle most windows programs properly
23:03ivancombined with lein's spawning of a second java
23:05seangroveclojurebot: ping
23:05clojurebotPONG!
23:05seangroveclojurebot: lastseen aphyr
23:05clojurebotCool story bro.
23:05seangrove$seen aphyr
23:05lazybotaphyr was last seen talking on #riemann 6 hours and 20 minutes ago.
23:07ivan(I've seen a lot of mintty problems including child processes not getting killed, or mintty locking up, also with non-cygwin Python)
23:07tieTYT2ivan: any suggestion to help with this?
23:07tieTYT2if i could kill all java processes with a cygwin command that'd be enough for me
23:07groovy2shoesyeah, mintty has problems with non-Cygwin anything, in my experience
23:08ivantieTYT2: install procps in the cygwin package list and use pkill to kill all the javas
23:09tieTYT2ok thanks
23:09ivanalternatively use conhost instead of mintty and use clink to alleviate some of the conhost pain
23:09ivanmore seriously linux
23:10tieTYT2ok thanks
23:11technomancytieTYT2: typically ctrl-d is the way you cleanly exit from a repl
23:11technomancyor (System/exit 0)
23:12groovy2shoesctrl-z on Windows
23:12groovy2shoeseven in mintty, when using stock Windows Java
23:15groovy2shoestechnomancy: it's funny that I remember it now, but as soon as I try to leave a repl inside mintty, I try ctrl-d a couple times before I remember Windows is weird
23:15groovy2shoesold habits die hard
23:16ivanyou could autohotkey that ;)
23:16groovy2shoesI'll look into it... I have a feeling my employer would frown on that...