#clojure logs

2012-05-08

00:01brehautim guessing long-predicate-name?
00:05felideoni guess. we could ask a schemer i would think
00:17tomojhyphen motion?
00:20ibdknoxit's long-predicate-name?
00:20ibdknoxin everything I've ever seen
00:38ynnivecho-area: I'm just getting started with aleph. how bad is memory usage?
00:57emezeskeynniv: I think echo-area was talking about how much memory the compiler used when compiling code that used aleph
00:58ynnivoh, ok. that doesn't bother me
01:09ivanecho-area: aleph takes 21 seconds to load and start an HTTP server here
01:09ivanis that unusual for a large amount of Clojure code?
01:09ivanI think aleph imports a lot of stuff
01:12felideonibdknox: still here?
01:33fliebel$mail
01:40wei_how do I change an agent's value in an error handler function defined by "set-error-handler!"?
01:47muhoois there some trick to pass a form to a macro that refuses to accept anything other than a string?
01:47muhooi.e. defpage in noir
01:47ibdknoxwhat are you trying to do?
01:48muhoo(defpage (str compose an url "/" like this) {...)
01:48muhooit'll work if i do, (def temp-hack (str compose an url)) (defpage temp-hack ...)
01:49muhoomaybe i need a ` or something
01:49muhoomacros are still somewhat mysterious to me
01:49ibdknoxthe latter is the only way to really do it in noir
01:49ibdknoxthough I'm curious why you're dynamically creating urls?
01:50muhootrying to eliminate the pages of boilerplate :-)
01:50ibdknoxcan you not just do it with route segments?
01:50muhoosome of it
01:51RoxxiDoes anyone know of an example of setting up a resources directory using lein-ring ?
01:51muhooi can combine things like (str stuff "/:id/:action") and then switch on {:keys [id action]}
01:52muhoobut that (str stuff) bit is what's making noir unhappy
01:52RoxxiI specified the :resources-path key, as well as a route for resources and files... but whenever I try to get index.html at my :resources-path it keeps returning not found
01:52muhooi have like 5 models, all have identical form machinery (crud stuff), so i'm experimenting with ways to eliminate the boilerplate.
01:58felideonibdknox: hey, I sent another pull request that improves the last one you merged. would be great if you could check it out. https://github.com/ibdknox/Korma/pull/61
02:12muhooibdknox: to give you some idea of where i'm trying to go: https://www.refheap.com/paste/2646
02:13muhoothat's like half the code of each view, which is duplicated in each.
02:13muhooso i'm trying to abstract it out somehow
02:15ibdknoxyou could do it with a macro
02:16ibdknoxor do it as a compojure route set
02:22muhoocompojure route set inside of noir?
02:26muhoocustom-handler, looks like
02:26muhoocustom-handler*, sorry
02:29Raynesibdknox: Did you seeth my comments on those noir pull requests?
02:29ibdknoxRaynes: I did
02:29ibdknoxit shouldn't be 307
02:29ibdknoxit should be 302
02:29ibdknoxas some bots still only accept http 1.0
02:30Raynesibdknox: Should I accept the request and change the status code?
02:31ibdknoxsounds reasonable
02:31ibdknoxRaynes: thank you much for helping out there
02:34felideonibdknox: anyone helping you out with korma?
02:35felideonnow or in the near-future
02:35ibdknoxnot currently, though I would especially love that one. I'm not in need of SQL anytime in the near future, which means I can't afford to spend tons of time on it
02:36RaynesHe is in dire need of a table of light, however.
02:36ibdknoxso someone who has more vested interest will probably do a better job than I currently would
02:36ibdknoxdude, who would not want a table made out of light
02:36ibdknoxthat sounds awesome
02:36ibdknoxRaynes: can haz plz?
02:36Raynesnowai
02:37felideonyou mean something like http://www.microsoft.com/surface/en/us/default.aspx ?
02:37felideon<grin>
02:37hiredmanI thought it was just really light, you know, made at of aluminum or something
02:37ibdknoxhiredman: lol
02:37RaynesI had a dream that hiredman and I had a brief conversation on IRC.
02:37ibdknoxfelideon: my goal is to get microsoft to give me one of those at some point ;)
02:38ibdknoxfelideon: though that website is *awful*
02:39amalloystill time to pledge, now that you know it's a table made of light (or take back your pledge if you were really excited about the aluminum, i guess)
02:40ibdknoxspeaking of awesome: Tim O'Reilly emailed me back :)
02:41Raynesibdknox: What did he say!?
02:41ibdknoxHe invited me to Foo camp to come talk about it :D
02:43hiredmanamalloy: I thought I was getting a really good price on that al
02:48fliebelWhoa, a few Clojury features python has that I was unaware of: http://python3porting.com/improving.html
02:50fliebelclojure-py does seem to use Python fractions, but they are a bit broken..
02:52ivanhm, what's wrong with them?
03:07fliebelivan: CompilerException: Compiler Exception don't know how to compile <class 'fractions.Fraction'>
03:08fliebelhttps://gist.github.com/650e02b154d2ebde1202
03:09fliebelThe just don't work at all
03:09emckenI wrote a lazy parsing of a big csv file and now I would like to insert the data into a database without opening and closing the db connection for every row - just can't figure out how to do it
03:11fliebelemcken: Could you explain why you can't reuse a connection?
03:13emckenfliebel: because I don't have enough experience with Clojure *heh*
03:13emckenfliebel: I can loop parse the csv file -> open the db connection -> write row to db
03:14fliebelemcken: So the goal is to move the connection up a level? define it as a top level var, or pass it around
03:14emckenfliebel: but can't figure out how to do something along the lines: open db -> parse csv file (1 line at the time lazy) -> write it to the database
03:15fliebel(let [con (open db)] (map (partial parse con) (line-seq csv)))
03:17emckenfliebel: yeah my problem is I can't figure out how to seperate the functions "with-connection" and "insert-record"... I'm pretty new to clojure
03:18fliebelemcken: separate?
03:19fliebelinside parse you could just do (with-connection con (insert-record blah)). You could bind the connection above that, but then you need to force the lazy seq.
03:20fliebelWhy do you want a lazy seq, if you just insert everything into the DB anyway?
03:21fliebel(with-connection (open db) (doseq [line (line-seq csv)] (insert-record (parse line)))
03:21emckenfliebel: I though doing (with-connection con (insert-record blah)) opens and closes the connection to the db everytime "with-connection" is called
03:22fliebelemcken: no, it just binds the given connection.
03:22fliebeltry (macroexpand-1 '(with-connection blah)) in a repl.
03:23emckenfliebel: ahh well I guess its working the way it should already... thanks a lot
03:23fliebelI bet it gives you something like (binding [*connection* blah])
03:32emckenfliebel: (macroexpand-1 '(sql/with-connection db (sql/insert-record "bbr" (parse-row test)))) gives...
03:32emckenfliebel: (clojure.java.jdbc.internal/with-connection* db (clojure.core/fn [] (sql/insert-record "bbr" (parse-row test))))
03:33fliebelok, remove the -1, see where it goes
03:33emckenfliebel: (doc with-connection) says: Evaluates body in the context of a new connection to a database then closes the connection.
03:33fliebeluh? oh... really? hrm...
03:34fliebelOk, then you'll need to skip the lazyness. From what I can tell, you don't really need it.
03:37fliebelemcken: Why are you using a lazy seq?
03:38emckenbecasue if I don't the size of the csv file will make my machine run out of memory
03:39amalloyso it occurred to me this evening that you can't pass functions to macros. this seems like something that is rarely (but not never) useful, and not fundamentally impossible
03:39amalloyfor example, you might have https://gist.github.com/2633304 and want (locals-map keyword [a b]) to expand to {:a a :b b}. currently that can't really work, because the macro receives the symbol keyword, not the function keyword
03:39amalloybut this also seems kinda like a crazy thing to want. does anyone have opinions/feedback on it?
03:43fliebelamalloy: Hold on, I'm forming one...
03:43emckenfliebel: I've just looked at you example again... I think I misread it before... it suddenly makes sense :)
03:46fliebelamalloy: I don;t know enough about fexprs to form the opinion I wanted, so I'll try to form another one.
03:46amalloyhaha
03:48kralnamaste
03:49fliebelamalloy: (defmacro foo [f] ((resolve f) 2 2))
03:50amalloyfliebel: sure, but then you can't pass, for example, (comp name first)
03:50fliebelamalloy: No... eval? :-\
03:51clj_guest002String is automatically defined to be java.lang.String in my *.clj files. I don't want this to happen. How do I hide java.lang.String ?
03:53fliebelamalloy: I would say passing a function to run at macro expansion time is an optimization in any case I can think of.
03:54amalloyfliebel: no way, not even in the example i gave
03:55amalloyi mean, i guess you could expand to {(keyword 'a) a, (keyword 'b) b}, so maybe you're right
03:55fliebelyea
03:56clj_guest002argh, help me :-)
03:56clj_guest002how do I prevent String from being auto defined to java.lang.String :-)
03:56fliebelclj_guest002: Why would you want that?
03:56amalloyclj_guest002: adding smiley faces doesn't make it less rude to repeat your plaintive cries after just five minutes of nobody being able to answer you at midnight
03:57al-maisanI wrote a small program that uses pmap (http://tinyurl.com/ctvx4l5) and it takes a minute to terminate after doing the actual "work" .. is this be design or am I doing something wrong?
03:57fliebelamalloy: When I started with Clojure, I wanted to write a template language at acroexpansion time, so it would be fast.
03:57amalloyal-maisan: some of both. it's an undesirable consequence of a design decision
03:58clj_guest002I need to defrecord String to be a [s x y], to be something that I can call drawString on
03:58al-maisanamalloy: aha, what is that design decision?
03:58amalloywhen you're done you can call (shutdown-agents) to kill the pool threads
03:58al-maisaninteresting..
03:59al-maisanamalloy: thanks for the hint! Will try that.
03:59fliebelclj_guest002: The easiest way is not to do that. You always get java.lang imported, and I don;t thik you can exlude it.
04:00fliebelclj_guest002: http://stackoverflow.com/questions/9758279/exclude-java-lang-in-clojure-namespace
04:01clj_guest002fliebel: alright, looks like I really shouldn't' do this
04:01clj_guest002thanks :-)
04:03amalloyhah, i was gonna upvote the second answer to that question before i found out it was just meeee
04:06echo-areaI have a list of files, and I want to read all of them, one by one. I want to reify clojure.lang.ISeq, such that I can read them this way: (doseq [line (reification-of-ISeq-through-the-files)] (do-this line) (do-that line)). But this is not functional: the reified object can't be consumed twice, since as it is used the first time it is changed in place. This seems to contrast with Clojure's philosophy, is there any better design?
04:07echo-areaWhat do you suggest?
04:13fliebelecho-area: So you want a seq of the lines of every file, so that you can repeatedly iterate them?
04:13amalloyi don't see any reason to have this like crazy custom reification, instead of just using for/doseq to iterate over the files, and then the lines within each file
04:14amalloy(doseq [f (file-seq ...)] (with-open [r (reader f)] (doseq [line (line-seq r)] ...)))
04:15Borkdudeass
04:15Borkdudeundo
04:16Borkdudetechnomancy: I just updated heroku, but when I type heroku it sprinkles errors on my screen
04:18Borkdudetechnomancy: ah, re-installing the "toolbelt" worked
04:19echo-areafliebel: Yes, I want to wrap around a list of files, internally it uses line-seq/file-seq, of course
04:20fliebelecho-area: So why not do what amalloy suggested? I don't see the need for the reify either.
04:21echo-areaamalloy: But the reading is inside a call-back, and it is not a contiguous process
04:21echo-areafliebel: That is, I will need to save the current process inside an atom, and resume later
04:23fliebelecho-area: What if you put the internal seq in a cycle, so that you can just keep on reding.
04:23fliebel&(take 10 (cycle [1 2 3]))
04:23lazybot⇒ (1 2 3 1 2 3 1 2 3 1)
04:24echo-areaI can't, as there can be a long time between two reads
04:24echo-areaSome else code calls my code to read.
04:26fliebelecho-area: I don't know, because I don't really understad your problem
04:27amalloyecho-area: you might be interested in http://stackoverflow.com/questions/7134733/tree-search-saving-execution-state as an alternative approach to atoms
04:43michaelr525hey
04:45michaelr525how to implement unescape for string content?
04:45michaelr525it's probably something really simple
04:46echo-areaamalloy_: That looks like continuation. Let me see..
04:46echo-areaThanks
04:51michaelr525haha
04:51michaelr525(read-string) worked for me
04:59emckenIs it possible to abort/break an evaluation in slime-repl (Emacs) without closing it down entirely?
05:01clgvemcken: do you know the rbeak macro which gives you a repl in its call context?
05:01clgv*break
05:03emckenclgv: no sorry :( looking for something which would work similar to Ctrl+c when running scripts from a terminal
05:03robertstuttafordhow do i get ccw to use my lein project.clj when starting a repl? i'm targetting clj 1.4 in my project.clj but my repl always starts with clj 1.3
05:03clgvemcken: oh ok
05:04clgvrobertstuttaford: not yet, I guess. or did they release the leiningen support plugin yet?
05:05clgvrobertstuttaford: to get clojure 1.4 you just have to remove 1.3 from buildpath and add the 1.4 jar
05:05emckenclgv: I found something I think I can use: C-c C-b
05:12robertstuttafordclgv: thank you
05:12robertstuttafordafter following cemerick's video, i have a lein plugin installed
05:13clgvoh ok. so there is a release of that plugin? laurent talked about it some weeks ago
05:13robertstuttafordi think it's still in beta
05:17clgvbut it didnt replace the 1.3 jar by the 1.4 one specified in project.clj?
05:26Borkdudehmm how I could save the gamestate per session, without making the model dependent on noir… https://github.com/Borkdude/tictactoe
05:26Borkdudeit's now hosted here http://webtictactoe.herokuapp.com/
05:27BorkdudeI could just save the gamestate in the view
05:27Borkdudeand give it to the model
05:31DukePatienceQuick question. Why Clojure and not CL?
05:33vijaykiranQuick answer. JVM
05:33DukePatienceOther than easy cross-platformism, what does JVM have that CL doesn't?
05:35BorkdudeDukePatience: for me the initial reason was: I can't change my environment (JVM/.NET), so how can I use Lisp in this environment
05:44_KY_If I call (eval), which namespace will it use, and how can I change it?
05:45_KY_(Sorry brb...)
06:10clgvDukePatience: an existing library for almost every problem ;)
06:39_KY_I want to set the namespace for a jar... I checked that it's set to "clojure.core"
06:39_KY_I mean, that's the namespace it uses for "eval"
06:40_KY_When I run java -jar, it doesn't allow me to (eval (ands different.namespace)),
06:40_KY_Saying "Can't change/establish root binding of: *ands* with set"
06:41_KY_Saying "Can't change/establish root binding of: *ns* with set"
06:41_KY_I want to do (eval (ns different.namespace))
06:42clgv&(eval '(let [n *ns*] (println n)))
06:42lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
06:42clgvah right
06:42_KY_&*ands*
06:42lazybotjava.lang.RuntimeException: Unable to resolve symbol: *ands* in this context
06:42_KY_&*ns*
06:42lazybot⇒ #<Namespace sandbox3826>
06:42_KY_&(ns clojure.core)
06:42lazybotjava.lang.ClassNotFoundException: clojure.core
06:42clgv_KY_: using eval like that shows that the namespace is the current namespace
06:43_KY_Well... let's say the namespace I want is genifer.core
06:43clgvbut you can use (in-ns 'bla) to switch to a namespace
06:43_KY_When java -jar starts, it's set to "clojure.core"
06:43_KY_Oh I see...
06:43_KY_That's cool
06:44clgvbut you may have to require it upfront
06:45muhoosleep is a theoretical construct
06:46BorkdudeI was wondering, will session information always remain in memory until the app is restarted? https://github.com/ibdknox/noir/blob/master/src/noir/session.clj
06:47_KY_Where should I put (in-ns ...)?
06:48clgv_KY_: within the eval
06:48_KY_Doesn't seem to have an effect
06:48_KY_Like (eval (in-ns ...) something)?
06:48clgvBorkdude: I think noir uses ring for it - you can check there whether the session has a timeout
06:49clgv_KY_: (eval '(do (in-ns 'my.ns) (do-sth ...)))
06:49_KY_I see...
06:49clgvthe second quote is likely not needed ^^
06:49_KY_The quote before "do" is needed?
06:49_KY_Ahh I see...
06:49_KY_Yes it's needed
06:49clgvyes. otherwise it's executed there.
06:50clgv,(doc eval)
06:50clojurebot"([form]); Evaluates the form data structure (not text!) and returns the result."
06:52_KY_That doesn't work...
06:52_KY_Perhaps, in-ands wraps the eval?
06:52_KY_Perhaps, in-ns wraps the eval?
06:54_KY_Nah... that doesn't work either =(
06:54clgv_KY_: paste an example with description
06:55_KY_I have a function, say (help), that I want to invoke within the namespace genifer.core
06:55_KY_But the user inputs it via (read)
06:56_KY_So I have to (eval (read))
06:56_KY_But the namespace isn't right
06:56_KY_I found out the namespace is clojure.core
06:56clgv_KY_: ah. try (binding [*ns* 'genifer.core] (eval (read)))
06:57clgvor better (let [input (read)] (binding [*ns* 'genifer.core] (eval input))
06:58_KY_That doesn't change the ns
06:58clgvit should
06:58_KY_In fact, I tried to change the ns within the input to (read)
06:59_KY_Came out with error: "Can't change/establish root binding of: *ns* with set"
06:59_KY_Maybe it's fixed in some way
06:59_KY_&(eval (read))
06:59lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
07:00_KY_&(eval *ands*)
07:00lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
07:00_KY_&(eval *ns*)
07:00lazybotjava.lang.SecurityException: You tripped the alarm! eval is bad!
07:00clgvthat prints the namespace 'bla provided that it exists: (binding [*ns* (the-ns 'bla)] (eval '(let [n *ns*] (println n))))
07:01_KY_I see...
07:01_KY_Perhaps it's the jar
07:01_KY_Yeah... it's because of the jar
07:01clgv_KY_: you can have a look at clojail - it always executes code in different namespaces ;)
07:17xumingmingvi am trying composure 0.6.4
07:17xumingmingvwhen i use request in defroutes
07:17xumingmingvit tells me that request can not be resolved, why?
07:18xumingmingvrequest is dynamically bounded magic variable in composure, right?
07:19antares_xumingmingv: it's not magic but it is only available when you are handling a request. By the time routes are defined, there is no request to use.
07:20antares_xumingmingv: plus, please paste your code if you want help on any specifics
07:21xumingmingvok
07:21xumingmingvhttps://gist.github.com/2634328
07:21xumingmingvcode is here
07:26xumingmingvantares_, any suggestions?
07:26xumingmingvI have seen this kind of usage: http://zef.me/2650/on-language-design-magic-variables-in-compojure
07:35antares_xumingmingv: that blog post is from 2 years ago
07:38xumingmingvoh...
07:39antares_compojure tests do not seem to use request anywhere, only specific parts of it
07:44xumingmingvi get my answer here: https://groups.google.com/forum/?fromgroups#!topic/clojure-web-dev/mEGlCmESxxY
07:50jweissis there a way to stop pr from printing namespaces? I see pprint offers that, but I want to print as a single line.
08:09hyPiRionjweiss: Are you only pr-ing vars?
08:09hyPiRionif so, you could potentially do an ugly hack
08:09hyPiRion,(print (second (re-find #"(?:\/)([^/]+)" (str #'concat))))
08:09jweisshyPiRion: in this case, i'm pr-ing quoted code
08:10clojurebotconcat
08:10hyPiRionAh.
08:10jweissi'm guessing the fix is some multimethod for print-method for symbols?
08:11jweissthe only problem is i think changing that would be system-wide, which i don't want.
08:12hyPiRionIs it possible to dynamically bind the multimethod? I would guess no, but that could've been a solution.
08:26echo-areaamalloy_: Finally I decide to use atom. That call-back function is from Java, which requires states, and I can't find anywhere to store state information unless using reference types
08:26echo-areas/That call-back function is from Java/That functions is called back from Java/
08:30_KY_I still can't change the namespace of (eval) in a jar, but I can do that in repl...
08:41_KY_I tried 3 methods, they all work in REPL, but no longer in the jar
08:42_KY_The methods are: binding, push-thread-bindings, and alter-var-root
08:42jonaskoelkerIs the meaning of #_ something like "the reader consumes and ignores the next s-expr"?
08:42gfredericksjonaskoelker: yep
08:43jonaskoelkeryay, I ar smart, I can interpolaetz
08:43clgv_KY_: build a minimal example with the binding method. best if I only have to "git clone" it
08:54_KY_https://www.refheap.com/paste/2652
08:55_KY_^^ the flower is just a test function...
08:55_KY_Try type (help) when prompted for input...
08:55_KY_It works in REPL, but not when made into a jar
08:57_KY_(In the 2 other methods please delete "pushback-stream" as well)
09:01clgv_KY_: there is no help function. how should calling 'help do anything?
09:01_KY_Oh I mean (flower)
09:06clgv_KY_: erm, what is your exact error?
09:06clgvI should have asked that earlier ^^
09:07_KY_When run as a jar... it fails to resolve symbol "flower"
09:07_KY_But it works when in REPL
09:07_KY_When run as a jar the namespace is "clojure.core"
09:08_KY_And it resists being changed
09:08fliebelWhat I did is walking the read datastructure, and resolving the symbols myself before I eval them.
09:09clgv_KY_: I can't reproduce your error.
09:11_KY_You compiled it into a jar?
09:11clgvyes. now it works^^
09:12_KY_That's strange... let me check...
09:12_KY_I was using lein
09:12_KY_How do you compile a single clj file?
09:13clgv_KY_ check here: https://www.refheap.com/paste/2653
09:16_KY_Still doesn't work here... =(
09:18clgv_KY_: I can upload you the whole project. where shall I?
09:18_KY_Maybe I'll just start one
09:18_KY_Using lein new?
09:19clgvyou know any uploader and I put it there for you^^
09:20clgv_KY_: http://www.sendspace.com/file/rg1udl
09:21_KY_Ok I get it...
09:23_KY_Ok I can run yours, and it works...
09:23_KY_Even as a jar
09:24_KY_But in my project with the exact same code, it doesn't work...
09:24clgv_KY_: then you are probably doing something strange in there
09:25clgv_KY_: you know that you can also start are real repl in your -main method via clojure.main/repl?
09:25_KY_Can you try (print *ands*) in your program?
09:25_KY_Can you try (print *ns*) in your program?
09:26clgvyou have the program ;)
09:26_KY_I tried that, it prints nothing...
09:27_KY_Oh I see... I have to use println
09:28_KY_In your program, I'm allowed to change the namespace... but not in my jar
09:29clgv_KY_: so you can rule out the 'binding form as the reason for that behavior ;)
09:32_KY_Could it be you're doing this in the -main function?
09:39_KY_I moved your code to my -main and now it works also...
09:40clgvwell you have to bind the correct ns there that contains the function you are calling
09:41clgv_KY_: do you want to have a real repl in your jar?
09:41jwr7Ahh, thanks to reduce-kv and some hinting my sparse-vector-normalizing code is now 30% faster. Nice!
09:42_KY_clgv: not exactly a REPL, but a more enhanced one... =)
09:42clgv_KY_: well, then I would start with clojure.main/repl and its parameters
09:46_KY_But I want to intercept the REPL
09:46clgv_KY_: have a look at its parameters and how they are used^^
09:50_KY_I see... it seems better than what I'm doing...
09:50clgv,(doc clojure.main/repl)
09:50clojurebotexcusez-moi
09:50clgv&(doc clojure.main/repl)
09:50lazybot⇒ "([& options]); Generic, reusable, read-eval-print loop. By default, reads from *in*, writes to *out*, and prints exception summaries to *err*. If you use the default :read hook, *in* must either be an instance of LineNumberingPushbackReader or duplicate its beh... https://www.refheap.com/paste/2654
09:52jwr7Are all unhinted function arguments boxed?
09:53clgvjwr7: only numbers. everything else is already an object
09:54jwr7clgv: well, yes, I meant numbers. I just wanted to know if clojure 1.4 does any auto-unboxing.
09:55jwr7Also, can map keys be unboxed, or are they always objects?
09:56clgvwell, you would have to look that up in the source. but afaik there is no special map for that
09:59_KY_What is meant by boxed?
10:02clgv_KY_: primitive int -> Integer object
10:07pandeirois there a function like filter/remove but that only filters/removes the first match and returns the rest of the seq untouched?
10:19rhcif anyone is interested, a wrote a clojure program ants.clj for a little clojure presentation: http://github.com/matthavener/banksim
10:19rhca wrote -> i wrote
10:22dnolenCLJS apply now much faster in master.
10:24drewrdnolen: how do you hack on compiler.clj? there's no project.clj
10:24drewrjust with a bare repl?
10:24dnolendrewr: I just work from the repo, making changing, making sure all tests pass.
10:25dnolendrewr: for performance work I make a lein + lein-cljsbuild + checkouts project
10:25drewryeah cljsbuild makes nice workflow out of cljs code
10:25drewrI wanted to fix that js-reserved compiler bug though
10:25dnolendrewr: cljsbuild does wonders.
10:26dnolendrewr: code generation stuff like that I just test with my eyes :)
10:26dnolendrewr: turn off optimizations in script/test
10:26dnolendrewr: look at the output of out/core-advanced-test.js
10:28dnolendrewr: for some simple stuff, also testing by loading the cljs.compiler at the repl also work. (c/emit (c/analyze {} '(some-form ...)))
10:47clgvrhc: you forgot to add :main to project.clj so (start) cant be resolved ;)
10:51rhcclgv: ahh, thank you, thanks for checking it out too
10:53_KY_Trying to call clojure.main/repl in a jar gives run-time error:
10:53_KY_"Attempting to call unbound fn: #'clojure.main/repl"
10:54clgv_KY_: you have to use or require the namespace as usual
10:56_KY_Works now... thanks =)
11:19tuxellaHello
11:19wkmanireGood morning.
11:20tuxellaI have a question about java interop, could someone help me?
11:20clgv~anyone
11:20clojurebotJust 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 ..."
11:20tuxellaok
11:21tuxellaI'd need to call a method of a java object with the method name. But I only know this method name at runtime
11:21clgvtuxella: then you have to use reflection
11:22tuxellaAs far as i have understood, the dot notation being a special form, this is not possible this way, and I haven't found any other way to call a method of a java object ..
11:22robertstuttafordis it possible to assoc a value into a map with a symbol as the key, but somehow use a string to create that symbol first?
11:22nDuff...well, there is evil^Weval :)
11:22S11001001tuxella: check clojure.lang java namespace for convenient utilities for calling reflectively while maintaining sanity (conflating integer types and such)
11:23robertstuttafordi guess the assoc part is easy. how do i make a symbol from a string?
11:23S11001001~(doc symbol)
11:23clojurebotdefmulti doc is ugly
11:23S11001001oh come on
11:23S11001001,(doc symbol)
11:23clojurebot"([name] [ns name]); Returns a Symbol with the given namespace and name."
11:23clgvtuxella: there is 'clojure.reflect
11:24@rhickeyhttp://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html
11:24tuxellaclgv: and i guess from this I can get my method by its name and call it afterward ?
11:24clgvtuxella: yes. but ask yourself, if you really need to do it like that
11:25tuxellaclgv: it looks (looked ?) like an easy way to expose methods of the tree I am walking in the configuration of the walker
11:30wkmanire,(doc partition)
11:30clojurebot"([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."
11:30tuxellaclgv: thank you for your help, I will try this way even if I agree that it may not be the best way
11:31jedmtnmanis there a specific channel for for the midje library?
11:33TimMcjedmtnman: There appear to be a few people in #midje, but I don't know if the core maintainers show up there.
11:33robertstuttafordclojure rocks. just sayin'
11:33robertstuttafordi'm about 10 days in, only really starting to write code now, and i'm loving it
11:33jedmtnmanTimMc: logged on there and there was no welcome message, so wasnt sure if it was the right context :)
11:34TimMcrobertstuttaford: \o/
11:34robertstuttafordi love what it's doing to my brain. nice challenge
11:36@rhickeyany questions on reducers?
11:37TimMcrhickey: I'm a little lost on reduers/map. It tells the reducible thing to layer in a map operation?
11:38clgvrhickey: only bookmarked it for later reading this evening ;)
11:38Borkduderhickey: will read it later, tnx
11:38TimMcMy language parser fails somewhere around "return something reducible via transformation of the reducing function, reducers."
11:39@rhickeyTimMc: map takes something reducible (e.g. a collection)
11:39robertstuttafordrhickey: no. but let me take this opportunity to thank you for your awesome language and talks that you've given!
11:39@rhickeyand returns something reducible (by implementing the coll-reduce protocol)
11:40@rhickeyso return value of map etends coll-reduce
11:40@rhickeywhen you call reduce on it , it modifies the function you give it (adding the mapping logic) and then passes that to the coll
11:40TimMcSo you're building a pipeline of operations that will occur once an actual reduce operation is called?
11:40@rhickeyTimMc: right
11:41@rhickeyessentially a new function, like a russian doll
11:41@rhickeynot really like a pipe of connections and flowing streams
11:41fliebelrhickey: This is basically an optimization to get rid of the intermediate objects, right?
11:41@rhickeyone key point is that there are no streams/seqs
11:42@rhickeyfliebel: getting rid of intermediate objects would be a) keeping the seq model, and then b) getting rid of its overheads
11:42@rhickeythis instead gets rid of the seq model
11:42@rhickeythe new model doesn't have intermediate objects
11:42kzarI've build my javascript file using lein-cljsbuild OK but when I try to use it the thing is trying to include /deps.js . No idea where that's come from but it doesn't exist and I can't figure out what to do. Any ideas?
11:43@rhickeybut it additionally has the property that the fundamental functions are not defined in terms of seqs
11:43@rhickeyand thus can be parallelized
11:44@rhickeyit's not stream fusion, there are no streams in the semantics anymore
11:44fliebelrhickey: When would I use it?
11:45TimMcI'm curious what happens when you use this with the naive Sieve of Eratosthenes.
11:45@rhickeyfliebel: when you are going to process the entire collection (i.e. don't need laziness) and you'd like to take advantage of your hardware to do that as fast as possible
11:46TimMc(which usually causes Stack Overflow due to nested filters)
11:46@rhickeylazy/parallel is the fundamental tradeoff
11:46tuxellarhickey: I understand it as something similar to coroutines, at least their python implementation, is that what you intend with this reducers ?
11:47@rhickeyIt also forces you into a less item-at-a-time model
11:47hyPiRionrhickey: Just a question after reading the source code: Any specific reason why 512 is the initial partition group for fold?
11:47@rhickeytuxella: not really
11:47ieureSoooooo. There's no code coverage tool for Clojure?
11:48@rhickeyhyPiRion: has to be something, that's somewhat empirical will not much data :)
11:48hyPiRionAhh, I see :)
11:48HCumberdaleHello from Gibraltar :)
11:48TimMcieure: I've heard of a coverage tool that was described as relatively naive... can't recall the name right now.
11:49ieureTimMc, Radagast?
11:49ieureIt's the only one I've found. Insufficient.
11:52fliebelrhickey: What happened to the pv* forkjoin map/reduce/filter etc? Is this it?
11:52@rhickeyfliebel: this replaces that
11:52@rhickeymuch better
11:53fliebelcool :)
11:53@rhickeyi.e. you won't need pmapthis, pmapthat
11:53@rhickeymap/filter etc are independent of parallelism
11:54HCumberdaleSo pvmap becomes the new map ?
11:54@rhickeyHCumberdale: no, map has nothing to do with p, nor v
11:54@rhickeyin this model
11:55TimMc"a combining function, a reducing function, and a collection" <- the combining function is something associative like +, but what is the reducing function?
11:55HCumberdaleSorry I meant pvmap becomes the new pmap?
11:55@rhickeyHCumberdale: pmap will always have a place as a hybrid lazy+parallel options
11:56mmarczykrhickey: so a reducible IO source would close the resource once done -- in particular, if (reduced ...) was used to stop the reduction, perhaps in an outer layer of the transformation?
11:56@rhickeyTimMc: it can be any reducing fn, could reduce to scalar like +, or build collection subresults
11:56@rhickeymmarczyk: yes
11:57HCumberdaleIs pvmap getting part of clojure 1.4 or are there no plans to merge it from clojure par branch?
11:57dnolenHCumberdale: sounds like stuff is now superseded by the new reducers work.
11:57@rhickeyHCumberdale: pvmap is not needed given reducers/fold
11:58dnolenlike that stuff
11:58fliebelIt seems the reducers/map takes one one coll, or is that part of the defcurried magic?
11:58HCumberdaleAhhh found a post about it from today
11:59drewrdnolen: how do I tell script/test where goog lives?
11:59@rhickeyfliebel: it does take only one, my todo list mentioned a multi-reducer
11:59dnolendrewr: compile w/ :whitespace or :simple optimizations
11:59drewrI get "out/core-advanced-test.js:1: ReferenceError: goog is not defined"
11:59fliebelah, great
11:59drewrdnolen: ah
11:59mmarczykrhickey: a ClojureScript-related question -- is fold relevant at all? just making sure before I dive into porting the namespace (not much porting work at all in this case, though... :-))
12:00mmarczykdnolen: I'm loving your apply patches, great stuff :-)
12:00@rhickeymmarczyk: it can never be parallel, but just implement using the Object fallback - turns into reduce
12:00@rhickeymmarczyk: gives code compatibility
12:00mmarczykrhickey: sure, will do
12:00dnolenmmarczyk: yes, huge speedups for apply.
12:00@rhickeyunti lwe can figure out how to get webworkers to help
12:00@rhickey:)
12:00mmarczykhah! :-)
12:01brainproxyor node child_processes
12:01brainproxy:)
12:04jlongsterdnolen: looks like we'll be able to create native browser-based debuggers after all: https://www.youtube.com/watch?v=TQxQr1H0iZ0
12:05dnolenjlongster: !
12:06jlongsterI guess I won't create a web VM :)
12:09mmarczykrhickey: can this be used to fuse layers of lazy seq transformations? I'm thinking e.g. if I have a bunch of transformations and I layer them appropriately, so they get "fused", can I just wrap it in a function returning (reduced (lazy-seq (cons x (somehow-get-"rest"-reducible)))) to get a lazy seq? or sth similar
12:11@rhickeymmarczyk: this is not stream fusion, nor about it, but there are benefits to using these reducers instead of seq versions even on lazy source if you are going to end up reducing
12:12@rhickeyalso note the composability bit
12:13fliebelrhickey: Still trying to understand the code. Is just reduce parallel, or map and filter too(without reducing)?
12:13@rhickeythe only thing that is parallel is fold
12:14@rhickeythat is enabled by the rest of the library being reduce-based
12:14@rhickeymap, and filter don't do any work on collection when called
12:16fliebelRight, so if I want to have a better pmap(i.e. pvmap), this is not it. This map and filter just compose untill you call reduce on them, if I understand it correctly.
12:16HCumberdaleis a "for" List Comprehension faster then a "map" ?
12:16technomancyHCumberdale: they compile to the same thing
12:16HCumberdalethx technomancy
12:19HCumberdalerhickey: do you use emacs ?
12:22kzarWhat makes the /repl route work for browser repls? Looking at examples I don't see it in the defroutes with everything else
12:25technomancyieure: radagast is pretty rudimentary, but there's another one that's quite new; check out guzheng
12:25technomancykzar: in my drawbridge article?
12:25dnolenCLJS breaking change for how browser REPL works but folks can finally stay abreast of latest GClosure instead of being a year behind - http://dev.clojure.org/jira/browse/CLJS-35
12:26kzartechnomancy: Well for example https://github.com/emezeske/lein-cljsbuild/blob/0.1.8/example-projects/advanced/src-cljs/example/repl.cljs
12:26dnolenthoughts welcome, basically for the simple case you now have to open your CJLS file at localhost:9000/file.html instead of directly via file://
12:26ieuretechnomancy, Thanks, I'll take a look.
12:26technomancykzar: oh, ok; never mind.
12:26mmarczykdnolen: that actually seems more convenient :-)
12:26dnolenmmarczyk: yeah :) I don't really see many problems with it.
12:27dnolenbut worth getting some feedback
12:32ibdknoxdnolen: would you consider a patch that remove the atom specific nature of swap! and reset! and made a IReset or some such protocol?
12:32ibdknoxdnolen: for CLJS
12:32bhenryping korma users and/or ibdknox… what if i need to check more than one constraint on the same key. i.e. "WHERE user.id IN list1-derived-from-locations AND user.id IN list2-derived-from-permission-groups"
12:33kzarWeird, I noticed the script tags for the example are inside the body. When I changed my code to do that it started working, surely script tags normally live up in the head though?
12:33ibdknoxbhenry: instead of using a map use the functions directly
12:33fliebelibdknox: I once submitted a patch for exactly that to Clojure.
12:33bhenryibdknox will two where's work?
12:34ibdknoxbhenry: actually, that probably would
12:34fliebelibdknox: http://dev.clojure.org/jira/browse/CLJ-803
12:34bhenryibdknox: good because i don't know how to do an (in) call the other way
12:34ibdknoxbhenry: I was thinking (where (and (in :x [2 3]) (in :x [4 5]))
12:35bhenryaha
12:35ibdknoxfliebel: huh
12:35ibdknoxfliebel: so there were no objections then
12:35dnolenibdknox: hmm probably should think about that. atom is the goto for state management, protocols add some overhead.
12:36fliebelibdknox: Not really, but noone really cared either, it seems. What did you think of in cljs that needs this?
12:37ibdknoxdnolen: fliebel: in order to do any realistic form of databinding I needed to create subatoms
12:37hiredmanibdknox: I objected on clj-803
12:37ibdknoxhiredman: whoops, should've read that one
12:38fliebeloh, true
12:38mmarczykdnolen: as far as convenience is concerned, me CLJS-35 is a clear win for me, given the option to pass in :serve-static false
12:40ibdknoxdnolen: fliebel: basically the problem is that in clojure we usually use a single atom to represent a collection of things. This makes it virtually impossible for you to delegate the updating of those to happen at a more granular level - all changes have to be made to the root atom. My little subatom basically keeps a reference to the path within the atom, notifies of changes specific to that path and allows you to update the root atom
12:40ibdknox transparently
12:40ibdknoxdnolen: fliebel: subatom certainly does not belong in core, but it *is* technically the atom and it seems dumb that I can't use the built-in swap! and reset! with it
12:42dnolenibdknox: sounds like something that needs to get written up and pondered :)
12:42fliebeldnolen: ibdknox: IIRC, Avout uses swap!! and reset!!, they could also benefit, I would think.
12:43dnolenibdknox: if atoms don't work for you - what you're asking for as the ability to use the same interface on a custom type right?
12:44ibdknoxdnolen: more or less
12:44dnolenibdknox: it could probably be zippy w/ IAtom marker protocol + ICompareAndSwap protocol
12:45fliebelhiredman: What do you think about avout, in respect to your comment on 803?
12:46lynaghkibdknox: have you seen Dave Sann's port of Knockout.js to CLJS? He's doing something similar with paths-within-atoms
12:47ibdknoxlynaghk: I haven't
12:47ibdknoxlynaghk: with this subatom stuff my databinding implementation is wonderfully simple now
12:47lynaghkibdknox: https://github.com/davesann/closeout
12:48fliebelibdknox: databinding?
12:48lynaghkibdknox: yeah? I'll check it out when it hits crate. I did a few hours of hammock time on Sunday thinking about this stuff, have some ideas I'll be implementing over the next week or so
12:50hiredmanfliebel: avout doesn't pretend to be local, it has it's own transactions and references
12:50lynaghkyou might want to checkout the Knockout.js documentation, it's very good. I'll probably do a hybrid of your approach (joining atoms with individual DOM element properties) and the DOM-walking that's in c2 now.
12:50hiredman(or at least it did last time I checked)
12:51ibdknoxfliebel: lynaghk: https://github.com/ibdknox/crate/blob/fd3508e121516d122638e67176c6b8ecce72c8b9/src/crate/binding.cljs
12:51fliebelhiredman: CouchDB doesn;t pretend to be local either, I think it would just be convenient to use the same interface. an avout atom uses swap!!, but does the same thing.
12:52hiredmanfliebel: right, but swap!! is not clojure.core/swap!
12:52lynaghkibdknox: do you have an example of calling code?
12:52hiredmanso when swap!! is used you know it is different from clojure.core/swap!
12:52hiredmanif he wants a couchdb atom, use swap!!
12:53hiredman(in fact, doesn't avout support exactly that?)
12:53hiredmanoh, avout has a mongo plugin, not couch
12:53ibdknoxlynaghk: https://www.refheap.com/paste/2658
12:54fliebelhiredman: he is me. I agree a distinction between distinct things is good, but they do use the same compare-and-set concept.
12:54ibdknoxhiredman: in my case it's not any different it does exactly what swap! does, it just does it on a subpart of the atom automatically as opposed to needing to do update-in ...
12:56hiredmanibdknox: I think there are other arguments that could be made there: A looks like an Atom, and you can swap! it like an atom, but swap! does something different? is that good?
12:57lynaghkibdknox: why a new type instead of just wrapping the update-in swap call (similar to how you implemented Waltz)
12:57ibdknoxlynaghk: because I need the events, the derefs, etc to be local to the path as well
12:58nDuffIf I want to generate a Java servlet from a Noir application, should I be using ring.util.servlet directly?
13:00lynaghkibdknox; ah, I see. Are you integrating this into any public projects once you have it tidied up, or is it for Light Table?
13:01ibdknoxhiredman: It's a fair argument. In this case, it behaves exactly as if that bit of data were its own atom and retains exactly the semantics of other atoms. While technically different, it's mostly a transparent convenience - it really is still the underlying atom.
13:02ibdknoxlynaghk: I'm sure it'll end up in things :) Databinding is wonderful and now that it can be used with idiomatic atom usage, I'll reach for it a lot. Right now, though, it was mostly for light table
13:04lynaghkibdknox: cool. I look forward to seeing what you do with it.
13:07technomancyibdknox: ISTR reading an essay from Rich in early days where he says he explicitly rejected Erlang's transparently-distributed approach for built-in stuff
13:08technomancy8 fallacies of network computing and all that
13:08ibdknoxtechnomancy: I'm not talking about distributed at all
13:08ibdknoxtechnomancy: it's just a reference to a subpart of an atom
13:09technomancyoh, ok; getting my threads crossed here I guess
13:09fliebeltechnomancy: I'm the one talking about distributed stuff.
13:09technomancyhttp://bc.tech.coop/blog/081201.html <- grep for "transparent distribution isn't transparent"
13:13TimMctechnomancy: Oh god, the title of that article -- I hope not!
13:15technomancyTimMc: yeah, taken a certain way it's kinda loper-os-ish
13:24TimMc?
13:27hiredmantechnomancy: the full thing is on clojure.org somewhere
13:30hiredmanah it's in http://clojure.org/state
13:37technomancycool
13:39y3di"Your 'thin sliver' idea is intriguing. Maybe we can call slivers "simple components" and build bigger things out of them. I wonder if there would be any benefit to that?" -- haha
13:55antoineBhello, i am looking for a function that do: (fun (fn [a b] (+ a b)) [1 2 3]) => [3 5]
13:55dan_bgiven a project created with "lein2 new foo", what (if anything) in its src/ directory should I expect to have been loaded when I run clojure-jack-in
13:55antoineBit don't work with apply
13:56dan_bbecause right now, nothing whatsoever and I can't tell if it's my error or if my expectations are wrong
13:57duck1123dan_b: lein swank (what jack-in uses) doesn't require any namespaces, you'll have to require your namespace first
13:58tmciver_antoineB: I think you should take a look at 'reductions'
13:58tmciver_hmm, perhaps no. something involving partition-all . . .
14:01BorkdudeantoineB: reductions
14:01Borkdude,(reductions + [1 2 3])
14:01clojurebot(1 3 6)
14:01Borkdudeow wait ;-)
14:02antoineBfrom [1 2 3] i want [3 5]
14:03antoineBso do 1 + 2 and 2 + 3
14:03tmciver_,(map (fn [ [a b] ] (+ a b)) (partition 2 1 [1 2 3 4 5))
14:03clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
14:03hiredmanalways use partition-all
14:03tmciver_,(map (fn [ [a b] ] (+ a b)) (partition 2 1 [1 2 3 4 5)))
14:03clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
14:03tmciver_agh
14:03tmciver_,(map (fn [ [a b] ] (+ a b)) (partition 2 1 [1 2 3 4 5]))
14:03clojurebot(3 5 7 9)
14:04tmciver_I suspect there's a slightly less verbose way to do that.
14:05hiredmanalways use partition-all
14:05antoineBi am not used to extra syntax form of clojure
14:07antoineBhiredman: in this case (if i understand partition-all well) we din't need partition-all because we use a length of 2 and a pace of 1
14:07TimMc&(let [x [1 2 3 4]] (map + x (drop 1 x)))
14:07lazybot⇒ (3 5 7)
14:09antoineBtmciver_: TimMc: thank you, i will use the tmciver solution, because i don't understand TimMc's
14:12TimMc...
14:13antoineBok i get it
14:14Borkdude(doc macrolet)
14:14clojurebotTitim gan éirí ort.
14:14Borkdude,(doc macrolet)
14:14clojurebotIt's greek to me.
14:14Borkdude,(resolve 'macrolet)
14:14Borkdude,(+ 1 2 3)
14:15Licensergreat you broke it!
14:15Licenser,(+ 1 1)
14:15Licensertotally did
14:15Scriptor&(+ 1 1)
14:15lazybot⇒ 2
14:15clojurebotnil
14:15clojurebot6
14:15clojurebot2
14:15Scriptorhah
14:15Licenserslooow
14:15Scriptor,(+ 1 1)
14:15clojurebot2
14:15Borkdude,(resolve 'macrolet)
14:15clojurebotnil
14:15Borkdudeah
14:15Scriptorthere we go
14:16Borkdude,(defmacro foo [] nil)
14:16clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
14:16Borkdudeah
14:17BorkdudeI used to program in common lisp and I remember having written this kind of macro: http://cljbin.com/paste/4fa962ffe4b0871973ed1888
14:19Borkdudeso (with-window w 2 [1 2 3] (apply + w)) would return [3 5] ;-)
14:20HCumberdalewhat is your clojure setup?
14:20ChousukeI suspect LOOP in common lisp can do that for you :p
14:20HCumberdaleAnyone tried JLine ?
14:20Borkdudechousuke I used loop inside the macro probably
14:21technomancyHCumberdale: jline1 is awful; jline2 is pretty good
14:21HCumberdaletechnomancy: your emacs starter kit does not use it, right?
14:21HCumberdaleit is emacs & slime ?!
14:22technomancyjline doesn't have anything to do with emacs, no
14:23hyPiRionJust excuse me for a moment
14:23hyPiRion,(remove #{2 5} (into #{} [(denominator 1/2)]))
14:23clojurebot()
14:23dnolenmmarczyk: at some point we might want to back out the prototype protocol tag trick for inline protocol defs.
14:24Borkdudechousuke, found it: https://gist.github.com/2638228
14:25HCumberdaletechnomancy: here is a setup with emacs (modded for macosx as aquamacs) http://paulbarry.com/articles/2008/07/02/getting-started-with-clojure-and-aquamacs
14:25zakwilsonMy initial look at reducers seems to suggest reducers/map isn't as parallel as the likes of useful/pcollect
14:25dnolenmmarczyk: my benchmarks from yesterday seem to show that it will trigger deoptimization in V8.
14:25technomancyclojurebot: blogs?
14:25clojurebotmake a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive
14:25technomancycrap
14:26technomancyclojurebot: blogs |are| never to be trusted
14:26clojurebotYou don't have to tell me twice.
14:26technomancyHCumberdale: ^^
14:26technomancythat blog post is painfully outdated =\
14:26hyPiRioncrap.
14:26HCumberdaleoh...
14:27zakwilsonOf course, I tried reducers on 1.4, which may not be a good idea.
14:29nDuffHmm.
14:29hyPiRionAnyone encountered this bug before? http://i.imgur.com/bXeF5.png
14:29HCumberdaleThe vimclojure repl drives my crazy
14:30hyPiRionWhen checking for equality on (denominator 1/2) and 2, it returns true.
14:32fliebelhyPiRion: Weird, but why on earth did you make an image of that?
14:33nDuffIs current noir known to work (or not) on Clojure 1.4.0? I'm getting a compile-time error (NoSuchMethodError) with 1.3.0-beta4, perhaps on account of the clj-stacktrace dependency: https://gist.github.com/5bef5eb161394e66cd58
14:33hyPiRionfliebel: Good question...
14:36fliebelhyPiRion: really weird...
14:36BorkdudeI'm reading some CL code of 7 years ago, the parens must have driven me crazy in let*… https://gist.github.com/2638319
14:37fliebelaha!
14:37fliebel&(class (denominator 1/2))
14:37lazybot⇒ java.math.BigInteger
14:38fliebelhyPiRion: ^
14:38hyPiRionfliebel: Ah
14:39hyPiRionfliebel: Thank you. Still weird though.
14:39fliebelsimilarly: ##(= #{2.0} #{2})
14:39lazybot⇒ false
14:40hyPiRion&(remove #{2 5} (vec (into #{} [(denominator 1/2)])))
14:40lazybot⇒ ()
14:40fliebelBut then I would think ##(= #{[]} #{()}) would also return false
14:40lazybot⇒ true
14:40hyPiRionSo that's weird.
14:40Bronsa,(= [] ())
14:41clojurebottrue
14:41fliebelBronsa: Clojure normally does equality by interface, so that ##(= 2.0 2)
14:41lazybot⇒ false
14:41fliebel... that worked in my repl.
14:42Borkdude,(= 2 2.0)
14:42clojurebotfalse
14:42hyPiRionYeah, repl and the bots aren't equivalent.
14:42hyPiRion,(== 2 (denominator 2))
14:42clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.Ratio>
14:42Borkdudein my repl false
14:42hyPiRionwhoops
14:42fliebel&(= 1 1/1)
14:42lazybot⇒ true
14:42hyPiRion,(== 2 (denominator 2))
14:42clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.Ratio>
14:43hyPiRionGah, sorry.
14:43hyPiRion,(== 2 (denominator 1/2))
14:43clojurebottrue
14:43fliebelyea, so my point was that normally 2 different number types or 2 different collection types can be equal.
14:44Wild_Cat&(= (.intValue 2.0) 2)
14:44lazybot⇒ true
14:44fliebeleven ##(= [1] [1.0]) is true in my repl.
14:44lazybot⇒ false
14:45fliebelBut then, I'm on 1.2.1
14:45hyPiRion&(identity? 2 (denominator 1/2))
14:45lazybotjava.lang.RuntimeException: Unable to resolve symbol: identity? in this context
14:45fliebelyea, something changed in 1.3
14:46hyPiRion&(identical? 2 (denominator 1/2))
14:46lazybot⇒ false
14:46hyPiRionThere we go - I suppose they check whether they're identical or not.
14:46fliebelIt'd be great if someone more knowingly about clojure equality could jump in.
14:48hyPiRion,(doc =)
14:48clojurebot"([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison."
14:48hyPiRionIt's probably not more complicated than that.
14:49fliebel" and compares numbers and collections in a type-independent manner"
14:49fliebelThat is what it does for 1.2... most of the time, but it seems this does not hold for 1.3+ anymore
14:50hyPiRionKind of weird that ##(= 2.0 2) isn't equal then, but maybe there's some floating point magic behind the scenes.
14:50lazybot⇒ false
14:50S11001001no, = is no longer numeric equality at all
14:51fliebelah! ##(doc ==)
14:51lazybot⇒ "([x] [x y] [x y & more]); Returns non-nil if nums all have the equivalent value (type-independent), otherwise false"
14:51fliebel&(== 2.0 2)
14:51lazybot⇒ true
14:51hyPiRionS11001001: Is the doc outdated then, or is my comprehension of the doc wrong?
14:52hyPiRion"compares numbers and collections in a type-independent manner.
14:52S11001001hyPiRion: probably it shouldn't say numbers anymore, though I think it still applies in some cases
14:52hyPiRionAh, okay.
14:53S11001001,(= (Long/fromValue 42) (Integer/fromValue 42))
14:53clojurebot#<CompilerException java.lang.IllegalArgumentException: No matching method: fromValue, compiling:(NO_SOURCE_PATH:0)>
14:53S11001001well, one of those
14:54hyPiRion,(= (Long. 42) (Integer. 42) (denominator 1/2))
14:54clojurebotfalse
14:54S11001001er
14:54S11001001,(= (Long. 42) (Integer. 42))
14:54clojurebottrue
14:54S110010011/2?
14:55hyPiRionLost a 4 there.
14:55hyPiRion,(= (Long. 42) (Integer. 42) (denominator 1/42))
14:55clojurebottrue
14:55S11001001hmm, I did not know about denominator
14:56fliebelthere's.. the other as well
14:56hyPiRionBigInteger, Short and friends?
14:56S11001001enumbriator
14:56fliebel$findfn 1/2 1
14:56lazybot[clojure.core/unchecked-inc-int clojure.core/numerator]
14:56hyPiRionnumberator
15:05nDuff...actually, no...
15:08nDuffs/stack/classpath/
15:14Borkdude$findfn [1 2 3] [3 5]
15:14lazybot[]
15:14Borkdude;-)
15:16raek$findfn 3 1
15:16lazybot[]
15:17raek$findfn 3 1
15:17lazybot[]
15:17raek$findfn 3 1
15:17lazybot[]
15:18gfredericks$findfn 3 1
15:18lazybot[]
15:19gfrederickspff. randomness.
15:19Bronsa$findfn 3 2
15:19lazybot[clojure.core/unchecked-dec clojure.core/unchecked-dec-int clojure.core/dec' clojure.core/dec]
15:19Bronsano luck.
15:19gfredericksBronsa: bet it returned 1 that time
15:19Bronsawhat about
15:19Bronsa$findfn 3 0
15:19lazybot[]
15:20amalloy$findfn 1 0
15:20lazybot[clojure.core/unchecked-dec clojure.core/rand-int clojure.core/unchecked-dec-int clojure.core/dec' clojure.core/dec]
15:20Bronsathat's cheating
15:20amalloy$findfn [4] 4
15:20lazybot[clojure.core/last clojure.core/peek clojure.core/first clojure.core/rand-nth]
15:42neotykHello everyone!
15:42fliebelneotyk: Hi
15:44dnolenneotyk: if I don't hear from any dissenters, I'll probably apply your patch later this evening or sometime tomorrow.
15:45Borkdude&findarg map % [1 2 3] [3 4 5]
15:45lazybotjava.lang.RuntimeException: Unable to resolve symbol: findarg in this context
15:45Borkdude$findarg map % [1 2 3] [3 4 5]
15:45neotykdnolen: great :)
15:45lazybot[]
15:45Borkdude$findarg map % [1 2 3] [2 3 4]
15:45lazybot[clojure.core/unchecked-inc-int clojure.core/unchecked-inc clojure.core/inc clojure.core/inc']
15:47jwr7rhickey: Finished reading the reducers blog post. Great thinking. It will become *really* useful for me with multiple sources and primitive-transmitting reducer function pipelines, though.
15:47beffbernardAnybody using Jenkins for CI? I'd like to include the GIT_COMMIT in the generated war but not sure which approach to take. Suggestions?
15:48Borkdude… I wonder what funcall in Clojure is … ;-)
15:48Borkdude$findarg map % [- + *] [1 2 3] [1 2 3] [1 2 3] [-1 6 27]
15:48lazybot[clojure.core/trampoline]
15:48Borkdude:P
15:48@rhickey_jwr7: yeah, primitives will be huge, I wanted to ship something before getting into that :)
15:49jwr7rhickey_: I wonder about the expected useful granularity of work when using fork/join though.
15:50@rhickey_jwr7: you can control that with an argument to fold
15:50@rhickey_not discussed in post
15:51jwr7rhickey_: you should do a BOF session about reducers at EuroClojure :-)
15:51@rhickey_fold n combinef reducef coll is the full sig
15:51fliebelneotyk: Are you going to give your presentation at amsclj tomorrow?
15:51@rhickey_n being the partition size hint
15:51neotykfliebel: yes, working on it )
15:52Borkdudeneotyk: I'm also coming, taking a student with me
15:52jwr7Now that I think about it, I'd really love to see a session where people complain about what they found problematic in Clojure and Rich answers.
15:52fliebelneotyk: I'm in amsterdam tomorrow, but in the wrong place, so I'll see it at euroclojure.
15:53S11001001I wouldn't, see Bruce's First Law of Lisp
15:53neotykfliebel: too bad, would appreciate your feedback
15:54fliebel$google Bruce's First Law of Lisp
15:54lazybot[Scott's Space - Programming Quotes] http://www.stgray.com/quotes/programmingquotes.html
15:54jwr7rhickey_: funny how your blog post fits right into what I've been thinking over the last week or so. I wrote a lot of code that operates on sets (of integers, mostly). I kept thinking that there must be better abstractions than just map and reduce.
15:54fliebelS11001001: What is the law?
15:55fliebel(and does first imply there is a rest law of lisp?)
15:57S11001001If it does not do exactly what you expect with zero hours consideration or experience, it is a bug in Lisp that should be fixed.
15:57S11001001from http://web.archive.org/web/20070712062323/http://brucio.blogspot.com/
15:57TimMcnice
16:02furth?
16:12felideonoh brucio
16:12nDuffAhh; I'll hazard it's clojure being listed in dependencies rather than dev-dependencies for noir that's messing me up.
16:13RaynesnDuff: Noir itself doesn't have any code AOT compiled against any version of Clojure. Perhaps one of its dependencies does.
16:14hiredmanreducers needs partition with
16:14nDuffRaynes: yup, noticed that looking inside the jar
16:14RaynesnDuff: I'm pretty sure that none of them do.
16:15nDuffRaynes: ...the other thing I'm suspicious of -- something in the chain is pulling in clojure-1.2.1.jar; I don't expect that having it in the classpath with clojure-1.4.0 is such a great idea.
16:15hiredmanpartition-by I guess
16:15RaynesnDuff: In fact, I'd expect that to be the problem.
16:15RaynesnDuff: Do you have a version of Clojure specified in your project?
16:15nDuffYes.
16:16RaynesIt should override everything else unless somebody used a version range somewhere.
16:17nDuffIs that true even when using Maven rather than Leiningen?
16:17RaynesLeiningen uses maven for dependency resolution, so the rules apply to both.
16:17nDuffAhh.
16:17LauJensenGood evening gents
16:19S11001001it may not override if someone used a hard version constraint (hopefully they didn't, they are bad)
16:20S11001001fortunately the default is soft constraint
16:20S11001001and no doubt the whole maven dependency tree would have fallen apart long ago were that not the case
16:23jwr7Is anybody working on a library for manipulating sets of integers in Clojure with good performance?
16:27jonaskoelkerjwr7: you can use the java primitives?
16:27jonaskoelker(that's not a question, that's a statement; the question is: is that what you were asking about / is that useful knowledge to you?)
16:28aaelonyis anyone using Apache Mahout via Clojure? is java-interop the only way to go?
16:40nDuffHmm. Something was just very odd with my environment; rebuilt from a completely clean tree, and all's well.
16:46RaynesnDuff: `lein deps :tree` is helpful for finding out where jars are coming from btw.
16:49TimMcnDuff: mvn clean; rm -r ~/.mvn/repository/; mvn
16:49TimMcOh wait, you're using lein. :-P
16:53nDuffTimMc: ...no, I am indeed using Maven.
16:53HCumberdale;)
16:54nDuff(some of the dependencies use lein, but my code is a JIRA plugin, and Atlassian's build system bits are all built as Maven plugins)
16:54TimMcI call that the Maven three-finger salute.
16:55RaynesnDuff: Your software is broken. Use leiningen. Assimilate. ASSIMILATE.
16:56RaynesOh, Atlassian crap.
17:13jodaroi'd talk shit too but i'm stuck with perforce and bugzilla right now
17:16jodarooh and sharepoint
17:17Raynesjodaro: Perforce is the awesome.
17:18TimMcWe switched from perforce to svn.
17:18Borkdudesharepoint…
17:18TimMcI think there's some regret from that decision.
17:18Borkdudedon't get me started
17:19jodaroi haven't been able to get into it, really
17:19TimMcI'm agitating for git. Might get it, too.
17:19jodaroyeah i'm missing github a lot
17:19jodarohaving everything in one place is nice
17:20lancepantzaaelony: hey dude
17:20lancepantzaaelony: so you're playing around with mahout?
17:29aaelonylancepantz: I'm about to. Do you have a nice clojars link for me?
17:30lancepantzaaelony: nope, wish i did
17:30aaelonylancepantz: i guess java-interop then
17:30lancepantzi messed around with mahout when it was young, really cool stuff
17:31aaelonyyeah, I think its matured a lot in the past year or two
17:31Raynes$google mahout
17:31lazybot[Apache Mahout: Scalable machine learning and data mining] http://mahout.apache.org/
17:31RaynesMan, stop making my machine learn things. It already knows far too much.
17:32aaelonyhehe, svm-clj looks interesting too
17:33aaelonyin any case, I'm dreaming of a cascalog-mahout package... that'd be pretty cool
17:42Roxxi``What is the clojure idiom for iterative function invocation (like map but with no return value)
17:43dnolenRoxxi``: perhaps you want doseq?
17:43Roxxi``Yup, thanks.
17:45muhooheh, tangle of circular require's
17:45muhootime to refactor :-/
17:46muhooi'm surprised the compiler doesn't puke on that, actually
17:46technomancyit will, once you restart your process
17:49dan_bI'm sure this has been asked before, but maybe the answer's changed recently: after adding a dependency in project.clj, is there any way to make a running session (started with clojure-jack-in) find the new jar(s)?
17:49nDuffdan_b: pomegranate can dynamically download and load new dependencies
17:49nDuffdan_b: https://github.com/cemerick/pomegranate
17:51dan_booh, looks cool. thx
17:54jtoyhow do you print out current time in clojure?
17:55Raynes&(str (java.util.Date.))
17:55lazybot⇒ "Tue May 08 14:55:07 PDT 2012"
17:55devnjtoy: you may want to look into joda time
17:55RaynesUnless he really only wants to print out the time.
17:56devnunless you really only want to print out the time
17:56S11001001what's time, anyway
17:56technomancyit should be a syntax error to use j.u.Date for anything else
17:56jtoydevn: Raynes way is fine i guess, I don't use java at all, but i guess clojure doesn't have a 'native' way
17:56S11001001what's native, anyway
17:56RaynesClojure doesn't have a 'native' way to do much of anything.
17:56RaynesThere is a reason it is hosted on the JVM. ;)
17:57devnS11001001: id like to raise you a mustache
17:57RaynesUnless we're defining native as 'a clojure function'.
17:57RaynesI'm defining it as 'a clojure function that does not call a Java method or something'
17:57S11001001I fold, no mustachioed shenanigans for me
17:57RaynesBut they always do somewhere down the line.
17:58zakwilsonDidn't somebody propose an LLVM port?
17:58TimMcOf course. :-P
17:58antares_jtoy: if you won't manipulate time in any way, (java.util.Date.) is good enough
17:59antares_jtoy: Clojure 1.4 reader even has literal support for dates/instances
17:59zakwilsonOtherwise java.util.Date is a nightmare you don't want anything to do with.
18:00nDuff...that reminds me -- what ever happened to pods?
18:15ynnivantares_: what does the 1.4 reader do when it sees a date?
18:16RaynesIt sprays breath freshener in its mouth and pulls the flowers out from behind its back.
18:16ynnivthat would be better than instantiating a j.u.Date
18:17antares_ynniv: it prints them out using instant literals, for example: {:date #inst "2012-05-08T22:16:26.560-00:00"}
18:19ynnivGoogle sent me to http://dev.clojure.org/pages/viewpage.action?pageId=950382 . That looks like a good idea.
18:20ynnivyou get j.u.Dates unless you specify otherwise
18:20dabdis there anyway to do (defn foo [..] ... (map recur ... )) ?
18:21brehautdabd: do you want map to recur into foo ?
18:21hyPiRiondabd: No, it's not tail-callable.
18:22dabdyes
18:22ibdknoxjust call foo again then
18:22dabdwithin foo i want to call foo with each element of a list
18:22hyPiRionbut map foo should be good enough.
18:22ynnivit appears that you're trying to reference the current function using 'recur', which sounds reasonable but doesn't make sense for what 'recur' does
18:23dabdisn't recur used to reference the current function?
18:23ynnivno, it's part of loop/recur
18:24ynnivrecur as a reference to the current function is a scheme thing
18:24dabd(map foo ...) works
18:24emezeskeynniv: I'm pretty sure the function itself can be used as a recur point
18:24emezeskeynniv: But recur has to be in the tail position, that's the restriction
18:24amalloyreally? recur points to the current function in scheme? i've never heard of that
18:25ynnivemezeske: yes, but it's a syntax, not a first class function
18:25dabdso the factorial here http://clojuredocs.org/clojure_core/clojure.core/recur could be written by replacing recur->factorial ?
18:26gtrakis there an 'into' with a filter function? I want to do some extra checks if there are duplicate keys
18:26emezeskedabd: No. In that case it's recurring to the (loop ...)
18:26ynnivdabd: referencing a function by name in its definition only works with defn
18:27dabdok
18:27ynnivhmm, my repl suggests otherwise
18:27gtrakI want access the the accumulator during the reduce I suppose
18:28gtrakI should just use reduce
18:30ynniv,((defn factorial [cnt acc] (if (zero? cnt) acc (recur (dec cnt) (* acc cnt)))) 4 1)
18:30clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
18:30ynnivhmm
18:30ynnivguess you aren't going to see that
18:30ynnivbut its the same as
18:30ynniv((defn factorial [cnt acc] (if (zero? cnt) acc (factorial (dec cnt) (* acc cnt)))) 4 1)
18:39gtrakhmmmm......
18:40gtrak,(+)
18:40clojurebot0
18:40gtrak,(-)
18:40clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$->
18:40gtrakwhy?
18:40clojurebothttp://clojure.org/rationale
18:41xeqi,(- 1)
18:41clojurebot-1
18:45AimHereThe why is probably because '-' has to have some special case code going on with less than 2 arguments
18:46gtraka buddy told me - isn't associative
18:46gtrakwas just thinking about it in context of the reducers news
18:47amalloygtrak: right. - and / don't form monoids over the integers (or reals), in the way that + and * do. i'm not sure if that's really relevant, since they do still have an identity value, which the zero-arg versions could return
18:47gtrakright
18:48amalloyi think it's more relevant that like...there's a meaning of (*) and (+) that "makes sense", whereas for (-) to return 0 is not very obvious, and why should (/) return 1?
18:49gtrak,[(reduce - 1) (reduce / 2)]
18:49clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
18:49dreishI would imagine it's a more-or-less stylistic decision driven by the one-arg special cases.
18:49gtrak,[(reduce - [1]) (reduce / [2])]
18:49clojurebot[1 2]
18:50dreish+ and * have a consistent meaning regardless of how many args they are called with.
18:50gtrakclearly the identity is at play for reduce to work
18:50S11001001iow + and * are consistent with concat for the sum and product monoids
18:50jtoyhow do you get a unix time from a date in clojure? it seem like in normal java you do: Date date = new Date (); date.setTime((long)unix_time*1000);
18:50dreish,(reduce str [1])
18:50gtrakhow do you guys know this stuff? haskell?
18:50clojurebot1
18:51dreishfn never gets called if coll only has one element
18:51technomancyjtoy: if you just want a number you can do System/getCurrentTimeMillis
18:51gtrakah, actually, my example was worthless
18:51technomancyand divide by 1000 if you want secondsn
18:51amalloygtrak: well, a little haskell. but i was introduced to monoids when i watched chouser's video on finger trees
18:51S11001001gtrak: consider: can you write an id such that for all nums i, (+ id i) yields i?
18:52S11001001numerically speaking, discounting weird type conversions & such
18:53jtoytechnomancy: that is all i want, (System/getCurrentTimeMillis) isn't found?
18:53gtrakS11001001, ah, yea, that works for minus only if you put id on the right :-)
18:53dreish,(System/currentTimeMillis)
18:53clojurebot1336517597611
18:53S11001001gtrak: the point of the id is that it has no effect; you can put as many in as you want, wherever you want, and the ids won't change the result
18:54hiredmanjtoy: that example code goes in the opposite direction of your question
18:54gtrakright
18:54jtoyhiredman: why?
18:54hiredmanyour question reads like you want to get the unix timestamp of a java.util.Date, but that example code turns a unix timestamp in to a java.util.Date
18:55dreish,(System/getenv "USER")
18:55clojurebot#<AccessControlException java.security.AccessControlException: access denied (java.lang.RuntimePermission getenv.USER)>
18:55S11001001gtrak: you can also find an id for *, and hell, for concat as well
18:55jtoyI just want current time, (System/currentTimeMillis) seems to work
18:55dreish_Nice_.
18:56S11001001gtrak: there are very many other identities, in fact exactly one for each monoid, but what you won't find is one for - or / :)
18:57gtrakfun :-)
19:01S11001001gtrak: I think the list of clojure data structures that don't imply monoids is shorter than the list of those that do. Since monoidal identities are quite useful in ordinary generic programming, I suggest keeping them all in mind
19:02gtrakis this covered in category theory texts a bit?
19:03amalloyyeah, monoids are one of the most useful/common categories in terms of CS
19:04gtrakI will prioritize this book in my queue
19:05gtrakstill trying to slog through reasoned schemer :-)
19:08ynnivdreish: you answered my question before I even asked it. awesome
19:09ynnivtwo bits up. 3!
19:24zii-primeargh. How do I test if a thing has been def'd yet?
19:24S11001001,(doc ns-publics)
19:24clojurebot"([ns]); Returns a map of the public intern mappings for the namespace."
19:24technomancy,(doc resolve)
19:24clojurebot"([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"
19:24S11001001&such
19:24lazybotjava.lang.RuntimeException: Unable to resolve symbol: such in this context
19:24S11001001:)
19:26zii-primeooh thanks :)
19:30zii-primebetter question: is there an easy way to test for a var being unbound?
19:31brehaut,(doc bound?)
19:31clojurebot"([& vars]); Returns true if all of the vars provided as arguments have any bound value, root or thread-local. Implies that deref'ing the provided vars will succeed. Returns true if no vars are provided."
19:31nDuffzii-prime: what's the context? If your goal is to avoid redefinitions, you might want to use defonce
19:36zii-primenDuff: eh, i'm prolly just micro-optimizing the syntax... context: only want one instance of the app open; if main is called again it should close the previous window
19:36zii-primedefonce is good enough
20:46XPheriorCan someone explain why this require call doesn't work? https://gist.github.com/2640779
20:48emezeskeXPherior: Care to elaborate on what you mean by "doesn't work"?
20:48XPherioremezeske: Yeah, my fault. Let me add the stack trace to the gist.
20:48emezeske^_^
20:48XPherioremezeske: It's there now. :)
20:49LuminousMonkeymain: core in project.clj
20:50LuminousMonkeyIsn't it supposed to be main: deps-sandbox.core
20:50LuminousMonkeyAnd do you need (gen-class) in the namespace declaration?
20:51XPheriorLuminousMonkey: I don't see that.
20:51XPheriorLuminousMonkey: That fixed it, thanks :)
20:51XPheriorI'm still getting used to Clojure project structure. Little things keep throwing me off.
20:52LuminousMonkeyI'm the same. :)
20:52XPheriorAlso, if I try to evalulate a form in Emacs, it obviously can't find the packages I'm using in the file. Is this a common problem, or am I going about it wrong?
20:53hiredmanyou need to restart the jvm when you add a dependency like that
20:53gfredericksrhickey's recent post makes me think of functors
20:54XPheriorhiredman: That seems really.. Extreme?
20:54cshellI just saw that post, didn't quite understand it the first time through - any good pointers to books/blogs that would help?
20:55gfrederickscshell: pff; I only know about functors from reading about monads. Probably that means you should just learn haskell :)
20:55LuminousMonkeyXPherior: Can you explain what you mean in another way?
20:55LuminousMonkeyXPherior: I think I might know what you mean, but I'm not sure.
20:56XPheriorLuminousMonkey: Hm, I'll try. So I'm trying to play around with Hiccup, and I want to just write some code and evalulate the form inside Emacs. When I try that though, Emacs doesn't know where Hiccup is.
20:56hiredmanXPherior: there are various mechanisms for loading code in to a jvm without using the classpath (which is fixed and static) none of which have really taken off
20:56mebaran151gfredericks: more technically monoids I think :)
20:56hiredmanso M-x clojure-jack-in again
20:56gfredericksmebaran151: eh?
20:57XPheriorhiredman: Got'cha.
20:57LuminousMonkeyHave you (require '[hiccup.core :as hic]) in SLIME?
20:57XPheriorhiredman: Odd. I don't have that function. Let me go figure that out.
20:57hiredmanXPherior: get a newer clojure-mode
20:57LuminousMonkeyOr evaled the ns declaration then switched to that ns in SLIME?
20:57XPheriorLuminousMonkey: It blew up
20:58XPheriorSame trace
20:58XPheriorhiredman: Okay, I'll do that now
20:58hiredmanI recommend running from the clojure-mode git, but the in one in marmalade should be fairly up to date
20:59cshellgfredericks: thanks, i'm still trying to learn clojure though :)
20:59gfrederickscshell: don't worry, several paragraphs later it is bogging me down too
21:02cshellgfredericks: yeah, I guess I'll have to read it several times more
21:02mebaran151gfredericks: he's talking about folds in terms of monoid operations, as opposed to just mapping a function (i.e. instead of mapping into collections of the same type (list -> list), which I think is a requirement of functors, he's building a more general framework where you have two functions, one to get the item of the first collection and another to combine with composite result, that you can then pipe somewhere else
21:05cshellmebaran151: man, i've been stuck in simple java land for way too long
21:05mebaran151cshell: Haskell is a good way to stretch your brain this way :)
21:06cshellmebaran151: better thank clojure?
21:07gfredericksmebaran151: I will rapidly alternate between reading the post and your paragraph and see what happens
21:07cshellgfredericks: maybe i should try that too
21:08mebaran151cshell: you can actually get stuff done in clojure; the type discipline in Haskell makes you deal with the concepts a little more directly, which can be burdensome in the beginning of a project (sometimes I just want to throw something on a web page, heh)
21:09gfredericksHaskell on a Horse?
21:11mebaran151gfredericks: I played with Yesod a little bit, which seemed well designed but getting non-trivial stuff up and running in Haskell can be a little tricky
21:12mebaran151you look at these type signatures Handler a b c q f g and just wonder how you'll get your humble little string where you actually want it
21:13gfredericksthese reducers are rather interesting
21:14gfredericksmebaran151: I only just now got to the fold part
21:33TimMcweavejester: Thoughts on adding an "initialize" feature to the ragtime migrations protocol? Could really help with DBs. I'd be willing to do the impl.
21:34weavejesterTimMc: Could you explain what you mean?
21:36TimMcweavejester: Well, ragtime's sql support currently looks pretty good once you have a DB with a schema and a migrations table. But how do you handle the initial condition, where the DB is empty and there isn't a migrations table yet?
21:37weavejesterTimMc: The SQL database type checks to see if there's a migrations table and if none exists, it creates one.
21:37gfrederickssupposedly elastic beanstalk lets you deploy ring apps. Does anyone know if that totally precludes using aleph asynchronously instead?
21:38TimMcweavejester: (I'm having trouble with my windowing system at the moment, so I won't be able to look at the code for a few minutes.)
21:38weavejestergfredericks: Unless things have changed, elastic beanstalk deploys via war to a Tomcat 6 server. No Netty, no async.
21:39gfredericksweavejester: okay, thanks
21:43gozalaCan anyone explain what exactly rfn does https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L125
21:43TimMcweavejester: So the implied setup code would be: 1) Create JDBC spec, 2) connect and create schema if probes indicate certain tables don't exist, 3) create a SQL Migrations record, 4) migrate-all ?
21:45weavejesterTimMc: Currently each time a migration is applied or removed for an SqlDatabase, the migrations table is created if it doesn't exist.
21:45weavejesterTimMc: I guess it could be more efficient with a setup/teardown
21:46weavejesterI need to get to sleep though :)
21:47TimMcweavejester: Wasn't thinking about efficiency, just simplicity of program initialization.
21:47TimMcOK, g'night. Thanks for setting me straight, I think I understand it now.
21:48weavejesterNight
21:51TimMcI guess it doesn't make sense for ragtime to be responsible for detecting blank schemas.
22:05muhooi remember there being some neat lein thing that'll automatically reload files in repl when they change? but i forgot its name
22:40muhoogah, illegal access error. i have a "global" foo.core/*bar*, i'm importing it to other ns's, and at times it seems the ns'es which use that *bar* sometimes catch it when it is unbound. or something. weird.
22:40muhoothis is on a noir app, so there is some dynamic recompilation going on in the background iirc
22:55muhoorecursive slappage
22:57muhoo(defn smoke-two-joints [] (smoke-two-joints) (recur))
22:57gfredericksI don't think that recur ever gets reached
23:00cshellhehe
23:04gfredericksmuhoo: (#(% %) #(% %))
23:07muhoogfredericks: that's my problem with the song!
23:08muhooit drove me nuts. i thought, "well, if you smoke 2 joints before you smoke 2 joints, and THEN you smoke 2 more, you'll never get to that last smoke 2 joints. it's unreachable!"
23:08gfredericks^ that's like an unDRYable expression
23:08echo-areaamalloy: I finally end up with this function, dropping-transform: http://pastebin.com/rsbDev0d What do you think?
23:08muhoothen i realize, the dude was so stoned, obviously he wasn't thinking about that.
23:09echo-areaamalloy: The final `loop' form is just an example, not the actual use of inputs.
23:09muhooalso, that (#(% %) #(% %)) is great, a clojure fork bomb
23:10muhoo&(#(% %) #(% %))
23:10lazybotjava.lang.StackOverflowError
23:10muhooya
23:10gfredericksjust a stack bomb
23:10gfredericksmuhoo: try refactoring out the repetition
23:10muhooin the stack bomb, or in that song?
23:10gfredericksthe stack bomb
23:11muhoo&#(% %)
23:11lazybot⇒ #<sandbox3826$eval11950$fn__11951 sandbox3826$eval11950$fn__11951@1f7480>
23:11muhoohuh
23:11muhoo&(#(% %))
23:11lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: sandbox3826$eval11960$fn
23:11muhoointeresting
23:11gfredericks&(#(% %) partial)
23:11lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: core$partial
23:12gfredericksboo
23:12gfredericks&(#(% %) complement)
23:12lazybot⇒ #<core$complement$fn__3929 clojure.core$complement$fn__3929@1aa4afc>
23:12muhoo &(#(% %) identity)
23:12muhoouh-oh
23:12muhoo&(#(% %) identity)
23:12lazybot⇒ #<core$identity clojure.core$identity@481e6a>
23:13muhoo&(#(identity %))
23:13lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: sandbox3826$eval12000$fn
23:13gfredericksmuhoo: the % makes it an arity-1 function
23:13gfredericksyou can't call it with no args
23:15muhoofun though. maybe i'll play with it later