#clojure logs

2010-10-15

00:10hiredmanclojurebot: scala is <reply>see: http://harrah.github.com/browse/samples/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala.html#65760
00:10hiredmanping?
00:10clojurebotPONG!
00:15_rata_how can I have multiple mutually-referencing objects in one atom?
00:29LauJensenGood morning all
00:36kmchi LauJensen :)
00:37notsonerdysunnyGood morning LauJensen
00:37notsonerdysunnydoes any of you have trouble with logging into clojuredocs.org?
00:38notsonerdysunnyif I try to login with my google-openid it very often hangs.. I would be lucky if I get in..
00:41LauJensenNever even heard of clojuredocs until now :)
00:42notsonerdysunnyI think it would be a nice place to contribute while we learn to use the stuff ourselves
00:42notsonerdysunnyIt has been around for a while now
00:43notsonerdysunnywe can add the things which we try out as examples for others to see and learn
00:43notsonerdysunnyvery nice model I think
00:44LauJensenJust signed in without any problems
00:45LauJensenInteresting project
00:45notsonerdysunny:) thats nice ..
00:45notsonerdysunnybut I have trouble
00:45notsonerdysunnydid you use your google openid?
00:47LauJensenI dont think I got it from google, just openid.com
00:49ohpauleez,(isa? #{1} #{})
00:49clojurebotfalse
00:49ohpauleez,(isa? #{} clojure.lang.PersistentHashSet)
00:49clojurebotfalse
00:49ohpauleezAccording to the doc, this only works if they are =
00:49notsonerdysunny,(supers (class #{}))
00:49clojurebotnotsonerdysunny: Gabh mo leithscéal?
00:49notsonerdysunny->(supers (class #{}))
00:49sexpbot⟹ #{clojure.lang.IObj clojure.lang.IFn clojure.lang.Seqable java.util.Set clojure.lang.IPersistentCollection java.lang.Runnable clojure.lang.Counted java.lang.Object clojure.lang.IEditableCollection clojure.lang.APersistentSet clojure.lang.IMeta clojure.lang.AFn java.io.Serializable clojure.lang.IPers... http://gist.github.com/627632
00:52ohpauleezSo how do you see if a child is the same type/subtype?
00:52ohpauleezDo I just do = on type()? That seems too verbose
00:56amalloymorning all
01:02LauJensenmorning amalloy
01:16kmchi amalloy
01:16ohpauleezgood morning amalloy
01:24kmca friendly bunch here
01:24kmcmore greetings than other channels :)
01:24amalloyi know! it's almost like i'm living the dream of my youth: have friends
01:25kmchaha
01:26ubiianyone going to clojure-conj?
01:32amalloyapparently it's going to be more like an identity than a conj...
01:39ubiijust curious how many attendees they planned for
01:39ubiilooks like they still have some tickets left
01:39amalloyi suspect a lot of the people who are going are in bed
01:40amalloysince it's late at the conj site
01:40ubiiyep, figured
01:40ubiiwill ask again in the morning
01:44kmcnorth carolina eh
01:45kmc$350 eh
01:45kmcerr $250
01:45amalloykmc: you're on the east coast. you could practically walk there
01:46kmcWalking directions to Durham, NC: VA-49 S. 697 mi. 9 days 4 hours
01:46amalloyand the conj starts...in about 10 or 11 days?
01:46hiredman8
01:47amalloykmc: better get walking
01:47replacaubii: yeah. I'm going. why?
01:48ubiiwas just curious how big of a crowd they were expecting, as I am thinking of going
01:48replacaI think it's going to be about 200.
01:48ubiiwow, bigger than what I thought
01:48replacaThat should be a really nice size gorup
01:49replacaLots of interaction between folks
01:49replacaI think it's going to be a lot of fun. (Assuming you're a geek like the rest of us ;))
01:51ubii20+ years in IT, guess that makes me geek enough :)
01:51ubiijust wish that I would have found out about the conference sooner, so I could have made arrangement to go
01:52ubiis/arrangement/arrangements
01:53replacawell, we'll miss you.
01:53replacaI know they did everything they could think of to make sure interested floks would know about it
01:54replaca*folks - wow I'm tired tonight :)
01:55ubiiwell, I have have been so busy with work the last 9 months or so that I haven't been able to do much with clojure lately, hence the reason I just found out about the conference
01:56replacayeah, I've hd that sort of thing happen to me as well
01:56replacaluckily not this time
01:57ubiibeen stuck doing mostly ruby, html, css, and javascript, when I would prefer to have been working with clojure :(
01:57replacastill only a few clojure jobs out there, but there are beginning to be more and more
01:58_atoheheh, you can do much worse than having to work in Ruby :-)
01:58replacaain't that the truth
01:58ubiijust started to force myself to spend what little extra time I have to continue to learn clojure and hopefully start using it in the work that I do
02:00ubiitrue, I could be stuck doing .Net development
02:00ubiior COBOL, like what my wife does :)
02:00Crowbar7ohh christ COBAL\
02:01ubiihmm, I wonder which would be more painful, visual basic or COBOL?
02:01ScriptorI don't think vb is that bad at all nowadays
02:01amalloyperl-compatible basic cobol-script
02:02ubiiwhat little vb experience I have was from the pre .Net days
02:03ubiihave had to work with C# and ASP.NET a bit and really did not like it
02:03Crowbar7the .net is better the nthe PHP I have to use
02:04Crowbar7wtf PHP calling classes starts with the same sign as a variable
02:04Scriptorcalling classes?
02:04Crowbar7$class->function
02:04Scriptorso you mean method calls?
02:04Crowbar7yeah
02:04Crowbar7sorrt
02:04Scriptoror class::function()
02:04amalloyCrowbar7: you mean $object->function? class::function()
02:04Crowbar7more or less yeah
02:05Scriptorwell, that makes sense
02:05amalloyyeah
02:05Scriptoran object is a variable, and you're calling a method on that object
02:05amalloynot standing up for php's $ syntax here, but it's totally consistent
02:05Scriptorone of the few times it *is* consistent, mind you
02:06Crowbar7what is not consistant is it's function naming scheme for core functins
02:06Crowbar7functions
02:06ubiihave to say that I would take Perl over PHP
02:06Crowbar7^^
02:06ScriptorI'd definitely take Perl 6
02:06Crowbar7I would take JAVA even over PHP
02:07Scriptoreh, I think I'd prefer dynamic languages for web dev
02:07Crowbar7I hate it so much, but maybe working with it 80% of the time does not help.
02:07LauJensenDid you guys try #clojure-casual ? :)
02:07Crowbar7:0
02:07Crowbar7p
02:07Crowbar7:p
02:08Crowbar7I'm going to try writing an asterisk lib in clojure just for fun to be honest.
02:08Crowbar7if it actually works I might put it in clojars
02:10ubiiLauJensen: sorry, we will stop yacking about these other inferior languages :)
02:14ubiiI wonder if there are any plans to record the presentations and make them available online, for folks who are not able to attend the conference
02:15LauJensennp
02:15amalloyubii: i heard someone say yes, or slides at least, but that is a non-authoritative answer
02:15LauJensenubii: It has been requested by several Europeans, but I dont know if the host can make it happen yet
02:19ubiiit would be cool, if they could, as I am not sure that I will be able to make it to the conference
02:19BahmanHi all!
02:19amalloyhey, this is a nice feature. i can attach :arglists metadata even to vars that aren't explicitly functions
02:20LauJensenBahman: Hey
02:21BahmanLauJensen: Hey.
02:23ubiihmm, the conference is an 18 hour drive from where I live and if I drive 120mph, than that is only a mere 9 hours :)
02:25ubiiactually, I would fly, but I am sure that with it only a week away, that the flights will be pricey
02:26amalloyhrm. i found some of my old code which is doing (apply concat (for ...)). can anyone think of a reason not to use mapcat there?
02:33DeranderI'm coming from ruby. I see the analogues of most of the sequence manipulation stuff I'm used to. Map, reduce, some, all good stuff. I cannot for the life of me find "each" though
02:33replacaubii: you might be right, but why not check anyway. You might be surprised
02:33DeranderHow can I call a function on each element of a list?
02:34replacaubii: especially if you stay over sat. night
02:34amalloyDerander: that's the same as map, in a functional language
02:34ubiireplaca: not too worried about the cost of the flight, the biggest concern is the lack of available rooms at the Hilton
02:34ubiilooks like they are completely booked on the 21st and 22nd
02:34amalloyie, if the function you want to call doesn't have side effects
02:34Deranderamalloy: even if I don't care what the return values are?
02:35amalloyDerander: the idiomatic way then would be doseq
02:35replacaubii: yeah, probably means you'd want to look around for a cheap car, unless there's another hotel right next door
02:35Deranderamalloy: aaahaaaaaa.
02:35amalloy,(doseq [x (range 3)] (print x))
02:35clojurebot012
02:35replacaI don't know the area, but you might want to check that out
02:35Deranderamalloy: thanks, I didn't look under "force evaluation of sequence" in the clojure api
02:35Deranderthat's exactly what I want
02:36ubiireplaca: I will look into my options in the morning
02:36amalloyDerander: the other possible solutions are dotimes, doall, and dorun, depending on what data structure you already have
02:36amalloy(anything with side effects either starts with do, or ends with !, as a general rule)
02:36clojurebot() invokes the form inside, but there is an implied str call. The semantics are different inside the interpolated string, necessarily so.
02:36Derandergood to know
02:36amalloyclojurebot: wtf?
02:36clojurebotI don't understand.
02:37DeranderI am writing a queueing doodad. It pulls a list of changed files and dispatches them to callbacks
02:37Deranderand I was just trying to figure out a way to actually call the goddamn function
02:37Deranders
02:37amalloyhahaha
02:37amalloy,(doc dorun)
02:37zkimola
02:37clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil."
02:38amalloyis probably better than doseq for your case
02:39Deranderamalloy: I have a list of files that have changed that I want to pass off to another handling function
02:39amalloy,(let [x (map println (range 4))] true)
02:39clojurebottrue
02:39LauJensenWorth a read: http://stackoverflow.com/questions/3906276/whats-the-difference-between-cake-and-leiningen#3939930
02:39amalloy,(let [x (map println (range 4))] (dorun x) true)
02:39clojurebottrue
02:39clojurebot0 1 2 3
02:39Deranderfrom my brief reading, isn't dorun more for force-generating a lazy sequence?
02:39Deranderyeah, my list isn't lazy
02:39amalloyif your list isn't lazy, then what's the problem?
02:40Deranderwell, I'm not sure how to call a function on each element of a list in clojure
02:40Deranderin ruby I'd say [1,2,3].each {|e| puts e}
02:40amalloysure
02:40amalloyin clojure it would usually be map, but map is lazy
02:40Deranderoooooooooh
02:40amalloyor, you could use doseq to construct the map and consume it all at once
02:41amalloyor, use map to make it, and dorun to force it
02:41Deranderokay. I was missing that part
02:41Deranderin ruby I'd only use map if I wanted to transmute a seq
02:41LauJensenamalloy: doseq to construct the map ?
02:41amalloyLauJensen: to uh...construct the seq
02:42amalloyoh
02:42LauJensenwith doseq which is intended for side effects?
02:43amalloy,(doseq [x (range 4)] (print x))
02:43amalloy,(dorun (map print (range 4)))
02:43clojurebot0123
02:43clojurebot0123
02:43amalloyare the two things i'm suggesting
02:43Deranderall is well now
02:43amalloyyeah, but now LauJensen is telling me i'm wrong
02:43Derandersuperfically doseq does what I want it to without any extra code
02:44amalloyyeah, i think doseq is a drop-in replacement for each
02:44LauJensenamalloy: Im just saying, doseq is for side-effects, so if you actually want to generate a return, use 'for'. Otherwise you're back in imperative land
02:44LauJensenits the word 'generate' that doesnt fit
02:44LauJensen,(doseq [x (range 5)] x)
02:44amalloyLauJensen: which is why i said generate *and consume*
02:44clojurebotnil
02:44LauJensen,(for [x (range 5)] x)
02:44clojurebot(0 1 2 3 4)
02:44kmcyou could use dorun with map, right?
02:44LauJensenkmc: sure
02:44amalloykmc: yeah, i suggested that
02:44kmc,(dorun (map print [1 2 3]))
02:45Derander (doseq [file (filter #(>= 0 (.compareTo last-check (Date. (last-modified %)))) (list-desktop-files))] (process file)) is the code that I'm running
02:45clojurebot123
02:45kmcah, i missed it
02:45LauJensenamalloy: nothing is generated, its a naive loop
02:45kmc,(defn mapM_ [f & xs] (doseq (apply map f xs))) ;)
02:45clojurebotDENIED
02:45amalloy,(doc pos?) ; Derander might want this instead of >= 0
02:45clojurebot"([x]); Returns true if num is greater than zero, else false"
02:46Deranderamalloy: unless the doc lies, that doesn't include zero
02:46Deranderyeah, I need it
02:46amalloyoh right
02:46Deranderit'd be a sweet replacement otherwise
02:47Derandersweeet. now all I have to do is write my callbacks
02:48amalloyLauJensen: how is that semantically different from a lazy seq, which never realizes more than one element at a time?
02:48amalloyDerander: the plumbing is done, now all i have to do is build a house?
02:49Deranderexactly
02:49Deranderthe fun part
02:49amalloytrue that
02:49Deranderfirst clojure project: engage
02:51amalloyDerander: hosting it on github?
02:51Deranderif I ever finish anything
02:51Deranderright now it's all over 10 lines of code
02:51Deranderall of
02:52amalloyheh, i shared a repo that was only 8 lines the other day
02:52Derander:P
02:53amalloyi like to get version control as soon as there's a single line, because i tend to mess stuff up and then forget how to fix it
02:53LauJensenamalloy: How is what different?
02:53Chousukeyou should at least make a local git repo :P
02:53amalloyLauJensen: a simple loop/recur
02:53Chousukeit's easy to push to github later
02:54LauJensenamalloy: loop/recur vs doseq are similar in that you can have local changes, ie side-effects. Its not what I would call idiomatic to functional programming however (though can still be pure)
02:55amalloyLauJensen: oh for sure, avoid them if at all possible
02:56LauJensenamalloy: Yea, and rarely is it not possible. Most loop/recur cans be replaced by reduce, unless you need short-circuiting of some kind. doseq shouldnt be used for any kind of generation, only side-effects
02:56Deranderokay, I'm sorry
02:57amalloyhaha
02:57Deranderif I have a list of conditions that I want to check against, how should I iterate through them idiomatically?
02:57Derander (filter #(and (not (= ".DS_Store" %)) (not (= ".localized" %))) (seq files))) is the current line
02:57Derandergargh. it's so mind bending
02:57LauJensenlooks good
02:57amalloydo you want the first true one, or all of them or what?
02:58DeranderI want it to do that, but I want to have a lot more files that I'm blacklisting
02:58Deranderbasically I want to be able to pull from a list, (".DS_Store" ".localized" "screw_this_file")
02:58Derandercan I do something like (not (in bad-word-list file))?
02:58amalloy,(not-any? #{'a 'q 7} [4 6 8 0])
02:58clojurebottrue
02:58amalloy,(not-any? #{'a 'q 7} [4 6 'q 0])
02:58clojurebotfalse
02:58Deranderoh.
02:58Derandergah.
02:58Derandersorry to waste your time
02:59amalloyhaha no
02:59amalloyit's fun
02:59LauJensenDerander: you can put your criteria in another function (filter meets-requirements? seq)
02:59amalloyplz ask moarrrr
02:59LauJensenafk
02:59amalloyDerander: my not-any? is using a set #{1 5 6} as a function
02:59Deranderamalloy: yeah
02:59amalloywhen called as a function, sets check whether they contain the argument passed
03:00amalloyk
03:01Deranderokay, trying to write my own version
03:01amalloyall righty. don't hesitate to ask for as much or as little advice as you want
03:02Deranderwell, I've got another question
03:02Deranderwhen should I use a set vs a list?
03:02Deranderthe docs don't state the performance characteristics
03:02Deranderlists are just linked lists, aren't they?
03:02amalloylists are just linked lists, yes
03:02Deranderare sets faster for lookup?
03:02amalloysets are arrays when they're small, and trees when they're big
03:03Deranderoooh, they're sneaky.
03:03Deranderbasically I'm wondering if I shouldn't make my list of bad files a set
03:03Deranderbecause then I get the nifty syntax which you used in your example above
03:03amalloyyou should, 100%, because of the way sets act as predicates
03:03Deranderalright then
03:04Deranderseems to work
03:04Derandersweet.
03:04amalloythe other thing you should consider (though not for this usage) is vectors, which are often better at being lists than lists are
03:05DeranderI have noticed an abundance of vectors in clojure code that I read
03:05DeranderI never use them because I'm used to elisp
03:05amalloyyou want a summary of the difference between vecs and lists?
03:05tobiasraederMorning everybody :)
03:05Deranderamalloy: if you write it I'll read it
03:05amalloyheh
03:07amalloylists have fast insert/delete at the front, O(n) random-access, and slow-but-not-awful insertion/deletion from the middle
03:07Deranderokay
03:07amalloyvectors have fast insert/delete at the back, O(1) random access, and awful insert/delete from anywhere else
03:08Deranderso basically linked list vs array
03:08amalloynot quite, because arrays don't have fast appends
03:08Deranderoh, right.
03:08amalloyand clojure lists don't have fast appends, unlike linked lists
03:09Deranderalright, thank you. that helps
03:09amalloybecause the list is immutable, it can't just tack something onto the end of the list; it has to copy every object in the chain to give it a new next pointer
03:09Deranderoooooooooooooh. I was wondering why.
03:09amalloytricky, isn't it
03:10DeranderI am very unused to immutable data structures
03:10amalloyso was i, three months ago :P
03:10amalloybut having vectors&lists is nice. for something that in elisp/CL you would have to build in backwards order and then reverse at the end, in clojure you can just build with a vector instead of a list
03:11Derandermakes sense
03:11amalloyrich's immutable datastructures are the masterworks that make clojure possible
03:12kmcyou can fast-append to the beginning, but not the end, of a persistent singly-linked list
03:12kmci'm not sure whether Clojure's lists have this property
03:12kmcamalloy, indeed, i was so excited when i first heard about hash tries
03:13amalloykmc: they do have this property
03:13Deranderthank you for the information. I need to go to sleep now or I'll be worthless for programming tomorrow
03:13kmchas anyone here read Okasaki's book _Purely Functional Data Structures_?
03:13DeranderAdiós
03:13amalloybuenas noches
03:14amalloyholy cow, the source for doseq is monstrous
03:15amalloyand for is even worse
03:26amalloy,(let [times (atom 0)] (dorun (pmap (memoize #(do (swap! times inc) (Thread/sleep 2000) %)) (repeat 10 1))) @times)
03:26clojurebotjava.lang.Exception: No such namespace: Thread
03:27amalloy,(let [times (atom 0)] (dorun (pmap (memoize #(do (swap! times inc) (. java.lang.Thread sleep 2000) %)) (repeat 10 1))) @times)
03:27clojurebot4
03:28amalloydoes anyone know a way to make pmap/memoize smarter? it's wasting cpu resources computing the same function four times in an attempt to memoize it
03:30ChousukeI suppose you could add a lock or something, so it blocks if the cache is being updated
03:30raek,(let [times (atom 0), f (memoize #(do (swap! times inc) (. java.lang.Thread sleep 2000) %)), _ (f 1)] (dorun (pmap f (repeat 10 1))) @times)
03:30clojurebot1
03:31Chousukebtw, (. java.lang.Thread sleep 2000) is better written as (Thread/sleep 2000)
03:31amalloyChousuke: see above. i tried that but clojurebot doesn't like it
03:32Chousukeah, right.
03:33amalloywasn't sure whether he was annoyed by the / or the lack of java.lang so i just switched both
03:33amalloy,Boolean/TRUE
03:33clojurebottrue
03:33amalloy,(Boolean/valueOf "true")
03:33clojurebottrue
03:34amalloyman wth clojurebot? why not Thread/sleep?
03:34ChousukeIt might just be doing some security checks.
03:34Chousukeand failing :p
03:34amalloyheh
03:34raek,Thread
03:34clojurebot#<clojurebot$eval4127$fn__4128 hiredman.clojurebot$eval4127$fn__4128@7c31af>
03:34amalloy,(java.lang.Thread.)
03:34clojurebot#<Thread Thread[Thread-1856,5,main]>
03:35Chousukehuh, why does Thread return a function
03:35amalloy,(meta (var Thread))
03:35clojurebot{:ns #<Namespace sandbox>, :name Thread}
03:36Chousuke,(Thread)
03:36clojurebotjava.lang.Exception: DENIED
03:36amalloyheh
03:36ChousukeI suppose Clojurebot is using the interpreter.
03:36raek-> (Thread/sleep 1000)
03:36sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: ()
03:37amalloy->(. Thread sleep 1000)
03:37sexpbotjava.lang.SecurityException: Code did not pass sandbox guidelines: ()
03:38amalloyexciting. can we inject code to clojurebot by instantiating a Thread with some unsafe Runnable object?
03:38raek,(def x 5)
03:38clojurebotDENIED
03:39raek,(java.lang.Thread. (fn [] (def x 5)))
03:39clojurebotDENIED
03:40raek,(-> x def)
03:40clojurebotDENIED
03:41raek,((resolve (symbol "eval")) '(+ 1 2))
03:41clojurebot3
03:41amalloyraek: slick
03:42amalloybut i think it maps eval to a safer eval
03:43raek,((resolve (symbol "eval")) (read-string "(def x 5)"))
03:43clojurebot#'sandbox/x
03:43raek,((resolve (symbol "eval")) (read-string "(ns-unmap 'sandbox 'Thread)"))
03:43clojurebotnil
03:43raek,(Thread/sleep 1000)
03:43clojurebotjava.lang.Exception: No such namespace: Thread
03:43amalloy,Thread
03:43clojurebotjava.lang.Exception: Unable to resolve symbol: Thread in this context
03:44amalloy,(. Thread sleep 1000)
03:44clojurebotjava.lang.Exception: Unable to resolve symbol: Thread in this context
03:45raek,((resolve (symbol "eval")) (read-string "(import 'java.lang.Thread)"))
03:45clojurebotjava.lang.Thread
03:45amalloy,(proxy [java.lang.Thread] [])
03:45clojurebotjava.lang.IllegalStateException: Var null/null is unbound.
03:47amalloy,(. java.lang.Thread sleep 100)
03:47clojurebotnil
03:49amalloy,(.join (. java.lang.Thread (currentThread)) 100)
03:49clojurebotnil
03:49amalloy,(.join (. java.lang.Thread (currentThread)) 30000)
03:49clojurebotExecution Timed Out
03:53amalloy,(let [threads (make-array java.lang.Thread 20)] (. java.lang.Thread enumerate threads) (dorun (map print threads)))
03:53clojurebot#<Thread Thread[main,5,main]>#<Thread Thread[pool-1-thread-1,5,main]>#< Thread[Smack Packet Writer (0),5,main]>#< Thread[Smack Packet Reader (0),5,main]>#<Thread Thread[Smack Keep Alive (0),5,main]>#<Thread Thread[Smack Listener Processor (0),5,main]>#<OutputThread Thread[class org.jibble.pircbot.OutputThread-Thread,5,main]>#<Thread Thread[pool-2-thread-1,5,main]>#<Thread Thread[pool-1-thread-2,5,main]>#<TimerThread Thread
03:54amalloyaha. and we could call .destroy on all of those
03:57amalloy,(reify Runnable)
03:57clojurebot#<sandbox$eval11118$reify__11119 sandbox$eval11118$reify__11119@121bcf2>
04:01amalloy,eval
04:01clojurebot#<core$eval clojure.core$eval@1415815>
04:02amalloy,(.run (reify Runnable (run [this] (eval "(def q 1)"))))
04:02clojurebotDENIED
04:02AWizzArdhttp://xkcd.com/722/
04:03amalloy,(.start (java.lang.Thread. (reify Runnable (run [this] (eval "(def q 1)")))))
04:03clojurebotDENIED
04:03amalloymeh
04:04yangsxhi, in my project.clj, I specifies ':resources "data"' to include the data subdirectory into the jar file, but all the files are put directly into jar without the path, can I specify the path in the resulting jar?
04:04amalloyyangsx: just put them in subdirectories under data
04:05amalloyeg data/foo/bar/baz.jpg should be in the jar under foo/bar/baz.jpg
04:11yangsxamalloy: Maybe I'm doing it wrong. I read the data in a let form in code. That is, for my code it's data/foo, in the jar file it's foo. Maybe I should use a ref to read the data.
04:12amalloyi guess i don't understand. and sorry, gotta head out
04:18svdbergany users of vimclojure here?
04:19kryftNo, but I will become one once I actually start writing clojure. :)
04:20raekyangsx: one way of doing it is to put the data/ dir in resources/
04:23xkbI'm trying to run the repl from inside vim, using the ns i'm editting
04:23xkbbut that doesnt really work
04:23xkbclasspath only shows clojure jars
04:23raeki'm not aware of any way of adding a prefix to the resulting path in thst case
05:39tobiasraederis it possible to read the contents of a symbol into a vector inside a macro?
05:39tobiasraederas in being able to (map #(dostuff) contents-of-the-symbol)
05:40carkh if i understood you question well, i'd say no
05:41carkhyour*
05:41carkhdo you have an example ?
05:43tobiasraederyes, one second
05:43AWizzArdWhat are the "contents of a symbol"?
05:44carkhif your macro call looks something liek this : (my-macro some-symbol) then some-symbol is totally opaque at macroexapansion time
05:45tobiasraederhttp://gist.github.com/627922
05:45tobiasraederlike that
05:45tobiasraedercontents of a symbol as in my case a vector that is bound to the symbol
05:45carkhwell your macro can see the value of fields at macroexpansion time and use it
05:46tobiasraederand how do i do that exactly?
05:46carkhjust put ~fields in place of <content-of-fields>
05:47xkbwhat does ~fields do?
05:47carkhlet me test that though =/
05:47notsonerdysunnyis there a way to search backwards through the history from the slime repl like we would do at a readline enabled terminal using control-r
05:48tobiasraeder@carkh seems like thats exactly what i was looking for and just beeing blind. i'll try if i can get it to work, thank you
05:48tobiasraeder@notsonderdysuny no idea :/
05:49tobiasraeder@carkh ah dread, i forgott one thing let me change the gist quick
05:49carkhnotsonerdysunny: try alt-p
05:49tobiasraeder@carkh i edited the gist if you dont mind checking it again
05:50carkhtobiasraeder: mhh you know i don't like that macro at all
05:51carkhit could be a function
05:51carkhi think that's not exactly what you want let me come back to you in a few
05:51tobiasraeder@carkh the actual case is a bit more complex and deals with alot of java interop class/interface generation
05:51tobiasraederokay, thanks
06:02carkhtobiasraeder: how about something like this http://gist.github.com/627945
06:03carkhbut i really don't like it
06:04tobiasraederyeah that might work
06:04carkhdoes this really needs to be done at compilation time ?
06:04tobiasraederill try to rework the class-name "-fields" into a map and just store the fields their
06:05tobiasraederyeah its part of some really huge java interop stuff
06:05tobiasraederi gotta grab some food, thank you for the input. if you care i'll let you know what i come up with in the end
06:09carkhhttp://gist.github.com/627945
06:09carkhsur i'd love to
06:09carkhsure*
06:41xkbany tips to improve this code: http://github.com/svdberg/clojurelisa/blob/master/src/clojurelisa/core.clj?
06:41xkbI'm planning to use it in a presentation on Clojure
06:42xkbits a fork from a blog-post, and I'm trying to make it more idiomatic
06:44edbond,(doc remove)
06:44clojurebot"([pred coll]); Returns a lazy sequence of the items in coll for which (pred item) returns false. pred must be free of side-effects."
06:44edbond,(doc replace)
06:44clojurebot"([smap coll]); Given a map of replacement pairs and a vector/collection, returns a vector/seq with any elements = a key in smap replaced with the corresponding val in smap"
06:45edbondxkb: why not use remove and replace ^^ in remove-item and replace-item?
06:46xkbgood tip
06:46xkbthanks
06:46xkbhmm.. only the predicate is a bit harder
06:47xkbas I need the nth item in a seq
06:52edbondthen remove-item is ok
06:55edbondxkb: closing brackets don't need a new line
06:57xkbok removed the two or three I found :)
07:39jjidoWhat is the license of clojure.jar? Can I just package it in my project along with the readme.txt?
07:40carkhxkb: (def gen-pixels (grab-pixels gen-image)) inside a function, that's very bad style
07:40cemerickjjido: Clojure uses the EPL license.
07:41cemerickWhether that's compatible with your project depends upon your project's license.
07:41jjidoEclipse, I read that. I use LGPL
07:41carkhxkb: same for defn inside functions
07:42cemerickI know the GPL and EPL don't play nice together. Not sure about LGPL.
07:47hiredmanhttp://gist.github.com/628066
07:48notsonerdysunnywhat are symbol macros?
07:57xkbcarkh: was afk for a while, and just read your remark
07:58xkbI thought I removed all defn within functions :?
07:58xkboh within the multimethod?
07:58carkhyes
07:59xkbshould I use letfn?
07:59carkhand there are many defs in other functions too
07:59xkbor just factor them out?
07:59carkhwell that's for you to decide =P
07:59xkb:)
08:00xkbwhat's the tradeoff anyway, between a let and a def within a function scope?
08:00xkbI usually use let bindings
08:00carkha def will modify the toplevel var
08:00carkhsame for a defn
08:00xkbbut the guy who originally wrote this uses def all the time
08:00xkbah
08:00carkhthat's like introducing global variables
08:00xkbso even within a function scope it introduces a top-level binding?
08:00xkbnasty
08:01carkhiirc it all started with recompiling stuff on the fly (which i dislike a lot too)
08:01carkhyes it does
08:01carkhyou can use binding if you want to redef stuff with a dynamic extent
08:02carkhor let for lexical scope
08:02xkband stuff like in source-image? the file-chooser is within the do scope
08:03carkhyou need to use let for the fileshooser
08:04xkbI somehow got something in my head not to use let with doto
08:04carkhalso that's nitpicking but ... your closing parenthesis should not be on a line by themselves
08:04xkbthat's wrong app/. :)
08:04xkbcarkh: hey, I like nitpicking :)
08:04carkh=)
08:05carkhi think we need to call hiredman to the rescue then !
08:47solussd_why isnt a record a function of its keys?
08:49solussd_or field names i guess
08:55tobiasraederit should be
08:55tobiasraederiirc it implements ilookup so that should work
08:56tobiasraeder,(defrecord myrecord [name])
08:56clojurebotDENIED
08:56tobiasraederanyway if you (:name (myrecord. "testname")) it returns "testname"
08:57tobiasraederor did i get wrong what you were looking for?
08:57AWizzArdHe wanted ((HisRecord. "x") :name)
08:57solussd_i'm looking for ((myrecord. "testname") :name)
08:58solussd_e.g. maps are functions of their keys
08:58solussd_,({:name "Joe"} :name)
08:58clojurebot"Joe"
08:58tobiasraederyeah, got that wrong i guess
08:58solussd_so, while that works fine with a struct created w/ defstruct, it's a no-go w/ a record. :/
08:59solussd_*defined w/ defstruct
09:01solussd_guess I'm just wondering why
09:02G0SUBsolussd_: because it doesn't make any semantic sense
09:02G0SUBsolussd_: records are not functions of their keys. they are just a bunch of fields.
09:03G0SUBsolussd_: if you need IFn like behavior, go ahead and implement that protocol for your custom type.
09:05AWizzArdsolussd_: also records don't eval to themselves
09:05AWizzArdWhen you eval a record, for example in a macro, it becomes a map.
09:05solussd_ok
09:06dnolensolussd_: maybe it's just me but the lack of IFn seems to me like an oversite
09:06dnolensolussd_: http://gist.github.com/628148
09:06solussd_dnolen: that's what it feels like to me. Doesn't feel very idiomatic- feels more 'java-interopish'
09:06stuartsierraIt is deliberate, but debatable.
09:10_fogus_You can say that again.
09:29fhdHi. Can I somehow create anonymous types with instance variables?
09:29stuartsierrafhd: yes, with reify
09:29fhdI can create top level types with deftype, but I'd rather have them anonymous. proxy doesn't seem to support that
09:29fhdstuartsierra: Okay, I'll take a look!
09:30stuartsierrareify doesn't have instance variables per se, but it creates closures over locals
09:30AWizzArdAnd proxy not?
09:30stuartsierraI forget
09:30AWizzArdk
09:30fhdstuartsierra: I do explicitly need instance variables, sadly. An API requires that.
09:31stuartsierraoh then you need deftype
09:31stuartsierrabut it can't extend concrete classes
09:31fhdstuartsierra: Yeah, and it works. But the types aren't anonymous, this bothers me a bit.
09:31stuartsierrayou could gensym the names :)
09:31AWizzArdInteresting it would be if I want to make a deftype for a new stream. As java.io.OutputStream is not an Interface I can't inherit from it in a deftype.
09:33fhdSo anonymous classes with instance variables are not possible in Clojure?
09:33javehello
09:33stuartsierraan anonymous class really just has a generated name, even in Java source
09:34fhdstuartsierra: Yeah, but I can create as many as I want at runtime, because it appends a number.
09:34fhdstuartsierra: Um, not at runtime I guess...
09:34stuartsierraexactly
09:34stuartsierraJava doesn't create classes at runtime
09:35fhdstuartsierra: Then I should find a way to work around this. Thanks :) Such a weird API, I'll rewrite that in Clojure one day :)
09:35stuartsierrayeah, sounds weird. who uses public instance variables anyway?
09:36fhdstuartsierra: This project: http://github.com/spullara/mustache.java
09:36stuartsierraI think that's been ported to Clojure already
09:37fhdstuartsierra: You think? That would really make my day
09:37fhdIt's so weird, I'm really one step from rewriting it myself...
09:37fhdPlus it's not on Maven Central...
09:38stuartsierrahttp://github.com/cgrand/moustache
09:38javeI'm doing some xml stuff with enlive but its a little bit awkward
09:38fhdstuartsierra: Isn't that something completely different? I stumbled across that too, but it doesn't seem to have anything to do with the Mustache template language.
09:38javeI have to do some workaroudns like adding xml headers and namespaces, is there some existing xml frontend to enlive?
09:38stuartsierradunno, never used any facial hair libraries
09:38fhdstuartsierra: :)
09:39stuartsierraI like my frameworks clean-shaven.
09:39fhdstuartsierra: I haven't shaved in days, and I partly blame this library :)
09:39stuartsierraMaybe you're a budding Longbeard.
09:40fhdstuartsierra: Not yet :)
09:40cemerickstuartsierra: hah! :-D (re: clean-shaven)
09:40cemerickDoes anyone know of a free geocoding web service that doesn't have TOS restrictions like Google's?
09:41javeopenstreetmap?
09:43fhdBy the way, is unit testing common in Clojure? I know there are quite strong opinions on TDD, so I'm wondering.
09:43cemerickjave: it's certainly a map, but I dont' see an API?
09:43javeoh it has apis
09:43cemerick(not= unit-testing TDD)
09:44stuartsierraTDD isn't necessary in Clojure because Clojure code always works. :)
09:44fhdcemerick: Hence my question
09:44fhdstuartsierra: How about unit testing then? :)
09:45javecemerick: I havent actualy coded anything m yself, but maybe you can have a look at the java client, its open source
09:45cemerickfhd: clojure.test is all about unit tests.
09:45fhdcemerick: Yup. And because clojure.test is pretty good, I thought unit testing might be real popular
09:45stuartsierraYou can do TDD in Clojure with clojure.test or Lazytest or ClojureCheck or ...
09:45cemerickjave: its API seems to be defined by the HTML export from the map. Ick.
09:46javewell there are all sorts of apis to the data
09:46cemerickI'd like to match the awesomeness of e.g. (-> "http://maps.googleapis.com/maps/api/geocode/json?address=Holyoke,%20MA&amp;sensor=false&quot; slurp clojure.contrib.json/read-json)
09:46javemaybe have a look at the josm client
09:47javewell, I dont think openstreetmap is so much about api awesomeness. its about making user contributed maps
09:47javeand thats how I use it
09:48cemerickOK. I was looking for a geocoding API. Anyway, thanks.
09:48cemerickfhd: I use clojure.test extensively in every one of my projects, and it seems to be very widely used in general.
09:49fhdcemerick: Hm, I see. Do you use it test-first or test-later style?
09:49cemerickI probably tend towards a 20/80 mix, respectively.
09:50cemerickfhd: tangential Q: do you have much of a ruby background?
09:51fhdcemerick: I found that the REPL fulfils most of my TDD needs, so I didn't miss it so far
09:51fhdcemerick: No, I'm mostly Java/C++
09:52cemerickbummer; there goes my TDD stereotype ;-)
09:53fhdcemerick: Sorry :) I'm not a TDD expert though, just discovered it a while ago
09:53fhdcemerick: I've done a bit of Emacs Lisp before, and I couldn't imagine doing TDD with it at all, so I didn't really try it with Clojure
09:54cemerickNever got into it myself. Seems to me that testing simple stuff should be...simpler than TDD. And testing complicated stuff often ends up being...more complicated than TDD can support.
09:55stuartsierraThat's what I'm trying to fix with Lazytest, don't think I've succeeded yet
09:55_fogus_I have a nice little segment in my talk about TDD :-)
09:55fhdcemerick: TDD is really nice for static languages, where you can't quickly test a function. Also leads to real nice object oriented design IMO
09:56fhdcemerick: But in Clojure, there's the REPL, so it's super easy to test specific functions. And it's functional, so creating object-oriented design is a bit weird
09:56cemerick_fogus_: looking forward to it
09:56fhdcemerick: I did get interested and ask some questions regarding how I could do specific things, and it seems to work technically. But I don't find it very nice
09:57cemerickstuartsierra: I'm afraid I've not looked at lazytest one bit. :-(
09:57_fogus_REPLs do not help much with regressions
09:57stuartsierracemerick: no worries
09:57stuartsierraIt's still evolving somewhat
09:57fhd_fogus_: That's true, the confidence from TDD is definately mising
09:57cemerickI'm a little behind on the cutting-edge clojure hackery from the past few months.
09:57fhd_fogus_: Then again, I haven't refactored my Clojure code much, so I don't really care
09:58_fogus_fhd: I'm confused. :-(
09:58fhd_fogus_: About what? :)
09:59_fogus_fhd: TDD, unit testing, refactoring... I'm not sure what we're talking about anymore. :(
10:00stuartsierra_fogus_: buzzword compliance
10:00fhd_fogus_: Well, TDD is basically unit testing + refactoring IMO
10:00fhd_fogus_: Kent Beck says, in a nutshell, that it helps create good designs because it encourages refactoring by providing confidence through loads of test cases
10:01_fogus_fhd: Oh I see. I doo TDD, but without the Ds
10:02fhd_fogus_: :)
10:02cemerick"Good design" does not come from a random walk through test failure.
10:03fhdcemerick: Well, the nice thing about TDD is that you use test cases to write "how" you want to use an API, and then you start writing the API.
10:03fhdcemerick: The weird thing about TDD is that you basically start writing crap, hard coding everything, only slowly moving towards an actual solution
10:03fhdcemerick: And then refactoring the hell out of that until you like it.
10:03cemerickYeah, I understand the idea, and I've done that to some extent, but that's not helping with design, it's simply codifying it ahead of its implementation.
10:04fhdcemerick: True. I actually do that most of the time, TDD or not.
10:04_fogus_I like to write apps with the API that I am going to design.
10:05lpetitIt has almost seemed to me (after having done that myself too, not denying my past errances :-) ), that doing TDD is easier when you already know the "field", the application domain of your problem.
10:05fhdAll in all, I'm not really convinced by TDD. It does have some good points, and the designs created by it are often actually quite nice. But I don't think it works well in all languages, as Beck claims
10:05lpetitAnd hard to do in unknown fields/territories.
10:05fhdlpetit: Definitely.
10:06lpetitWith clojure, once you know your "field/domain" well, you have the tools to go very high in abstractions, removing all the bits of code redudancy you find. Including your test suite.
10:07lpetitAnd once you know your application domain well, it makes less sense to "rewrite in TDD style" from scratch a new application.
10:07fhdlpetit: Yeah, I read somebody making this point: In functional programming, you write "what" you want, not "how" that should be achieved. Such code doesn't require tests.
10:08stuartsierraGreat, so I've been wasting my time on test frameworks when I could have been writing real code.
10:08fhdAlthough confusing at first, I found it pretty nice that I don't have to bother with object-oriented design in Clojure. Makes things so much easier
10:08lpetitno, you will need tests. REPLs "on the fly" tests are volatile
10:09lpetitstuarsierra: of course you're just kidding, but I didn't see this smiley of you saying so at the end of your sentence ;-)
10:10stuartsierra:)
10:10_fogus_stuartsierra's world is crashing down around him
10:10stuartsierratypical
10:10fhdSorry for starting this :)
10:10fhdI'm still trying to make my mind up on these issues, being pretty new to FP.
10:11fhdI've never done testing _without_ TDD, actually, so I wouldn't really know how to approach that :)
10:11lpetitfhd: it's the nice effect of using a language with less accidental complexity. But when you will be facing problems with more essential complexity, the need for designing things will come, again (but then, you'll add software complexity as you add problem domain essential complexity, and that's a big win)
10:11javearent macro arguments supposed to not be evaluated?
10:11stuartsierrajave: not in the macro itself
10:12stuartsierrathey usually get evaluated eventually
10:12fhdlpetit: Well, I find Clojure design _much_ _much_ easier than OO design for the simple problems I'm tackling.
10:12lpetitjave: you can see macros as functions "eating" source code
10:13javeits odd, because I'm using some macros from Enlive. but I need to clone and modify one of the macros
10:13lpetitjave: ... digesting source code, and returning source code :-)
10:13javeand it doesnt behave the same way
10:13fhdlpetit: Object responsibilities, tell-don't-ask, design patterns... that's really a load of accidental complexity :)
10:13lpetitfhd: normal, functions are simpler building blocks than classes.
10:13AWizzArdDoes gen-class support mutable fields as deftype does?
10:14lpetitfhd: tell don't ask is interesting, but probably for *true* asynchronous message-passing systems, a la Erlang.
10:14_fogus_Erlang is the *only* OO language!
10:14lpetitAWizzArd: you can specify a "state", and generally you'll place a ref or an atom there
10:14fhdOMG
10:14javeoh noes, language wars...
10:15_fogus_:p
10:15fhdjave: Should be quick. This is the clojure channel :)
10:15jave:)
10:16AWizzArdlpetit: So gen-class won't have an as efficient field access as deftypes.
10:16javeI'm happy so long as I dont have to code in a language thats physically harmfull
10:16clojurebotmake 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
10:16AWizzArdBut deftypes can't inherit from other classes.
10:16fhdBut I'm really impressed by Clojure so far. I just wanted to do a few quick experiments, but I ended up using it for a larger project.
10:16fhdPlus I'm giving a talk about it next week :P
10:16AWizzArdfhd: in Köln?
10:16lpetitAWizzArd: indeed
10:17fhdAWizzArd: Ja, aber in meiner Firma
10:17AWizzArdk
10:18stuartsierraBy the way, anybody noticed that swank-clojure doesn't display errors in Clojure 1.3 ?
10:18lpetitfhd: interestingly enough, the set of reasons I came to clojure isn't equal to the set of reasons I'm staying with clojure. I discovered a lot *beyond* what attracted me first.
10:18AWizzArdstuartsierra: right
10:18javeclojure repl errors sometimes arent very helpful
10:18AWizzArdI end up typing *e all the time :)
10:18lpetitstuarsierra: no
10:24edbonddoes structs deprecated in 1.2 ?
10:24xkbAnother question regarding my code at http://github.com/svdberg/clojurelisa/blob/master/src/clojurelisa/core.clj
10:24xkbI think the use of the multimethod mutate is not very benificial here..
10:24xkbdo you agree?
10:30@rhickeybindings now get automatically conveyed to future calls and agent sends
10:30@rhickeyhttp://github.com/clojure/clojure/commit/b1bed1b1c936855801e6d6dd40e649fddb6c039d
10:30stuartsierraholy cow!
10:32AWizzArdHmm, I am trying to grasp what this means.
10:32stuartsierraI don't know if I like that or not. I was getting used to saying "don't use binding"
10:33stuartsierraDon't get me wrong, I'm impressed.
10:34stuartsierraBut how far down the chain does it go?
10:34AWizzArdstuartsierra: what does this update do with bindings under the hood?
10:34jjidois there a limit to the level of continuations in a CPS program? I am at hundreds and only getting started...
10:34stuartsierraIf I do (binding [...] (send ... A)) and the action A sends another action, does it inherit the same bindings as A?
10:34@rhickeysome notes here: http://dev.clojure.org/display/design/Improve+Binding
10:35AWizzArdOho, looks like the Confluence Wiki :)
10:35@rhickeystuartsierra: all sends inherit the bindings at the point of send
10:35stuartsierraok
10:36AWizzArdOh very interesting indeed.
10:41stuartsierraIs this leading us down the road of first-class environments?
10:41@rhickeyno
10:41stuartsierraok
10:42stuartsierragood
10:42@rhickeye.g., no locals in this environment
10:42stuartsierraah, yes
10:44stuartsierraWhy do you always change the language while I'm trying to write a presentation? :)
10:44@rhickeythese benefits convey to pmap, which uses future calls
10:46@rhickeyAWizzArd: userland use of bindings should be unaffected by this, but this is much more efficient than manual rebinding a la bound-fn
10:47AWizzArdSounds good, I will download that version tonight.
10:48@rhickeystuartsierra: I'll go back to sitting on my hands :)
10:48stuartsierraheh
10:48lpetitrhickey: good news !
10:48stuartsierraJust restrain yourself from making any earth-shattering changes for the next week, if you can, ...
10:48lpetiterm, not you sitting on your hands, of course :-)
10:49xkbstuartsierra: are you working on a presenation for clojure-conf? ;)
10:49stuartsierrayou betcha
10:49xkbnice :)
10:50edbondhttp://faustus.webatu.com/clj-quick-ref.html#struct says structs deprecated in 1.2. Is this correct?
10:50lpetitrhickey: still didn't write a macro to automate the unrolling of first args ;-)
10:52@rhickeylpetit: they all end up being slightly different - I haven't spent the time to see what really could be generalized
10:53lpetitrhickey: oh
10:53lpetitok
10:53stuartsierraedbond: structs are replaced by deftype / defrecord
10:54@rhickeylpetit: we're still in the process of getting it all configured, confluence jira etc
10:55lpetitrhickey: ok. but let apart the configuraiton, the titles of the other wiki pages seem interesting (though I will not have time to dig into them right now)
10:57lpetitstuartsierra: page on Modularity could be updated for ccw : it's now using the clojure.osgi project, and doesn't use the "eclipse buddies" mechanism anymore (but note that *currently*, clojure.osgi is still dependent on some Equinox aspect, though it's an implementation detail that could be gotten rid of when I or aav has the time to work on it)
10:57lpetitclojure.osgi v1.2.10 to be precise. (1.2 means "compatibility with clojure 1.2", 10 is just a classical version counter)
10:57fhdGotta go, bye
11:05stuartsierralpetit: thanks, updated
11:06lpetitstuartsierra: that was quick !
11:06stuartsierraanything to avoid writing this presentation :)
11:14lpetitstuartsierra: modularity page again. What does it mean to "work fine in Glassfish" ? In which scenario ? One clojure jar per webapp's WEB-INF/lib/ I guess ? Maybe being more explicit on this could help ...
11:18lpetiteven git-revert is simpler than reverting with svn !
11:21tobiasraederis there a way to put quotes into doc strings?
11:22woobytobiasraeder: you can escape them like \"
11:23tobiasraederah okay, i guess emacs just screwed me over then :D
11:25lpetittibiasraeder: install paredit.el, and you'll just be able to type " again inside a literal string to automatically get the \ for free (though not at the end of the string => then you'll have to escape paredit and type \ manually)
11:25lpetitIs it me that just gave an advice for emacs ? Wow, must be sick .. :-)
11:27lpetitNooo, that's just a false sign of peace before the conj .... Embrace and Extend, gnarl gnarl gnarl ... :-E
11:29dpritchettI'm messing around in vimclojure and I notice that Meikel has bound <C-Up> to "UpHistory" but not <C-K>
11:29dpritchettany reason I shouldn't rebind C-K as well? I try not to use the arrow keys
11:32tobiasraeder@lpetit thanks a ton, using paredit but wasnt aware of that
11:57ohpauleezDoes anyone know if there are videos of StrangeLoop?
11:59defnohpauleez: they are filming a lot of it
11:59defnbut not /all/ of it -- which talk were you hoping to see?
12:00ohpauleezah awesome, thanks defn. No one in particular, just wanted to thumb through them and watch the ones that seem interesting
12:00lypanovanyone know how to get vimclojure to print out output from commands executed on the cmdline on the go rather than buffering it all?
12:00defnyeah fortunately/unfortunately they cost of the ticket didn't permit a lot of the perks some confs have
12:00ohpauleezI skipped StrangeLoop for conj, and had to cancel the conj trip because of work
12:00defnoh no!
12:00defni met chouser yesterday which was cool
12:01ohpauleezAwesome!
12:01cemerickrhickey: that's a helluva change!
12:01defni drove to strangeloop so i could handle the cost of flying down to conj
12:01cemerickGet them all out of the way now, plz. ;-) (sorry, chouser, _fogus_ )
12:02ohpauleezcemerick: Don't be sorry, they get a free second edition now :)
12:02ohpauleezlypanov: You want to pipe the output to another shell/console?
12:02@rhickeycemerick: well, it's been a known wart for a while, must be removed to make way for easier parallelism
12:02ohpauleezinstead of the designated buffer?
12:02lypanovohpauleez: just into the buffer at the time its happening rather than queuing it up.
12:03lypanovohpauleez: (when using "send top level")
12:03cemerickrhickey: for sure, it's a welcome change. I can't think of any immediate downsides -- do you know of any?
12:03_fogus_cemerick: I don't follow
12:03ohpauleezAhh, Yeah, I don't know how to do that. I think it's based on the semantics (Looks for the exit code of the process)
12:03@rhickeyso, who's ready for a bifurcation of vars into dynamically rebindable and not?
12:04jjidodoes Clojure have a function to compare two Comparables? < does not work
12:04lpetitrhickey: would affect REPL user xperience ?
12:04@rhickeycemerick: no downsides, as the perf is nearly ideal, one thread local reference, no copies, no cost dependent on number of vars
12:05ohpauleez_fogus_: He wants all the changes out of the way for writing the book.
12:05@rhickeylpetit: in what way?
12:05lpetitrhickey: *you* tell me :-)
12:05lpetitrhickey: redefinition, I mean
12:05jjidorhickey: sounds interesting
12:05cemerickrhickey: perhaps a bifurcation would mean that this non-dynamically-rebindable thing won't be called a var...?
12:05notsonerdysunny->(when-first [[x y z] [1 2 3 4 5]] (+ x y z))
12:05sexpbotjava.lang.UnsupportedOperationException: nth not supported on this type: Integer
12:05lpetitrhickey: and potentially need for reevaluation of all dependent code ?
12:05notsonerdysunny,(when-first [[x y z] [1 2 3 4 5]] (+ x y z))
12:05clojurebotnotsonerdysunny: Pardon?
12:06notsonerdysunny->(when-first [[x y z] [1 2 3 4 5]] (+ x y z))
12:06sexpbotjava.lang.UnsupportedOperationException: nth not supported on this type: Integer
12:06cemerick_fogus_: just (foolishly) joshing the other authors :-P
12:06notsonerdysunnythe above expression is return nil on my computer
12:06notsonerdysunnyI was expecting it to return 6
12:06_fogus_cemerick: Thankfully, we can still squeeze in edits. ;-)
12:06@rhickeyI have new ideas about how to make the non-dynamically rebindable vars still 'update-able', for the only viable usage - redefinition of fixed/enhanced functions
12:06notsonerdysunnycan somebody clarify what is happening here..
12:06lpetitrhickey: maybe I should have first aksed: I don't see the use cases
12:06@rhickeyso no re-eval required
12:07lpetitok
12:07@rhickeybut the perf benefits of direct/static binding
12:07lpetitseems like everybody is *working hard* not to produce conf slides ... :)-
12:08@rhickeycemerick: naming-wise, I'm thinking var and dynamic-var
12:08@rhickeycemerick: dynamic being something you ask for explicitly
12:08lpetit"consts" could be misleading ?
12:08@rhickeydefdynamic
12:09arkhhow do I import multiple classes from the same packege in a ns declaration? (e.g. something like this (ns my-namespace :import [java.util Date Timer])
12:09_fogus_lpetit: Done mine. :-)
12:09cemerickholy breakage, batman :-P
12:09@rhickeylpetit: const might be something else altogether
12:09replacalpetit: I'm writing mine! But I'm way behind my ambitions as well :)
12:09@rhickeycemerick: no breakage except for dynamic rebinding of fns
12:09cemerickrhickey: right
12:09cemerickNot that I'm arguing against the breakage.
12:09@rhickeyso, I'm here to listen to the moaning around that loss
12:10ohpauleezarkh: (:import (java.util Date Timer)) should work
12:10@rhickeyarguably, mocking frameworks should be doing root rebinding
12:10lpetit_fogus_, replaca: good for *you* :-)
12:11ohpauleez(ns my-ns (:import (java.util Date Timer))) (arkh)
12:11@rhickeydynamic fns used for e.g. error handling could still be created, explicitly
12:11@rhickeydynamic binding for monkey-patching will die a deserved death
12:11arkhohpauleez: I receive the following with that: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword
12:12lpetitrhickey: and clojure.osgi which currently dynamically rebinds clojure.core/load ... :-
12:12cemerick,(binding [+ -] (+ 10 10)) ; But this is fun! :-P
12:12clojurebot20
12:12lpetit:-/
12:12cemerickoh, right, core is static these days
12:12hiredmandynamic binding is also used a lot for stubbing out functions for testing
12:12@rhickeylpetit: that's monkey patching IMO
12:12hiredman+ is inlined
12:13lpetitrhickey: for sure :-)
12:13@rhickeyhiredman: see above, root rebinding more suitable, no?
12:13cemerick,(binding [+ -] (apply + [10 10]))
12:13clojurebot0
12:13cemericktrue enough
12:13ohpauleezarkh: take a look at: http://gist.github.com/628461
12:14ohpauleezIs your :import in a s-expr?
12:14hiredmanrhickey: yes, well, our tests have started moving down the road of using this with-var-root macro that alter-var-roots and then restores
12:14arkhohpauleez: no - that was the problem, then : ( - Thank you
12:14ohpauleezarkh: happy to help
12:14@rhickeyhiredman: exactly
12:15hiredmanI am not sure which I dislike more, alter-var-root or binding
12:15lpetitrhickey: I see root-rebinding as even more "monkey patching" than "call-stack bound rebinding", non ?
12:15lpetits/non/no/
12:15sexpbot<lpetit> rhickey: I see root-rebinding as even more "monkey patching" than "call-stack bound rebinding", no ?
12:15@rhickeylpetit: root rebinding is not something you would leave in place, just for testing
12:19@rhickeyroot rebinding will be possible, but it will be expensive as it will force all var caches to reload on next use
12:19@rhickeyso, doing that on code reloads/evals is fine, doing that in tight loop is not
12:19replacaalter-var-root is great for setting up the program environment (processing command line args, reading param files and setting global parameters, etc.)
12:20replacaPurism is situational :)
12:21@rhickeyI'm trying to find the middle ground between bind-once of ML and the high-cost of anything could change at any time, the latter being not very functional
12:21@rhickeyin this model non-dynamic vars would be presumed constant throughout a fn body
12:21_fogus_rhickey: I needed it to simulate record invariants. No tight loops involved
12:22hiredmanhuh
12:22@rhickeythis facilitates caching var contents
12:22@rhickeythread binding is reserved for explicit dynamic vars
12:22lpetitindeed, when anything can be rebound, it's hard to agree with blog posts which say that clojure-only functions only rely on the input arguments !
12:22hiredmanthe binding propagation will make my scope implementation that uses binding work across threads
12:22@rhickeyon fn entry, a guard is tested that checks for _any_ var root alteration, reloads cache if needed
12:23@rhickeythis way, you can reload without re-evaluating downstream consumers
12:23ohpauleezthis change sounds pretty god to me
12:23ohpauleezgood
12:23@rhickeybut most of the overhead of dynamism is removed
12:23ohpauleezI appreciated the walkthrough rhickey
12:24@rhickeyhiredman: supporting resource scopes was one of the goals for the thread binding improvements
12:25@rhickeybut right now we all pay a high price for ever-possible dynamism
12:25jjidorhickey: is "at function entry" the right place?
12:25@rhickeyI'm quite stoked, as this new model will avoid much of the brittleness of direct linking and static
12:26@rhickeyjjido: where else?
12:27@rhickeyjjido: there is talk of providing access to safepoints for alternative langs, might be a few releases of JDK away...
12:27jjidorhickey: it could be user-specified
12:27lpetitsounds reasonable. and the semantics make sense, don't they ? (def not-rebindable) (defdynamic *rebindable*) . Now really no more arguing on adding or not CL-like ++ earmuffs around not-rebindable ...
12:27@rhickeyjjido: what would the choices be?
12:28jjidorhickey: nondynamic function, dynamic
12:28cemericklpetit: I think I may be one of just a handful that ever used ++ anyway.
12:28lpetitheh
12:28@rhickey+ick+
12:29@rhickeyjjido: to what purpose?
12:29jjidonot sure ;)
12:29lpetitwill read the rest on the logs, must drive home. cu buddies
12:29@rhickeyjjido: non-dynamic == can't call fixed functions
12:30jjidorhickey: I didn't understand that
12:30hiredmandone? for promises as has been a sore point
12:30@rhickeyjjido: if you don't really have a use case, nevermind
12:31hiredmanor actually await-for for promises
12:31@rhickeyhiredman: ?
12:31jjidorhickey: ok.
12:32hiredmanrhickey: a way in core to await on the delivery of a promise with a timeout would be nice
12:32@rhickeyhiredman: yes, it's on the agenda awaiting a good design
12:33hiredmanright, I am running through the new (to me) wiki
12:33@rhickeyah
12:33hiredmanlots of excellent stuff
12:33hiredman(as per the usual)
12:34hiredmana compiler that explicitly passes state, sounds like a job for clojure.contrib.monads
12:34@rhickeyhiredman: that blocking calls page is not ok by me yet
12:35hiredmanah
12:35fliebelAny Overtone hackers in here?
12:38@rhickeyhiredman: the idea has support, that design, not
12:38carkhLazy seqs + bindings : would it be possible to somehow attach bindings to closures ?
12:38carkhor would that make these lexical instead
12:39@rhickeycarkh: you could, but the cost of establishing per seq step might be too high
12:39carkhattaching at closure instanciation time (tho i don't know know what's under the hood)
12:40carkhright
12:40@rhickeyso, I'm still thinking about that but have delivered the first half (thread pool support)
12:41carkhto me the lazy seqs part is most important, but i can live with it as it is right now
12:41kumarshantanuhi, is there any clojure.contrib for dealing with conversion of keyword to/from camelCase strings?
12:41kumarshantanuor any project for that matter
12:41carkhkumarshantanu: i'd love to see that, and also for SQL type naming
12:43@rhickeyso, no strong objections to defns becoming not-dynamically (thread-locally) rebindable?
12:43kumarshantanucarkh: SQL type naming as in database-agnostic types? :string {:limit 30} --> VARCHAR(30)
12:44carkhrhickey: to me rebinding these is bad style anyways
12:44fliebelrhickey: I missed most of this, but just defns, or any def?
12:44cemerickrhickey: a msg to clojure-dev pointing at the transcript might flush out a principled objection *shrug*
12:44@rhickeyany def, there will be a defdynamic
12:44fliebelsounds good to me :)
12:45carkhkumarshantanu: nope just :hello-world becoming "hello_world" it's all easy, but it would be nice to have this kind of convertions all in the same place
12:45carkhrhickey: but you mean not even with the binding macro ?
12:46@rhickeycarkh: the binding macro would only work with defdynamic vars
12:46carkhwew that's pretty destructive for old code
12:48@rhickeycarkh: really?
12:48@rhickeypresume we can easily make defs of *foo* dynamic
12:48hiredmanwell, using *foo* and binding all over the place is pretty horrible, so destroying it is good
12:48carkhhiredman: it is, but sometimes that's the best tool
12:49technomancythat is going to hurt testability badly. right now one of the things that makes clojure code easy to unit test is that you can rebind some of the functions it relies on.
12:49kumarshantanucarkh: I am writing some code and need camelCase to/from keyword conversions -- might as well write something and factor it out
12:49hiredmancarkh: rarely
12:49@rhickeydynamic is only being removed as the default, not as an option
12:49technomancyif you have to indicate what can be rebound, you will start to need things like dependency injection
12:49kumarshantanurhickey: technomancy: that's spot-on -- mocking dependencies is the biggest use case
12:49@rhickeytechnomancy: how so?
12:49hiredmantechnomancy: well there will be root rebinding apparently
12:49hiredmane.g. with-var-root or something
12:50technomancyok, maybe I don't have enough context; I should wait till I hear more.
12:50@rhickeytruly mocking/stubbing/injecting something requires more power than binding anyway, as that only affects one branch
12:51@rhickeyeveryone needs to be clear we are only talking about rebinding, not redefing
12:53@rhickeyan aPI option is to trigger dynamics from the earmuffs (def *dynamic-foo*) == dynamic
12:53carkhhiredman: i have this now becoming rather large web application, i use binding at the top of the url matching tree as soon as i know the customer in order to "binding" the currency he uses, i can't imagine passing such a value trough all function calls without passing a state mage-object which in the end is not any better than rebinding vars
12:53AWizzArdSo, in principle this only shadows older bindings, and releases them when the body closes.
12:53carkhmage->mega
12:53@rhickeythat will minimize breakage for anyone using the convention
12:54cemerickplease no sniffing of var names to hint semantics
12:54@rhickeylet's not argue about dynamic vars, they have obvious utility and are used by Clojure itself, and are not going away under this proposal
12:55@rhickeycemerick: significantly reduces the breakage, and ensures the naming convention
12:55jkkramercould a warning be issued?
12:55carkhrhickey: huh the earmuff thing seems a bit too magical
12:57@rhickey(defdynamic no-earmuffs) will be considered bad karma though
12:57defn11:55 < jkkramer> could a warning be issued?
12:57carkhwouldn't it make sense to take the reverse option of going defstatic or def for dynamic as it is now ?
12:57@rhickeywatning about what?
12:57@rhickeywarning
12:57cemerickrhickey: Granted, but it's still bad. Not as bad as the -void-methodName black magic, but still bad.
12:58@rhickeycemerick: alternatives for breakage reduction welcome
12:58jkkramer"i'm making *your-def* dynamic but you should really use defdynamic"
12:59danlarkinmy vote is against the name of a var influencing its behavior
12:59carkhand give us an error when trying to binding a static var
12:59@rhickeyjkkramer: yes, more likely if we intend to deprecate the earmuffs==dynamic as a transition feature only
12:59jkkramerright
12:59@rhickeycarkh: tat is certain
12:59@rhickeythat
13:00carkhso why not defstatic+def instead of defdynamic+def ?
13:00hiredmandef would not be the same as static
13:00carkhjust like you need to specify that function is static and get dynamic by default
13:00hiredmanin the case of defdynamic+def
13:01@rhickeycarkh: because it's not static, there is a lot of code that presumes namespaces contain vars, dynamic vars will be Vars by inheritance if not by mode
13:01jjidoCould we define an auto-dynamic variable pattern?
13:01hiredmanit would just not be bindable, which is not the same thing
13:01cemerickrhickey: I don't have any alternative breakage mitigation suggestions at the moment. Adding and then taking away magical var names seems even worse than adding them at all, though.
13:01jjidousing a regex
13:01@rhickeycemerick: even if it never makes a release?
13:02jjidoThat way you can use the earmuffs, dyn-something or whatever pattern you like
13:02cemerickrhickey: that changes the calculus significantly
13:04amalloyi don't understand the objection to carkh's proposal. leave def the way it is, and introduce a defstatic; that gives you access to the new language "feature", while not breaking old code that assumes it can rebind something
13:05cemerickamalloy: people wanting speed is more common then people wanting dynamic rebinding
13:06ohpauleezcemerick: I totally agree, but I kind of like the suggestion myself
13:07ohpauleezas far as migration is concerned. That said I really only use dynamic binding in the cases already mentioned and am fine working around them
13:09hiredmanamalloy: that proposal rests on a faulty understanding of the choices and tradeoffs involved
13:09cemerickThe same dynamic applied to the prim stuff: people care way more about perf in common cases than the generality of arbitrary precision.
13:09carkhtss ok static might not be the best word
13:09carkhbut you get the idea
13:10ohpauleezcemerick: I actually thought of that as the counter example. People don't care about auto-promotion most of them time (in fact, I'm sure they rarely expect it), but when they want it, it's there
13:11cemerickohpauleez: the same applies here -- rebinding is rarely used, but defdynamic is there when you need it
13:11jjidoI like that Clojure can calculate factorial of 10000.
13:12ohpauleezI completely agree. I only use rebinding in the situations listed already, and I'm fine being explicit about them
13:12ohpauleezI retracted my statement from before
13:13carkhyou might not have a big code base to take into account maybe .. *cries*
13:13ohpauleezYou can't please everyone :)
13:13jjidocarkh: but you can use refactoring tools on your code can't you?
13:13carkhwhat tools ?
13:14ohpauleezor a macro!
13:14carkhall i have is good old emacs
13:14ohpauleezI thought emacs had everything?
13:14ohpauleez:)
13:14jjidoohpauleez: exactly!
13:15ohpauleezcarkh: sed will fix it for you
13:16ohpauleezall of this aside, do we really need the special *binding-name-that-is-now-dynamic* trick?
13:16ohpauleezI understand this change will break some projects, but those projects depend on an earlier version on clojure
13:17_fogus_This appears to break only one example in JoC, so I say it's a win. :-)
13:17ohpauleezAwesome!
13:21amalloyi agree it seems wrong to treat *vars* specially, but as indicated above i don't really understand the issues, so feel free apply a grain of salt
13:29fhdHi. I'm about to do some string conversion in Clojure. I'd usually just read the string line by line and then add the modified lines to a StringBuilder.
13:29fhdHowever, that's quite imperative. Any hints on how to do this more elegantly in Clojure?
13:30fhdSpecifically, I'm parsing a file and replacing some magics in it by the respective entries in a map.
13:32kumarshantanufhd: Google's Guava is a nice library -- but it's Java
13:32rlbmay need more details, i.e. can the pattern you're looking for span lines? Are you dealing with a *lot* of data overall? per-doc?, etc.
13:33fhdrlb: I'm not really worried about efficiency ATM. It's rather small files, a few hundred bytes.
13:33fhdrlb: The patterns cannot span lines.
13:33rlbfhd: slurp, replace the pattern, then dump?
13:33fhdrlb: Well, it's several patterns. There are tags in the file, like '{{SOMETHING}}'
13:34rlbfhd: or if you don't want to hold the whole doc in memory, use a line-seq, etc.
13:34fhdThen I want to replace each of these with the map value for the key :SOMETHING
13:34fhdrlb: I thought about just doing a few replaces, but that would be ~10 string replacements on each complete file. Don't find that too elegant.
13:35rlbhow many items in the SOMETHING domain?
13:35rlb(max)
13:35fhdkumarshantanu: Does Guava have functionality for that? I'm actually trying to do it as Clojure-style as possible, but if there's something I can reuse...
13:35fhdrlb: Hm, I'd guess each item will usually pop up once or twice. And there should be up to 10 different items
13:36kumarshantanufhd: Guava lets you read from a file line by line -- nice API
13:36rlbyou could use a map (or doseq if you only want one line in memory at a time), and a function that just replaces all the patterns in that line before passing it on (via return or write)
13:36@rhickey_fogus_: what breaks in JoC?
13:36fhdrlb: Yeah, that's pretty much how I'd do it in Java. But I thought this was kinda weird in Clojure
13:37rlb(doseq [line (line-seq file)] (write-line ...))
13:37kumarshantanufhd: see this example -- http://www.copperykeenclaws.com/googles-guava-java-the-easy-parts/ (Files.readLines...)
13:37amalloyfhd: i'm in favor of rlb's proposal. just define a write-line function that does the necessary replacements
13:38fhdamalloy: Hm, OK I guess.
13:38fhdI somehow thought there was some funky function for this in Clojure :)
13:38amalloywrite-line can use reduce on a list of replacements to avoid writing .replace more than once
13:38fhdI'll just use StringBuilder then
13:39fhdamalloy: Hm, I'll look at that
13:40nishantCan I do a require :as from the REPL?
13:41fhdrlb: Why would I use doseq here? Isn't map fine too?
13:42rlbfhd: map should be fine as long as you don't hold on to the head of the result
13:42amalloy,(let [replacements [["a" "A"] ["b" "B"]]] (reduce (fn [str [from to]] (.replaceAll str from to)) "at bat"))
13:42clojurebotjava.lang.UnsupportedOperationException: nth not supported on this type: Character
13:42rlb(or as long as you don't care if each doc's completely in RAM at some point)
13:43rlband it's more flexible if you ever need that
13:43fhdrlb: I didn't really understand any of that, but I guess I'll just use doseq :)
13:43amalloy,(let [replacements [["a" "A"] ["b" "B"]]] (reduce (fn [str [from to]] (.replaceAll str from to)) "at bat" replacements))
13:43clojurebot"At BAt"
13:43rlbfhd: map returns a sequence containing the result
13:43rlbi.e. (line-1 line-2 line-3)
13:43fhdrlb: Ah, I see
13:44amalloyfhd: see above for a reduce/replace recipe
13:44fhdrlb: And doseq returns nothing and just does stuff?
13:44rlbdoseq doesn't -- it's not a functional op
13:44rlbit's just for side-effects
13:44fhdamalloy: Thanks, pretty nice
13:45rlbfhd: but since map is lazy, and line-seq is lazy, then map won't keep everything in ram either, as long as no one holds on to the head of the result.
13:46fhdrlb: I don't really get the "holding onto the head" thing
13:46rlbi.e. (doseq [line (map ...)] (print line))
13:46amalloy,(nth (range) 100000000)
13:47clojurebotExecution Timed Out
13:47amalloy,(let [x (range)] (nth x 100000000))
13:47clojurebotExecution Timed Out
13:47amalloyfhd: the first of those examples will work, eventually, in a real repl
13:47rlbfhd: with a lazy seqence, the items of the sequence aren't computed until they're needed, so you can traverse an infinite list in finite memory as long as you don't hold on to the head of the list.
13:47amalloybecause as soon as it's done with an element it can be GCed
13:48fhdrlb: So by holding onto, you mean keeping a reference to the element?
13:48amalloythe second one won't, because x is still referring indirectly to every element in range
13:48rlbfhd, right
13:48rlbi.e. (def ints (all-integers)) is *bad*, even if all-integers is lazy
13:48fhdrlb: Ah, I see. If I would hold references, all memory would eventually be consumed.
13:48rlbbut (doseq [i (all-integers)] (prn i)) is fine
13:49rlbwell, for some definition of "fine"
13:49_fogus_rhickey: rebinding an exception handler defn (and example in the final chapter)
13:49rlbit won't run out of ram at least
13:49amalloyrlb: well, fine except you're printing an infinite sequence :)
13:49_fogus_s/and/an
13:49stuartsierraeventually you'll run out of paper
13:49rlbnah, just electrons
13:50@rhickey_fogus_: so, exception handlers are still valid uses of dynamic fn vars (and the original motivation for allowing dynamic fns), but will have to be explicit about the dynamism
13:51_fogus_rhickey: It's the only use case that we mention. :-)
13:51@rhickeyI'm considering retaining support for the :dynamic true metadata for this purpose, as a second set of dynamic def variants seems like a waste
13:52@rhickey_fogus_: you can slap :dynamic true on that now (harmlessly) and it might still work
13:52rlbfhd: easy way to play around with infinite lists in clojure is via cycle, repeat, or repeatedly.
13:52_fogus_rhickey: A footnote might be in order... we do not have enough of those.
13:53_fogus_;-)
13:53_fogus_!!! http://twitter.com/amitrathore/status/27464468779
13:54@rhickeynice!
13:55kryftTold where?
13:55rlbfhd: another thing to keep in mind is that if you're not used to laziness, execution may not happen when you expect it to. i.e. it happens when each element of the list is *consumed*. If the list is never consumed; no execution...
13:55amalloykryft: at strangeloop
13:56fhdrlb: I guess I'll take the chance :)
14:03_fogus_Hmmm, just realized that the wording in the Var section might need to be adjusted also.
14:06fhdAre private functions in Clojure mostly a way to make people coming from Java happy or is their use encouraged?
14:07rlbfhd: it's not a problem, just the way laziness works, but I imagine it can be surprising
14:07amalloyfhd: i think they're encouraged. don't clutter namespaces with functions nobody will want
14:08amalloyif someone (use)s your library, they don't want tab-completion for your process-portion-of-file function
14:08fhdamalloy: Probably. I was mostly wondering because I don't think there's such a mechanism in other Lisps, so I thought it might not be Lisp-y
14:09carkhit is also encouraged to only use the symbols you need
14:09rbanffyHi folks. Total newbie installed Clojure from ELPA. I would like to use 1.2 instead of 1.1. What can I do?
14:09carkh(:use [mynamespace :only [frobnicate])
14:10technomancyrbanffy: try the swank-clojure readme; sounds like you found some out-of-date docs
14:11rbanffytechnomancy: Where can a *total* newbie find it?
14:12fhdcarkh: Hm, I always use evertything.
14:13amalloyfhd: i do too, but it's a filthy habit, just like it is in java
14:13amalloyi just can never remember the syntax for using selectively
14:13qedI thought proxy was deprecated for some reason.
14:14qedGuy Steele just said to learn clojure.
14:15amalloyqed: your thunder has been stolen already
14:15fhdamalloy: Well, I kind of like .* in Java :P Hardly ever had any problems with that, and it's IMO worth removing ~100 files from each file.
14:16qedamalloy: I think that was me actually.
14:16qedI'm defn.
14:16amalloyqed: are you fogus too? :P
14:16qedHaha. :F
14:16amalloyfhd: .* is convenient if you're not using a decent IDE, but it means (for example) if you see a strange class like MagicDoStuff in the code, you don't know what package it's from
14:17amalloybut eg Eclipse will manage all the imports for you so that anyone readong your code knows exactly what classes come from where
14:18fhdamalloy: Yeah, but I'm usually on Emacs. Someone using Eclipse can actually see where the file is from by holding the cursor over it :) Well it's probably a matter of taste in the end.
14:21amalloyfhd: search google for "java style guide import .*", the first N hits say DONT DO IT
14:23jjidoamalloy: because of name clashes?
14:24rbanffytechnomancy: I see slime-lisp-options points to 1.1 Is there an easy way to change that?
14:24amalloyjjido: meh. that's only really a problem for java.util.Date :P. it just makes the code harder to read if you're seeing it for the first time
14:26amalloyi mean yes, it's obviously a style issue since the compiler doesn't care, but so are newlines
14:26fhdamalloy: There's reasons for both approaches, that's why I called it a matter of taste. The topic is quite controversial on the web apparently.
14:27technomancyrbanffy: yeah, you don't need swank-clojure.el, just clojure-mode and slime-repl
14:28rbanffytechnomancy: That's confusing. All I wanted was to make M-x slime give me 1.2...
14:31fhdHm, but there's one problem. When I make functions private, I cannot call them from the REPL for testing purposes anymore.
14:31opqdonutfhd: you can say (in-ns 'foo)
14:31opqdonutthen they should be visible
14:31fhdopqdonut: Great, thanks
14:32amalloyor just (ns foo), which expands to the same thing
14:32opqdonutmmm yeah
14:32fhdamalloy: Isn't (ns) already included in (use)?
14:32amalloyfhd: no. use is a combined require/refer
14:33opqdonutyep
14:33opqdonutuse imports the given ns into the current ns
14:33opqdonutns or in-ns changes which ns you are in
14:33fhdopqdonut: Ah, okay
14:33opqdonutthis affects the visibility of private stuff and also where defs go
14:43duncanmif i have a map {:a 1 :b 2} and i just want to keep the same map but increment all the vals by one, how should i write that?
14:43fhdCan I turn a keyword into a string?
14:44fhde.g. :name -> "name"
14:44duncanm,(str :foo)
14:44clojurebot":foo"
14:44fhdwow
14:44jkkramer,(name :foo)
14:44clojurebot"foo"
14:44duncanmeven nicer
14:44fhdThanks :)
14:45mrBliss,(into {} (for [[k v] {:a 1, :b 2}] [k (inc v)]))
14:45clojurebot{:a 2, :b 3}
14:45duncanmmrBliss: that's kinda messy...
14:45mrBlissduncanm: indeed
14:46duncanmmrBliss: in my mind, what i want to do is to 'map' over the vals of a map and get back a map (and not a list of vals)
14:47mrBlissduncanm: unfortunately, that's not how seqs work :-( I've needed this too
14:48amalloy,(let [m {:a 1 :b 2}] (zipmap (keys m) (map inc (vals m))))
14:48clojurebot{:b 3, :a 2}
14:50mrBlissamalloy's version is faster on my machine
14:50amalloyreally? i wonder why
14:51amalloyanyway you could easily write a generic map-over-vals function and then use that all over
14:51mrBlisszipmap is loop and recur and for is a bit messier. Also I create a new vector for every element in the map
14:54hiredman,(doc fmap)
14:54clojurebot"clojure.contrib.generic.functor/fmap;[[f s]]; Applies function f to each item in the data structure s and returns a structure of the same kind."
14:56amalloyaha, nice
14:59fhdamalloy: Remember your replaceAll code from earlier? It works fine, but I don't really understand it. What does (fn [str [from to]] do?
15:00fhdamalloy: I presume it are the two values passed in from resume, but I don't really know that syntax
15:02amalloyfhd: do you understand destructuring yet?
15:03fhdamalloy: Haven't heard it in the context of Clojure yet, so I guess no
15:03amalloyk
15:03amalloyin binding forms like let and fn args, instead of just plain variable names you can give sequences
15:03amalloythat says "the thing that you will bind to this is a sequence; break it down and assign its elements to the variables i name"
15:04fhdamalloy: Ah, so the second argument is a vector?
15:04amalloy,(let [[a b c] (range)] b)
15:04clojurebot1
15:04fhdI see, cool.
15:05amalloysince reduce is iterating over a seq of [from to] vectors, and tracking a single string as the result, the signature of the reduction function is [str [from to]]
15:05fhdBecause reduce always passes two strings in, I see
15:05fhdPretty clever
15:05amalloyindeed, destructuring is amazing
15:06fhdBut most of the time I look at Clojure code, I feel like it's far too clever for me
15:06fhdAnd when I happen to write clever stuff myself, I feel like an evil genious. Well, at least evil.
15:06fhdDoes that change with time? :)
15:06amalloyhaha not yet
15:07amalloycheck out http://rosettacode.org/wiki/Fibonacci_sequence#Clojure for the thing that most recently made my jaw drop (i wrote the description at the bottom to help me understand it)
15:09fhdOMG
15:09fhdI wonder if I'd be better at understanding this stuff if I had studied maths instead of CS :)
15:10amalloyprobably not. you just have to get used to functional programming
15:11fhdamalloy: I really like it so far, but I realised just recently that functional programming wasn't OOP with closures :P
15:11Adamantamalloy: laziness is awesome, huh? :)
15:11amalloyheh
15:11amalloyAdamant: it's not the laziness so much as the clever way of maintaining metadata that you throw away before giving out the result
15:12Adamantnot holding onto the head and intermediate results? yeah
15:12amalloyi feel like i've fully grokked it now that i've written some code that comverts to/from base N that uses the same idiom
15:13rlbfhd: destructuring can also be useful when defining multiple function bodies, i.e. (defn foo ([x] x) ([x [y z]] (+x y z)))
15:13fhdrlb: Basically overloading, huh?
15:13rlbit allows more sophisticated argument matching
15:13fhdrlb: Yeah, I imagine it can make for real beautiful signatures
15:14amalloyfhd: depends on your notion of beauty. if you nest too deeply it starts to become unreadable
15:15amalloyand there are more advanced features for destructuring. for example:
15:15amalloy,(let [f (fn [{a :name, b :age}] ) (str a b))] (f {:age 9}))
15:15clojurebotUnmatched delimiter: )
15:16fhdamalloy: True. But I find it more explicit than passing an array or a collection that contains two elements
15:16amalloy,(let [f (fn [{a :name, b :age}] (str a b))] (f {:age 9}))
15:16clojurebot"9"
15:16fhdI need Clojure highlighting for irssi
15:17fhdHm, that's essentially named parameters
15:18amalloyfhd: well, named parameters are a special case of map destructuring
15:18mrBlissfhd: Emacs comes with ERC
15:18fhdmrBliss: Haha :) Although an Emacs user, I was never a big fan of using it as an OS :P
15:19amalloyyou can do map destructuring in more complicated ways, for example pull apart a map that's inside a vector
15:19fhdamalloy: Is that whole destructuring thing Clojure-only or general Lisp? I never did advanced stuff in Emacs Lisp, so I wouldn't know
15:20amalloyi believe CL has it but it's way less pretty/convenient
15:20mrBliss,(let [{:keys [a b c]} {:a 1 :b 2 :c 3}] [a b c])
15:20clojurebot[1 2 3]
15:20fhdI believe the variable parameter lists in Emacs use something similar
15:20amalloylisp has &rest and &keys
15:21fhdYeah, that's it. Then it's not destructuring
15:21amalloyand i think a destructuring-bind function that does stuff like clojure, but it's just harder to get at (like most lisp things)
15:21AdamantCL, please
15:21amalloyargh, i said CL last time
15:21AdamantI don't like the conflation of 'Lisp' with CL
15:22amalloyAdamant: it's a pretty...Common...mistake :)
15:22Adamantnot that I don't like CL, but unless they plan to create another standard, formal or informal, it's a dead language
15:22ohpauleezamalloy: haha that was a good one
15:22Adamantoh yeah
15:22Adamantso good it's good while still being bad :P
15:22Adamantalso, you must now put on the sunglasses while background music plays "YEeeoowww!!!!!"
15:23amalloyi prefer the drum sting while the audience groans
15:23Adamanthey, that works :P
15:24fhdWhen using line-seq, can I somehow preserve (to re-add) the EOL characters?
15:25mrBliss,(interleave [1 2 3] (repeat "\n"))
15:25clojurebot(1 "\n" 2 "\n" 3 "\n")
15:25mrBlissreplace [1 2 3] with your (line-seq ..)
15:26fhdmrBliss: Well, I would like to preserve the EOL chars exactly as they appear, if possible
15:26fhdmrBliss: i.e. whatever stile the file uses, plus add one to the end or not
15:26mrBlissyeah I just saw it too
15:26fhds/stile/style/
15:26sexpbot<fhd> mrBliss: i.e. whatever style the file uses, plus add one to the end or not
15:26fhdnow that's neat
15:27mrBlissdo you mean keeping \r\n or \n?
15:27fhdmrBliss: Yeah. If they're mixed, I'd like to keep them mixed. Don't want to play cop here.
15:31technomancyrbanffy: if you're still around, the short version is that it's very awkward to launch clojure processes from elisp because of the fact that the classpath must be known up front. so it's best to launch it with lein/cljr/etc and connect from Emacs
15:35hsuhwhy (= 1M 1.0M) is false?
15:36amalloy,(map class [1M 1.0M])
15:36clojurebot(java.math.BigDecimal java.math.BigDecimal)
15:36amalloyhm. dunno hsuh
15:36ohpauleezyeah, that's what I thought too
15:37amalloyit may be that bigdecimal keeps track of how much precision it's recording
15:37amalloyeg, for scientists 1 != 1.00
15:38amalloy,(map #(.precision %) [1M 1.0M])
15:38clojurebot(1 2)
15:39amalloyhsuh, ohpauleez: ^^
15:39ohpauleezahh, for sure
15:40hsuhok, but there should be some way of testing something like this without knowing the precision,no? (ok i see that zero? works for 0.00000M but anyway...)
15:40_rata_hi
15:42raekif you convert them to the same type, you can always compare them
15:43hsuh,(= (bigdec 300M) (bigdec 300.000M))
15:43clojurebotfalse
15:43lrenn,(= 0 (.compareTo 1M 1.0M))
15:43clojurebottrue
15:45hsuh,(zero? (- 1.0M 1.000M))
15:45clojurebottrue
15:46raekI'm not sure, but maybe java's requirements on .equals has something to do with this
15:46hsuhok
15:46raekthis was changed pretty recently too
15:48_schulte_so acording to http://clojure.org/lazy filter is not fully lazy, is that still the case?
15:48amalloy_schulte_: that proposal is very old
15:49_rata_how can I have multiple mutually-referencing objects in one atom?
15:49fhdIs there anything similar to "instanceof" in Clojure?
15:50amalloy,(instance? 1 Integer)
15:50clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Class
15:50_rata_fhd, instance?
15:50_schulte_amalloy: but is filter still non-lazy? I have some out-of-memory errors that would indicate that something in the take/filter/map/pmap/filter/repeatedly stack is not lazy
15:50amalloy,(instance? Integer 1)
15:50clojurebottrue
15:50amalloyno, filter is lazy
15:50fhdAh, great
15:50amalloy,(supers (class {})) ; also sorta useful maybe
15:50clojurebot#{java.util.concurrent.Callable clojure.lang.IMeta clojure.lang.Counted clojure.lang.Seqable java.lang.Runnable java.io.Serializable clojure.lang.APersistentMap clojure.lang.ILookup java.lang.Object clojure.lang.Associative clojure.lang.IEditableCollection clojure.lang.IPersistentMap clojure.lang.IObj java.util.Map clojure.lang.IPersistentCollection java.lang.Iterable clojure.lang.AFn clojure.lang.IFn}
15:51_schulte_amalloy: ok, thanks, on a related question then, do you know of a way to explicitly free an object, currently the GC is throwing out-of-memory errors because it's working too hard
15:51amalloy_schulte_: the GC will free things that aren't referenced anymore. can you post a gist or something so we can see what the problem is?
15:52hsuh,(or (> 1M 1.0M) (< 1M 1.0M) (= 1M 1.0M))
15:52clojurebotfalse
15:52raekhttp://www.assembla.com/wiki/show/clojure/Enhanced_Primitive_Support <-- mentions something about equality for number types
15:53hsuhtks
15:53_schulte_amalloy: sure, see http://gist.github.com/628831, something in this loop is running out of memory, the idea behind the code is to cycle through thousands of objects, dumping them to STDOUT and quitting after `out-num' successfull ones have been found
15:53_schulte_any ideas/feedback are much appreciated
15:54plathropDo people tend to deploy their Clojure apps with some way to connect and get a repl inside the application?
15:54plathropSo you can do live changes?
15:55hsuhraek: tl;dr: is not a simple problem :)
15:55raekfor development, I always run a swank server in the clojure instance
15:57raekfor the projects that I have running but not currently developing, I keep a repl in a screen, just in case
15:58hsuhraek: but do you change stuff or its more for peeking around?
15:59aavramHello, I'm having an issue getting the links to work in labrepl somewhat like as described here : http://github.com/relevance/labrepl/issues/issue/13 . I have tried removing the lib directory and ~/.m2/repository/ but still can't get the links to work. Any suggestions?
15:59amalloy_schulte_: how long does evaluate-asm take to run? it looks like you may be spawning zillons of threads at once before any of them complete
15:59raekin my IRC bot, I change stuff all the time
15:59_schulte_amalloy: <=8 seconds
15:59hsuhraek: i dont know if that is considered production :)
15:59_schulte_amalloy: ok, thanks, I'll try removing the pmap
16:00plathropraek: I do the same in development and was thinking it would be cool when you actually deploy the app to have the ability to connect to arepl.
16:00raekwell, I wouldn't consider that project production either
16:00_schulte_it'd be nice to be able to specify a threadpool size for pmap...
16:00amalloyyour code mostly looks like it's fully lazy, so pmap is the only culprit that comes to mind
16:01raeka web app I made is running in the background, but I rarely touch that
16:01_schulte_great thanks, I was confident in the lazyness until I saw the clojure.org/lazy page which implies that the clojure core isn't quite lazy
16:01hsuhplathrop: that sounds like fun, being able to fix things on the fly and impress people... but on think it would be very popular IRL
16:01raekbut it is neat to be able to inspect variables when it's running, if I need to
16:02plathropIt was a useful trick when I was using list.
16:02plathroplisp even
16:02plathropCommon lisp even :-P
16:03hsuhplathrop: that habit can be transferred to clojure, no prob i guess
16:03fhdIn the body of a (for, I can add elements like this [:hello :world]. Can I also add two blocks of elements?
16:04hsuhslime repl lets me connect to a running swank, change namespace, redefine functions, its neat...
16:04fhdI tried [:hello :world][:foo :bar], but it just ignores one entry
16:05_rata_fhd, what do you want to do?
16:05_rata_do you want to return the four values from (for ...)?
16:06_rata_then [[:hello :world] [:foo :bar]] would do it
16:06fhdI have a list of replacements that looks like this [["hello" "world"]["foo" "bar"]] etc.
16:06fhdI only added one replacement on each execution of (for, so this worked. But now I want to add two entries
16:07fhd_rata_: That would create a new vector, like this: [[["hello" "world"]["foo" "bar"]]["normal" "replacement"]]
16:07fhdIt's the code amalloy|afk gave me earlier
16:07rlbfhd: not sure you can easily preserve the ends as-is. You could either just pull in the whole doc and filter it via slurp and multiple string/replaces, or write your own lazy seq that keeps the endings. See (source line-seq). Of course the slurp approach will be more expensive.
16:08raekfhd: if I understood the problem correctly, you need to return a collection of things, and apply concat to the seq you get from for
16:08fhdrlb: I guess I'll leave it like this for now. Did some ugly (if (= line (last lines)) "\n") for now
16:09raek,(apply concat (for [x (range 5)] (if (even? x) [x x] [x])))
16:09clojurebot(0 0 1 2 2 3 4 4)
16:09fhdraek: I don't think that's it
16:09raekthe problem being "replacing certain elements with one elements and other with two"
16:09fhdSimply put, I want to return _two_ values from (for
16:10raekfhd: then you simply have to pair them together in some sort of collection
16:10raekor do two separate fors
16:11nishant,(doc concat)
16:11clojurebot"([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls."
16:12raek,(map (juxt inc dec) (range 10))
16:12clojurebot([1 -1] [2 0] [3 1] [4 2] [5 3] [6 4] [7 5] [8 6] [9 7] [10 8])
16:13raekfhd: what is your desired input and output? can you provide an example?
16:14fhd_Hm. So that means I'll have to add my elements wrapped in another vector, than somehow flatten the whole thing and make pairs out of every two elements?
16:16dpritchettargh
16:16dpritchetti took a few months off from clojure and now i can't think functionally anymore
16:17dpritchettgiven a list of lists how do i return the list with the largest second element? ((1 1) (2 10) (3 4)) should return (2 10)
16:18dpritchetti'll bet i could do it with reduce
16:18mrBliss,(apply (partial max-key second) '((1 1) (2 10) (3 4)))
16:18clojurebot(2 10)
16:19fhdIs it possible to somehow "flatten" a vector, i.e. turn [[[1 2]][3 4]] into [1 2 3 4]?
16:19mrBliss(doc flatten)
16:19clojurebot"([x]); Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns nil."
16:19fhdoh
16:19dpritchettthanks
16:19seancorfield,(flatten [[[1 2]][3 4]])
16:19clojurebot(1 2 3 4)
16:19seancorfieldnote that it returns a seq, not a vector
16:20ohpauleezprotocol experts, can someone inform me why I'm seeing a NullPointer when eval'ing this file http://github.com/ohpauleez/net-ns/blob/master/src/net_ns/server/atom_mapper.clj
16:20seancorfield,(apply vec (flatten [[[1 2 ]][3 4]]))
16:20clojurebotjava.lang.IllegalArgumentException: Wrong number of args (4) passed to: core$vec
16:20seancorfieldhmm, i can never remember how to call vec :)
16:21seancorfield,(vec (flatten [[[1 2]][3 4]]))
16:21clojurebot[1 2 3 4]
16:21LaPingvinovec works on seqs
16:21LaPingvinomore or less like str
16:21fhdI just realized that it's far more elegant if I use a regex instead of two patterns
16:22seancorfield,(str "Takes " "any" " number of" " strings")
16:22fhdPhew, I really didn't want to use the flatten solution :)
16:22clojurebot"Takes any number of strings"
16:25raekfhd: if you only want to flatten one level, you can use apply concat
16:28fhdraek: But is that really the best solution for adding two or more elements to a list using for? By adding a vector with two elements and then flatten the whole thing later?
16:30raekfhd: so you have a sequence of things, you produce a part of a sequence from each element and want those sequence to be made into one big sequence?
16:31fhdraek: Well, I'm producing a totally different sequence from another one. The sequence I produce has several entries per value of the original sequence.
16:31plathropIs clojure.contrib.mock the best mock library out there? Trying to add unit tests to code that calls out to Java objects, and I don't want to create real Java objects.
16:32rbanffytechnomancy: Thanks. I know it seems to be a bit awkward, but, since swank can do it by itself, there must be some way to teach it to use a different set of .jars
16:33raekfhd: then I would recommend (mapcat f coll), which is the same as (apply concat (map f coll)), or using (apply concat (for ...))
16:33ubiidoes anyone know, if the Clojure-conf presentations will be recorded and made available online?
16:33fhdraek: i.e. removing exactly one "layer"? I'll do that then
16:33raekfhd: but to answer your question, yes. I would add them to a vector and use concat
16:34raekalso, concat is lazy
16:34bmhAny recommendations for a computational geometry lib? Java or Clojure
16:34raekas is for and map
16:35fhdraek: Wow, it works. Magical.
16:35_rata_how can I have multiple mutually-referencing objects in one atom?
16:36ohpauleezbmh: I would go with Clojure and call Java as needed
16:37ohpauleezbmh: What specifically are you doing?
16:37ohpauleezohh, you're looking for a lib, my b
16:37bmhohpauleez: That's the plan. 3d convex hull / delaunay triangulation on a sphere
16:38ohpauleezboth those algos aren't bad to implement, but I'm digging around some code to see if I've used a library ever
16:40ohpauleezbmh: Typically in the past I've just called out to Mathematica and matlab as needed
16:40bmhohpauleez: oh geez! Ouch
16:41ohpauleezyeah, I'm not coming up with much
16:41ohpauleezsorry bmh
16:41bmhI guess I can implement qhull
16:42ohpauleezyeah, it's pretty straight forward
16:42bmheven in 3d?
16:42ohpauleezif my memory serves me correctly
16:43ohpauleezMy old lab just did it on the JVM and published, "On the use of Computational Geometry to Detect Software Faults at Runtime"
16:44fhdWow, accomplished quite a lot today, thanks to you guys! Cya.
16:45bhenrywhat would a ring handler look like if i want a link to make the browser ask the user to download a *.xls
16:47amalloybhenry: the header for that is Content-Disposition=attachment, as i recall. google that and you'll probly find the right answer
16:47bhenryyeah i just dead. do i just give my handler a :headers key?
16:47bhenryi just did*
16:48amalloybhenry: probably. i don't actually use ring
16:48raekbhenry: include a {"Content-Disposition" "attachment; filename=foo.bar"} header
16:48bhenryraek: thanks.
16:49bhenrywhen i first started using ring i made a template that takes a context map, and i forgot that i already have a headers key in there.
16:50raekbhenry: also remember to set the Content-Type to the correct MIME type
16:51bmhohpauleez: found one: http://www.cs.ubc.ca/~lloyd/java/quickhull3d.html
16:52ohpauleezawesome!
16:53raekohpauleez: I looked at your atom-mapper code, but I could find in the clojure docs that extend-type takes doc strings
16:55ohpauleezahh, I didn't even think of that. Thanks raek . Let me try that out
16:56mattreplis there a simple way to get the source path for where a namespace is defined on the class path?
16:58ohpauleezraek: That was it
17:01raekdefprotocol takes docstrings though... (and is where (doc someprotocol-method) takes the docs from)
17:02ohpauleezI see that now, thanks!
17:03raeknp :)
17:17vIkSiTwow, this place has *grown* in a month :)
17:26bhenryokay so query params come in as either a string or a vector. how can i idiomatically make a one item vector of the string when there is only one? i.e. (something string-or-vec) returns vector of string(s)
17:26bhenrydo i have to do a conditional to check if it's a vector or string and act accordingly?
17:27gfrlog,(vector? [123])
17:27clojurebottrue
17:27gfrlog,(string? "haha)
17:27clojurebotEOF while reading string
17:28raekare you talking about ring? in that case, when do you get query params as a vector?
17:28gfrlog,(string? "haha")
17:28clojurebottrue
17:29bhenryif the same param is used twice like opt=1&opt=2
17:29bhenryopt comes in as ["1" "2"]
17:29amalloy,(let [x "x"] (or (vector? x) [x]))
17:29clojurebot["x"]
17:29amalloyoh that won't work :P
17:30raekah, didn't know that ring.middleware.params/wrap-params could do that...
17:30bhenryraek i was surprised too, but i want to use it to my advantage
17:31raek,(letfn [(vectorize [x] (if (vector? x) x [x]))] [(vectorize 1) (vectorize [1 2])])
17:31clojurebot[[1] [1 2]]
17:31gfrlog,(doc letfn)
17:31clojurebot"([fnspecs & body]); Takes a vector of function specs and a body, and generates a set of bindings of functions to their names. All of the names are available in all of the definitions of the functions, as well as the body. fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+)"
17:32gfrlogclojure documentation does _not_ talk down to you
17:32raekyes, it feels a bit odd that r.m.p/assoc-param need to check whether the param is a vector in order to add more elements, and that the user then needs to check whether it is a vector again in order to use it...
17:32raek:/
17:34raekmaybe this would have been better if it was split into two different wrap-params middlewares
17:36raekto have an as simple as possible "data contract" (what the stuff that goes in and out of functions looks like), is essential in Clojure, IMHO
17:40ohpauleez~seen stuartsierra
17:40clojurebotstuartsierra was last seen parting #clojure, 212 minutes ago
17:46gfrlog,(format "%d hours, %d minutes" (quot 212 60) (rem 212 60))
17:46clojurebot"3 hours, 32 minutes"
18:06ohpauleez_fogus_: ping
18:07raekWhen speaking only in tautologies, you have to state facts, but also don't, or don't.
18:13amalloy,((juxt quot rem) 212 60) ; <== gfrlog
18:13clojurebot[3 32]
18:13gfrlog,(doc juxt)
18:13clojurebot"([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
18:14gfrlogamalloy: awesome
18:14gfrlogthere's no excuse for repetition
18:14amalloyjuxt is a great trick. ever since i saw raek use it for the first time, i try to find juxt in every problem i solve :P
18:15gfrloghmmmm
18:15gfrlog,((juxt juxt juxt) juxt juxt)
18:15clojurebot[#<core$juxt$fn__3657 clojure.core$juxt$fn__3657@d1ea84> #<core$juxt$fn__3657 clojure.core$juxt$fn__3657@17baeb1>]
18:15amalloylol
18:15gfrlogsolved that problem
18:15amalloy,((comp (juxt juxt juxt) juxt) juxt juxt)
18:16clojurebot[#<core$juxt$fn__3655 clojure.core$juxt$fn__3655@b56813> #<core$juxt$fn__3655 clojure.core$juxt$fn__3655@1c3c0fd>]
18:16gfrlogso much abstraction the poor JVM is going through and all we get are some hex codes
18:16amalloya good lesson: everything is bits, eventually
18:16raekamalloy: :)
18:17gfrlogit'd be fun to have a program that takes a java object and creates a graph of the nested objects all the way down to primitives
18:17gfrlogI guess that's not necessarily acyclic though :(
18:17raekamalloy: (btw, what did I use juxt for that time?)
18:19amalloyraek: awww, i just looked at my logs and it was actually jkkramer; you told him how beautiful it was
18:19amalloy,(map (juxt first count) (partition-by identity [:a :a :a :b :b :c :d :d]))
18:19clojurebot([:a 3] [:b 2] [:c 1] [:d 2])
18:20raekah, yes... that one is really neat
18:20gfrlog,(partition-by identity [:a :a :b :b :c :d :d])
18:20clojurebot((:a :a) (:b :b) (:c) (:d :d))
18:20Derander,(partition-by identity [:a :a :a :b :b :c :d :d])
18:20clojurebot((:a :a :a) (:b :b) (:c) (:d :d))
18:20Deranderlol.
18:20Derander,(count (partition-by identity [:a :a :a :b :b :c :d :d]))
18:20clojurebot4
18:21gfrlog,(+ 4 12)
18:21clojurebot16
18:21Derander,(pow 4 12)
18:21clojurebotjava.lang.Exception: Unable to resolve symbol: pow in this context
18:21gfrlogcomputers know the darndest things
18:21gfrlog,(#(% %) #(% %))
18:21clojurebotjava.lang.StackOverflowError
18:22Deranderokay, so guids collide sometimes. Why can't one prefix a guid with the originating computer's name to avoid collisions?
18:22gfrlogsome uuid schemes use that
18:22Deranderis there a downside?
18:22gfrlogsecurity I think
18:22gfrlogat least for a general implementation
18:22Deranderbecause someone knows where something comes from?
18:22gfrlogyeah
18:22Deranderoh, I don't give a rats ass about that
18:23gfrlogthen you're probably fine
18:23Deranderjust writing a sync engine between my desktop & laptop. okay.
18:23Deranderthanks. I was wondering if I'd gone insane and was missing something
18:23gfrlogI doubt you have to worry about collisions though
18:23Derandergfrlog: "In the OSF-specified algorithm for generating new (V1) GUIDs, the user's network card MAC address is used as a base for the last group of GUID digits, which means, for example, that a document can be tracked back to the computer that created it. This privacy hole was used when locating the creator of the Melissa worm[2]. Most of the other digits are based on the time while generating the GUID."
18:24Derandersorry for wall of text, but apparently that is basically what is done already
18:24gfrlogthat's on wiki? that's where I read it
18:24Derandermmhm
18:24gfrlogI thought it said there were newer versions though
18:24amalloyDerander: yes, but there are a lot of other GUID/UUID types than v1. as it happens v1 is back in vogue now that cassandra uses them, but for quite a while they were out of fashion
18:25Deranderyeah, I've never read anything but hate about guids in general
18:25amalloyv3 and v5 especially, for some reason
18:25Deranderwhen they seem like a decent solution to a common problem
18:25gfrlogwe should namespace guids
18:26amalloy,(in-ns guids) ; this is gonna fail :(
18:26clojurebotjava.lang.Exception: Unable to resolve symbol: guids in this context
18:26amalloy,(ns guids) ; this is gonna fail :(
18:26clojurebotnil
18:26amalloyreally?
18:26gfrlogwhat's the guids ns?
18:27amalloy,(do (ns guids) *ns*)
18:27clojurebot#<Namespace guids>
18:27amalloygfrlog: i dunno
18:27amalloyjust made it up
18:27amalloy,(do (ns guiasfdsds) *ns*)
18:27clojurebot#<Namespace guiasfdsds>
18:27gfrlogthat's the easiest way to write code ever
18:28arrummzenHow do I test for inequality in clojure?
18:28amalloy,(not= 1 4)
18:28clojurebottrue
18:28arrummzen=)
18:29gfrlog,(if (zero? (- 1 4)) true false)
18:29clojurebotfalse
18:29gfrlogwhoops backwards
18:29gfrlogthat one always trips me up
18:29amalloy,(not (zero? (- 1 4)))
18:29clojurebottrue
18:30amalloygfrlog: (if a true false) is a sin
18:30gfrloglol
18:30amalloy,(boolean 'a)
18:30clojurebottrue
18:30gfrlogI was about to ask if that exists
18:30gfrlogin other languages you can use !!
18:30amalloy<== always one step ahead
18:30gfrlogwhich is fun
18:31amalloytry it in java :P
18:32gfrlogoh gross
18:32gfrlogbut here goes
18:32amalloy,(nth (iterate not 'a) 3)
18:32clojurebotfalse
18:32gfrlog!(ob==null || ob == false)
18:32amalloy,(tale 5 (iterate not 'a))
18:32clojurebotjava.lang.Exception: Unable to resolve symbol: tale in this context
18:32amalloy,(take 5 (iterate not 'a))
18:32gfrlogthat probably wouldn't compile
18:32clojurebot(a false true false true)
18:33gfrloglol
18:33gfrlogwhy doesn't clojure have an eval-java function?
18:33amalloygfrlog: it would compile if obj were a Boolean, i think
18:34gfrlogyeah
18:34amalloy,(not (or (nil? Boolean/TRUE) (false? Boolean/TRUE)))
18:34clojurebottrue
18:35_ulisesevening folk
18:35gfrlog,(= Boolean/TRUE true)
18:35clojurebottrue
18:35amalloy,(if (Boolean. "true") 1 2)
18:35clojurebot1
18:36amalloy,(if (Boolean. "false") 1 2)
18:36clojurebot1
18:37gfrlog(println "DENIED")
18:37gfrlogdang comma
18:37Derander,(println "DENIED")
18:37clojurebotDENIED
18:38amalloy,(or (def x 1) (println 'DENIED))
18:38clojurebotDENIED
18:38gfrlogomg did it work?
18:38amalloylol no
18:38bmhWhat's the correct way to turn a primitive matrix (i.e. int[][]) into a clojure collection?
18:38Deranderno one knows
18:38gfrlog:)
18:38amalloy,(seq (byte-array 10))
18:38clojurebot(0 0 0 0 0 0 0 0 0 0)
18:39bmhamalloy: wrong direction
18:39bmhoh
18:39bmhseq
18:39gfrlog,(short-array 10)
18:39clojurebot#<short[] [S@f51f3b>
18:39amalloy,(map seq (seq (make-array Integer/TYPE 3 3)))
18:39clojurebot((0 0 0) (0 0 0) (0 0 0))
18:39gfrlogprimitives are fun
18:40kmci asked this before, but don't recall an answer; sorry if i missed it or something
18:40kmchow lightweight are Clojure threads?
18:40gfrlogI think they are java threads
18:41kmcok
18:41kmchow lightweight are Java threads? ;)
18:41gfrlogdunno :)
18:41gfrlogthey're not erlang I don't think
18:41amalloynot very
18:41kmcok
18:41kmcso i can't spawn 100,000 of them?
18:42amalloybad idea; maybe possible
18:42gfrlogtime for erlang!
18:42kmcor ghc haskell
18:42kmcnew IO manager in GHC 7.0 too
18:42amalloy,(for [_ 10] (java.lang.Thread.))
18:42clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
18:43amalloy,(for [_ (range 10)] (java.lang.Thread.))
18:43clojurebot(#<Thread Thread[Thread-1979,5,main]> #<Thread Thread[Thread-1980,5,main]> #<Thread Thread[Thread-1981,5,main]> #<Thread Thread[Thread-1982,5,main]> #<Thread Thread[Thread-1983,5,main]> #<Thread Thread[Thread-1984,5,main]> #<Thread Thread[Thread-1985,5,main]> #<Thread Thread[Thread-1986,5,main]> #<Thread Thread[Thread-1987,5,main]> #<Thread Thread[Thread-1988,5,main]>)
18:43gfrlog(conj todo-list "port clojure to erlang" "learn haskell")
18:43raekkmc: clojure uses java's executor framework for agents and futures
18:43Deranderamalloy: is it slightly dangerous that we can spawn threads on clojurebot?
18:44raekkmc: which means that all actions sent to agents with 'send' is handler by a fixed-size thread pool
18:44amalloyyes; it's a possible security hole we found last night
18:44Deranderfuuuuuuun
18:44amalloy,(for [_ (range 10)] (Thread.))
18:44clojurebot(#<Thread Thread[Thread-1990,5,main]> #<Thread Thread[Thread-1991,5,main]> #<Thread Thread[Thread-1992,5,main]> #<Thread Thread[Thread-1993,5,main]> #<Thread Thread[Thread-1994,5,main]> #<Thread Thread[Thread-1995,5,main]> #<Thread Thread[Thread-1996,5,main]> #<Thread Thread[Thread-1997,5,main]> #<Thread Thread[Thread-1998,5,main]> #<Thread Thread[Thread-1999,5,main]>)
18:44kmccool raek
18:44amalloyoh. that didn't work before. i think raek blew up more of his security
18:45gfrlog,(Thread. (partial println "haha"))
18:45clojurebot#<Thread Thread[Thread-2001,5,main]>
18:45kmcwhen you call (Thread.) with no argument like that, what thread does it actually spawn?
18:45_uliseshey all, I have a bit of an odd request: I am looking for a mentor to improve my knowledge of Clojure and functional programming (amongst other things) so if anybody is interested/up to the task, please take a look at http://pastebin.com/rn4h8Tk1 and let me know your thoughts :)
18:45Derander(Thread.)
18:45Derander,(Thread.)
18:45clojurebot#<Thread Thread[Thread-2003,5,main]>
18:45amalloythreads don't do anything until you call .start
18:45amalloyso these threads, i think, just get GCed immediately
18:46Derander,(.start (Thread.))
18:46clojurebotnil
18:46Derander,(.start (Thread. (partial println "hi")))
18:46clojurebotnil
18:47gfrlogthe println is apparently invisible either way
18:48amalloybackground threads don't have access to the terminal
18:48amalloyiirc
18:48raek,(.start (Thread. (bound-fn [] (println "hi"))))
18:48clojurebotnil
18:48raekthe *out* binding is thread-local
18:48amalloy,(doc bound-fn)
18:48clojurebot"([& fntail]); Returns a function defined by the given fntail, which will install the same bindings in effect as in the thread at the time bound-fn was called. This may be used to define a helper function which runs on a different thread, but needs the same bindings in place."
18:49raekthat's why prints in other threads don't print in the slime repl in emacs
18:49gfrlog,(.start (Thread. (.println System/out "okay")))
18:49clojurebotnil
18:49raeknew thread gets the root binding of *out*, which is System/out
18:49gfrlog,(.println System/out "then why don't they work?")
18:49clojurebotnil
18:50amalloyraek: but even in a repl println from a separate thread doesn't work
18:50gfrlogit gets blocked?
18:50raek,(let [out *out*] (.start (Thread. (binding [*out* out] (println "hi")))))
18:50clojurebothi
18:50amalloyoh, nice
18:51raekyou can also do (alter-var-root #'*out* (constantly *out*)) to set the root binding of *out* to the one in the current thread
18:51gfrlograek: is your *out* special in clojurebot, or also System/out?
18:52amalloy,(let [out *out*] (.start (Thread. (binding [*out* out] (dotimes [n 10] (. java.lang.Thread sleep 5000) (println n))))))) ; does this timeout?
18:52clojurebotExecution Timed Out
18:52raekI don't know how clojurebot is implemented, but I believe *out* is bound to a fn that sends messages over IRC
18:52raek*bound to a writer
18:53gfrlogoh, I mistakenly inferred you wrote it from some previous comment I've forgotten
18:53amalloyraek: i don't think it can be that simple, or my println would write at least once
18:53raekI write bots, but not clojurebot :)
18:53raekclojurebot is hiredman's bot
18:54amalloyclojurebot: author?
18:54clojurebotPardon?
18:54amalloyclojurebot: author is hiredman
18:54clojurebotAck. Ack.
18:54gfrlogclojurebot: Pardon?
18:54clojurebotHuh?
18:54gfrlogclojurebot: Huh?
18:54clojurebotexcusez-moi
18:54rlbAre there ways other than compile to make 1.2 startup much faster?
18:54amalloyclojurebot: source?
18:54clojurebotsource is http://github.com/hiredman/clojurebot/tree/master
18:55raekanyway, println prints to whatever is in *out*. the default root binding of *out* is System/out wrapped in a PrintWriter.
18:55amalloyclojurebot: cake?
18:55clojurebotcheesecake is delicious.
18:55amalloydamn it. he won't remember when i tell him about cake
18:55amalloyrlb: try cake
18:57raekhttp://github.com/hiredman/clojurebot/blob/master/src/hiredman/sandbox.clj#L123
19:00rlbamalloy: thanks, I know it might also be possible to use something like nailgun, but in this case I'm interested in speeding up standalone executable time.
19:01amalloyrlb, you could start the jvm in -client mode, but that won't make a very big difference. java is not a fast-startup language, and clojure is another layer on top of it
19:01gfrlogirb starts pretty fast -- maybe implement clojure in ruby
19:06rlbamalloy: right, client doesn't really help. An empty java program runs in about 0.1s here, a compiled empty clojure program, about 0.9s, so about 9x slower, and pushing a notable threshold wrt command-line interactivity.
19:07rlbI was just trying to determine if it might be feasible to use clojure for some command-line tools that needed to be fairly fast.
19:07gfrlogis the Integer constructor the preferred way to convert string to int?
19:08rlbgfrlog: that's reasonable.
19:09plathrop,(contains? [:plathrop :foo :bar] :plathrop)
19:09clojurebotfalse
19:09plathropWhat am I missing here about contains? I'd expect a true.
19:10ohpauleezplathrop: use some
19:10plathrop,(some [:plathrop :foo :bar] :plathrop)
19:10clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword
19:10ohpauleez(some #{"a"} ["a" "b" "c"])
19:10raekplathrop: contains? checks for keys. in arrays, the indicies are the keys
19:10ohpauleez,(some #{"a"} ["a" "b" "c"])
19:10clojurebot"a"
19:10ohpauleez,(some #{"d"} ["a" "b" "c"])
19:10clojurebotnil
19:11plathropraek: ah, thanks for the explanation
19:11raekplathrop: either use sets (if you check whether an element is there more that once) or 'some'
19:11raek,(contains? #{"a" "b" "c"} "a")
19:11clojurebottrue
19:12raeksets have constant time* membership tests
19:12plathropI think sets is what I want. Thanks folks!
19:13raek,[(#{"a" "b" "c"} "a") (#{"a" "b" "c"} "d")]
19:13clojurebot["a" nil]
19:13raekalso, you can use the set as a predicate directly, unless nil can appear in the set
19:33Derander1.5 hours until weekend
19:33DeranderI have never been more excited to get home and fire up emacs
19:33amalloyDerander: you need to get home to fire up emacs? they don't have ssh at your place of business?
19:33Deranderoh, I'm working in emacs on a laptop
19:34Deranderit's just that I'm not working on my own programs :-)
19:34DeranderI'm @ work right now.
19:34amalloywell, just work on them secretly
19:34Deranderthere is a thought
19:34amalloyor while your actual work "compiles"
19:34Deranderif only ruby compiled
19:35amalloyhttp://xkcd.com/303/
19:35DeranderI only get to pull that excuse when I'm installing some library
19:35Deranderthat has c extensions
19:41amalloyDerander: you could recompile ruby. the latest version is much better
19:41Deranderyeah, unfortunately I've already got 1.9.2 running :-(
19:53bmhis it possible to list two licenses in project.clj in a lein project?
19:59maravillasbmh: check out http://github.com/technomancy/leiningen/blob/master/sample.project.clj
19:59maravillasthe comment above the :license entry says :licenses is supported
19:59bmhmaravillas: I did see that, but it doesn't have a use case. If I specify more than one :name it will explode
20:02amalloybmh: i'd guess it's like: :licenses [{:name foo} {:name bar}]
20:02maravillasdid you try :licenses [{:name ...} {:name ...}] ?
20:02bmhthat sounds like a reasonable thing to try
20:02maravillaslooks like lein pom just concats :licenses, :licences, and the single :license entry
20:03maravillassingle :license and :licence entries, that is
20:04bmhhooray
20:04amalloymaravillas: haha, so you don't need to use :licenses if you have two? you can use licenses and licences
20:04amalloyer. but without any Ss
20:05maravillasyeah, seems to be aware of both spellings :)
20:05maravillashttp://github.com/technomancy/leiningen/blob/master/src/leiningen/util/maven.clj#L224
20:06bmhmaravillas: very deferential to the Commonwealth, I suppose
20:08technomancyheh; nice. (that wasn't me)
20:10maravillaslooks like michal marczyk
20:13yayitsweihas anyone deployed a clojure webapp with nginx and can give me some pointers?
20:14yayitsweior if not that, a recommendation for the simplest way to deploy a web app
20:16Raynesyayitswei: In the simplest case, a simple proxy_pass will do the trick. I've had success with this: http://gist.github.com/629193
20:16RaynesI'd stick around and help more, but I've got to take off. Good luck. <3
20:16yayitsweithanks Raynes
20:19jeff__hi all. i'm looking for some advice. what would be the most idiomatic way of processing a very long list/array of numeric data returning a result. the result itself is a bunch of different calculations, some of which are scalars and others are themselves lists. what i'm doing for now is (reduce my-function initial-state) where initial-state is a map which gets new values assoc'ed in my-funtion as appropriate. is this a good way to do
20:19jeff__this?
20:19clojurebotthis is not a bug
20:21jeff__actually, it's more like: (reduce my-function initial-state my-list-of-numeric-data)
20:40_rata_is there any problem to have a ref containing a vector of refs? (but the later aren't mutated)
20:45quotemstrHas anyone here worked with JUNG from Clojure? I want to write a program that manipulates a graph and makes a movie out of it, and Java has all the good libraries.
20:59nollidjat the slime repl, is there a way to break a running command and jump into a debugging mode?
21:00nollidji am wishing i had something like the integration gdb has with emacs, so that i can step ahead, examine the local environment, go up and down the stack, etc, within a running program
21:01nollidjis there a way to get slime to do that?
21:03bhenrynollidj: http://hugoduncan.org/post/2010/swank_clojure_gets_a_break_with_the_local_environment.xhtml
21:04quotemstrAwesome!
21:04quotemstr#!/usr/bin/clj works as expected!
21:04quotemstrIs there a performance penalty for doing that?
21:05nollidjbhenry: thanks. it's encouraging that some work is being done, but blegh. i hope this makes it into swank-clojure
21:05nollidjso, is it true that atm there is no way within just emacs/slime/swank-clojure to set a breakpoint?
21:05bhenryit is.
21:06bhenryif you're using swank clojure you should be able to put (swank.core/break) somewhere in your code
21:06nollidjthanks for the info. i'll see what debug-repl can do
21:07nollidjah, my problem is that somewhere in the program things just stall (cpu usage drops to 0%, memory allocation stops)
21:07nollidjordinarily, i'd send it a signal while running it in a debugger and step it forward to see what's going on
21:07nollidji will continue to sprinkle printlns or maybe some clojure.core/breaks
21:07bhenryoh i see. not sure how to go about that
21:07nollidjer, swank.core
21:07nollidjthanks for debug-repl, though
21:08bhenrythe article is about how that functionality from debug-repl is now in swank-clojure
21:09nollidjoh, that is good
22:26dpritchettevening
22:27mabeshello
22:30jsandacan someone show me an example of using the map fn on a map. i'm struggling a bit with how to do this
22:32dpritchettC-c M-p is supposed to load the namespace under my cursor into slime, right?
22:32mabes,(map (fn [[k v]] [(str k) (inc v)]) {:foo 12 :bar 34})
22:32clojurebot([":foo" 13] [":bar" 35])
22:33mabesjsanda: ^ destructuring the k,v is what you need to do
22:33jsandathat's what i'm struggling with
22:33jsandamabes: thx for the example
22:33jsandathat helps
22:33mabesand if you need it to be a map you can use into
22:33mabes,(into {} (map (fn [[k v]] [(str k) (inc v)]) {:foo 12 :bar 34}))
22:33clojurebot{":foo" 13, ":bar" 35}
22:37RaynesIt might be cleaner to use for if you need to destructure something: (into {} (for [[k v] {:foo 12 :bar 34}] [(str k) (inc v)]))
22:38mabesyeah, good point
22:43jsandaRaynes: that does seem a bit more intuituve
22:43jsandathx for both examples
23:09cemerickRaynes: how's life lately? :-)
23:09Raynescemerick: Fantastic. The excitement continues to build.
23:10cemerickgood, good
23:11RaynesYours? :>
23:11cemerickHectic. Ever so slightly unpleasant, but hopefully that's temporary.
23:29bhenrydpritchett: my slime repl using swank-clojure has the same highlighting as any of my clojure buffers. i didn't have to do anything special
23:29bhenryjust used emacs starter kit and elpa
23:30dpritchetti dont have the starter kit
23:30dpritchetti guess i could nuke everything and start over
23:30dpritchettbut i'll miss my toolbars
23:30rdsr,(partition 3 [1 2])
23:30clojurebot()
23:31rdsrisn't this behaviour a little wierd?
23:31mabes,(partition-all 3 [1 2])
23:31clojurebot((1 2))
23:31rdsroops I'm using the wrong fn
23:31rdsrthnks mabes :)
23:31mabesrdsr: np, I knew exactly where you were going ;)
23:32rdsrhehe
23:32_rata_dpritchett, isn't it clojure-mode what you need?
23:33dpritchettclojure-mode doesn't work with the repl... bhenry seems to be right though
23:34bhenrydpritchett, there's got to be some hook out there
23:35dpritchettit's fine, i didnt' have much in my .emacs.d folder
23:35dpritchettso i'm rebuilding it
23:35dpritchettfor the 3rd time today :)
23:35technomancyit's not in the starter kit
23:39dpritchettso technomancy do you have good highlighting in your swank repl?
23:39technomancyI do not
23:39technomancythats' how I know it's not in the starter kit =)
23:39dpritchettman
23:40bhenrydpritchett: apparently i'm retarded. i just checked and i don't either. my bad.
23:40technomancy(add-hook 'slime-repl-mode-hook 'clojure-mode-font-lock-setup) ;; there's the trick
23:40technomancymakes the prompt non-highlighted though, which is too bad
23:40technomancystill nice
23:40technomancyI should put that in the readme
23:41mabesahh, clojure-mode-font-lock-setup.. didn't think about that... I had only tried the major mode which didn't work out too well as you could imagine
23:41dbleylhello
23:41technomancywould be more complicated if you still want to use slime with CL
23:41dpritchettclojure is my only slimy language at the moment
23:41dpritchettso i add that line to the end of init.el i guess?
23:41technomancyapparently there are still some greybeards who care about that; I'll let them come up with a form that works for it.
23:41technomancyja
23:41dpritchetti just evaled it in my scratch buffer and nothing looks different
23:42technomancyyou'd have to reconnect for it to take effect
23:43Deranderit took me far too long to learn about c-m-x.
23:43Deranderfar too many keystrokes wasted moving to the end of the top level sexp and then c-x'ing
23:43dbleylIs there any way to influence the compiled java output of :gen-class? Trying to interop with a Java lib that expects a run method to be discovered thru reflection.
23:46bhenrytechnomancy: with that line my emacs loads up fine but then when i connect to swank i get an error in process filter about the font-lock part
23:47dpritchettlooking much better now thanks technomancy and bhenry
23:47bhenryokay so i guess it worked for dpritchett, so i'm wondering what i did wrong
23:48dpritchettwell i have a fresh install of the starter kit for one :D
23:48dpritchettand then i added the line phil mentioned to ~/.emacs.d/init.el at the end
23:49bhenryi added to the end of my .emacs.d/bhenry/init.el so ...
23:49bhenryhmph
23:49bhenryi guess since my brain falsely remembered having syntax highlighting in the repl it wasn't much of an issue for me to begin with