2009-04-19
| 01:21 | ChrisF___ | i'm kindof curious who's sneaking it into the corporate enviro? |
| 01:22 | ChrisF___ | i'll be perfectly honest....unless we have different sufrface syntax on it, its a no go...for everybody |
| 01:22 | hiredman | uh |
| 01:23 | hiredman | well, thats just like, you're opinion, man... |
| 01:23 | ChrisF___ | uhh....yeah, we can dick around with as computer geeks, but it will never go for anybody in the corporate enviro |
| 01:23 | ChrisF___ | hiredman: dude, nobody will ever do s-expression |
| 01:24 | dreish | http://www.mail-archive.com/clojure@googlegroups.com/msg12271.html |
| 01:24 | ChrisF___ | it's hard enough to be dynamic...but to do s-expressions is a non-starter |
| 01:24 | dreish | ChrisF___: You're babbling. |
| 01:24 | ChrisF___ | just aanother geek language |
| 01:25 | hiredman | http://www.flickr.com/photos/gnuvince/2944227285/ |
| 01:25 | ChrisF___ | ChrisF___: yes, i'll take that as i agree |
| 01:25 | Cark | haha nice one hiredman |
| 01:25 | Cark | olegs pointer made me laugh |
| 01:25 | hiredman | it's gnuvince's |
| 01:25 | ChrisF___ | have fun dorks, you have no choice in the corporate environemant |
| 01:25 | hiredman | just repasting |
| 01:26 | ChrisF___ | you're like jrugy |
| 01:26 | ChrisF___ | jruby |
| 01:26 | ChrisF___ | oops |
| 01:26 | hiredman | ChrisF___, you ever read any discworld books? |
| 01:26 | ChrisF___ | hiredman: don't worry, you'll never be a PHB |
| 01:27 | hiredman | ChrisF___, in the mythos of the discworld trolls, it is believed that living creates are actually living backwards through time |
| 01:27 | ChrisF___ | so go have fun dicking around with shit that nobody will never use |
| 01:27 | dreish | ChrisF___: Good grief, can you even read? |
| 01:27 | ChrisF___ | rich probably understands that...he just wants to be able hack himself |
| 01:28 | ChrisF___ | he didn't think dweebs would follow |
| 01:28 | hiredman | ChrisF___, it is an interesting idea, and one that would not typically show up in a cultural myth |
| 01:28 | hiredman | ChrisF___, because it is sort of a distinction without a difference |
| 01:28 | ChrisF___ | yes, we will get scala |
| 01:28 | ChrisF___ | before some idiocy that insisits on s-expressions |
| 01:29 | hiredman | ChrisF___, but I think it is used to sort of engender a feeling of hidden depths in the troll culture |
| 01:29 | dreish | There's also http://www.mail-archive.com/clojure@googlegroups.com/msg11977.html |
| 01:29 | ChrisF___ | ahh, yes....i can't believe you brought up the troll word before this time |
| 01:29 | dreish | Two substantial production deployments before the language is even at 1.0, before there is even a single book out. |
| 01:29 | ChrisF___ | it took you this long? yes, you're just weak and had to weave it in |
| 01:30 | ChrisF___ | yes we have many substantial dork deployments of jruby and jpython |
| 01:30 | hiredman | ChrisF___, so you've read the books? |
| 01:30 | ChrisF___ | hiredman: why are you losing? |
| 01:31 | ChrisF___ | no wonder i never hire java dorks |
| 01:31 | ChrisF___ | thank god for a real modern language like C# 3.0 |
| 01:32 | ChrisF___ | have fun idiots...once you put a python-like surface syntax on your toy, then we can talk |
| 01:35 | cp2 | hrmf. |
| 01:35 | cp2 | reminds me of this quote: |
| 01:35 | cp2 | shut the hell up i aint a no lifer nerd like u... |
| 01:37 | hiredman | it would be depressing if that became a regular occurrence here |
| 01:45 | replaca | Oh looks like I missed some fun |
| 01:46 | replaca | Poor ChrisF___ has to work in a fabric covered box all day |
| 01:46 | replaca | and assumes that everyone shares that aspiration :-) |
| 01:55 | cp2 | hm, JNA is so much more appealing than JNI |
| 01:56 | cp2 | although they have different purposes i suppose |
| 01:56 | cp2 | however, using JNI for what JNA does is what i mean |
| 09:07 | emacsen | pjb3, hey |
| 09:07 | emacsen | ping again |
| 09:07 | pjb3 | emacsen: hey |
| 09:07 | emacsen | so I saw your mail. You want JSON as the internernal data structure? |
| 09:07 | emacsen | internal that is |
| 09:08 | pjb3 | emacsen: No, internally would be clojure data structures |
| 09:08 | pjb3 | Just use JSON to define the "tubes" |
| 09:08 | emacsen | okay, we need to all work on a common set of vocabulary |
| 09:08 | emacsen | maybe we should do that at the mtg |
| 09:09 | emacsen | can you use it in a sentence? ;) |
| 09:10 | pjb3 | What Luke has in the file test.tube (haha), I would make test.json |
| 09:12 | emacsen | oh gotcha |
| 09:28 | emacsen | dliebke, hi |
| 09:28 | emacsen | are you a member of the study group? |
| 09:34 | dliebke | emacsen, do you mean the d.c. study group? |
| 09:34 | emacsen | yeah |
| 09:34 | dliebke | no, I just learned about it a couple days ago |
| 09:35 | emacsen | about clj or the study group? |
| 09:35 | dliebke | the study group |
| 09:35 | emacsen | ah |
| 09:35 | emacsen | well do you know clj well? |
| 09:36 | dliebke | I've been programming with it a lot the last few months |
| 09:36 | emacsen | ah cool |
| 09:36 | emacsen | well, if you'd like to work on a side project, we're starting one :) |
| 09:37 | dliebke | sounds cool, but I've got a side project that has been consuming all my time already :) |
| 09:37 | emacsen | fair nuff |
| 09:38 | emacsen | dliebke, so to be a total shill, do you know it's at HacDC? :) |
| 09:40 | dliebke | emacsen, HacDC? |
| 09:40 | emacsen | http://www.washingtonpost.com/wp-dyn/content/article/2009/04/18/AR2009041800112.html |
| 09:40 | emacsen | DC's hackerspace |
| 09:42 | dliebke | very cool, thanks for the article link |
| 09:42 | emacsen | no problem |
| 09:50 | emacsen | wow another DC person |
| 09:50 | emacsen | I think we need to convince rhickey to move down here |
| 09:51 | emacsen | marklar, do you know about the DC Clojure study group? |
| 10:09 | marklar | emacsen: yes, it popped up in a google search a few weeks back |
| 10:09 | marklar | I couldn't make the one on the 4th though |
| 10:11 | emacsen | you know we're doing one today |
| 10:12 | marklar | no I didn't... what is the website again? |
| 10:13 | marklar | nevermind, I found the google group. I won't be able to make it today either, I would like to come to one though |
| 10:14 | emacsen | k |
| 13:59 | unlink | I put /usr/share/java/commons-codec.jar on my classpath via "java -cp /usr/share/java/commons-codec.jar -jar clojure.jar", yet I am unable to (:import org.apache.commons.codec.binary.Base64). What might be the problem? |
| 14:05 | dreish | Can't use -cp and -jar together. |
| 14:13 | unlink | dreish: Oh, heh. You're right. Thanks. |
| 14:16 | unlink | Is there a smarter way of starting clojure than manually spelling out all the classpath elements (which are jars located in a couple choice directories)? |
| 14:18 | unlink | java -cp /usr/share/java/foo.jar:/usr/share/java/bar.jar:/home/unlink/Lib/clojure.jar:/home/unlink/clojure-contrib.jar clojure.lang.Script asdf.clj |
| 14:23 | arohner_ | unlink: what a few people do is write a bash script that adds dir/*.jar to the cp |
| 14:23 | arohner_ | function load_jars() |
| 14:23 | arohner_ | { |
| 14:23 | arohner_ | for file in "$@"; do |
| 14:23 | arohner_ | jars=$jars:$file |
| 14:23 | arohner_ | done |
| 14:23 | arohner_ | } |
| 14:23 | arohner_ | load_jars jars/*.jar |
| 14:23 | arohner_ | java -cp $jars |
| 14:25 | unlink | Hmm, I'm trying to see if I can start the Repl from ant. Doesn't seem especially possible. |
| 14:25 | arohner_ | why not? |
| 14:26 | unlink | Because it wants to handle all I/O itself |
| 14:27 | unlink | First off every line of output gets prepended with " [java] " |
| 14:28 | arohner_ | eww |
| 14:38 | Lau_of_DK | Hey guys |
| 14:38 | unlink | Hi Lau_of_DK. |
| 14:39 | technomancy | hello |
| 14:42 | unlink | It looks like GAE is swallowing my classpath somehow. |
| 14:42 | Lau_of_DK | GAE? |
| 14:43 | unlink | Google App Engine. |
| 14:44 | unlink | oh, it wants me to copy all of my jars to WEB-INF/lib. |
| 14:45 | Lau_of_DK | ah |
| 14:45 | unlink | IT WORKS! |
| 14:45 | unlink | excellent. |
| 14:46 | unlink | google app engine summarily ignores any classpath you give java when loading classes. |
| 15:40 | unlink | Is there anything like & for map bindings? Like "bind this parameter from the map to a and bind the rest of the map to other |
| 15:48 | unlink | How do I expand a vector return value to multiple arguments to a function? sort of like fn(*(lambda: 1,2,3,4...)()) in python. The key being that I don't know how many elements there are in the returned vector |
| 15:51 | arohner_ | unlink: the special forms page lists the available destructuring options with for maps |
| 15:51 | arohner_ | http://clojure.org/special_forms |
| 15:51 | arohner_ | can you give an example of what you want to do with return values to multiple arguments? |
| 15:51 | arohner_ | that sort of sounds like another destructuring thing, but I'm not quite sure what you want to do |
| 15:53 | unlink | I'm writing a function which produces an HTML document and accepts two parameters, a function which returns a vector of elements that go in the body and a map of context variables that are used in rendering the body. You can think of the method as a sort of "base template". |
| 15:54 | arohner_ | oh, are you looking for apply? |
| 15:54 | arohner_ | (apply + [1,2,3]) => 6 |
| 15:56 | unlink | What I described I want is that. |
| 15:56 | unlink | I *actually* want somethiing even simpler. |
| 15:58 | unlink | namely cons |
| 15:58 | unlink | O:-) |
| 15:59 | arohner_ | :-) |
| 15:59 | gnuvince_ | What is it you want? |
| 16:11 | technomancy | why is there a separate function for getting a seq from an enumeration? |
| 16:45 | cp2 | technomancy: because seq doesnt 'know how to' make a sequence from an enumeration |
| 17:11 | dliebke | technomancy: yeah, what cp2 said -- specifically since a java enumeration doesn't implement the Seqable interface and has no seq method |
| 17:12 | Chousuke | It'd be neat if Java had some way to have interface adaptors kind of like C++ concept maps :/ |
| 17:12 | Chousuke | C++0x, that is :P |
| 17:12 | Chousuke | or is it C++1x nowadays |
| 17:13 | cp2 | hrmm Chousuke ? |
| 17:13 | cp2 | could you link me |
| 17:14 | rhickey_ | technomancy: because seq is called often (automatically) in various functions, but creating 2 seqs on the same enumeration would be trouble, thus you have to do it explicitly |
| 17:14 | Chousuke | cp2: I'll just summarise. There's a new templating mechanism to require template parameters to implement a certain interface (== 'concept'), and concept maps allow you to write code and "show" how to implement a concept with some type that doesn't have 1:1 the same interface |
| 17:16 | cp2 | ah |
| 17:16 | cp2 | i see |
| 17:16 | Chousuke | cp2: so for example, if your concept requires the ability to use a ">" operator, but your type has only a greater_than() method available, a concept map can be used to "implement" the > interface with greater_than() |
| 17:16 | cp2 | oh right |
| 17:16 | cp2 | neat |
| 17:16 | cp2 | rhickey_: makes sense, i didnt consider that |
| 17:50 | unlink | Is there a shorter form for (if a a b)? |
| 17:50 | cp2 | if-let |
| 17:50 | hiredman | or |
| 17:51 | cp2 | o |
| 17:51 | hiredman | (or a b) |
| 17:51 | cp2 | yeah |
| 17:51 | unlink | I've been doing (let [[some-expr] [a]] (if a a b)) |
| 17:51 | unlink | Oh, or sounds good. :-) |
| 18:31 | unlink | I've got a (:gen-class) without a :name arg. How does it know what to call the class? |
| 18:34 | hiredman | it names it after the namespace |
| 18:39 | technomancy | rhickey_: ah thanks; interesting. |
| 18:39 | technomancy | there's no way the "don't know how to make a seq from $FOO" exception could be changed to mention enumerable-seq, is there? |
| 18:40 | cp2 | oh yeah |
| 18:40 | cp2 | that reminds me |
| 18:40 | cp2 | rhickey_: typo in the doc for enumeration-seq |
| 18:40 | rhickey_ | technomancy: there are many things you can't make a seq from |
| 18:40 | rhickey_ | ,(find-doc "enumeration") |
| 18:41 | rhickey_ | where's clojurebot? |
| 18:41 | cp2 | down |
| 18:41 | cp2 | "Returns a seq on a java.lang.Enumeration" |
| 18:42 | cp2 | should be java.util.Enumeration |
| 18:42 | cp2 | nothing major |
| 18:42 | technomancy | right; so the exception message isn't predicated on the type that's trying to be turned into an enumeration. that's what I was wondering. |
| 18:42 | technomancy | *turned into a seq |
| 18:44 | rhickey_ | cp2: fixed - thanks |
| 18:58 | stuhood | hmm, it seems a bit of a wart that (sorted-set) takes values, and (set) takes a collection |
| 19:00 | stuhood | ah... i guess that is because there is a literal for sets |
| 19:01 | rhickey_ | no, the comparable of is hash-set |
| 19:01 | Chouser | hash-set is the corollary. |
| 19:01 | stuhood | gotcha... thanks |
| 19:02 | cp2 | np rhickey_ |
| 19:55 | lisppaste8 | technomancy pasted "extract-jar" at http://paste.lisp.org/display/78858 |
| 19:56 | technomancy | is there a more concise way to write the loop at the end of that function? |
| 19:56 | technomancy | I feel like there should be a better way to express that. |
| 20:23 | hiredman | (.close (reduce #(.write % %2) something-else (take-while #(not= -1 %) (repeatedly (.read sometihgn))))) |
| 20:23 | hiredman | hmmm |
| 20:24 | hiredman | the .close is a bad idea, best to use with-open |
| 20:24 | hiredman | erm |
| 20:25 | hiredman | the reduce function should be #(doto % (.write %2)) |
| 21:25 | unlink | What is the (:xyz ...) syntax? (with a keyword at the beginning of the parens) |
| 21:26 | hiredman | keywords look themselves up in maps |
| 21:27 | hiredman | there is also an optional second argument |
| 21:27 | hiredman | which is a default value to return |
| 21:28 | unlink | So how is (:xyz foo bar) evaluated? |
| 21:29 | hiredman | user=> (:a {:a 1 :b 2}) |
| 21:29 | hiredman | 1 |
| 21:29 | hiredman | user=> (:a {:b 2} 1) |
| 21:29 | cp2 | keys are functions of maps |
| 21:29 | hiredman | 1 |
| 21:30 | unlink | So (:xyz foo bar) is the same as (get foo :xyz bar)? |
| 21:30 | hiredman | yes |
| 21:30 | unlink | when foo is a map. |
| 21:31 | unlink | Or are they really equivalent? |
| 21:31 | hiredman | yes |
| 21:31 | unlink | oh ok |
| 21:32 | unlink | so (:import java.io.File) is the same as (get java.io.File :import) ? |
| 21:32 | hiredman | it would be, except most likely you are seeing that inside the ns macro |
| 21:33 | unlink | oh |
| 21:33 | unlink | I am. |
| 21:33 | hiredman | in that case (:import java.io.File) is (import 'java.io.File) |
| 21:35 | unlink | I'm not really sure why there is a distinction in the language between symbols and keywords |
| 21:36 | hiredman | just a second |
| 21:40 | hiredman | ugh |
| 21:41 | hiredman | not having my logs to grep through is such a pain |
| 21:42 | hiredman | unlink, start here http://clojure-log.n01se.net/date/2009-04-15.html#15:36 |
| 21:44 | unlink | Intersting. |
| 21:45 | hiredman | stops maybe around 15:59 |
| 21:47 | unlink | Is something wrong with me if I find Clojure is more intuitive than Scheme? |
| 21:47 | unlink | s/is // |
| 21:48 | Raynes | unlink: No. |
| 21:48 | Raynes | Clojure rocks Scheme's world. |
| 21:48 | unlink | I've always found Scheme very clumsy for things I want to do on a fairly regular basis. |
| 21:48 | dreish | Clojure's design better conforms to the expectations of a programmer steeped in the languages that are popular right now. |
| 21:49 | dreish | I guess it might also be objectively better. |
| 21:49 | unlink | I never made it past the "which CL implementation should I use?" hurdle so I'm not equipped to opine about CL versus Clojure. |
| 21:52 | Raynes | My CL experience ended when I installed SBCL. |
| 21:52 | unlink | Is there a shorthand for something of this form? (let [[a] [1]] (let [[b] [(+ a 1)]] b)) -- here 1 means some java constructor invocation and (+ a 1) means a method on that object |
| 21:54 | Cark | (doto (new MyObject) (.method param)) |
| 21:54 | Cark | ? |
| 21:55 | unlink | heh. That's almost too good. |
| 21:56 | Cark | this form will return your first object ... if you expect to get the result of calling the method ... you'd use -> |
| 21:57 | Cark | (-> (new MyObject) (.method param)) |
| 21:58 | hiredman | unlink, I think you scheme is showing in your let |
| 21:59 | Cark | yep there are many brackets there =) |
| 21:59 | hiredman | you must want (let [a 1] ...) not (let [[a] [1]] ...) |
| 21:59 | unlink | whoa. |
| 22:00 | hiredman | but the second form does work, it has needless destructuring |
| 22:01 | technomancy | hiredman: thanks; take-while looks like it could clean things up nicely |
| 22:02 | technomancy | hiredman: I don't understand why you use doto there though |
| 22:03 | technomancy | isn't doto just for when you're calling different methods many times on the same object? |
| 22:03 | hiredman | because reduce needs to return the object you are writing to so you can write to it again |
| 22:03 | hiredman | I mean, you could use #(do (.write % %2) %) |
| 22:04 | technomancy | oh, of course. |
| 17:40 | hiredman | I haven't used compojure in some time, you might want to ask compojure specific questions on the compojure google group |
| 17:40 | unlink | probably |
| 21:48 | msingh`` | is there any doc for using clojure within an existing java project. I would like to call clojure code from java.. |
| 21:49 | cp2 | http://markmail.org/message/tx23zaxf77b6widh |
| 21:49 | cp2 | quick google brought that up |
| 21:50 | cp2 | although, i would keep looking around |
| 21:50 | msingh`` | thanks! |
| 21:52 | msingh`` | the java interop docs work in the oppposite direction |
| 21:52 | cp2 | yeah, i know |
| 21:52 | cp2 | there was an example somewhere else i remember looking at |
| 21:52 | cp2 | dont know where it is though, or what it was |
| 21:56 | Cark | http://berlinbrowndev.blogspot.com/2009/03/java-clojure-interoperability-calling.html |
| 21:56 | cp2 | there you go msingh`` |
| 21:57 | msingh`` | sweet cheers :) |
| 22:03 | msingh`` | i dont think i'll use this approach.. the amount of boilerplate needed exceeds the small amount of clojure code i was going to use |
| 22:04 | msingh`` | i wanted to adapt the sparkline generator from http://jonathanwatmough.com/2008/02/simple-sparkline-generator-in-clojure/ to render some data from a running java app |
| 23:25 | Lau_of_DK | Has anybody here had success emitting specific HTTP headers using Compojure/Ring ? |
| 23:25 | AWizzArd | I would also be interested to know more about this. |
| 23:25 | AWizzArd | Btw, Lau, what headers would you like to send? |
| 23:26 | Lau_of_DK | content-type "text/html" and Connection: close |
| 23:26 | Lau_of_DK | Rigth now, no headers are being emitted, despite my best efforts, which is causes a cascade of problems |
| 23:26 | Lau_of_DK | (compojure.server.jetty/run-server {:content-type "text/html" :Connection "close"} "/*" myservlet) does not give me anything |
| 23:28 | Lau_of_DK | (GET "/text" [{"Content-Type" "text/plain"} "This is plain text." "And some more text."]) |
| 23:28 | Lau_of_DK | Wiki says so |
| 23:30 | AWizzArd | Hmm, I would hope for being able to return the headers (if I want to) with each request, and not specifying them as an arg to run-server. |
| 23:30 | AWizzArd | Ah okay, in your GET you are also trying this. |