#clojure logs

2012-10-07

00:02SgeoIs there a way to get lein test to expand all stack traces?
00:03SgeoAlso, I hate Clojure stack traces so much
00:11SgeoI have no idea if what I found in delimc is a bug or an intended case
00:11SgeoAnd thus don't know if "fixing" it would break anything
00:11SgeoOr even how to "fix" it, come to think of it
00:34lancepantzI've managed to lose the function signatures that clojure-mode usually prints in the emacs minibuffer, is there a manual way to turn it on?
00:40ChongLilancepantz: I believe that's eldoc
00:40ChongLiyeah
00:41ChongLiit only works for me when I have eldoc-mode enabled
01:14jonasenHow do you upgrade from nrepl.el 0.1.3 to 0.1.4?
01:22spoon16_what is the appropriate way to grab the latest version of a dependency in the leiningen project file?
01:31wingyhow do i unquote id in : '[:find ?account :where [?account :name id] [?account :password password]]
01:32jonasenwingy: Why not pass id as an argument?
01:32wingyjonasen: how do you mean?
01:33jonasenwingy: (q '[:find ?account :in $ ?id :where ...] my-db id)
01:35wingyjonasen: didn't know you could do that (just started to read the tutorial)
01:35wingythx a lot
01:36lancepantzChongLi: thank you!
01:55lpvbI want to use a more powerful editor but emacs has a loot of unfriendly to remember keybindings
01:55lpvb:(
01:56ivanlpvb: I use CUA mode and do some rebinding (esp. ESC -> ctrl-g)
02:06wingyhow come that i have no :session key in my req object
02:06wingyi think i have to use wrap-session
02:07SgeoRan 69 tests containing 69 assertions. 2 failures, 29 errors.
02:07SgeoI think the safest conclusion is that I suck.
02:14lpvbarghh, I'm just going to dump time into learning emacs until I get it and disregard every ill feeling I have while doing so. I hope it doesn't disappoint.
02:20clj_newb_234how do I get lein to include clojure.contrib.math
02:20clj_newb_234what do I put into project.clj
02:42wingyto destroy the session info i just send an empty session back?
02:44wingyi sent {:session nil} and it seems to work
03:18fredyranybody who knows how to output unescaped things with clojure.data.xml?
03:18fredyr(emit-str (sexp-as-element [:tag {} "
"]))
03:19fredyrgives me 
 which isn't really what i wanted
03:48lpvbamusing: https://www.youtube.com/watch?feature=player_embedded&v=1JZnj4eNHXE
03:49Sgeoasdfasdfasdf
03:49SgeoSo:
03:49SgeoI am completely able to define the function that I want at the REPL
03:49SgeoJust can't do it from within this project for some stupid reason
03:50SgeoAs in, can't load it from the file or it will try to pass some Java method more than 20 parameters
03:50SgeoI don't get it at all
03:50Sgeowtf
03:53fredyrlol LadyJava
03:54SgeoAnd I'm still having trouble trying to rewrite delimc to not force :use on everyone
04:16SgeoI suppose I shouldn't fault Clojure for the existence of garbage libraries.
04:17SgeoAfter all, Haskell also has garbage libraries.
04:26SegFault1XSgeo: That's a pretty useless thing to say.
04:28SegFault1XSgeo: Pretty much every single language ever has garbage.
04:49RaynesSgeo: You can use paredit in other languages.
04:49Raynesemacs-starter-kit has some paredit-for-other-langs goodies, but it probably works out of the box for other languages too.
06:42lancepantzwhat the up to date way to use clojure.contrib.math
06:42lancepantzi need an exponent function
06:48vijaykiranlancepantz: clojure.math.numeric_tower ?
06:48vijaykiranhttps://github.com/clojure/math.numeric-tower/blob/master/src/main/clojure/clojure/math/numeric_tower.clj
07:25qerubIs there some library that macro-generates a deftest from a table of test cases (like '[[x (->camelCase x) (->CamelCase x)] ["camel-case" "camelCase" "CamelCase]])?
07:28augustlhmpf, the fact that the "body" of Ring http requests can only be read once is proving to be a major pain in the ass
07:28augustlif some middleware somewhere reads it, then all other middlewares that depend on it will fail miserably
07:29augustlthere should probably be some sort of convention for how a middleware that reads a body that can only be read once should behave..
07:30qerubaugustl: +1
07:31augustlalso, side effects sucks.. :P
07:36augustlthe multipart-params middleware in ring core reads body but doesn't seem to be making any attempts of making it readable by other middlewares
07:38augustlthe input stream I'm getting is a http://download.eclipse.org/jetty/stable-7/apidocs/org/eclipse/jetty/server/HttpInput.html, I'm not very familiar with Java stuff though..
07:38augustlanyone knows if there's possible to read a java.io.InputStream multiple times somehow?
07:40augustlthe only solution I can think of is to wrap my app in a middleware that reads :body and replaces it with a new input stream that can be read multiple times
07:44qerubaugustl: For reference, Rack solves it this way: http://rack.rubyforge.org/doc/Rack/RewindableInput.html
07:45augustlqerub: same problem there it seems
07:46augustlwould make sense if middlewares didn't assume what the content of :body was..
07:47augustlso that I could turn :body into a byte array instead of an input stream, but then the multipart middleware would break
07:50qerubaugustl: Maybe you can file an issue on https://github.com/ring-clojure/ring/issues to get the discussion going?
07:50qerubaugustl: I think Rack request bodies are required to be "rewindable", i.e. always saved for future reads.
08:45augustlqerub: the more I think about it, the more I conclude that Ring is doing the right thing
08:46augustlafter all, what's actually the use case for reading the body multiple times? I don't have one, it's just sloppy middleware chaining on my part that's causing it
08:46augustlI'll think about it some more before posting an issue..
08:46antares_augustl: Rack developers themselves don't recommend doing exactly what Rack is doing
08:46antares_lots of pain points and not-so-great features around streaming and middleware composition
08:53augustlantares_: indeed, if the body is a 100mb file upload (which it might be in my case) reading it twice is a bit silly..
12:51fckwHi there.
12:51fckwI have a question: I am currently learning on how namespaces work in clojure.
12:51fckwYou can use (use 'my.namespace).
12:51fckw(And others like require etc.)
12:52fckwWhy do I have do use the single apostrophe before the namespace name?
12:52SegFault1Xfckw: To quote it.
12:52fckwIt's quoting - I know. But why do I need to quote it?
12:52Iceland_jackfckw: so it doesn't get evaluated
12:53fckwSo it's a symbol then that needs to be quoted?
12:53SegFault1Xfckw: And because under the hood it's just calling require/refer for you.
12:54fckwHm, I'm still sometimes a little confused when to use a string, a symbol or a quoted symbol in clojure.
12:54SegFault1Xfckw: Sometimes it depends on the form in question.
12:55fckw@SeqFault1X: Ah, I see. And how do I find out which form requires with input?
12:55SegFault1Xfckw: Documentation.
12:55SegFault1XOr ask, or google.
12:55fckw:)
12:57fckwSeqFault1X: Thanks for your answer.
12:57SegFaultAXfckw: No problem.
12:59SegFaultAXfckw: Apparently it has to do with clojure.lang.Namespace/find requiring a symbol when trying to lookup the appropriate namespace.
13:01fckwOk. How did you find this out?
13:01SegFaultAXfckw: Reading the source.
13:01fckwSource of namespace.clj?
13:02SegFaultAXfckw: clojure/core
13:03fckwHm, alright. Still lot of things to figure out for me.
13:06fckwThis is also helpful concerning the matter: http://blog.8thlight.com/colin-jones/2010/12/05/clojure-libs-and-namespaces-require-use-import-and-ns.html
13:06SegFaultAXfckw: That's basically the de facto resource for learning about Clojure's namespacing.
13:15fckwSo, obviously, when working in the REPL I first have to load a namespace using one of the various load-XXX functions, before I can do a use or a require on the namespace?
13:15metellusfckw: no, use and require are all you need
13:19fckw@metellus: But why does the following example not work then:
13:20fckw(ns foo)
13:20fckwSorry, rather:
13:20fckw(ns 'foo)
13:20fckw(defn myfunc [a b] (* a b))
13:20fckw(ns 'bar)
13:20fckw(myfunc 4 5)
13:21fckwIt says: FileNotFoundException
13:21fckwAlso when I now say: (use 'foo)
13:22@rhickeyhow does one get lein to use a local jar, e.g. I work on clojure, have a temporary jar I want to try in the context of a lein project?
13:22@rhickeyusing lein localrepo leaves lein complaining: Could not find artifact local.repo:clojure:pom:1.5.0-alpha6 in clojars/central
13:22@rhickeywhich seems harmless for lein repl, but I am using tooling calling `lein classpath` and the warning is in the output
13:24hiredmanthe easiest way to use a custom build of clojure is maybe to run `mvn install` in a clojure checkout, which will put the jar in ~/.m2 where lein can find it
13:24pjstadigthat's usually what i do with a custom clojure build, too
13:25@rhickeyIsn't that what localrepo is doing for me?
13:25@rhickeyI've read that similar problems crop up with mvn install
13:26pjstadigi've never used lein localrepo myself
13:26pjstadigi usually either do the mvn install or at work we have an archiva instance that we put some jars into
13:26@rhickeyI don't want to use the proper clojure name/group and mess up other things
13:28pjstadigrhickey: you did a `lein localrepo install something something`?
13:29@rhickeypjstadig: yes
13:29@rhickeylein localrepo install ~/dev/clojure/clojure.jar local.repo/clojure 1.5.0-alpha6
13:29@rhickeyand lein repl runs, with that jar, after complaining
13:29hiredmanpjstadig: is it normal for lein to search through repos in order and print warnings for each repo where it cannot find whatever?
13:30@rhickeybut lein classpath puts the warning in the output, spoiling things for downstream tooling
13:30fckwok, need to quit. Thanks, guys.
13:30fckwBye.
13:32@rhickeyI'd much rather just have an {:unreproducible-classpath-extension path/to/jar} in project.clj
13:33@rhickeythere's something fundamentally wrong about having to produce pseudo-deployed artifacts for wip
13:33@rhickeytrying to play along, but no joy
13:33pjstadigi feel like if you don't have a jar in your .m2 it will iterate through the repos and print warnings until it finds the one that has it
13:34pjstadignot sure if that is lein or the maven code printing the warning
13:34@rhickeyit's in .m2
13:34pjstadigyeah that's weird
13:34@rhickeyit's something to do with a pom
13:34pjstadigi don't get any warnings for something that's in my .m2
13:34pjstadigsounds like it might be
13:34@rhickeynot using mvn install leaves it pom-less
13:36@rhickeymanually copying the pom shuts it up
13:37@rhickeythanks guys
13:51holohi
13:51OEhey
14:11SgeoMaybe if I actually take the time to comprehend how delimc works, I'll be able to fix it
14:11SgeoAnd learn something in the process
14:22bonegaIs there a standard clojurescript macro for making this nicer? (set! (. obj field) value)
14:26hiredmanbonega: (set! (.-field obj) value)
14:27GoshIf I use (:import ..) inside the ns macro it does not work, but if I use it outside it works. Any ideas?
14:27bonegahiredman: thanks thats better. But would prefer (set! obj -field value)
14:28bonegasuppose there are some good reason
14:29GoshI am lunching a repl with this single file. Maybe should I compile it?
14:30GoshCompilerException java.lang.IllegalArgumentException: Unable to resolve classname: Display, compiling:(NO_SOURCE_PATH:1)
14:30Goshthis is the error
14:30hiredmanGosh: the file is missing an import of the Display class from whatever package
14:31Gosh(ns test
14:31Gosh (:import (org.eclipse.swt.widgets.Display)))
14:31Goshif I use (ns test) (import org.eclipse.swt.widgets.Display)) it works
14:31hiredmanGosh: a. don't use single segment namespaces, b. that is not a correct import statement
14:32hiredmanGosh: what is the difference between (:import (org.eclipse.swt.widgets.Display)) and (import org.eclipse.swt.widgets.Display)) ?
14:32GoshI have no idea.
14:33GoshThere was an example with marged ns and import
14:33hiredmanGosh: just look at the text
14:33Goshcan oyu do that?
14:33hiredmanwhat is different?
14:34GoshAre you asking me if is it syntacticaly correct or what?
14:35Goshhttp://clojuredocs.org/clojure_core/clojure.core/import here
14:35hiredmanI am asking you to visual compare the characters in the two snippets of text and tell me what the differences between the two are
14:35hiredmanvisually
14:36BronsaGosh: he's guiding you to understand the error
14:37Bronsai think.
14:37Goshlol, I do not get it
14:37Goshcuz org.eclipse.swt.widgets.Display is the same in both instances
14:37hiredmanok, what about the rest?
14:37kmicu(:import vs (import
14:37metelluswhat else?
14:38GoshI do not know mybe it is a special form and you can do it
14:38Bronsathis is fun
14:38Gosh(import ) = fun call?
14:38Goshwtf
14:38Goshlol
14:38Goshare you gonna answer me or what
14:39metellus(:import (org.eclipse.swt.widgets.Display))
14:39hiredmanGosh: I am not even asking about anything specific to clojure, just take the two snippets as text you came across on the internet, if you ran a character by character diff, what are the differences
14:39metellus(:import org.eclipse.swt.widgets.Display)
14:39metellus(:import (org.eclipse.swt.widgets.Display))
14:39metellusnow they are lined up
14:39metellusone above the other
14:39metellusfind the differene
14:39hiredmanGosh: org.eclipse.swt.widgets.Display is infact the opposite of what I am asking about, because that string is the same in both
14:40Goshimport its the same aswel
14:40Goshthe rest I dont know
14:40Goshif the syntax is correct
14:40SgeoForget about the syntax. Pretend that the language was gibberish.
14:41kmicu"Forget about syntax" ;]
14:41Goshi am staring at it 5min alredy lmao
14:42Goshthe "(" surrounding the class name?
14:42metellusyes!
14:43kmicustop teasing him ;) Gosh: http://www.infoq.com/presentations/Clojure-Namespaces-Vars-Symbols you should watch this
14:45Goshnice, now I have to spend 42min to get my answer
14:45Sgeokmicu, I should probably watch that too
14:46SgeoAlthough I think I have a grasp of it
14:46metellusGosh: as you saw, there shouldn't be parentheses around the class name
14:46SgeoCommon Lisp symbols are like Clojure vars rather than Clojure symbols, right?
14:48Goshhttp://clojuredocs.org/clojure_core/clojure.core/import he puts parentheses around class names
14:48Goshoh nvm
14:48GoshI see it now
14:48kmicuthe path to enlightenment is long and difficult
14:48metellusyou either need no parens at all of you need '()
14:48metellusor you need*
14:49metellusGosh: the reason is that if you just put parentheses, then Clojure tries to treat it as a function call
14:49metellus,(+ 1 2)
14:49metellusvs
14:49clojurebot3
14:49metellus,'(+ 1 2)
14:49clojurebot(+ 1 2)
14:49GoshI know this
14:49hiredmanmetellus: stop
14:50GoshI though ns were something special
14:51hiredmanGosh: I would not recommend listening to metellus, he is just confusing things
14:51hiredmanGosh: ns is special, it is a macro, and you don't quote in it
14:51hiredmanGosh: you said "I see it now" so you see the difference between the example and what you were doing?
14:56GoshI saw that he was using parens with this format (package-name classes..). Still dont know why he is not putting ' infront of the list
14:56hiredmanns is a macro, the usual evaluation rules don't apply
14:58Goshok, thanks
14:59kmicuJust out of curiosity, do any of you use Programmer Dvorak xor Colemak layout?
15:00tomojI use programmer dvorak
15:06kmicutomoj: Any problems with emacs/vim? And whether the change was worth the price? ;]
15:07kmicuI want to move to P.Dvorak/Colemak and drop this qwerty malarkey
15:08tomojI use emacs, haven't noticed much problem. but I think I learned emacs after switching to dvorak
15:09tomojhard to say whether it was worth it therefore
15:09kmicutomoj: one question - do you want to go back to qwerty goofiness? ;)
15:11kmicu"Qwerty was originally designed with the sole purpose of slowing down the typist so that typewriters would jam less and not need to be repaired as often."
15:11chouserI don't think that's true
15:11chouser"A popular myth is that QWERTY was designed to "slow down" typists though this is incorrect – it was designed to prevent jams[4] while typing at speed, allowing typists to type faster." -- http://en.wikipedia.org/wiki/QWERTY
15:13kmicubut the most commonly used characters are not on the homerun :/
15:15kmicunvm, let's get back to clojure
15:19kmicuhomerow* ;)
15:28tomojkmicu: no way
15:28tomojeven programmer dvorak over dvorak seems like a no brainer for clojure, not having to hit shift for (,[,{ etc
15:30AimHereA simpler fix would have Caps Lock locking shift for everything
15:30AimHereAnd then using the olde Lispe notionne of making it case-insensitive
15:34Apage43is autodoc still kept up somewhere?
15:45Urthwhyteis there a way to unpack a vec and use it as function args?
15:45Urthwhytei.e (+ (unpack [1 2)) => 3
15:46algernonUrthwhyte: (apply + [1 2])
15:46Urthwhytethank you algernon :0
15:46Urthwhytes/0/)/
15:47wunkiI have one outputstream which I want to attach two consumers to, anyone tips how to do that?
15:57oichwhat am I doing wrong? (System/getProperty "java.class.path") shows clojopts jar file. (ns (:use 'clojopts.core)) in a file resolves with lein run. But, with lein repl, this does not work:(require '[clojopts.core]). clojopts results in can not find symbol
15:57oichor (require 'clojopts.core)
15:59oichnever mind...
16:06uroborus_labsWhere would the proper or idiomatic locations to store files needed for tests?
16:06uroborus_labsIn the "test" directory or is it ok to create a directory at the project root?
16:08SegFaultAX|workuroborus_labs: Why not the test directory in the root of the project?
16:10gfredericksI think you can make a test-resources as well if you like separating the code from the other files
16:11uroborus_labsOk thanks, I think i will go the test-resources route
16:11gfredericksyou might have to add a lein option to make it work; check the lein sample-project.clj if it doesn't.
16:11tomojyou can put them in dev-resources, or add :resource-paths "test-resources" or whatever to the :dev profile
16:11tomojer, ["test-resources"]
16:24GoshWhy would you quote something inside a macro?. Example (import '(package classes)). Would the import macro get as an input a list containing quete symbol and another list containing symbols package and classses?. Why would you let this as a valid input, instead of just (import (package classes)) since evaluation does not work inside macros?
16:25Sgeoimport is not a macro. ns is.
16:25SgeoThe :import form in the ns does not need quoting around stuff, since a macro is reading it. But import is a function.
16:25SgeoHmm, hold on, I may be wrong
16:26Goshimport is a macro
16:26Gosh(import '(package classes)) = (import (package classes))
16:26Goshwhy?
16:26clojurebotwhy is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone
16:26SgeoDon't know. Consistency with functions such as use?
16:28GoshClojure is inconsisten as ****. For some keywords you can pass arguments inside a vector and for some inside a list. Its confusing.
16:30SgeoLists conventionally tend to imply special significance to the first element, while vectors don't
16:31Sgeo(import '(java.util Date Calendar)) ; the first element of the list has special significance, it is the prefix for the other classes
16:31SgeoThere are worse inconsistencies in Clojure, which I blame on Java
16:49kmicudnolen: nice work ;) https://github.com/clojure/clojurescript/commits/source-map I thought that the project is dead
16:49gfredericksGosh: the ns macro in particular isn't something anybody is proud of
16:50dnolenkmicu: heh it's not done, been hoping to get some help on it but still no takers.
16:51SgeoHi dnolen
16:52ziltiI'm trying to use autocomplete with either ritz-nrepl or nrepl, but both give me error messages. Does that work for someone? Or is it a bug, since it's under heavy development?
16:52SgeoI think my best bet for fixing delimc is going to be actually reading and understanding it first, rather than thinking I know how to fix it off the bat
16:53kmicudnolen: where is an issue tracker for cljs1-source-map project? ;)
16:53dnolenkmicu: no issue tracker beyond the source :)
16:54SgeoIncidentally, if I want to write a function that only makes sense inside a reset (it uses shift and thus its code needs to be transformed), is (reset (defn foo [] ...)) the appropriate way to do that?
16:55dnolenSgeo: it's a brain twister. I suspect Chris Frisz's CLJTCO will be more useful for implementing proper delimited continuations for Clojure.
16:55ziltiSgeo: Better use (defn- foo [] ...) or (let [foo (fn [] ...)])
16:56hugodzilti: if you are running ritz-nrepl, then you need to make sure you are using one of the provided "complete" ops
16:57Sgeozilti, uh, the function is intended to be in a library, to be used by other code
16:57Sgeodnolen, although I will say that writing the function at the REPL seemed to work properly. Loading it in from a file in my project didn't though :/
16:59ziltihugod: Where can I find that?
16:59dnolenSgeo: what's the error you're seeing?
16:59SgeoSomething about trying to give more than 20 parameters to a methods
16:59Sgeomethod
17:00hugodzilti: https://github.com/pallet/ritz/tree/develop/nrepl#provided-nrepl-ops
17:00SgeoThis was last night, I don't have it open still
17:00hugodzilti: I see the links don't go anywhere :(
17:01ziltihugod: some go
17:01dnolenSgeo: yeah, I don't know and I don't have time to dig into it.
17:02ziltihugod: Ok and where do I need to tell ritz which ops to use?
17:03hugodzilti: add ritz.nrepl.middleware.simple-complete/wrap-simple-complete or ritz.nrepl.middleware.fuzzy-complete/wrap-fuzzy-complete to the :nrepl-middleware as shown under https://github.com/pallet/ritz/tree/develop/nrepl#nrepl-general-middleware-usage
17:04hugodyou can put these in your user profile too, I believe
17:07ziltihugod: I get a java.lang.ClassNotFoundException: complete.core
17:10hugodzilti: complete.core is used by vanilla nrepl.el, but is not added automatically by the ritz-nrepl server. You would need to add it to your :dev dependencies to use a ritz nrepl server with vanilla nrepl.el (ie without loading the nrepl-ritz.el package).
17:21ziltihugod: What's the dependency for complete.core? I can't find that one.
17:22hugodzilti: clojure-complete "0.2.2"
17:22clojurebotCool story bro.
17:22ziltithanks
17:33ziltiNice. It completely stopped to work now. Exception in thread "main" com.sun.jdi.InvocationException: Exception occurred in target VM
17:40wingyis there a way to remove the namespacing in keywords eg. from :item/name to :name
17:42tomoj(comp keyword name)
17:44wingy(name keyword) worked
17:44wingythx
17:44wingyoh forgot it returned the string
17:45nightfly_(keyword (name ::example))
17:45gfredericks,((comp keyword name) ::example)
17:45clojurebot:example
17:46arrdem,(name :foo)
17:46clojurebot"foo"
17:46arrdembau5. didn't know that was a thing.
17:46gfredericks(def remove-initial-colon (comp keyword name)) ;; worst named function evar
17:53Raynes&(-> ::foo name keyword)
17:53lazybot⇒ :foo
17:53gfredericks&:::::::foo
17:53lazybotjava.lang.RuntimeException: Invalid token: :::::::foo
17:55SgeoMetadata on the var rather than the fn still annoys me
17:55SgeoIt means that that def isn't equvalent to using (defn remove-initial-colon [x] (keyword (name x)))
17:55SgeoAnd it means that comp doesn't preserve the arglists of the first function
17:57technomancyyeah, it's very annoying
17:59gfredericksbooo certain things!
17:59S11001001Sgeo: Lisp is reinvent def :)
17:59technomancymy implementation of partial for Leiningen tasks maintains arglists info
17:59tomojwhat are some reasons _for_ metadata on the var?
18:00technomancytomoj: way back in the day you couldn't attach metadata to functions
18:01tomojthat's.. not what I wanted to hear :(
18:01gfrederickseasy fix?
18:01technomancypossibly before clojure 1.0-ish
18:01SgeoBackwards compatibility for the loss!
18:01gfrederickscould start attaching to both for backward compatibility
18:01S11001001,(-> (fn [] 42) (with-meta {:x :y}) meta)
18:01clojurebot{:x :y}
18:02SgeoS11001001, what did you mean by <S11001001> Sgeo: Lisp is reinvent def :)
18:03S11001001Sgeo: solution in any Lisp is always replace with your own version :)
18:08gfrederickstakes a lot of work to replace it in clojure.core as well
18:16amalloyfunctions don't actually have a meta slot anymore, fwiw. with-meta works by creating a wrapper around the base function that *does* have a meta slot
18:17gfredericks,(map type [(fn [] 3) (with-meta (fn [] 3) {:x :y})])
18:17clojurebot(sandbox$eval27$fn__28 clojure.lang.AFunction$1)
18:17gfredericksoh. righti.
18:17amalloyi think that happened in 1.4
18:17gfredericksamalloy: so what's the effective difference?
18:18amalloygfredericks: effective? not much. but it means that most functions have a smaller memory footprint and construction cost, because they don't need to be told their meta
18:21technomancysupposedly one day clojure will get knobs for people who care about stuff like that so the rest of us can just have nice features
18:22SgeoKnobs?
18:22SgeoLike Common Lisp's declare/declaim/proclaim ?
18:22Sgeo(declare (optimize (speed 3)))
18:22arrdem... proclaim?
18:22danlarkinmythic future knobs
18:22technomancyDynamic |--x-----------| Memory-lite
18:23technomancydanlarkin: along with clojure-in-clojure
18:23Sgeohttp://www.lispworks.com/documentation/lw50/LWUG/html/lwuser-90.htm
18:23danlarkinwhat're the odds on cic coming before knobs
18:26gfredericks,(printf "The odds are %d." (rand-int 10))
18:26clojurebotThe odds are 2.
18:26technomancyclojurebot: never tell me the odds
18:26clojurebotTitim gan éirí ort.
18:27gfrederickswhat the heck did he just learn
18:27amalloywelsh, right?
18:27amalloyor maybe gaelic?
18:27arrdem(inc technomancy )
18:27lazybot⇒ 2
18:27gfredericksno I mean what state-change did technomancy cause
18:28amalloygfredericks: none
18:28technomancywho knows what evil lurks in the heart of clojurebot
18:28technomancy...only the hiredman knows
18:30amalloy(except insofar as he changed your state to remember him speaking in tongues)
18:30gfredericksclojurebot: The odds |aren't|
18:30clojurebotIt's greek to me.
18:30gfredericksclojurebot: The odds |aren't|.
18:30clojurebotIn Ordnung
18:30gfredericks~odds
18:30clojurebotThe odds aren't .
18:30gfrederickserk
18:30arrdem... is clojurebot okay?
18:30gfrederickshe's just this guy you know
18:32arrdemclojurebot: are you okay?
18:32clojurebotPardon?
18:33arrdemoh well...
18:33arrdemI was hoping for Eliza or worse
18:35gfredericksoughtn't be too hard to embed a cleverbot impl
18:40arrdemclojurebot: limited
18:40clojurebotlimited is time
18:40dlitvakclojurebot: help commands
18:40clojurebothelp is http://clojure.org
18:41technomancythis gets my goat every time: No method in multimethod 'do-copy' for dispatch value: [java.net.URL java.io.File]
18:42danlarkinyeah that is a shame
19:40ssurgnierIs there an equivalent to reshape/cast in incanter? I found incanter.core/deshape for melting but no luck yet on casting.
20:09wingydoes anyone know when clj 1.5 will be here?
20:09wingyif i am doing a new web app should i use 1.5 master snapshot or 1.4?
20:09casion1.4
20:13SgeoAlthough, I can't help but wonder if I could do... better somehow
20:13SgeoAs it is, functions based on shift are not realistically usable from functions not processed through the transform
20:13casionSgeo: what is it exactly?
20:14Sgeocasion, delimited continuations for Clojure
20:16casiongoogle is useless here :|
20:16SgeoHmm, I may be mistakne
20:17SgeoTry googling for shift and reset
20:17Sgeohttp://en.wikipedia.org/wiki/Delimited_continuation#Examples
20:17casionSgeo: I'm working through that
20:18SgeoUsing it leads to, in my opinion, a nicer way of using monads than do notation.
20:20casionI have quite a few levels of terminology to absorb before I understand any of this apparently
20:21Sgeo(reset (+ 1 (shift k CODE)))
20:21SgeoWhenever the shift expression returns, the + 1 is skipped
20:21Sgeowithin CODE, k is a function, which does this: (k x) will effectively return the value that occurs when you replace the shift with x
20:22casionwhy is the + 1 skipped?
20:23SgeoBecause that's how shift and reset are defined, it's presumably convenient to be able to not execute the continuation
20:23SgeoThe + 1 will only be done when k is called
20:23Sgeo(reset (+ 1 (shift k 0)))
20:23Sgeo;; 0
20:24casionwhy wouldn't k be called?
20:24casionor when?
20:24Sgeocasion, if the body of the shift doesn't call it, it won't be called
20:24Sgeo(reset (+ 1 (shift k (k 5)))) ;; 6
20:25casionso if K is not called, then the third item in the form is returned for (reset)?
20:26casionk, sorry
20:26amalloy(reset (+ 1 (shift k (map k [5 6])))) ;; (6 7), right?
20:26casionand if k is called, then the body of shift is replaced with the resulut of k
20:26casiondo I have that correct?
20:26nappingk is a binder there, bound to #(+ 1 %)
20:27Sgeoamalloy, yes
20:27Sgeocasion, better to think of it that the reset will be replaced with the result of the body of the shift
20:27SgeoWhich can itself, by calling k, call the rest of the stuff between the reset and shift
20:28SgeoBecause k can be called multiple times
20:28casion...
20:28amalloycasion: the chunk of the call stack between reset and shift is "copied" into the function k
20:28casionamalloy: ahhh
20:28amalloyand used iff k is actually called
20:28casionok, that makes more sense
20:29casionwhen would this be useful then?
20:29casion(and thank you for taking time to explain it)
20:29SgeoIt allows for arbitrary control flow
20:30casionSgeo: can you give a basic example of how k being called or not produces some useful functionality?
20:30SgeoAnd the reason I'm interested in it right now is because it seems like it should be usable for a nicer syntax than do notation for monads
20:31SgeoUh. I'm not especially experienced with continuations.
20:31casionI do believe I understand how it works, but not the application
20:31amalloycasion: one example is implementing exceptions in terms of continuations
20:31casionwould you do exceptions with it maybe?
20:31casionI need to learn to read the screen while I type if amalloy is around
20:31amalloyhah
20:31nappinghttp://okmij.org/ftp/continuations/
20:31amalloyyou can also implement something like lazy sequences with continuations
20:32bfabryI've written a function... explode-map, which I think should actually be called denormalize? is there a word/concept for what I'm trying to do here http://pastie.org/4930513
20:32casionbrb, I have more questions in a minute or two
20:32amalloyand so on, et cetera. my understanding is that it's a very general form of control-flow that can be special-cased to most of the things languages do
20:33amalloybfabry: not really a good idea to explode a map without knowing its contents. eg, what if someone wants to store a map in v4, and still get [a f v4] rather than an exploded submap?
20:34bfabryamalloy: I know its contents. The entire thing needs to be flattened to go on from here.
20:35bfabryamalloy: for some background on the purpose, I'm converting a nested map into a rails-compatible url query string
20:36amalloyokay, so write the function and use it. it's certainly not in the standard libs or in useful
20:36bfabryit occurs to me if I had a function like (walk-leaves (fn [parents leaf] (...)) nested-map) this would look much clearer, does such a function exist?
20:38SgeoWhy does apply concat bother me so much?
20:38casionbfabry: zippers?
20:38SgeoIs it because I'm used to Haskell's concat just taking a list of lists?
20:39SgeoAnd the fact taht concat doesn't... confuses me a bit I guess
20:39SgeoAlthough it makes sense
20:39bfabrycasion: yeah see zippers sort've look at me hintingly like they're what I want but I don't understand them yet :) Can they be used to implement something like (walk-leaves ?
20:40casionbfabry: I'd imagine clojure.zip/next is what you want
20:40casionbfabry: though you could be more efficient than that usually
20:42bfabrycasion: building up a string just before calling an external web service, the efficiency of building the string is not likely to be an issue :) It's the clarity and doing things the "correct" way that interests me
20:42SgeoUniversally flattening everything is rarely correct
20:43amalloybfabry: https://gist.github.com/3850118
20:44bfabrySgeo: I'm not universally flattening everything. I am flattening a specific thing that needs to be flattened.
20:44bfabryamalloy_: interesting! thank you
20:44wingyaren't these equivalent: (ns (:use [datomic.api :only [q db] :as d])) vs (ns (:require [datomic.api :refer [q db] :as d]))
20:48wingyi guess not .. the latter gave me error on console
21:02wingymy bad .. it actually is the same .. the error was due to something else
21:03wingynow i can have :require only instead of mixing it with :use :)
21:36doctordaebakhello all. anyone aware of the parallella project?
21:36doctordaebakproject to make a 16-core computer for $99.
21:37doctordaebakeveryone who'd like to see clojure eventually running on this, please check out this page:
21:37doctordaebakhttp://www.kickstarter.com/projects/adapteva/parallella-a-supercomputer-for-everyone
21:37doctordaebakthe company seems to be solid and they have delivered real products before.
21:38doctordaebakthose interested, please pass the word on. thanks.
21:52gfredericksmy advanced cljs code still has whitespace present; what's the cljsbuild option for removing that?
22:32SgeoOh, it's Enlive that has trouble with arbitrary XML
22:32SgeoFor some reason I thought Hiccup
22:46leafw,(println 1)
22:46clojurebot1
22:50wingydoes clojure have functions for parsing/building URL query strings?
22:51wingyfrom maps
22:51wingyhttp://stackoverflow.com/questions/9745566/how-to-convert-map-to-url-query-string-in-clojure-compojure-ring
23:10wingyhow do you generate a random nr in clojure?
23:12Raynesnr?
23:12clojurebotnrepl is a network REPL implementation: http://github.com/clojure/tools.nrepl
23:16wingyRaynes: number
23:16Raynes&(rand)
23:16lazybot⇒ 0.18493043508556506
23:17Raynes&(long (rand))
23:17lazybot⇒ 0
23:17RaynesSuper long.
23:18wingyRaynes: cool!
23:18Raynes&(long (rand 10000000000))
23:18lazybot⇒ 6040549939
23:19wingynice
23:30amalloy&(rand-int 1564)
23:30lazybot⇒ 1220
23:38wingyamalloy: nice
23:39wingywhat is the best way for a key in a map to require another key in the same map
23:39amalloythat doesn't make sense
23:41wingyamalloy: {:url "http://app.com&quot; :path "#{url}/home"}
23:41wingyi wanna reuse :url in :path
23:41Goshwhats the difference between "." and ".." macro?
23:41wingyGosh: .. is a "chain" macro
23:42wingyinstead of you using multiple . calls you can use .. and then chain all the calls together
23:42Goshand single dot works just for one invocation?
23:42wingyyeah
23:42Goshok thanks
23:42wingyi think
23:42GoshCan I use -> and --> instead of dots for java ?
23:44friowingy: i'm pretty sure you can't do that :)
23:45wingyGosh: (. "hello" toUpperCase)
23:45wingyvs
23:45wingy(.. "hello" toUpperCase (replace \H \N))
23:45wingyso i was right
23:45friowhat are you actually trying to achieve? surely it'd make more sense to just leave path as "/home/" and then combine them when necessary? (format "%s/%s" (:url my-map) (:path my-map))
23:45frio(although no doubt that last bit can be compressed a bit!)
23:45brehaut(-> "hello" .toUpperCase (.replace \H \N))
23:45brehaut,(-> "hello" .toUpperCase (.replace \H \N))
23:45clojurebot"NELLO"
23:46wingyfrio: i guess
23:46wingyyeah ill just do that
23:47brehautusing bare dot is fairly uncommon; most code uses the sugared method syntax these days and leaves dot for edge cases and complicated stuff
23:47wingybrehaut: which means your examples are the way to go?
23:47brehautGosh: ^ so yes, -> and ->> can be used with java
23:47amalloybrehaut: mostly for macros in my experience
23:48brehautmakes sense
23:49amalloythe number of times i've ripped ~(symbol (str "." method-name)) out of macros...
23:49brehauthaha
23:52wingy,(rand-int 1000000000000000)
23:52clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: 661653239191293>
23:52wingy,(long (rand 1000000000000000))
23:52clojurebot190712672568951
23:52wingylong power