#clojure log - Oct 07 2012

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

0:02 Sgeo: Is there a way to get lein test to expand all stack traces?

0:03 Also, I hate Clojure stack traces so much

0:11 I have no idea if what I found in delimc is a bug or an intended case

0:11 And thus don't know if "fixing" it would break anything

0:11 Or even how to "fix" it, come to think of it

0:34 lancepantz: I'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?

0:40 ChongLi: lancepantz: I believe that's eldoc

0:40 yeah

0:41 it only works for me when I have eldoc-mode enabled

1:14 jonasen: How do you upgrade from nrepl.el 0.1.3 to 0.1.4?

1:22 spoon16_: what is the appropriate way to grab the latest version of a dependency in the leiningen project file?

1:31 wingy: how do i unquote id in : '[:find ?account :where [?account :name id] [?account :password password]]

1:32 jonasen: wingy: Why not pass id as an argument?

1:32 wingy: jonasen: how do you mean?

1:33 jonasen: wingy: (q '[:find ?account :in $ ?id :where ...] my-db id)

1:35 wingy: jonasen: didn't know you could do that (just started to read the tutorial)

1:35 thx a lot

1:36 lancepantz: ChongLi: thank you!

1:55 lpvb: I want to use a more powerful editor but emacs has a loot of unfriendly to remember keybindings

1:55 :(

1:56 ivan: lpvb: I use CUA mode and do some rebinding (esp. ESC -> ctrl-g)

2:06 wingy: how come that i have no :session key in my req object

2:06 i think i have to use wrap-session

2:07 Sgeo: Ran 69 tests containing 69 assertions. 2 failures, 29 errors.

2:07 I think the safest conclusion is that I suck.

2:14 lpvb: arghh, 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.

2:20 clj_newb_234: how do I get lein to include clojure.contrib.math

2:20 what do I put into project.clj

2:42 wingy: to destroy the session info i just send an empty session back?

2:44 i sent {:session nil} and it seems to work

3:18 * Sgeo is starting to wish he had a paredit-like thing in other languages

3:18 fredyr: anybody who knows how to output unescaped things with clojure.data.xml?

3:18 (emit-str (sexp-as-element [:tag {} "
"]))

3:19 gives me 
 which isn't really what i wanted

3:48 lpvb: amusing: https://www.youtube.com/watch?feature=player_embedded&v=1JZnj4eNHXE

3:49 Sgeo: asdfasdfasdf

3:49 So:

3:49 I am completely able to define the function that I want at the REPL

3:49 Just can't do it from within this project for some stupid reason

3:50 As in, can't load it from the file or it will try to pass some Java method more than 20 parameters

3:50 I don't get it at all

3:50 wtf

3:53 fredyr: lol LadyJava

3:54 Sgeo: And I'm still having trouble trying to rewrite delimc to not force :use on everyone

4:16 I suppose I shouldn't fault Clojure for the existence of garbage libraries.

4:17 After all, Haskell also has garbage libraries.

4:26 SegFault1X: Sgeo: That's a pretty useless thing to say.

4:28 Sgeo: Pretty much every single language ever has garbage.

4:49 Raynes: Sgeo: You can use paredit in other languages.

4:49 emacs-starter-kit has some paredit-for-other-langs goodies, but it probably works out of the box for other languages too.

6:42 lancepantz: what the up to date way to use clojure.contrib.math

6:42 i need an exponent function

6:48 vijaykiran: lancepantz: clojure.math.numeric_tower ?

6:48 https://github.com/clojure/math.numeric-tower/blob/master/src/main/clojure/clojure/math/numeric_tower.clj

7:25 qerub: Is there some library that macro-generates a deftest from a table of test cases (like '[[x (->camelCase x) (->CamelCase x)] ["camel-case" "camelCase" "CamelCase]])?

7:28 augustl: hmpf, the fact that the "body" of Ring http requests can only be read once is proving to be a major pain in the ass

7:28 if some middleware somewhere reads it, then all other middlewares that depend on it will fail miserably

7:29 there should probably be some sort of convention for how a middleware that reads a body that can only be read once should behave..

7:30 qerub: augustl: +1

7:31 augustl: also, side effects sucks.. :P

7:36 the multipart-params middleware in ring core reads body but doesn't seem to be making any attempts of making it readable by other middlewares

7:38 the 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..

7:38 anyone knows if there's possible to read a java.io.InputStream multiple times somehow?

7:40 the 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

7:44 qerub: augustl: For reference, Rack solves it this way: http://rack.rubyforge.org/doc/Rack/RewindableInput.html

7:45 augustl: qerub: same problem there it seems

7:46 would make sense if middlewares didn't assume what the content of :body was..

7:47 so that I could turn :body into a byte array instead of an input stream, but then the multipart middleware would break

7:50 qerub: augustl: Maybe you can file an issue on https://github.com/ring-clojure/ring/issues to get the discussion going?

7:50 augustl: I think Rack request bodies are required to be "rewindable", i.e. always saved for future reads.

8:45 augustl: qerub: the more I think about it, the more I conclude that Ring is doing the right thing

8:46 after 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

8:46 I'll think about it some more before posting an issue..

8:46 antares_: augustl: Rack developers themselves don't recommend doing exactly what Rack is doing

8:46 lots of pain points and not-so-great features around streaming and middleware composition

8:53 augustl: antares_: indeed, if the body is a 100mb file upload (which it might be in my case) reading it twice is a bit silly..

12:51 fckw: Hi there.

12:51 I have a question: I am currently learning on how namespaces work in clojure.

12:51 You can use (use 'my.namespace).

12:51 (And others like require etc.)

12:52 Why do I have do use the single apostrophe before the namespace name?

12:52 SegFault1X: fckw: To quote it.

12:52 fckw: It's quoting - I know. But why do I need to quote it?

12:52 Iceland_jack: fckw: so it doesn't get evaluated

12:53 fckw: So it's a symbol then that needs to be quoted?

12:53 SegFault1X: fckw: And because under the hood it's just calling require/refer for you.

12:54 fckw: Hm, I'm still sometimes a little confused when to use a string, a symbol or a quoted symbol in clojure.

12:54 SegFault1X: fckw: Sometimes it depends on the form in question.

12:55 fckw: @SeqFault1X: Ah, I see. And how do I find out which form requires with input?

12:55 SegFault1X: fckw: Documentation.

12:55 Or ask, or google.

12:55 fckw: :)

12:57 SeqFault1X: Thanks for your answer.

12:57 SegFaultAX: fckw: No problem.

12:59 fckw: Apparently it has to do with clojure.lang.Namespace/find requiring a symbol when trying to lookup the appropriate namespace.

13:01 fckw: Ok. How did you find this out?

13:01 SegFaultAX: fckw: Reading the source.

13:01 fckw: Source of namespace.clj?

13:02 SegFaultAX: fckw: clojure/core

13:03 fckw: Hm, alright. Still lot of things to figure out for me.

13:06 This 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:06 SegFaultAX: fckw: That's basically the de facto resource for learning about Clojure's namespacing.

13:15 fckw: So, 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:15 metellus: fckw: no, use and require are all you need

13:19 fckw: @metellus: But why does the following example not work then:

13:20 (ns foo)

13:20 Sorry, rather:

13:20 (ns 'foo)

13:20 (defn myfunc [a b] (* a b))

13:20 (ns 'bar)

13:20 (myfunc 4 5)

13:21 It says: FileNotFoundException

13:21 Also when I now say: (use 'foo)

13:22 rhickey: how 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 using lein localrepo leaves lein complaining: Could not find artifact local.repo:clojure:pom:1.5.0-alpha6 in clojars/central

13:22 which seems harmless for lein repl, but I am using tooling calling `lein classpath` and the warning is in the output

13:24 hiredman: the 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:24 pjstadig: that's usually what i do with a custom clojure build, too

13:25 rhickey: Isn't that what localrepo is doing for me?

13:25 I've read that similar problems crop up with mvn install

13:26 pjstadig: i've never used lein localrepo myself

13:26 i usually either do the mvn install or at work we have an archiva instance that we put some jars into

13:26 rhickey: I don't want to use the proper clojure name/group and mess up other things

13:28 pjstadig: rhickey: you did a `lein localrepo install something something`?

13:29 rhickey: pjstadig: yes

13:29 lein localrepo install ~/dev/clojure/clojure.jar local.repo/clojure 1.5.0-alpha6

13:29 and lein repl runs, with that jar, after complaining

13:29 hiredman: pjstadig: is it normal for lein to search through repos in order and print warnings for each repo where it cannot find whatever?

13:30 rhickey: but lein classpath puts the warning in the output, spoiling things for downstream tooling

13:30 fckw: ok, need to quit. Thanks, guys.

13:30 Bye.

13:32 rhickey: I'd much rather just have an {:unreproducible-classpath-extension path/to/jar} in project.clj

13:33 there's something fundamentally wrong about having to produce pseudo-deployed artifacts for wip

13:33 trying to play along, but no joy

13:33 pjstadig: i 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:34 not sure if that is lein or the maven code printing the warning

13:34 rhickey: it's in .m2

13:34 pjstadig: yeah that's weird

13:34 rhickey: it's something to do with a pom

13:34 pjstadig: i don't get any warnings for something that's in my .m2

13:34 sounds like it might be

13:34 rhickey: not using mvn install leaves it pom-less

13:36 manually copying the pom shuts it up

13:37 thanks guys

13:51 holo: hi

13:51 OE: hey

14:11 Sgeo: Maybe if I actually take the time to comprehend how delimc works, I'll be able to fix it

14:11 And learn something in the process

14:22 bonega: Is there a standard clojurescript macro for making this nicer? (set! (. obj field) value)

14:26 hiredman: bonega: (set! (.-field obj) value)

14:27 Gosh: If I use (:import ..) inside the ns macro it does not work, but if I use it outside it works. Any ideas?

14:27 bonega: hiredman: thanks thats better. But would prefer (set! obj -field value)

14:28 suppose there are some good reason

14:29 Gosh: I am lunching a repl with this single file. Maybe should I compile it?

14:30 CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: Display, compiling:(NO_SOURCE_PATH:1)

14:30 this is the error

14:30 hiredman: Gosh: the file is missing an import of the Display class from whatever package

14:31 Gosh: (ns test

14:31 (:import (org.eclipse.swt.widgets.Display)))

14:31 if I use (ns test) (import org.eclipse.swt.widgets.Display)) it works

14:31 hiredman: Gosh: a. don't use single segment namespaces, b. that is not a correct import statement

14:32 Gosh: what is the difference between (:import (org.eclipse.swt.widgets.Display)) and (import org.eclipse.swt.widgets.Display)) ?

14:32 Gosh: I have no idea.

14:33 There was an example with marged ns and import

14:33 hiredman: Gosh: just look at the text

14:33 Gosh: can oyu do that?

14:33 hiredman: what is different?

14:34 Gosh: Are you asking me if is it syntacticaly correct or what?

14:35 http://clojuredocs.org/clojure_core/clojure.core/import here

14:35 hiredman: I 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:35 visually

14:36 Bronsa: Gosh: he's guiding you to understand the error

14:37 i think.

14:37 Gosh: lol, I do not get it

14:37 cuz org.eclipse.swt.widgets.Display is the same in both instances

14:37 hiredman: ok, what about the rest?

14:37 kmicu: (:import vs (import

14:37 metellus: what else?

14:38 Gosh: I do not know mybe it is a special form and you can do it

14:38 Bronsa: this is fun

14:38 Gosh: (import ) = fun call?

14:38 wtf

14:38 lol

14:38 are you gonna answer me or what

14:39 metellus: (:import (org.eclipse.swt.widgets.Display))

14:39 hiredman: Gosh: 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:39 metellus: (:import org.eclipse.swt.widgets.Display)

14:39 (:import (org.eclipse.swt.widgets.Display))

14:39 now they are lined up

14:39 one above the other

14:39 find the differene

14:39 hiredman: Gosh: org.eclipse.swt.widgets.Display is infact the opposite of what I am asking about, because that string is the same in both

14:40 Gosh: import its the same aswel

14:40 the rest I dont know

14:40 if the syntax is correct

14:40 Sgeo: Forget about the syntax. Pretend that the language was gibberish.

14:41 kmicu: "Forget about syntax" ;]

14:41 Gosh: i am staring at it 5min alredy lmao

14:42 the "(" surrounding the class name?

14:42 metellus: yes!

14:43 kmicu: stop teasing him ;) Gosh: http://www.infoq.com/presentations/Clojure-Namespaces-Vars-Symbols you should watch this

14:45 Gosh: nice, now I have to spend 42min to get my answer

14:45 Sgeo: kmicu, I should probably watch that too

14:46 Although I think I have a grasp of it

14:46 metellus: Gosh: as you saw, there shouldn't be parentheses around the class name

14:46 Sgeo: Common Lisp symbols are like Clojure vars rather than Clojure symbols, right?

14:48 Gosh: http://clojuredocs.org/clojure_core/clojure.core/import he puts parentheses around class names

14:48 oh nvm

14:48 I see it now

14:48 kmicu: the path to enlightenment is long and difficult

14:48 metellus: you either need no parens at all of you need '()

14:48 or you need*

14:49 Gosh: the reason is that if you just put parentheses, then Clojure tries to treat it as a function call

14:49 ,(+ 1 2)

14:49 vs

14:49 clojurebot: 3

14:49 metellus: ,'(+ 1 2)

14:49 clojurebot: (+ 1 2)

14:49 Gosh: I know this

14:49 hiredman: metellus: stop

14:50 Gosh: I though ns were something special

14:51 hiredman: Gosh: I would not recommend listening to metellus, he is just confusing things

14:51 Gosh: ns is special, it is a macro, and you don't quote in it

14:51 Gosh: you said "I see it now" so you see the difference between the example and what you were doing?

14:56 Gosh: I 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:56 hiredman: ns is a macro, the usual evaluation rules don't apply

14:58 Gosh: ok, thanks

14:59 kmicu: Just out of curiosity, do any of you use Programmer Dvorak xor Colemak layout?

15:00 tomoj: I use programmer dvorak

15:06 kmicu: tomoj: Any problems with emacs/vim? And whether the change was worth the price? ;]

15:07 I want to move to P.Dvorak/Colemak and drop this qwerty malarkey

15:08 tomoj: I use emacs, haven't noticed much problem. but I think I learned emacs after switching to dvorak

15:09 hard to say whether it was worth it therefore

15:09 kmicu: tomoj: one question - do you want to go back to qwerty goofiness? ;)

15:11 "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:11 chouser: I don't think that's true

15:11 "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:13 kmicu: but the most commonly used characters are not on the homerun :/

15:15 nvm, let's get back to clojure

15:19 homerow* ;)

15:28 tomoj: kmicu: no way

15:28 even programmer dvorak over dvorak seems like a no brainer for clojure, not having to hit shift for (,[,{ etc

15:30 AimHere: A simpler fix would have Caps Lock locking shift for everything

15:30 And then using the olde Lispe notionne of making it case-insensitive

15:34 Apage43: is autodoc still kept up somewhere?

15:45 Urthwhyte: is there a way to unpack a vec and use it as function args?

15:45 i.e (+ (unpack [1 2)) => 3

15:46 algernon: Urthwhyte: (apply + [1 2])

15:46 Urthwhyte: thank you algernon :0

15:46 s/0/)/

15:47 wunki: I have one outputstream which I want to attach two consumers to, anyone tips how to do that?

15:57 oich: what 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:57 or (require 'clojopts.core)

15:59 never mind...

16:06 uroborus_labs: Where would the proper or idiomatic locations to store files needed for tests?

16:06 In the "test" directory or is it ok to create a directory at the project root?

16:08 SegFaultAX|work: uroborus_labs: Why not the test directory in the root of the project?

16:10 gfredericks: I think you can make a test-resources as well if you like separating the code from the other files

16:11 uroborus_labs: Ok thanks, I think i will go the test-resources route

16:11 gfredericks: you might have to add a lein option to make it work; check the lein sample-project.clj if it doesn't.

16:11 tomoj: you can put them in dev-resources, or add :resource-paths "test-resources" or whatever to the :dev profile

16:11 er, ["test-resources"]

16:24 Gosh: Why 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:25 Sgeo: import is not a macro. ns is.

16:25 The :import form in the ns does not need quoting around stuff, since a macro is reading it. But import is a function.

16:25 Hmm, hold on, I may be wrong

16:26 Gosh: import is a macro

16:26 (import '(package classes)) = (import (package classes))

16:26 why?

16:26 clojurebot: why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

16:26 Sgeo: Don't know. Consistency with functions such as use?

16:28 Gosh: Clojure is inconsisten as ****. For some keywords you can pass arguments inside a vector and for some inside a list. Its confusing.

16:30 Sgeo: Lists conventionally tend to imply special significance to the first element, while vectors don't

16:31 (import '(java.util Date Calendar)) ; the first element of the list has special significance, it is the prefix for the other classes

16:31 There are worse inconsistencies in Clojure, which I blame on Java

16:49 kmicu: dnolen: nice work ;) https://github.com/clojure/clojurescript/commits/source-map I thought that the project is dead

16:49 gfredericks: Gosh: the ns macro in particular isn't something anybody is proud of

16:50 dnolen: kmicu: heh it's not done, been hoping to get some help on it but still no takers.

16:51 Sgeo: Hi dnolen

16:52 zilti: I'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:52 Sgeo: I 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:53 kmicu: dnolen: where is an issue tracker for cljs1-source-map project? ;)

16:53 dnolen: kmicu: no issue tracker beyond the source :)

16:54 Sgeo: Incidentally, 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:55 dnolen: Sgeo: it's a brain twister. I suspect Chris Frisz's CLJTCO will be more useful for implementing proper delimited continuations for Clojure.

16:55 zilti: Sgeo: Better use (defn- foo [] ...) or (let [foo (fn [] ...)])

16:56 * Sgeo just wants to write a one-liner function to make monads VERY nice to use in Clojure

16:56 hugod: zilti: if you are running ritz-nrepl, then you need to make sure you are using one of the provided "complete" ops

16:57 Sgeo: zilti, uh, the function is intended to be in a library, to be used by other code

16:57 dnolen, 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:59 zilti: hugod: Where can I find that?

16:59 dnolen: Sgeo: what's the error you're seeing?

16:59 Sgeo: Something about trying to give more than 20 parameters to a methods

16:59 method

17:00 hugod: zilti: https://github.com/pallet/ritz/tree/develop/nrepl#provided-nrepl-ops

17:00 Sgeo: This was last night, I don't have it open still

17:00 hugod: zilti: I see the links don't go anywhere :(

17:01 zilti: hugod: some go

17:01 dnolen: Sgeo: yeah, I don't know and I don't have time to dig into it.

17:02 zilti: hugod: Ok and where do I need to tell ritz which ops to use?

17:03 hugod: zilti: 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:04 you can put these in your user profile too, I believe

17:07 zilti: hugod: I get a java.lang.ClassNotFoundException: complete.core

17:10 hugod: zilti: 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:21 zilti: hugod: What's the dependency for complete.core? I can't find that one.

17:22 hugod: zilti: clojure-complete "0.2.2"

17:22 clojurebot: Cool story bro.

17:22 zilti: thanks

17:33 Nice. It completely stopped to work now. Exception in thread "main" com.sun.jdi.InvocationException: Exception occurred in target VM

17:40 wingy: is there a way to remove the namespacing in keywords eg. from :item/name to :name

17:42 tomoj: (comp keyword name)

17:44 wingy: (name keyword) worked

17:44 thx

17:44 oh forgot it returned the string

17:45 nightfly_: (keyword (name ::example))

17:45 gfredericks: ,((comp keyword name) ::example)

17:45 clojurebot: :example

17:46 arrdem: ,(name :foo)

17:46 clojurebot: "foo"

17:46 arrdem: bau5. didn't know that was a thing.

17:46 gfredericks: (def remove-initial-colon (comp keyword name)) ;; worst named function evar

17:53 Raynes: &(-> ::foo name keyword)

17:53 lazybot: ⇒ :foo

17:53 gfredericks: &:::::::foo

17:53 lazybot: java.lang.RuntimeException: Invalid token: :::::::foo

17:55 Sgeo: Metadata on the var rather than the fn still annoys me

17:55 It means that that def isn't equvalent to using (defn remove-initial-colon [x] (keyword (name x)))

17:55 And it means that comp doesn't preserve the arglists of the first function

17:57 technomancy: yeah, it's very annoying

17:59 gfredericks: booo certain things!

17:59 S11001001: Sgeo: Lisp is reinvent def :)

17:59 technomancy: my implementation of partial for Leiningen tasks maintains arglists info

17:59 tomoj: what are some reasons _for_ metadata on the var?

18:00 technomancy: tomoj: way back in the day you couldn't attach metadata to functions

18:01 tomoj: that's.. not what I wanted to hear :(

18:01 gfredericks: easy fix?

18:01 technomancy: possibly before clojure 1.0-ish

18:01 Sgeo: Backwards compatibility for the loss!

18:01 gfredericks: could start attaching to both for backward compatibility

18:01 S11001001: ,(-> (fn [] 42) (with-meta {:x :y}) meta)

18:01 clojurebot: {:x :y}

18:02 Sgeo: S11001001, what did you mean by <S11001001> Sgeo: Lisp is reinvent def :)

18:03 S11001001: Sgeo: solution in any Lisp is always replace with your own version :)

18:08 gfredericks: takes a lot of work to replace it in clojure.core as well

18:16 amalloy: functions 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:17 gfredericks: ,(map type [(fn [] 3) (with-meta (fn [] 3) {:x :y})])

18:17 clojurebot: (sandbox$eval27$fn__28 clojure.lang.AFunction$1)

18:17 gfredericks: oh. righti.

18:17 amalloy: i think that happened in 1.4

18:17 gfredericks: amalloy: so what's the effective difference?

18:18 amalloy: gfredericks: 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:21 technomancy: supposedly 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:22 Sgeo: Knobs?

18:22 Like Common Lisp's declare/declaim/proclaim ?

18:22 (declare (optimize (speed 3)))

18:22 arrdem: ... proclaim?

18:22 danlarkin: mythic future knobs

18:22 technomancy: Dynamic |--x-----------| Memory-lite

18:23 danlarkin: along with clojure-in-clojure

18:23 Sgeo: http://www.lispworks.com/documentation/lw50/LWUG/html/lwuser-90.htm

18:23 danlarkin: what're the odds on cic coming before knobs

18:26 gfredericks: ,(printf "The odds are %d." (rand-int 10))

18:26 clojurebot: The odds are 2.

18:26 technomancy: clojurebot: never tell me the odds

18:26 clojurebot: Titim gan éirí ort.

18:27 gfredericks: what the heck did he just learn

18:27 amalloy: welsh, right?

18:27 or maybe gaelic?

18:27 arrdem: (inc technomancy )

18:27 lazybot: ⇒ 2

18:27 gfredericks: no I mean what state-change did technomancy cause

18:28 amalloy: gfredericks: none

18:28 technomancy: who knows what evil lurks in the heart of clojurebot

18:28 ...only the hiredman knows

18:30 amalloy: (except insofar as he changed your state to remember him speaking in tongues)

18:30 gfredericks: clojurebot: The odds |aren't|

18:30 clojurebot: It's greek to me.

18:30 gfredericks: clojurebot: The odds |aren't|.

18:30 clojurebot: In Ordnung

18:30 gfredericks: ~odds

18:30 clojurebot: The odds aren't .

18:30 gfredericks: erk

18:30 arrdem: ... is clojurebot okay?

18:30 gfredericks: he's just this guy you know

18:32 arrdem: clojurebot: are you okay?

18:32 clojurebot: Pardon?

18:33 arrdem: oh well...

18:33 I was hoping for Eliza or worse

18:35 gfredericks: oughtn't be too hard to embed a cleverbot impl

18:40 arrdem: clojurebot: limited

18:40 clojurebot: limited is time

18:40 dlitvak: clojurebot: help commands

18:40 clojurebot: help is http://clojure.org

18:41 technomancy: this gets my goat every time: No method in multimethod 'do-copy' for dispatch value: [java.net.URL java.io.File]

18:42 danlarkin: yeah that is a shame

19:40 ssurgnier: Is there an equivalent to reshape/cast in incanter? I found incanter.core/deshape for melting but no luck yet on casting.

20:09 wingy: does anyone know when clj 1.5 will be here?

20:09 if i am doing a new web app should i use 1.5 master snapshot or 1.4?

20:09 casion: 1.4

20:12 * Sgeo should go back to reading the delimc code

20:13 Sgeo: Although, I can't help but wonder if I could do... better somehow

20:13 As it is, functions based on shift are not realistically usable from functions not processed through the transform

20:13 casion: Sgeo: what is it exactly?

20:14 Sgeo: casion, delimited continuations for Clojure

20:16 casion: google is useless here :|

20:16 Sgeo: Hmm, I may be mistakne

20:17 Try googling for shift and reset

20:17 http://en.wikipedia.org/wiki/Delimited_continuation#Examples

20:17 casion: Sgeo: I'm working through that

20:18 Sgeo: Using it leads to, in my opinion, a nicer way of using monads than do notation.

20:20 casion: I have quite a few levels of terminology to absorb before I understand any of this apparently

20:21 Sgeo: (reset (+ 1 (shift k CODE)))

20:21 Whenever the shift expression returns, the + 1 is skipped

20:21 within 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:22 casion: why is the + 1 skipped?

20:23 Sgeo: Because that's how shift and reset are defined, it's presumably convenient to be able to not execute the continuation

20:23 The + 1 will only be done when k is called

20:23 (reset (+ 1 (shift k 0)))

20:23 ;; 0

20:24 casion: why wouldn't k be called?

20:24 or when?

20:24 Sgeo: casion, if the body of the shift doesn't call it, it won't be called

20:24 (reset (+ 1 (shift k (k 5)))) ;; 6

20:25 casion: so if K is not called, then the third item in the form is returned for (reset)?

20:26 k, sorry

20:26 amalloy: (reset (+ 1 (shift k (map k [5 6])))) ;; (6 7), right?

20:26 casion: and if k is called, then the body of shift is replaced with the resulut of k

20:26 do I have that correct?

20:26 napping: k is a binder there, bound to #(+ 1 %)

20:27 Sgeo: amalloy, yes

20:27 casion, better to think of it that the reset will be replaced with the result of the body of the shift

20:27 Which can itself, by calling k, call the rest of the stuff between the reset and shift

20:28 Because k can be called multiple times

20:28 casion: ...

20:28 amalloy: casion: the chunk of the call stack between reset and shift is "copied" into the function k

20:28 casion: amalloy: ahhh

20:28 amalloy: and used iff k is actually called

20:28 casion: ok, that makes more sense

20:29 when would this be useful then?

20:29 (and thank you for taking time to explain it)

20:29 Sgeo: It allows for arbitrary control flow

20:30 casion: Sgeo: can you give a basic example of how k being called or not produces some useful functionality?

20:30 Sgeo: And 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:31 Uh. I'm not especially experienced with continuations.

20:31 casion: I do believe I understand how it works, but not the application

20:31 amalloy: casion: one example is implementing exceptions in terms of continuations

20:31 casion: would you do exceptions with it maybe?

20:31 I need to learn to read the screen while I type if amalloy is around

20:31 amalloy: hah

20:31 napping: http://okmij.org/ftp/continuations/

20:31 amalloy: you can also implement something like lazy sequences with continuations

20:32 bfabry: I'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:32 casion: brb, I have more questions in a minute or two

20:32 amalloy: and 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:33 bfabry: 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:34 bfabry: amalloy: I know its contents. The entire thing needs to be flattened to go on from here.

20:35 amalloy: for some background on the purpose, I'm converting a nested map into a rails-compatible url query string

20:36 amalloy: okay, so write the function and use it. it's certainly not in the standard libs or in useful

20:36 bfabry: it 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:38 Sgeo: Why does apply concat bother me so much?

20:38 casion: bfabry: zippers?

20:38 Sgeo: Is it because I'm used to Haskell's concat just taking a list of lists?

20:39 And the fact taht concat doesn't... confuses me a bit I guess

20:39 Although it makes sense

20:39 bfabry: casion: 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:40 casion: bfabry: I'd imagine clojure.zip/next is what you want

20:40 bfabry: though you could be more efficient than that usually

20:42 bfabry: casion: 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:42 Sgeo: Universally flattening everything is rarely correct

20:43 amalloy: bfabry: https://gist.github.com/3850118

20:44 bfabry: Sgeo: I'm not universally flattening everything. I am flattening a specific thing that needs to be flattened.

20:44 amalloy_: interesting! thank you

20:44 wingy: aren't these equivalent: (ns (:use [datomic.api :only [q db] :as d])) vs (ns (:require [datomic.api :refer [q db] :as d]))

20:48 i guess not .. the latter gave me error on console

21:02 my bad .. it actually is the same .. the error was due to something else

21:03 now i can have :require only instead of mixing it with :use :)

21:36 doctordaebak: hello all. anyone aware of the parallella project?

21:36 project to make a 16-core computer for $99.

21:37 everyone who'd like to see clojure eventually running on this, please check out this page:

21:37 http://www.kickstarter.com/projects/adapteva/parallella-a-supercomputer-for-everyone

21:37 the company seems to be solid and they have delivered real products before.

21:38 those interested, please pass the word on. thanks.

21:52 gfredericks: my advanced cljs code still has whitespace present; what's the cljsbuild option for removing that?

22:32 Sgeo: Oh, it's Enlive that has trouble with arbitrary XML

22:32 For some reason I thought Hiccup

22:46 leafw: ,(println 1)

22:46 clojurebot: 1

22:50 wingy: does clojure have functions for parsing/building URL query strings?

22:51 from maps

22:51 http://stackoverflow.com/questions/9745566/how-to-convert-map-to-url-query-string-in-clojure-compojure-ring

23:10 how do you generate a random nr in clojure?

23:12 Raynes: nr?

23:12 clojurebot: nrepl is a network REPL implementation: http://github.com/clojure/tools.nrepl

23:16 wingy: Raynes: number

23:16 Raynes: &(rand)

23:16 lazybot: ⇒ 0.18493043508556506

23:17 Raynes: &(long (rand))

23:17 lazybot: ⇒ 0

23:17 Raynes: Super long.

23:18 wingy: Raynes: cool!

23:18 Raynes: &(long (rand 10000000000))

23:18 lazybot: ⇒ 6040549939

23:19 wingy: nice

23:30 amalloy: &(rand-int 1564)

23:30 lazybot: ⇒ 1220

23:38 wingy: amalloy: nice

23:39 what is the best way for a key in a map to require another key in the same map

23:39 amalloy: that doesn't make sense

23:41 wingy: amalloy: {:url "http://app.com" :path "#{url}/home"}

23:41 i wanna reuse :url in :path

23:41 Gosh: whats the difference between "." and ".." macro?

23:41 wingy: Gosh: .. is a "chain" macro

23:42 instead of you using multiple . calls you can use .. and then chain all the calls together

23:42 Gosh: and single dot works just for one invocation?

23:42 wingy: yeah

23:42 Gosh: ok thanks

23:42 wingy: i think

23:42 Gosh: Can I use -> and --> instead of dots for java ?

23:44 frio: wingy: i'm pretty sure you can't do that :)

23:45 wingy: Gosh: (. "hello" toUpperCase)

23:45 vs

23:45 (.. "hello" toUpperCase (replace \H \N))

23:45 so i was right

23:45 frio: what 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:45 (although no doubt that last bit can be compressed a bit!)

23:45 brehaut: (-> "hello" .toUpperCase (.replace \H \N))

23:45 ,(-> "hello" .toUpperCase (.replace \H \N))

23:45 clojurebot: "NELLO"

23:46 wingy: frio: i guess

23:46 yeah ill just do that

23:47 brehaut: using bare dot is fairly uncommon; most code uses the sugared method syntax these days and leaves dot for edge cases and complicated stuff

23:47 wingy: brehaut: which means your examples are the way to go?

23:47 brehaut: Gosh: ^ so yes, -> and ->> can be used with java

23:47 amalloy: brehaut: mostly for macros in my experience

23:48 brehaut: makes sense

23:49 amalloy: the number of times i've ripped ~(symbol (str "." method-name)) out of macros...

23:49 brehaut: haha

23:52 wingy: ,(rand-int 1000000000000000)

23:52 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for int: 661653239191293>

23:52 wingy: ,(long (rand 1000000000000000))

23:52 clojurebot: 190712672568951

23:52 wingy: long power

Logging service provided by n01se.net