#clojure logs

2011-05-26

00:00tomojI just effectively wrote (->> (range) (map (juxt identity identity)) (map (partial apply *))) instead of (map #(* % %) (range))
00:18amalloytomoj: c'mon, (map (comp (partial apply *) (juxt identity identity))
00:22tomoj:)
00:43crowbarI'm trying to run lein deps but the process is hanging on Downloading: org/clojure/clojure/1.2.1/clojure-1.2.1.pom from central and nothing is happening. any way for me to get around this?
02:29raekno_mindu: a node is a map with the keys :tag, :attrs and :content
02:31raekno_mindu: "<p>foo <a href="http://example.com/&quot;&gt;bar&lt;/a&gt; baz</p>" corresponds to {:tag :p, :attrs {}, :content ("foo " {:tag :a, :attrs {:href "http://example.com/&quot;}, :content ("bar")} " baz")}
02:32Jeffrey04erm... I am following the tutorial provided by labrepl, and i don't understand this instruction (chapter: unified update model)
02:32Jeffrey04The request function takes a URL string and returns a map of response data. Try it a the REPL to see how it works.
02:32raek...and when having these as code literals, you of course need [] instead of ()
02:33Jeffrey04(source request) yields => Source not found
02:34raekJeffrey04: I haven't used labrepl, but have you required/used the namespace 'request' is in?
02:34Jeffrey04@raek no instruction on that
02:35raeksource and doc will only work after the containing namespace has been loaded
02:35Jeffrey04@raek i thought it is using clojure-http.client, but doesn't seem like it is the case :/
02:35raekJeffrey04: what happens if you just eval "request" (without the quotes) in the repl?
02:36Jeffrey04CompilerException java.lang.Exception: Unable to resolve symbol: request in this context, compiling:(NO_SOURCE_PATH:0)
02:36Jeffrey04do labrepl people host their own irc channel?
02:37no_minduraek: thnxs, I figured that out
02:37Jeffrey04btw @raek, mind if i ask you what timezone are you in? you seem to be around 24/7
02:37Jeffrey04lol
02:37raekGMT+2
02:38no_minduraek: my problem was that when I supplied a map, The element was not being rendered. So I wrapped the map in a cons and it worrked
02:38raekbut since I am currenlty a student, I'm frequently on IRC...
02:38raekor, I can be
02:38Jeffrey04@raek lol XD
02:42Jeffrey04@raek any good tutorial for beginner?
02:47raekJeffrey04: well, there are the Clojure books, 4clojure.com (a site with a lot of small puzzles), and iirc there should be some kind of tutorial at try-clojure.org
02:47raekI guess it depends on what you are looking for
02:48Jeffrey04@raek: finished try-clojure.org already, will have a look see at 4clojure.com
02:48Jeffrey04thanks
02:49raekregarding "installing" Clojure, it can be good to know that you most ofter don't install Clojure itself but one of the tools, like Leiningen or Cake
02:50raek4clojure is not really a tutorial, but it is a very handy way of testing your knowledge
02:53raekJeffrey04: oh, how could I forget this: http://learn-clojure.com/
02:54raekas the site says, this is a often-referenced one http://java.ociweb.com/mark/clojure/article.html
02:55Jeffrey04@raek is actually trying to pick up clojure in a week to see whether it is good enough for my postgrad project
02:57raekJeffrey04: I also recommend Rich Hickey's presentations here http://blip.tv/clojure - especially the Clojure Concurrency one
02:58raekhe talks about why it matters that there is a language like Clojure
02:58thorwilin a week? won't the question rather be if your understanding of clojure will be good enough by then for a good decision? ;)
03:01raeksome of the non-conference videos (Clojure Concurrency, Clojure Sequences, Clojure Data Structures, Clojure for Java Programmers, Clojure for Lisp Programmers) are quite long, so it will probably take about a week t osee them all... :-)
03:02raekbut they explain well what's included in Clojure, and why
03:03Jeffrey04@thorwil lol, yea, figured it may be an impossible task, but still gotta try. liking what i see so far (except the endless parentheses, but i have been writing short functions started a year ago so not that much of a problem)
03:03raek(those vids were what got me hooked on Clojure)
03:06thorwilafter writing some JS for an anotherwise clj web project, i really don't see a problem with the syntax on the clj side ... ;)
03:07Jeffrey04@thorwil to me it is just placing the opening parenthesis in front of function name
03:07Jeffrey04lol
03:14TobiasRaederMorning :)
03:15TobiasRaederWhat is the idiomatic way of comparing two strings (similar to <, > for numbers)
03:15TobiasRaederThe strings are version strings in the format of "12.35.14335.15335" etc
03:16chouserhm, maybe split each string into a vector of integers and compare those?
03:16chouser,(compare [12 35 45] [12 50])
03:16clojurebot1
03:17chouser,(compare [12 35 45] [12 25])
03:17clojurebot1
03:17chouserheh, or maybe not
03:18chouserthat might work if you pad with zeros to the same length
03:23raek,(compare [12 35 45] [12 50 10])
03:23clojurebot-1
03:23raek,(compare [12 35 45] [12 25 10])
03:23clojurebot1
03:24raekah, in lexicographical order, shorter sequences are sorted before those sequences that have it as a prefix
03:25raekor?
03:26clgvraek: prefix?
03:27TobiasRaedermh
03:27raekfoo < foobar < foobaz
03:28clgvlol. I meant in your array case. for me it seems like a straight forward lexicographical sort
03:29TobiasRaederwhat you think of splitting the string into int vectors and then walk all vectors,
03:29TobiasRaedercompare them and if they are the same proceed to the next element otherwise return comparison result?
03:37clgvTobiasRaeder: sounds like lexicographical comparison as well ;)
03:38TobiasRaeder;)
03:38TobiasRaederThanks for the input
04:07fmwI'm having some trouble accessing metadata on my deftest objects: http://paste.pocoo.org/show/395393/ How do I get to access that metadata?
04:08fmwI'm trying to add a conditional to my fixture, so I can manually tell it not to create test databases for certain tests in my db module.
06:48bprdoes the destructuring keyword :as not work when destructuring arguments to a function?
06:51fliebelbpr: I;d think it should work. You experience otherwise?
06:51bpryeah
06:51bprunless i was doing it wrong
06:52fliebel&((fn [[a b :as c]] [a b c]) 1 2 3)
06:52sexpbotjava.lang.IllegalArgumentException: Wrong number of args (3) passed to: sandbox11964$eval15285$fn
06:52fliebel&((fn [[a b :as c]] [a b c]) [1 2 3])
06:52sexpbot⟹ [1 2 [1 2 3]]
06:52bprhrm
06:52fliebelworks for me...
06:53bprso i see
06:53fliebelbpr: can you paste yours?
06:54bpr&(defn segment-matcher
06:54bpr [[[type var] & rest] :as pattern input bindings]
06:54bpr ((segment-match-table type) pattern input bindings))
06:54sexpbotjava.lang.SecurityException: You tripped the alarm! def is bad!
06:54bprdoes :as have to be at the very end?
06:55bpri wound up coding it like: &(defn segment-matcher
06:55bpr "Call the right function for this kind of segment pattern."
06:55bpr [pattern input bindings]
06:55bpr (let [[[type var] & rest] pattern]
06:55bpr ((segment-match-table type) pattern input bindings)))
06:55fliebelbpr: try [[[type var] & rest :as pattern] input bindings]
06:56bproh nice
06:56bprthat compiles
06:56bpri'm implementing the pattern matching described in PAIP
06:56fliebelPAIP?
06:57bprParadigms of Artificial Intelligence Programming
06:57fliebelbpr: Be sure to talk to dnolen in any case. :)
06:57bprthanks for your help!
06:58clgvhow can i easily replace the elements of a seq that match a given criterion by a constant?
06:58fliebelbpr: I wrote this mini thing, but dnolen is working on something much bigger and more efficient. http://pepijndevos.nl/clojure-micro-pattern-matcher
06:58fliebelHe's doing efficient predicate dispatch, with DAGs and maximum sharing and all.
06:59bpr(map #(if (predicate %) 'constant %) sequence)
06:59fliebelpattern matching is a specific case of predicte dispatch I;ve been told.
06:59bpri think that'll do u clgv
06:59clgvbpr: I thought there might be something shorter built-in ;)
06:59bprfliebel: wow, that sounds impressive
07:00bprclgv: there may be
07:00bprclgv: i'm pretty new to clojure
07:01fliebel&(map {:a :b} [:a :b :c]) ; not really a predicate
07:01sexpbot⟹ (:b nil nil)
07:01fliebelouch
07:01clgvI need the predicate. ;)
07:02clgvyour use case can be done by "replace" ;)
07:02fliebel$doc replace
07:02clgvoh no. replace does it even better ;)
07:02clgv&(replace {:a :b} [:a :b :c])
07:02sexpbot⟹ [:b :b :c]
07:03fliebelTha's what I was aiming at yea...
07:03bprwow, that's nice
07:03clgvbut I need the predicate^^
07:03fliebel&(map {:a :b} [:a :b :c] [:a :b :c]) ;)
07:03sexpbot⟹ (:b :b :c)
07:04clgv&({:a :b} :b :a)
07:04sexpbot⟹ :a
07:05clgv &({:a :b} :c :a)
07:05fliebelhm, I can;t think of anything better for the predicate than the if bor came up with.
07:08bprfliebel: thanks for that link
07:08bprI think i'll prob learn a lot from that code
08:43tufflaxwhat's the site with clojure beginner exercises online?
08:44tufflaxfirst war like (= _ true) or something
08:44tufflaxs/war/was/
08:44sexpbot<tufflax> first was like (= _ true) or something
08:45bpri don't know about that example, but check out labrepl for a good set of beginner exercises
08:47manuttertufflax: I think you are looking for 4clojure.org
08:57tufflaxaa yes manutter thanks
08:57manutternp
09:01powr-tocIs it possible to mock protocol functions with clojure.contrib.mock?
09:13clizzinif i need a clojure program to send me emails, what's the best lib/jar to use?
09:17aavclizzin: depends on what emails you expect o receive :)
09:18aavclizzin: seriously - i'm using a simple wrapper (self made) around javamail api
09:18manutterThere's one called Postal listed on clojure-toolbox.com, and I started a little one at https://github.com/manutter51/nonomail
09:19manuttermine is still work-in-progress, but the sending part works for me in testing, so feel free to check it out if you're interested
09:22clizzinmanutter: thanks, i'll check it out
09:22clizzinaav: what do you mean what emails i expect to receive?
09:22manutterI haven't looked at it in a couple months, but let me know if you have any questions or find anything really ugly
09:23clizzinit's just a monitoring program that will email me if it detects trouble
09:23clizzinmanutter: what's the concept of a session in the context of nonomail?
09:24sthuebneranybody using clojuresque (kotarak's Gradle plugin) with SLIME? I was expecting some similar feature like `mvn clojure:swank`. But couldn't find any pointers in the internets
09:24manutterclizzin: it's a JavaMail session, it holds the credentials (username/password/server/etc) and manages communications with the server
09:25clizzinah i see
09:25clizzinnot very familiar with javamail, will take a look
09:25manutterIt really makes more sense in the context of reading mail, like from an IMAP server, but I haven't got that part done yet
09:25bartjclizzin, you can find sample code somewhere here: http://github.com/kyleburton/sandbox/
09:26clizzinbartj: err examples of manutter's nonomail lib?
09:27aavclizzin: emails are different. i.e. spam, important news, etc :) sorry - it could be my broken sense of humor :)
09:27clizzinnot sure what you're trying to say you have a sample of
09:27manutterI doubt if it's a sample of nonomail, I haven't really mentioned it publicly before today
09:28manuttercome to think of it, I probably shouldn't have mentioned it today, since I don't recall writing any docs for it, hmmm...
09:29bartjclizzin, no, it uses javax.mail
09:29clizzinbartj: oh i see
09:29clizzinbartj: mind telling me what the path is? there are a lot of different things in that repo.
09:30joegallomanutter: fancy seeing you here!
09:30manutterheya joe, how's things :)
09:31joegallothings are great! I just saw you mentioning postal, and than I looked at your name, and I thought, "I know that guy!"
09:31bartjclizzin, I can't find it there, I took the code sometime ago
09:32bartjclizzin, from his github repo. here's the relevant function you will need - http://pastebin.com/Pk0fGCvW
09:32manutterjoegallo:Yeah, I've seen your name pop up here now and then but I was too busy at the time to shout out
09:32joegalloheh, no worries.
09:32clizzinmanutter: it looks fairly clear from the code, though of course every project should have docs
09:32bartjclizzin, with relevant usage provided below in the paste
09:33clizzinbartj: cool, thanks
09:33bartjclizzin, just remember to add the appropriate imports and you will be good to go
09:33manutterclizzin: it's on my todo... ;)
09:33joegalloclizzin: but, ummm... docs aren't any fun to write... :)
09:33manutteractually, the most fun part of nonomail was writing the midje tests
09:33clizzinjoegallo: i actually kind of like writing docs (to stuff i've written myself! i'm not volunteering for anything here). what's the point of writing something if no one can figure out how to use it?
09:34bartjclizzin, let me know if it works for you!
09:35manutterclizzin: the midje tests in nonomail are the best docs for how to use it right now
09:36manutterIf I get some time tonight I think I can grab a code sample from somewhere
09:54JG`Quick Q. I'm trying to create a list of structs, and probably missing something very obvious. Here's my code: (defstruct nodex :p :rel :props)
09:54JG` (def tree-basics (list (
09:54JG` (struct nodex nil :identities {:type "identities"})
09:54JG` (struct nodex nil :decisions {:type "decisions"})
09:54JG` (struct nodex nil :trading {:type "trading"})
09:54JG` (struct nodex nil :testing {:type "testing"}))))
09:54JG`
09:54JG`Wrong number of args (3) passed to: PersistentStructMap
09:54JG` [Thrown class java.lang.IllegalArgumentException]
09:55JG`the weird thing is, if i take the 'testing' line out (leaving it with 3 list members), it works fine.
09:59bpr&(do (defstruct nodex :p :rel
09:59bpr :props) [09:54]
09:59bpr (def tree-basics (list (
09:59bpr (struct nodex nil :identities {:type "identities"})
09:59sexpbotjava.lang.SecurityException: You tripped the alarm! def is bad!
09:59bpr (struct nodex nil :decisions {:type "decisions"})
09:59bpr (struct nodex nil :trading {:type "trading"})
09:59bpr (struct nodex nil :testing {:type "testing"})))))
09:59bprboo
10:00CheckieJG`... what's the purpose of the paren after list?
10:01JG`none, that was the problem. ty.
10:52imadeI would expect that (reverse "madam") would give "madam" istead of char array
10:52fliebelimade: Look at clojure.string, it does that, I think.
10:53fliebelimade: http://clojure.github.com/clojure/clojure.string-api.html#clojure.string/reverse
10:53fliebelcore/reverse works on the iseq interface, so you get back an iseq.
10:58dsophmm how you guys start nailgun?
10:59dsoprecent lein-nailgun doesn't seem to work with clojure 1.2.x
11:04manutterdsop: I never really played with nailgun per se, but I believe it's what's behind the jark stuff
11:05manutterand jark is working well for me
11:05dsopjar?
11:05dsopjark
11:05clojurebotjark is a clojure daemon for scripting: http://icylisper.in/jark/
11:05dsopkk thx
11:05manutterheh, tks clojurebot
11:06manutterwhat's that command now...
11:06manutterbotsnack
11:06manutter#botsnack
11:06manutterhmm, something like that
11:06manuttero well, good job bot
11:06fliebel,botsnack
11:06clojurebotjava.lang.Exception: Unable to resolve symbol: botsnack in this context
11:06manutterlol, he choked on his snack
11:07manutter&botsnack
11:07sexpbotjava.lang.Exception: Unable to resolve symbol: botsnack in this context
11:07manutter$botsnack
11:07sexpbotmanutter: Thanks! Om nom nom!!
11:07fliebelwrong bot
11:07manutterah, right command, wrong bot
11:07fliebel~botsnack
11:07clojurebotthanks; that was delicious. (nom nom nom)
11:07manutterthere we go
11:07manutterthe bots are fed, my work here is done.
11:08fliebelclojurebot: botsnack is Thanks, can I have chocolate next time?
11:08clojurebotprimetime is <lowlycoder> i'm not convined clojure is ready for primetime until i see facebook apps in clojure
11:12danlarkinwow
11:12danlarkinI was not aware that facebook apps were the arbiter of primetimeliness
11:13fliebelHow do I tell clojurebot to forget stuff? :(
11:13danlarkinwhen did the committee decide?
11:13danlarkinclojurebot: forget primetime is <lowlycoder> i'm not convined clojure is ready for
11:13danlarkin primetime until i see facebook apps in clojure
11:13clojurebotc'est bon!
11:14danlarkinerf, like that except not with the linebreak
12:06manutterprimetime
12:06manutterjark
12:07manutterhrm
12:07manutter~jark
12:07clojurebotjark is a clojure daemon for scripting: http://icylisper.in/jark/
12:07manutterah
12:07manutter~primetime
12:07clojurebotprimetime is <lowlycoder> i'm not convined clojure is ready for primetime until i see facebook apps in clojure
12:09hiredmanto be fair that means I could have written it a month ago (it was actually over a year ago and was hosted on appengine)
12:09manutterYes, but has lowlycoder SEEN it?
12:10technomancyk
12:10technomancyoops
12:10hiredmanmanutter: excellent point
12:10edw; Touch file: "machines/C/stackops.ext"
12:10edw; Touch file: "machines/C/traditional.bin"
12:10edw; Touch file: "machines/C/traditional.ext"
12:10edw;unable to open file #[pathname 6004 "/home/edw/dev/mit-scheme/src/compiler/machines/i386/dassm1.bin"]
12:10edw;To continue, call RESTART with an option number:
12:10edw; (RESTART 1) => Return to read-eval-print level 1.
12:10edw2 error>
12:10edwEnd of input stream reached.make: *** [all-native] Error 1
12:10edwedw@li246-89:~/dev/mit-scheme/src$ more compiler/machines/
12:10edwC/ bobcat/ mips/ spectrum/ vax/
12:10edwalpha/ i386/ sparc/ svm/ x86-64/
12:10edwedw@li246-89:~/dev/mit-scheme/src$ more compiler/machines/i386/
12:10edwassmd.scm dassm2.scm instr2.scm make.scm rules4.scm
12:13pjstadigedw: good point
12:13pjstadig:)
12:23faust45how i can reload code in repl?
12:24no_minduhow do I iterate over all the keys of a map ?
12:26Vinzent,(keys {:a 1 :b 2})
12:26clojurebot(:a :b)
12:26tufflaxI have made a class with gen-class that has a -main, how do I run it in the repl? I don't wanna have to make a jar and execute java on it. :P
12:27Vinzentfaust45, what do you mean? You can redefine any var from the repl
12:28Vinzenttufflax, i think -main is a plain function, so you can call it from the repl like any other
12:28faust45Vinzent: i have app running in repl how i can reload my app?
12:28imadeno_mindu: (for [k (keys {1 1 2 2 3 3 4 4})] (inc k))
12:30Vinzentfaust45, maybe try (require 'your.core.ns :reload-all)?
12:30tufflaxVinzent ok, thanks. There is something wrong with my code though :(
12:31faust45Vinzent: yes thanks ;)
12:42clizzinwhat's the best way to loop repeatedly with a pause at the end of each loop? basically, i want a function to run every minute, but i want to avoid the JVM startup time that would accompany the run if i were to make this a cron task that ran the function through a jar.
12:43clizzinbtw, to those who were giving mail advice earlier, i ended up going with postal because it looked like a very mature and actively maintained lib. sorry i didn't end up using any of your solutions, but i really appreciated the help
12:44TimMcclizzin: Is drift OK?
12:44clizzinTimMc: a little bit, but hopefully not beyond like 5s
12:45Vinzentclizzin, you can start fn in other thread, call Thread/sleep, then recur
12:45clizzinVinzent: so, use 'loop' to control the loop and just pass no args to 'recur'?
12:46TimMcclizzin: What happens if you throw an exception in the loop?
12:46TimMcdaemons are tricky
12:47clizzinTimMc: ideally, it should email me the exception. if the emailing itself throws an exception, it should log on disk. but then the loop should continue.
12:47raekclizzin: cron4j is super-simple to use from clojure and uses the same syntax as cron. if you only want a task to be run every now and then this is probably overkill
12:47raek(cron4j runs within one jvm instance)
12:48Vinzentclizzin, yep, simplest thing would be (.start (Thread. (fn [] (println "called") (Thread/sleep 1000) (recur))))
12:48clizzinraek: oohh nice. but re your overkill comment: do you mean to say that cron4j is overkill for running a task now and then?
12:50raekclizzin: if you don't care about that it is run exactly every 60 seconds (just that there is about one minute delay in betwen) a simple loop and a sleep solves the problem more simpler
12:50clizzinraek, Vinzent: gotcha, i'll just do the loop/sleep then for now
12:50clizzinthanks!
12:50clizzingreat to know about cron4j though, that'll be perfect later on down the road
12:50clizzinjvm startup time's a bitch
12:52Vinzentbtw, i'd like to announce another web framework for clojure: https://github.com/dnaumov/jaco any feedback is strongly welcome!
12:52raekclizzin: this runs my-fn 12:30 on mondays to fridays :-) (doto (Scheduler.) (.schedule "30 12 * * 1-5" #'my-fn) (.start))
12:54raek[org.clojars.ghoseb/cron4j "2.2.1"]
13:01fliebelVinzent: I don't need webframeworks, I create my own ad hoc, informally -specified, bug-ridden, slow implementation of half of RoR
13:02manutterlol
13:03fliebelcommon guys, the logs are still not on google for this term. I'm trying to popularize Clojure here.
13:05amalloyfliebel: funny you should mention that. the php application i've been working on for a year falls into that category
13:06Vinzentfliebel, :)
13:08VinzentI have often heard that clojure doesn't need web frameworks, but that sounds strange, isn't it?
13:08fliebelamalloy: I thought PHP in itself was already an ad hoc... of RoR. You must be adding the other half?
13:08amalloyfliebel: php was first, so i doubt it
13:08TimMcClojure is... porn? http://correlate.googlelabs.com/search?e=clojure&amp;t=weekly
13:10amalloyfliebel: but we have a guy who likes rails and he's been adding feature after feature for months. we now have a bad, ugly version of rails that breaks a lot
13:10ataggart"ugly version of rails" didn't think that was possible
13:10fliebelamalloy: You should call it PHP on Rails New ;)
13:12amalloynah. i'm calling it: so long, i'm off to work with ninjudd and lancepantz
13:14fliebelVinzent: Real man use raw sockets. I guess Lisp attracts more real man then PHP and Ruby and all.
13:15amalloyfliebel: you don't mean high-level nonsense like socket.h, do you? i use raw ioctl
13:15Vinzentfliebel, well, russian lispers don't consider clojure as a lisp :)
13:18Vinzentreal man use only parentheses
13:19Vinzentand never touches jvm :)
13:19TimMcVinzent: ##(#(% %) #(% %)) alphanumerics are for wimps
13:19sexpbotjava.lang.StackOverflowError
13:20TimMcgfrlog: Do you remember how far we got without alphanumerics?
13:27wastreli'm working on 4clojure problems
13:28manutterme too
13:28manutterwell, in my free time
13:28wastrelright at this moment i mean :]
13:32manutterCompojure is a little more interesting than Clojure: http://correlate.googlelabs.com/search?e=compojure&amp;t=weekly#
13:32wastrelwhat's brazil tube?
13:34manutterI'm at work, not sure I dare google that...
13:35amalloyhah
13:35clizzinwell, that was a great penis joust that just happened there (re the 'real man' shit)
13:35clizzin(as you can see, i'm taking clojure logs to searchability for something else)
13:36Vinzentlooks like popularity going down fast
13:36clizzini think clojure + mongrel2 has a lot of potential for a really amazing web framework
13:37clizzinanyway, sleep time, night all
13:41fliebelwait, what? mongrel2? What's that good for? *googles*
14:01dnolenmaking a Scheme-ish pair abstraction for Clojure that's as fast as Cons / PersistentList is tricky ...
14:07ataggartto what end?
14:10dnolenataggart: core.logic needs it, Prolog / miniKanren sequences allow logic variables as tails in addition to seqs and nil.
14:11dnolensome core.logic programs run surprisingly slower than the comparable Prolog, I'm beginning to suspect it's the overhead around my LCons (Pair data structure) design.
14:11ataggartrevealing my ignorance, what's the difference between a pair and a two-element vector?
14:12dnolenataggart: (1 . 1) is legitimate Scheme, such a thing is impossible to do w/ vectors (or any sequence like thing in Clojure)
14:13dnolenin Clojure only (1 . nil) or (1 . ()) is possible.
14:14ataggartso you want to use a cons-like fn that accepts not just seqs in the second slot?
14:15no_minduIam building a stack based on ring. I want that the request object recevied, should be available globally to all namespaces and functions. How do i do this ?
14:15dnolenataggart: I already have it, I just want it to be faster.
14:15ataggartlink to src?
14:18dnolenattagart: heh it's a doozy, https://github.com/clojure/core.logic/blob/master/src/main/clojure/clojure/core/logic/minikanren.clj#L340
14:18ataggartnvm, found it
14:18dnolenataggart: another relevant line is 435, I think a lot of time being wasted there.
14:20amalloyno_mindu: that sounds tremendously non-functional
14:20dnolenataggart: another issue is 440, (lcons a (lcons b ...)) way more expensive then '(a b ...), was considering using delays ...
14:22amalloydnolen: isn't the consing in '(a b) done at read time? i don't think you can get as fast as "do nothing at runtime"
14:23dnolenamalloy: in some simple tests using delays will get you the same perf, like lazy sequences you don't pay for what you don't use.
14:27no_minduamalloy: why ? if some data is to beused by every second function in the stack, it makes more sense to put it in some central store
14:29no_mindI mean put the data in some central store
14:29amalloyit will make your code hideously difficult to test at the repl, for example. nothing will work unless you create a valid ring request
14:30amalloyif you want to make some *pieces* of the data global, just those pieces you use, that's going to be easier to work with. as long as you label them clearly and don't mutate them, it's not such a problem
14:31amalloyno_mind: you can even see an example where i did just that, at https://github.com/dbyrne/4clojure/blob/develop/src/foreclojure/utils.clj#L15
14:35fliebeldnolen: You should try to win bpr for your predicate dispatch efforts ;)
14:35ataggartdnolen: please forgive the likely dumb question, but why isn't this the implementation of lcons? https://gist.github.com/993734
14:35ataggartdnolen: "you don't have enough contextual knowledge" is an appropriate response.
14:35itissidHey has some one used cascalog here?
14:36itissidmaybe for Machine learning stuff
14:36fliebelitissid: nathanmarz has, I guess :)
14:36itissidnathanmarz, Hey can I know one thing I once wrote some machine learning algorithms in hadoop back when mahout was not there.. Now i had to write ridiculous amounts of code to do something like Newton raphson..
14:36itissidNow there is mahout
14:37itissidwhich still is too huge
14:37itissidcascalog seems to make the pain go away
14:37fliebelataggart: You are just adding it as the last item, right? Not as 'the rest'
14:38itissidnathanmarz, are there examples on the web that do ML stuff with cascalog?
14:38dnolenataggart: next will give you nil and you know you're done. that is not the case w/ lcons.
14:39nathanmarzitissid: i don't know of any examples on the web doing ML
14:39dnolenataggart: next/rest always give seq or nil. lcons needs next/rest to give seq, nil, or lvar
14:39amalloyitissid: you could also look up sam ritchie who's done a lot of cascalog/hadoop stuff in clojure
14:39nathanmarzitissid: if you tell me about the algorithm you're trying to do, I can provide some guidance as to what that would look like with cascalog
14:40dnolenataggart: we don't want to muck with Clojure next, so LConSeq defines lnext, which does the desired thing.
14:40dnolenfliebel: bpr?
14:41fliebeldnolen: Yea, he was in here this morning, talking about writing a pattern matcher.
14:42itissidnathanmarz, well i am just scouting my old Hadoop project, I want to learn this new way of doing this, but first tell me; Do you think iterative map reduce is much easier than writing it with plain java and hadoop..
14:42itissidi mean iterative map reduce using datalog+clojure+cascade
14:46no_mindamalloy: well the requirement is to have a valid ring request for anything to work. I mean the whole stack is based on parsing the request url and request params... so in such case dependency on a ring request for things to work sounds fair enough.
14:46dnolenfliebel: ah yeah he was talking about the pattern matching bit in PAIP, which is simplistic.
14:47nathanmarzitissid: yes, dramatically easier
14:48amalloy*shrug* suit yourself. there's a reason nobody likes global variables: they add a lot of incidental complexity. but you have the power, and if your judgment is that it will make your program easier to maintain, feel free
14:48itissidnathanmarz, Thanks I will give it a try..
14:48dnolennathanmarz: Storm sounds cool. looking forward to hearing more about that.
14:49amalloydnolen: nathanmarz is probably going easy on Storm so he doesn't get a bad rep for all these tornados
14:53fliebelamalloy: tornados?
14:57choffsteinHey all! Anyone here using moustache? I can't figure out a good way to get static files served (e.g. javascript, css, images, etc)
14:57choffsteinI keep having to create different paths
14:57amalloyfliebel: the US has had a couple really large tornado events in the past month or so
14:58fliebelamalloy: Ah, I was thinking http://www.tornadoweb.org/ so I did not get your joke.
15:01dnolenfliebel: open to suggestions, I won't adopt that syntax for predicate dispatch / pattern matching.
15:02dnolenfliebel: in core.logic it's an important distinction because it means you're creating a logic variable.
15:02dnolenfliebel: I toyed w/ capital letters a la Prolog, but that just seemed too un-Lispy. ? has a precedent w/ Norvig and others.
15:03fliebeldnolen: What about extending symbol/var with lvar?
15:03dnolenfliebel: a-lvar ?
15:04fliebeldnolen: dunno, but the equivalent of a lowercase symbol in Clojure would be a :keyword I think.
15:04fliebelSo basically any symbol is what would be an uppercase symbol in Prolog.
15:04dnolenfliebel: yeah can't do that because you can use any Clojure literal for unifying w/.
15:04JGQ on doseq. Code: (doseq [tree-node (filter #(= (:parent %) par-uid) tree-basics)]
15:05JGHow do I make sure this doesn't fail if the filter returns nill?
15:05fliebeldnolen: ?
15:05dnolenfliebel: no symbols are lowercase in Prolog too. Logic vars are uppercase.
15:07fliebeldnolen: OKay, other crazy idea. Make all symbols logic vars and unify them with what they might refer to.
15:08dnolenfliebel: sounds inefficient.
15:09fliebeldnolen: Then make them logic vars based on if they refer to something. Same thing.
15:09dnolenfliebel: refer to what?
15:10fliebeldnolen: something... I don't know. Okay, what about leaving symbols alone, and turning vars into lvars? So you'd write #'blah instead of ?blah.
15:11ataggartJG: if the seq is empty/nil, the body isn't called
15:11dnolenfliebel: changing the meaning of Clojure idioms seems ... ill-advised.
15:13fliebeldnolen: OKay. But I still don;t understand why you can;t make a var implement your logic var protocol.
15:13dnolenfliebel: LVar has data fields that Vars don't, can't bring Var into the protocol.
15:14dnolenjust like String can't have metadata
15:14fliebeldnolen: Okay, fair enough...
15:22JGataggart - thanks. I get an error which suggests it is, probably some other hidden thing.
15:40amalloyJG: fwiw, i prefer to write that as (filter (comp #{par-uid} :parent) tree-basics)
15:57jweissI"m noticing in my leiningen project that when i run lein install, it installs a jar file with some compiled classes from clojure.contrib. that's not supposed to happen, is it?
16:01pjstadigjweiss: do you have any AOT compiled classes?
16:02jweisspjstadig: yeah
16:02pjstadighttp://dev.clojure.org/jira/browse/CLJ-322
16:03pjstadigthere's a bug where AOT compiles more than just the classes you ask it to
16:03jweisspjstadig: ah ok that's exactly what i'm seeing, thanks
16:03pjstadigi think there are some lein mechanics to clean out the extra AOT classes
16:04pjstadigsome options in the project.clj
16:04pjstadigtechnomancy would know better
16:04jweissthe bloat is insignificant, so it's no biggie, but just thought it looked 'wrong'
16:07jweisspjstadig: hm, i found a stackoverflow question where technomancy says lein 1.4 will have a workaround. i guess i need to activate it somehow since i have 1.5
16:08pjstadigyeah there's an option to have it clean extra class files
16:08pjstadigi don't recall it off the top of my head
16:09jweissah i found it :class-file-whitelist
16:09jweissfrom the lein tutorial
16:14lucianthis reminds me, i've been wondering if clojure works with gcj
16:15luciana use case might be android, since clojure's boostrap is gc-intensive and dalvik has a slow gc
16:15pjstadiglucian: in what way? clojure compiles down to jvm bytecode
16:15pjstadigisn't gcj a java compiler?
16:15luciani was wondering if gcj AOT might be useful
16:16lucianit's a bytecode-to-native compiler
16:16pjstadighmm
16:16pjstadiginteresting
16:18amalloylucian: stay away from gcj
16:19fliebelamalloy: why?
16:19lucianamalloy: have you tried it?
16:20amalloynot for years. it hasn't really kept up with javac
16:20luciani see. last time i tried it (a couple of years ago) it was quite nice
16:21amalloyhttp://gcc.gnu.org/java/ hasn't been updated since 2009
16:21amalloyand it didn't support 1.5 then
16:21lucianhmm, that is bad
16:21lucianany other ideas about android?
16:21luciannot even necessarily clojure, just not java
16:22pjstadigmirah
16:22amalloyyeah, mirah's an interesting idea
16:22lucianpjstadig: yeah, i looked at that
16:22amalloyhttp://gcc.gnu.org/java/status.html seems to be their "we know, everything is broken" page
16:22luciancouldn't get it to work, and it's appears immature. not sure what to think
16:23pjstadigtechnomancy seems to have gotten it to work for some simple android apps
16:23fliebelamalloy: That's like Java and rpython having a lovechild, right?
16:23lucianfliebel: jruby, but yeah
16:23pjstadigi've never used it myself, but i'm pretty convinced it would be great for an android app
16:25luciani've also looked at kawa, since app inventor uses it. although it appears to be an interpreter
16:25fliebellucian: I said rpython because it is a more static subset of Python, as far as I know.
16:26lucianfliebel: well, sort of. RPython is just an implementation detail of PyPy, you can't actually use it for anything other than building a VM
16:26lucianfliebel: mirah has extensions instead, so it's not even a subset of ruby
16:26lucianfliebel: i guess a more precise comparison would be with cython
16:26pjstadigmirah?...mirah is a statically typed ruby
16:28RaynesAm I the only one that finds it weird to compare Mirah to... Python? :o
16:29pjstadigessentially...or maybe ruby inspired...headius was specifically trying to bring static typing to a ruby-like syntax that compiles to JVM bytecode
16:29fliebelRaynes: I could compare it to Forth if that makes you feel more comfortable?
16:30Raynesfliebel: Sure.
16:30lucianRaynes: RPython and Cython are not quite python, hence the comparison
16:30lucian(just like mirah is not quite jruby)
16:31fliebelRaynes: Well, Mirah is kind of like Forht, in that it tries to embrace the host platform, instead of abstract it away. Unlike Python of course.
16:32fliebelBoth have very simple syntax also.
16:38technomancymirah's syntax is not really simple
16:39technomancybut it is a very thin layer over the host platform otherwise
16:41fliebelHm, I should ask fogus what he's up to. Was babbling something about JVM Forth the other day on Twitter.
16:41fliebel$seen fogus
16:41sexpbotI have never seen fogus.
16:41hiredmanjvm bytecode is stack based
16:42fliebelhiredman: So in that case, Forth is just JVM assembly :)
16:42hiredmanso the code is similar to forth in often being about stack manipulation
16:42fliebel~seen fogus
16:42clojurebotI don't understand.
16:42fliebel$seen fogus'
16:42sexpbotI have never seen fogus'.
16:42fliebelgrr
16:43fliebel$seen fogus`
16:43sexpbotfogus` was last seen talking on #clojure 1 week and 6 days ago.
17:22no_mindIwas going through clojure coding standards. can someone explain this to me "Unroll optional named arguments. Callers should not have to wrap optional named arguments in a map literal: "
17:25pjstadigno_mind: that sounds to me like the difference between (my-fun arg :optional-arg "foo") and (my-fun arg {:optional "foo"})
17:26no_mindpjstadig: my guess was same but wanted it to confirm this from experience developers
17:29ataggartno_mind: https://gist.github.com/994128
17:32no_mindthnxs ataggart
18:02zakwilsonhttp://pastebin.com/Q2V8Kzbx <-- I'm getting a "No single method..." error when trying to compile this ClojureQL code. I imagine I simply don't quite understand how to use join/rename, and I can't find anything by googling the error message.
18:10maaclDoes anyone know an elegant way of getting all moustache routes to also match routes with trailing /. It appears inelegant to have to write all routes twice.
18:12Tcepsamaacl: I know nothing of moustache, but can you somehow use a regular expression instead of a string to specify the route?
18:13offby1I am a total Clojure n00b, and have never used (or, for that matter, ever even heard of) mustache. But: I would hope that its config would let you pass in a function to match the URL.
18:13offby1If that's the case, you could (as Tcepsa suggests) trim any trailing / _before_ invoking the matcher
18:17maaclTcepsa: offby1: Well the syntax is a bit different - I am already matching on a regex, but moustache expects an empty string to match just a trailing slash - it basically ignores the slashes and just looks at the parts in betweeb
18:22amalloyTcepsa: you can just write a little middleware that strips the / before handing it to moustache
18:23jweissis there some reason that AOT compiling is normally slow (like 15 seconds to compile 1 relatively simple class), or am i doing something wrong?
18:23jweissi am guessing it's compiling all the deps
18:23amalloy(defn strip-slash [handler] (fn [req] (handler (update-in req [:uri] remove-the-slash))))
18:23jweissbecause the first class is slow but the next isn't
18:23amalloythen instead of passing your moustache routes straight to ring/jetty, pass jetty (strip-slash moustache-routes)
18:24amalloyi use compojure, not moustache, so i don't know the route syntax, but the point is you can do it Ring-side before moustache ever sees it
18:28amalloyfor completeness: (update-in req [:uri] clojure.string/replace #"/$" "")
18:28bprwhy would M-x clojure-jack-in bomb-out with: https://gist.github.com/994245
18:28technomancyjweiss: yes; there's a bug in the clojure compiler where you can't AOT compile a namespace without compiling all the namespaces it depends upon
18:28Tcepsaamalloy: Awesome ^_^
18:29amalloyTcepsa: the ring concept makes it amazingly easy to extend and manipulate the pipeline
18:29technomancybpr: probably competing versions of swank; try clearing everything but 1.3.1 out of ~/.lein/plugins and project.clj
18:29bprok thanks
18:32bprnow i get: error in process filter: Cyclic keymap inheritance
18:32bprin *Messages* and the *swank* looks similar to the gist i posted, except there's no exception
18:33maaclamalloy: thanks that is a good idea
18:33Tcepsaamalloy: It's definitely on my list of things to learn! Just too many great tools, not enough time. ~grin~
18:40bprtechnomancy: Thanks for your help. It looks like I had 2 problems, 1: multiple versions of swank-clojure and 2: I was setting up a slime keymap in my .emacs.d/*
18:40bprit's working now though
18:40technomancysweet
18:52zakwilsonAm I understanding correctly that I can't use rename in ClojureQL without also using project?
18:59wruthw4lkhi there..some help with installing clojure-mode?
19:02zakwilsonHi there. Perhaps you could tell us exactly what your question is instead of just generally asking for help.
19:03wruthw4lksorry....i have installed it as per the getting started page in dev.clojure...after installing the emacs starter kit..and used elpa to install it..it works for first time...but when i quit emacs reload it, i cant run it agai
19:03wruthw4lkagain*
19:04zakwilsonPastebin your .emacs
19:07wruthw4lkhttp://pastebin.com/EG5BWzqJ
19:07wruthw4lkthats it
19:10zakwilsonI think you need a (package-initialize) in there before you start using the package stuff.
19:10wruthw4lkthanks..let me try it out
19:12wruthw4lkok...so that works..thanks!!! :)
19:14zakwilsonNo problem.
19:25wruthw4lksorry..but there seems to be yet another problem...till i added (package-initialize) to my .emacs, i could connect to a swank server (lein, without syntax highlighting) but now, when i try slime-connect, i get "Symbol's function definition is void: slime-define-both-key-bindings"...any help here?
19:26technomancywruthw4lk: maybe you have slime installed via apt-get as well or something?
19:28wruthw4lktechnomancy: yeah i did...would that be a problem?
19:29choffsteinDoes anyone here use moustache?
19:29technomancywruthw4lk: yeah, it will probably conflict
19:30wruthw4lktechnomancy: thanks... ill try it out :)
19:40wruthw4lktechnomancy: thanks...it works!! but shouldn't the slime repl too have syntax highlighting? i can get syntax highlighting in .clj files now..
19:44nathanmarzdnolen fliebel: we'll be putting up some cool demos of storm soon. our bottleneck on the demos actually isn't storm, but doing all the javascript to make a pretty realtime frontend
19:44technomancyrepl syntax highlighting is separate
19:44technomancyI think that's in durendal
19:44technomancy,google durendal clojure
19:44clojurebotjava.lang.Exception: Unable to resolve symbol: google in this context
19:44technomancy~google durendal clojure
19:44clojurebotFirst, out of 36 results is:
19:44clojurebottechnomancy/durendal at master - GitHub
19:44clojurebothttps://github.com/technomancy/durendal/blame/master/durendal.el
19:48offby1this channel needs a better bot! :-)
19:49technomancyoffby1: you have no idea how often I have to keep myself from "Let's"ing in here
19:49technomancyI did steal a few things though.
19:49technomancy~guards!
19:49clojurebotSEIZE HIM!
19:53bprI'm very new to the java ecosystem and clojure especially. Is there any facility for tracing program execution? Like common lisp's trace?
19:53bprI've been looking at clojure.tools.logging's trace macro, but i can't seem to get any output
19:54technomancybpr: C-c C-t can toggle tracing a single defn inside slime
19:54technomancybpr: if you want step-by-step, cdt is probably your best bet
19:55bproh, i didn't know about cdt
19:55bprthanks
19:56tmciverNeed some help with swank-clojure: after M-x clojure-jack-in I try to use auto complete but emacs complains C-c TAB is undefined . . .
20:30pickles1quick q: is there a clojure bif equivalent to haskell's partition function? something that can like: (hpartition even? [1 2 3 4 5]) -> [[2 4] [1 3 5]]
20:37amalloyclojure.contrib.seq/separate
20:38amalloy$google clojure contrib separate clojuredocs
20:38sexpbotFirst out of 93 results is: ClojureDocs - clojure.contrib.seq/separate
20:38sexpbothttp://clojuredocs.org/v/57
20:38amalloypickles1: ^
20:38mangie_mutthi, trying to use jcurses with lein, but can't seem to get it to work: http://pastebin.com/xQRJcREz
20:39pickles1amalloy: thx a bunch! I was sure there had to be one, but didn't feel like going through the docs 1 fn at a time
20:40pickles1(im open to suggestions on better ways to find functions)
20:40amalloy$findfn even? (range 10) [0 2 4 6 8]
20:40sexpbot[clojure.core/filter]
20:40amalloypickles1: ^
20:41amalloyfairly limited, but useful for finding basic functions
20:41pickles1neat, i shall have to put that somewhere that i'll remember so i can reference it
20:42pickles1thx again!
20:42pickles12 internet points for you
20:42zakwilson$findfn (range 5) [1 2 3 4 5]
20:42sexpbot[]
20:42zakwilson$findfn inc (range 5) [1 2 3 4 5]
20:42sexpbot[clojure.core/map clojure.core/pmap clojure.core/keep]
20:42zakwilsoncool.
20:43amalloy$findarg (map % (range 5)) [1 2 3 4 5]
20:43sexpbot[]
20:43amalloyhm. i thought that worked
21:07pickles1hm, clojure's not finding separate... is contrib a separate lib?
21:08pickles1(i'm a clj noob)
21:09pickles1... apparently i need to rtfn
21:09pickles1*rtfm
21:09pickles1idk what rtfn would be...
21:16amalloythe news
21:17amalloybut pickles1, you can define separate yourself. it's trivially easy
21:17pickles1tru
21:17amalloy(def separate (juxt filter remove))
21:17pickles1yeah, was just wonderin if there was already a function i had access to that would do it
21:17amalloy&(let [separate (juxt filter remove)] (separate even? (range 10)))
21:17sexpbot⟹ [(0 2 4 6 8) (1 3 5 7 9)]
21:18pickles1since i don't know the library all that well yet
21:18amalloy*nod*
21:18pickles1hm, juxt looks interesting
21:19amalloy(inc juxt)
21:19sexpbot⟹ 1
21:19amalloyheh
21:19amalloyjoin the juxt fan club
21:21danlarkinpresident: hiredman
21:21pickles1what are the dues?
21:22danlarkin...you have to use juxt
21:22danlarkinthat's enough punishment
21:22pickles1lol
21:40gfrlog,((juxt list vector hash-set str name identity) :what)
21:40clojurebot[(:what) [:what] #{:what} ":what" "what" :what]
22:02amalloyi like using juxt to demonstrate the difference between apply and reduce, because a lot of new users seem to think the two are interchangeable
22:02amalloy&((juxt apply reduce) (partial list '+) (range 5))
22:02sexpbot⟹ [(+ 0 1 2 3 4) (+ (+ (+ (+ 0 1) 2) 3) 4)]
22:05pickles1juxt seems like a dual of map to me
22:07amalloypickles1: it is
22:08pickles1well then... that would be why
22:08amalloyit's a specialization of map to be more convenient for a common class of problems, i suppose
22:09pickles1mm
22:09amalloyeg, ##((juxt quot rem) 55 7)
22:09sexpbot⟹ [7 6]
22:09pickles1wellp, tis mah bedtime
22:09pickles1thx again for the help amalloy
22:10amalloyany time
22:10pickles1even pi o'clock?
22:10amalloydon't be irrational
22:12pickles1mm, i thot it was real, maybe i was imagining it
22:13pickles1(i best leave before we go off on a tangent -- and use old math jokes too much)
22:13pickles1nite, thx again
23:35JulioBarrosAnybody here? New to clojure and want to play with https://github.com/getwoven/infer how do I add/import it to my project/repl?
23:44offby1wish I knew
23:44offby1probably using the "ns" form, but other than that ...
23:50mefestoJulioBarros: are you using leiningen or cake?
23:51JulioBarrosUsing is a strong word :) trying to use leiningen
23:51mefestoheh
23:51mefestoa quick search of clojars came up with http://clojars.org/infer
23:51dnolenJulioBarros: it has a project.clj, install a lein, clone the repo, then from the repo dir you ran run 'lein install'. You can then include infer just like any other include your own project.clj dependency list
23:51mefestopushed nov of last year
23:52mefestoor you can clone the github repo and do a lein install
23:52mefestoerr, n/m dnolan beat me
23:54JulioBarrosok. Thanks. Let me try that. I'm brand new to this so could be messing up something obvious.