#clojure logs

2011-05-08

01:03TheMoonMasterSTM is amazing.
04:20kzarCan you perform dynamic method calls without creating a macro?
04:41thorwilkzar: do you mean somehow arriving at the name of a function as a string, then call it?
04:43kzarthorwil: Well I have my keyword :insert , I've changed it to the symbol .insert fine. But then when I call it (thing-containing-.insert object) it doesn't work. I (sort of) get why, the dot form is evaluated at compile time so I'm going about it the wrong way?
04:46thorwilno idea how the java-interop might screw you there. i mean, with foo.method, i don't know if that shouldn't be though of as one symbol
04:47thorwilguess an alternative to a macro might be eval
05:07raekkzar: (clojure.lang.Reflector/invokeInstanceMethod object "method name" (to-array [arg1 arg2 ...]))
05:13raekkzar: Also, if you do want to use a macro, it's probably easier to generate (. object method arg1 arg2 ...) rather than (.method object arg1 arg2 ...). The latter is syntactic sugar for humans.
05:17kzarraek: Ah right, actually which approach is more idiomatic?
05:18raekkzar: I would say that if you know the method name at compile time, there is no good reson to not generate (. object method ...) with a macro
05:19raekthat will be compiled into a invokevirtual JVM bytecode instruction
05:20raeka reflective call will be far mor slower, but sometimes you simply do not know class+method until at runtume
05:22kzarHmm if I'm honest I'm not sure if I do know the method name at compile time or not. I've got a bunch of actions for google calendar and for each one I have to call one of 4 methods, either .insert .update .query or .delete . So I could have a switch to say if it's type is :insert then do (.insert ....) for each of the 4 but I figured that was ugly
05:24raekkzar: so you want to be able to do someting like (foo :insert obj ...)?
05:25kzarraek: Yea pretty much I guess
05:27thorwilmy first mail to the enlive group didn't go through for 2 days, then when i mailed again, both copies arrived immediately. now a reply on the second of them send about 11 hours ago did not appear so far :/
05:27kzarraek: I think I'm just going to use a case statement on the type keyword and make it easier on myself
05:27raek(case action :insert (.insert ...), :update (.update ...), :query (.query ...), :delete (.delete ...))
05:27kzarraek: Yep exactly! I'll try and be clever another day
05:28kzarraek: You see what I mean though, it feels like you should be able to go from :insert to (.insert object ..)
05:28raekif all the cases follow exactly the same pattern, it would be quite simple to do a (actions action [:insert :update :query :delete]) macro that expands to this
05:29raekkzar: any reason you don't want four separate defns?
05:29kzarhow do you mean?
05:30raek(defn insert-fn [...] (.insert ...)) (defn update-fn [...] (.update ...)) etc
05:31kzarI guess because I've got a seq of actions and I don't know that they will all be the same type. I wanted to map over them running the same function
05:31raekkzar: how are you going to call the function that contains this case expression? always with a variable containing a unknown keyword or do you know the keyword?
05:32kzarraek: Just with a map, I could check the type of action in the mapping function though for sure
05:34raeksomething like this maybe? (def fn-map {:insert #'insert-fn, :update #'update-fn}) (map #((fn-map %1) %2) actions args)
05:35raekthis is one way that closely fits the "to go from :insert to (.insert object ..)" description
05:36raekthe case way would be fine too, I guess
05:37kzarraek: How about this, I map over the list of actions with a macro that generates the method calling code
05:39raekkzar: sounds good
05:40raekgiven that the method name is the only difference between the calls, of course
05:40kzarheh yea I'm hoping it is, if it turns out that's not the case I'll go back to using a function with a case statement me-thinks!
05:44kzarraek: Thanks for the ideas anyway, that was a puzzler
11:12bartjer, anyone with a machine learning background here ?
11:22jamesswifthey folks. question for those who have written some web apps in clojure. preferably with ring etc.
11:25jamesswiftI am running my app with jetty as usual and then reverse proxying with apache. but was wondering what is the best strategy for dealing with the fact that the absolute path can be changed. issues include adjusting the routes (currently I do (str *prefix* "/my-route") and also I'm using enlive for templating, this brings problems where I need to reference css and js files. Usually one would keep a common css file in something like
11:25jamesswift"/css/"
11:28jamesswiftSo basically just wondering what solutions others have come up with to make this painless?
11:33gfrlogjamesswift: your *prefix* is the path with hostname?
11:34gfrlog(I just arrived, so I'm reading your comments from http://clojure-log.n01se.net/ and might be missing some)
11:38jamesswiftgfrlog: i wrote a little wrapper which checks the incoming request to see if it's being x-forwarded and if so use binding to change *prefix* to the reverse proxy path I've set up in apache. if it's not being forwarded it remains an empty string.
11:39jamesswiftgfrlog: all the comments are there. i probably should expand on the issue a bit.
11:40jamesswiftgfrlog: i actually made a mistake in describing, sorry. apache reverse proxies don't change the uri so i don't change the route but i do have to change and redirects. so the *prefix* is only prepended to redirect URIs and not routes as I mentioned before.
11:41jamesswiftgfrlog: i'll write up a code sample and pastebin it. back in 5 mins
11:41gfrlogjamesswift: apache is adding a prefix to your path? like a sub-uri?
11:47jamesswiftgfrlog: Here is an example https://gist.github.com/46bd4b12e078864ccae0
11:48gfrlogI think if you have to have a path prefix, that might be essentially how to handle it. The only way I can think of to make it nicer is to create a url function so you aren't repeating (str *prefix* ...) everywhere.
11:48jamesswiftgfrlog: I'm using mod_proxy so that I have my clojure app hosted at http://examplecom/some-virt-path but really it's running on localhost:8080 for example so Apache reverse proxies /some-virt-path to localhost:8080 without changing the uri path in the headers
11:49gfrlogwhen I was doing rails I started using subdomains instead of sub-URI's precisely in order to avoid this headache
11:50gfrlogsubdomains are transparent since you don't have to include them in the links etc.
11:50jamesswiftgfrlog: yeah that's the only strategy I can think of too. pity. the main headache comes with having to rewrite urls in the template pages that reference common stuff like css.
11:51jamesswiftgfrlog: the apache docs do mention a third party mod which can rewrite urls in the response html but that feels wrong
11:51gfrlogjamesswift: I usually find myself creating a helper function for writing urls anyhow, so if you're used to that it's not that bad
11:51gfrlogjamesswift: I agree that's ugly
11:53jamesswiftgfrlog: i suspect a rule at the top of every enlive template that matches all href and src values starting with '/' might be the simplest solution right now.
11:53gfrlogjamesswift: I use the helper function for when some resource's ID is going into the url, so I'm not messing with (str) or (format)
11:53jamesswiftgfrlog: makes sense
13:13dnolenfascinating GHC 7 uses constraint solving for type inference, http://research.microsoft.com/en-us/um/people/simonpj/papers/constraints/index.htm, CHR lead co-wrote the paper.
14:31fliebeldnolen: oh, nice, so Haskel is an example of these 'al la carte' type systems?
14:33dnolenfliebel: no.
14:33fliebeldnolen: Okay, then what is the type system about?
14:34dnolenfliebel: the paper is how generalized let creates problems for type inference and their new (even controversial) approach, it's a big break from HM style type-inference.
14:43dnolenfliebel: it's yet another reason I would like to see an efficient constraint solver implementation added to core.logic. interestingly enough, efficient predicate dispatch might be useful here...
14:44fliebeli see…
14:44Ramblurris there a function that is the opposite of 'take', i.e, get the _last_ n items in a coll?
14:45Ramblurrsomething like (drop (- (count coll) n)) coll)
14:45kzarRamblurr: might be a better way but you could reverse it and then take the n items
14:45Ramblurroh jebus, there is a take-last
14:46kzarah cool, didn't know that :)
14:46dnolenfliebel: maybe next year Clojure will have state-of-the-art optional static typing ...
14:46Ramblurrkzar: yea, found it via clojuredocs.org's "See Other" feature
14:47fliebelthat'd be awesome, but how deep do you need to dig into clojure for that? or is it just a lot of typehints?
14:49dnolenfliebel: would need some kind of hook into data produced by the compiler, but it would be a very loose coupling.
14:49fliebelS I guess that's "waiting on the new compiler", together with some other cool stuff.
15:14fliebelWhy does if-let not support multiple bindings? So that all bindings have an 'and' relation, with 'or' still being usable to let the first truthy case. (if-let [x true y (or false true)] [x y]) > true true
15:39KineticShampooHello
15:39odyssomayhello
16:30KineticShampooCan someone explain what a 'higher order function' is in layman terms?
16:30KineticShampooI found the term while searching for college assignments on Clojure to practice on.
16:30KineticShampoohttp://www.cis.upenn.edu/~matuszek/cis554-2010/Assignments/clojure-01-exercises.html
16:31KineticShampooie "You don't need higher order functions"
16:31Thorna function which acts on functions
16:31kzarKineticShampoo: It's a function that takes functions as arguments or returns functions
16:32fliebel&(partial + 1)
16:32sexpbot⟹ #<core$partial$fn__3678 clojure.core$partial$fn__3678@27291d>
16:32KineticShampookzar: Thanks! That's a simple explanation. :) So the function uses the returns values of another function, correct?
16:32fliebelIn this case, partial takes a function, and returns a new function with the supplied args already provided.
16:33fliebel&((partial + 1) 1)
16:33sexpbot⟹ 2
16:33kzar(defn example [f num] (f num 10)) (example * 5) = 50 (example + 5) = 15
16:34kzarKineticShampoo: Yea it's all dead handy, partial is great too
16:35ThornKineticShampoo: not just one that uses return values of another function. that would make most every C function higher order lol
16:35fliebelIt's these kind of things that help writing a DSL, macros are pretty meh for most things ;)
16:35ThornKineticShampoo: (defn f [a] (a 3 4)) (f +) ; takes a function (+) as an argument and applies it to 3 and 4
16:39Thornor: (defn make-adder [b] (fn [a] (+ a b))) ((make-adder 3) 7)
16:43KineticShampooWhen I first tried Clojure on a VM I used Eclipse and I remember it having a plugin that I assume automatically installed everything for me.
16:43KineticShampooNow I installed Ubuntu 11.04 and want to use Geany as my editor. So without Eclipse, how can I install Clojure? Googling has lead me to believe that the only way is to git pull from the repo on github.
16:44maaclThis https://gist.github.com/961679 solves http://www.4clojure.com/problem/62 at my REPL but 4clojure claims wrong no. of args to comp - any ideas?
16:44pdk`you just need to have the two jars for clojure and clojure-contrib
16:45pdk`have them in your classpath and you're golden
16:45fliebelKineticShampoo: Have a look at Leiningen too
16:45KineticShampooIs this the standard way?
16:46fliebelMost people use lein or cake. managing the classpath and jars yourself is uncool imo.
16:47Thornmaven it standard in the java world, but it downloads half of the internet on the first run
16:48fliebelAnd a tenth of the internet on each subsequent run
16:49Thorn*is
16:55fliebelWhy does if-let let into a temp var and then in the truth case into the real var? Does it hurt anyone to let it right away?
16:56fliebelwhen-let is even weirder, since there is no false case.
16:58kzarI have (:import [java.net URL]) in my ns declaration and it was working fine until I had to restart my Clojure process. It's giving me "Unable to resolve clasname: URL" now though :o any ideas?
17:05maaclHas previous versions of Clojure had issues with (apply comp '()) ?
17:08fliebel&(comp)
17:08sexpbotjava.lang.IllegalArgumentException: Wrong number of args (0) passed to: core$comp
17:09fliebelmaacl: What issues?
17:09maacl&(apply comp '())
17:09sexpbotjava.lang.IllegalArgumentException: Wrong number of args (0) passed to: core$comp
17:10fliebel&(apply comp identity '()) ; this *might* be what you want
17:10sexpbot⟹ #<core$identity clojure.core$identity@1c22e0d>
17:11maaclIt evals fine at my REPL using 1.3.0-alpha5
17:11fliebelmaacl: What does it do?
17:12fliebelOh, i see, just what I just typed.
17:12fliebelit returns identity
17:12maaclyes
17:12brehaut,()
17:12clojurebot()
17:13brehautfliebel: you dont need to quote the empty list
17:13fliebelbrehaut: Oh, nice to know :)
17:13brehauti keep forgetting too :)
17:13maaclSo the behavior must have changed at some point?
17:14fliebelmaacl: yes, it must, unless we got all rolled up in a time continuum.
17:14fliebelBut my identity hack works around it, if you must support both.
17:14maaclfliebel: well, you never know
17:15maaclfliebel: yes, thanks
17:25KineticShampoohm.
17:29gfrlogKineticShampoo: yep.
17:33ekoontzhey, question about mapcat..
17:33ekoontzhttps://gist.github.com/961694
17:34ekoontzhow would i do that if i wanted to pass an additional param to cook-kids
17:37tomojmapcat is just like map in that way ##(mapcat #(list %1 %2) [1 2 3] [4 5 6])
17:37sexpbot⟹ (1 4 2 5 3 6)
17:37ekoontz##(mapcat #(list %1 %2) [1 2 3] [4 5 6])
17:37sexpbot⟹ (1 4 2 5 3 6)
17:37ekoontzthanks a lot tomoj :)
17:37ekoontzmakes sense..the googles they did nothing
17:39ekoontz*cool-kids not cook-kids lol
17:40KineticShampoo##mapcat #(list %1 %2) [1 2 3] [4 5] [6] [7 8 9])
17:40KineticShampoo##mapcat #(list %1 %2 %3 %4) [1 2 3] [4 5] [6] [7 8 9])
17:41ekoontzthanks KineticShampoo
17:43tomojof course #(list %1 %2) is a bit silly
17:43brehautekoontz: also if you are using mapcat it may be that for would be cleaner
17:44ekoontzbrehaut: i see, thanks, tho it took me a while to parse your sentence :)
17:45brehautekoontz: sorry about that, i should have quoted the funs. i cant get to your gist at the moment so i dont know if its relevant, but 'for' is list comprehensions, which is just sugar over the list monad and mapcat is bind in the list monad
17:46ekoontzi am still strugging with the clojure syntax
17:46ekoontzuse to (mapcar #'(lambda(x) ...)
17:46ekoontz*used
17:47tomojwas your example just for playing around with mapcat?
17:48ekoontzyeah let me try pastebin
17:49ekoontzsorry having pastebin problems too lol
17:49brehautmy internet is just extremely slow ATM
17:49brehauti cant get to anything ;)
17:49ekoontzhttp://pastebin.com/FGAaq1uc
17:49ekoontzare we in the same cafe? ;)
17:51tomojexample seems strange for mapcat
17:52raekekoontz: #' means something else in clojure. functions and variables share the same namespace.
17:53ekoontzthere's no #'lambda i guess right
17:53raekjust use fn
17:53raek,(map (fn [x] (inc x)) [1 2 3])
17:53clojurebot(2 3 4)
17:53brehautekoontz: heres the correspondence: (for [a (range 3) b [:a :c]] [a b]) => (m-bind (range 3) (fn [a] (m-bind [:a :c] (fn [b] (m-return [a b]))))) => (mapcat (fn [a] (mapcat (fn [b] [[a b]]) [:a :c])) (range 3))
17:53raek,(map inc [1 2 3])
17:53clojurebot(2 3 4)
17:54brehaut(m-bind and mapcat take their args in reverse order)
17:54ekoontzthanks raek
17:54ekoontzok..that makse sense
17:54ekoontzmakes*
17:55raekekoontz: your cool-kids example can also be written as (for [kid '(kurt bob tony), :when (= kid 'kurt)] kid)
17:55brehautekoontz: the middle form is very slightly pseudocode; it makes use of forms from the clojure.contrib.monads library
17:55tomojbut why?
17:56ekoontzbrehaut: the middle form..?
17:57brehautin the big block of nonsense i pasted above
17:57ekoontzlike..never heard of (m-bind) before..
17:59brehautekoontz: thats 'just' monads stuff; im only using it to demonstrate the corrospondence; mapcat is fairly rare in clojure code because for is cleaner
17:59brehaut(most of the time)
17:59brehautekoontz: m-bind is a abstraction over function application
17:59ekoontzthe word 'monads' scares me
17:59brehautyeesh s/is a/is just an/
18:00tomojekoontz: so would you use mapcat or for to do exactly what your example does?
18:00ekoontzi keep hearing about it and still don't understanding it
18:00ekoontzi would use mapcat personally
18:00tomoj(that's a yes/no, not a mapcat/for question)
18:00ekoontzmaybe because i don't know (for)
18:01tomojhow about ##(filter '#{kurt} '[kurt bob tony])
18:01sexpbot⟹ (kurt)
18:01tomojI don't know whether the example was contrived for mapcat or whether that way was unknown
18:01ekoontzhaven't heard of (filter) either
18:01ekoontzbut it seems very intuitive :)
18:02ekoontzwell i want to pass another param to the filtering function
18:04gfrlogekoontz: you want to pass the first param or the second?
18:35gfrlog$findfn [7,8,9,10] 9 2
18:35sexpbot[]
18:35gfrlog$findfn 9 [7,8,9,10] 2
18:35sexpbot[]
18:36gfrlog:-|
18:48gfrlog$findfn [4,5,6] 5
18:48sexpbot[clojure.core/second clojure.core/fnext]
20:22sritchiehey all -- is it possible class call some method other than -main inside of a namespace, when running java -jar my-standalone.jar my.ns arg1 arg2
20:23sritchiejava -jar my-standalone.jar my.ns method-name arg1 arg2, for example/
20:25tomojI don't think so, but you can have -main decide to call other functions
20:26tomoj`man java` says it looks for public static void main(String[] args) and that's it
20:30sritchietomoj: that makes sense, I could get the same behavior by using the first argument as input to case
20:31sritchiethanks
20:32tomojguess the problem is if you want to support passing a method-name and not, how do you tell whether it's method-name or arg1?
20:35gfrloghis default case would decide that it's arg1?
20:40tomojsure, but if you ever want to pass an arg1 that happens to have the same name as some function in the namespace..
20:40gfrlogno way out of that
21:28KineticShampooFINALLY!
21:29KineticShampooFinished this project tasks I had with my school software.
21:29KineticShampooNow I can focus on some Clojure. Problem is I don't really know what to make with the language. Any beginner exercises you would recommend? Something to get me thinking in Clojure?
21:29gfrlogman some folk just set up a site for exactly that
21:29gfrlogit probably had a catchy name too
21:30gfrlogone sec I can find it...
21:30KineticShampooGoogle?
21:30gfrlogwouldn't know what to google for
21:30KineticShampooIf you say Google I'll slap you. No matter how many proxies you're behind.
21:30gfrlog4clojure
21:30KineticShampoo:D
21:30KineticShampooOh yeah, that's Raynes site.
21:30gfrlogright
21:31gfrlognot what you're looking for?
21:31KineticShampooI used it, but while I can solve some of the problems I don't feel I'm learning; if that makes sense.
21:31gfrlogokay -- project euler then?
21:31gfrlogunless you hate math
21:31KineticShampooI'm looking for a concrete assignment. The type you would get during first or second year Uni. (Yes I hate math! :D)
21:32KineticShampooIs there something like Codingbat, but for Clojure?
21:32gfrlogI'm out of ideas. Best I can offer at this point is to think up something for you myself :)
21:33KineticShampooShoot for it. :)
21:33KineticShampooBetter yet, what book do you recommend for someone new?
21:33gfrlogokay. Write a web app that will make millions of dollars simply by virtue of the fact that it is deployed at the domain lolwaffle.com. I'll contribute the domain name and we can split the profits.
21:34KineticShampooCan I use a visual basic gooey?
21:34TheMoonMasterWoah woah waoh, we aren't tracking IP's
21:34gfrloghuh?
21:34tomoj:D
21:35TheMoonMasterhttp://www.youtube.com/watch?v=hkDD03yeLnU
21:35gfrlogoh wait right
21:35gfrlogI should've caught that
21:36gfrlogKineticShampoo: my estimate is that the total number of clojure books is between two and three, inclusive.
21:36TheMoonMasterMacros are odd
21:36gfrlogTheMoonMaster: yep
21:36KineticShampooLOL
21:36TheMoonMasterKineticShampoo: I'm reading Programming Clojure
21:36KineticShampooSeriously? Only two books!?
21:36gfrlogKineticShampoo: I've only read one of them.
21:37TheMoonMasterhttp://pragprog.com/titles/shcloj/programming-clojure
21:37gfrlogKineticShampoo: ^ that was the one I read
21:37TheMoonMasterThat is the only good one I know of.
21:37gfrlogit was like two years ago. I liked it.
21:38KineticShampooI wish Raynes would hurry up with his book. It has a kiddie cover, it seems to be a good fit for newbies. Hehehehe
21:38TheMoonMasterIn the beginning it does fairly well teaching the concepts, but at concurrency and macros it starts to fall behind imo.
21:39gfrlogTheMoonMaster: it sure taught me to avoid macros :)
21:39TheMoonMastergfrlog: Yeah, prevent the whole, what the hell did I just code mentality...
21:39gfrlogI think only in the last six months or so have I started using macros goodly
21:39tomojgoodly! <3
21:39TheMoonMasterI really don't have much to program due to lack of creativity in that field, but clojure is nice so far.
21:40TheMoonMasterI mostly do web development, and unfortunately I don't like clojure for web stuff as much as I like Ruby for it.
21:40gfrlogTheMoonMaster: help KineticShampoo and you two can split his half of the million
21:40TheMoonMastergfrlog: Sorry, but it would end up being made in rails.
21:41gfrlogbut OOP is so sticky
21:41tomojmaybe the frontend
21:41TheMoonMasterRuby OOP is nice.
21:41tomojyou want to write the entire backend in rails too? are you doing anything interesting? :)
21:41KineticShampooDoes Clojure have classes? Or just lists and maps?
21:41gfrlogKineticShampoo: it has some differenter things. It also has the plain java classes if you need them for something awkward
21:42tomojoh, I didn't read the backlog, you don't have to do anything interesting with that domain name
21:42gfrlogtomoj: what do I need to do then, just add adsense?
21:42TheMoonMasterHaha, I can't thing of anything to do with lolwaffle.com
21:43tomojI dunno, it was your idea?
21:43gfrlogas best I can tell
21:45gfrlogKineticShampoo: now that I think about it, there are probably like six or eight different parts of clojure that could be given as an answer to that question, depending on what you mean by "classes"
21:46KineticShampooI mean them in the traditional POJO/POCO class context.
21:47gfrlogas I understand it, the clojure complaint about Java OOP is that it's a pile of different concepts mashed together when you'd prefer to have them separately and take only what you need
21:47gfrlogso for example some java classes (Utils?) are just collections of related methods. That's what clojure namespaces do
21:48RaynesKineticShampoo: Man, I wish I'd hurry up with my book more than you do.
21:48gfrlogif I were good at explaining this stuff, I would go on to list several other concepts. But it is too humid.
21:49KineticShampooRaynes get to it! Stop trolling around the F# forums.
21:49gfrlogRaynes: I wish for more wishes
21:49TheMoonMasterJust saying, I hate macros right now.
21:50RaynesI've been trolling F# forums? :o
21:50gfrlogTheMoonMaster: what're you doing?
21:50tomojI really like clojure's not having arbitrary object hierarchies built up between me and the data because I almost always know how to just get the damn data
21:50ClintegerRaynes you’re not done with that yet? D:
21:50RaynesI sure wish somebody would have told me this.
21:50TheMoonMastergfrlog: Reading the macros chapter, wrapping my head around this isn't easy.
21:50RaynesClinteger: Man, it takes time to write a book.
21:50Clintegerit’s ok :p i’m only joking, you’re busier than me and i’d still be writing chapter 1 :)
21:50gfrlogTheMoonMaster: oh. well then. Let me try putting it this way.
21:51KineticShampooFree copies for DIC members with over 500 karma? :D
21:51gfrlogTheMoonMaster: a macro is a function that takes code and messes with it and outputs some other code
21:51KineticShampoo*wink wink nudge nudge*
21:51TheMoonMasterYeah, I get that much
21:52RaynesKineticShampoo: Not a chance. I'll probably give away a few copies with some sort of contest though.
21:52gfrlogTheMoonMaster: okay. Well then, I already understand macros, so why on earth does that not lead directly to you understanding them?
21:52TheMoonMasterlol
21:52gfrlogTheMoonMaster: it seems so easy!!!
21:53TheMoonMasterHaha, this book just doesn't teach it in a way I understand easily I suppose.
21:53TheMoonMasterI'll get it eventually.
21:54gfrlog(defmacro with-clojure [& forms] `(do ~@forms))
21:54TheMoonMasterI do like the way Clojure does java integration though, that is pretty sweet.
21:55TheMoonMasterI have no idea what `(do ~@forms) even does
21:56gfrlogit does something like (cons 'do forms)
21:56TheMoonMasterI don't understand what `do does either.
21:57TheMoonMasterSorry, I am super new to clojure
21:58gfrlogthat's funny cause 'super' and 'new' are both keywords in Java
21:58TheMoonMasterOhhhhhh, so the ` quotes the whole thing, and the ~ evaluates that and doesn't quote it!
21:58TheMoonMasterHaha, to be honest I really don't do much JAva
21:59TheMoonMasterI did Java for like a week last year for my AP CS exam in high school.
21:59gfrlogTheMoonMaster: yeah basically. There's an obvious and a subtle difference between ' and `
22:00gfrlogby which I mean not that the difference is both subtle and obvious, but that there are two differences, and one is subtle and the other is obvious
22:00TheMoonMasterHaha yeah
22:00gfrlogand the fact that they are two different characters is not either of them
22:01gfrlogthe obvious difference is that ` allows unquoting, which you just observed
22:01gfrlogthe subtle one has to do with qualifying symbols, and I refuse to elaborate due to cognitive limitations
22:01TheMoonMasterlol alright
22:02gfrlog` is used most often in macros because unquoting is so convenient
22:02gfrlogbut you can use it anywhere
22:02gfrlog,`(I have ~(+ 3 4) piles of functions)
22:02clojurebot(sandbox/I sandbox/have 7 sandbox/piles sandbox/of sandbox/functions)
22:02TheMoonMasterIdiomatically do you use ` much outside of macros?
22:02gfrlogI don't think I ever have
22:03gfrlognor seen it
22:03TheMoonMasterDidn't think so.
22:03gfrlogprobably because of that obnoxious subtle difference that clojurebot just exhibited
22:03TheMoonMasterlol
22:04amalloyi use ` in functions when the functions are helper functions used by macros
22:04gfrlogamalloy: I'm trying to write some code to convert clojure functions to point-free versions. Does that sound stupid or awesome or like something that already exists?
22:04TheMoonMasteramalloy: I can see how that makes sense.
22:04amalloybecause you don't (usually) break macros up into N smaller macros, you break them up into N functions and one master macro
22:05amalloy$google amalloy macro writing macros
22:05sexpbotFirst out of 38 results is: Clojure: macro-writing macros
22:05sexpbothttp://hubpages.com/hub/Clojure-macro-writing-macros
22:05amalloyTheMoonMaster: ^ is my blog entry on it
22:05gfrlog$google amalloy babies having babies
22:05sexpbotFirst out of 86 results is: Dr. Stephen A. Malloy
22:05sexpbothttp://www.rootsweb.ancestry.com/~ncccha/biographies/stephenamalloy/stephenamalloy.html
22:05gfrlogwell that's enlightening
22:05TheMoonMasterDefinitely bookmarking your site
22:05amalloywth
22:06gfrlogsorry, I'm apparently in a strange mood tonight
22:07gfrloghmm. that is a rather strange search result.
22:08TheMoonMasterlol
22:08TheMoonMasterSo are clojure agents similar to Scala actors?
22:09gfrlogare scala actors similar to those erlang things?
22:09TheMoonMasterYeah
22:09gfrlogokay. then I think the answer is no
22:09gfrlogbut it might be yes
22:09TheMoonMasterAlright, I'll do some research, just curious if anyone had a fast answer.
22:10brehautTheMoonMaster: typically actors define their operations internally (based on some sort of data message) whereas agents hold data and have the operations defined externally (as some sort of behavioural message)
22:10TheMoonMasterbrehaut: Thanks for the clarification
22:11brehautTheMoonMaster: clojure's agents also use a thread pool for executing on by default where as (at least conceptually in erlang) the agents have their own thread or process (typically lightweight)
22:13TheMoonMasterMakes sense, might be a jvm limitation
22:13brehautits a design decision; agents and actors fullfil quite different design roles
22:15TheMoonMasterI suppose that is due to the functional nature of clojure
22:15brehautnot really
22:15TheMoonMasterOh, I'm super new to functional programming beyond map reduce and filter
22:15amalloyTheMoonMaster: you are making a lot of statements of the form "i assume X" but have stated you don't know a lot about the domain. probably best to keep those crazy ideas to yourself for a while
22:15amalloyor at least ask about them rather than state them
22:16TheMoonMasteramalloy: Sorry about that, I'll keep that in mind
22:46KineticShampooDo you guys use the counterclockwise plugin for eclipse?
22:46tomojTheMoonMaster: I was a rubyist at your age ;)
22:46tomojtook me some years after to find clojure though, you've got a head start on me
22:47TheMoonMastertomoj: Oh yeah? I find a lot of similarities in the philosophies between ruby and clojure. I am really loving it so far.
22:47amalloyKineticShampoo: some do
22:47amalloymost use emacs
22:47TheMoonMasterKineticShampoo: I use vim, it's nice with vimclojure
22:48TheMoonMastertomoj: Do you use Ruby anymore? Or have you switched to using mostly clojure or some other language?
22:49tomojif I have a choice I use clojure, ruby only for chef, python and php because people pay me
22:50TheMoonMasterHaha, I use PHP because people pay me.
22:50tomojsucks eh?
22:50TheMoonMasterYeah, I am used to it though, it was my first language.
22:51tomojmine too I suppose, but that only reinforces my disgust. plus I had a good 4 years or so without ever having to look at it
22:52TheMoonMasterAfter I understood programming concepts and whatnot I kinda ditched PHP to learn other languages, then a about 3/4 years later I had to reunite with PHP.
22:55amalloyphp is my most-recent language. it's not a happy language
22:55TheMoonMasterHaha, most certainly not.
22:55TheMoonMasterWhenever I can I try to use CodeIgniter to ease the pain
22:56TheMoonMasterAnd other times I am tortured by the horrible creation called wordpress plugins
22:56TheMoonMasterWriting those is the most annoying thing I have ever done programming wise.
23:01carllercheamalloy: eh, why did you learn PHP?
23:02amalloycarllerche: job
23:02carllercheamalloy: are you in SF?
23:02amalloyfor now
23:02carllercheyou should let me buy you a beer sometime for all the help :)
23:22tomojTheMoonMaster: have you written any drupal modules?
23:22TheMoonMastertomoj: Have not, never been a fan of drupal
23:24tomojtry never to :)
23:25TheMoonMastertomoj: I think the rule of thumb is try to avoid PHP altogether. lol
23:36zrilakI've just been reminded of the difference between "evaluate" and "yield" by this block of code: (if-let [foo (...)] (handle normally) (throw (RuntimeException. (...)) What is the Clojure way to fire an exception in this case?
23:37zrilakDo I just split it into (let [...] (if ...)) ?
23:38amalloyzrilak: huh? that code looks fine; perhaps you can clarify what you want?
23:38zrilakamalloy: if-let does not evaluate the "else" form; I want the exception to be thrown at the time when "if-let" is evaluated, not lazily
23:39zrilakor am I horribly misunderstanding something?
23:39amalloyhaha that apparently confused me so much i /parted
23:40zrilakI assumed you hit C-k in the wrong frame
23:40amalloy&(if-let [x nil] (prn x) (throw (Exception. "OMG x is false")))
23:40sexpbotjava.lang.Exception: OMG x is false
23:40amalloyzrilak: it already does what you want, is what i am getting at
23:40zrilakhrm, gotcha
23:40zrilakthen it's obviously the "me not digging things right" case :)
23:40amalloyor, at any rate, what you are saying you want. it's never safe to assuming those are the same thing :)
23:40zrilakthanks
23:40zrilaktrue, true
23:41zrilakbut again, your patience is limitless. Thanks :)
23:45TheMoonMasterAnyone see/use clojure atlas?
23:46zrilakI tried it, it's nifty, if a bit buggy
23:46TheMoonMasterYeah, it does seem a bit buggy
23:47TheMoonMasterI don't think that was the best way to implement an API browser.
23:47TheMoonMasterBut it was awesome
23:47zrilakProbably not, but it's good that people are experimenting with paradigms
23:47TheMoonMasterYeah, it was an interesting concept
23:52zrilakI haven't had so much fun learning a new language since Oberon
23:53TheMoonMasterHaha, it feels almost like another ruby to me.
23:53TheMoonMasterWhich is a good thing
23:54zrilakit's driving me crazy, though, I *know* there are macros and functions that can cut down my code and increase readability, but I just can't bring myself to stop typing and start reading, until I hit a hitch.
23:55zrilakI like to evaluate docs lazily
23:56TheMoonMasterlol, I'm just trying to take it slow and understand clojure.
23:56tomojcemerick made it?
23:56tomojatlas, I mean
23:56tomojor coincidentally someone else named chas?
23:57amalloytomoj: cemerick
23:57tomojnow I feel bad for clicking "I don't want to buy"
23:58zrilakbuy the book instead :)
23:58tomojwhich one?
23:58zrilakhttp://www.amazon.com/Clojure-Programming-Chas-Emerick/dp/1449394701
23:59TheMoonMasterI am definitely getting that when it's released.
23:59zrilakthough I've ordered "The Joy of Closure", seems denser