2009-07-12
| 01:16 | Ali_ | I am learning clojure, can I ask a question here? |
| 01:24 | cmvkk | yes. |
| 01:34 | Ali_ | I am receiving IllegalArgumentException when I define this function |
| 01:34 | Ali_ | (defn pascal-triangle |
| 01:34 | Ali_ | "Returns a lazy sequence of all the rows in pascal triangel." |
| 01:34 | Ali_ | (iterate |
| 01:34 | Ali_ | (fn [row] |
| 01:34 | Ali_ | (concat '(1) |
| 01:34 | Ali_ | (map #(reduce + %) (partition 2 1 row)) |
| 01:34 | Ali_ | '(1))) |
| 01:34 | Ali_ | '(1 1))) |
| 01:35 | Ali_ | Don't know how to create ISeq from Symbol. |
| 01:35 | Ali_ | Where in this definition is it creating ISeq from symbol |
| 01:35 | cmvkk | probably partition. |
| 01:35 | Ali_ | I tried this separately |
| 01:36 | Ali_ | (defn p-t-row [r] |
| 01:36 | Ali_ | (concat '(1) |
| 01:36 | Ali_ | (map #(reduce + %) (partition 2 1 r)) |
| 01:36 | Ali_ | '(1))) |
| 01:36 | Ali_ | this works and every time I call it I get a new row from pascal triangle |
| 01:42 | cmvkk | oh, duh. the simplist things are the easiest to overlook. |
| 01:42 | cmvkk | for pascal-triangle, you want def not defn. |
| 01:43 | cmvkk | it's expecting a function definition with an arglist, and it's choking because there isn't one... |
| 01:43 | Ali_ | I will look into that. But I was looking at the code for fibs in lazy-seqs which is similar and it uses defn |
| 01:44 | Ali_ | isn't it? |
| 01:44 | cmvkk | well you can use this as a function, but it at least needs an empty arglist. |
| 01:44 | cmvkk | just put [] after the docstring. |
| 01:44 | Ali_ | oh, yes yes |
| 01:44 | Ali_ | thanks |
| 01:44 | Ali_ | I forgot about that, thanks a lot |
| 01:53 | Ali_ | still not working |
| 01:53 | Ali_ | I am getting wrong number of arguments to iterate now |
| 01:53 | Ali_ | after I added the empty arglist or using def |
| 01:53 | Ali_ | (defn pascal-triangle |
| 01:53 | Ali_ | "Returns a lazy sequence of all the rows in pascal triangle." |
| 01:53 | Ali_ | [] |
| 01:53 | Ali_ | (iterate |
| 01:53 | Ali_ | (fn [row] |
| 01:53 | Ali_ | (concat '(1) |
| 01:53 | Ali_ | (map #(reduce + %) (partition 2 1 row)) |
| 01:53 | Ali_ | '(1)) |
| 01:54 | Ali_ | [1]))) |
| 01:55 | Ali_ | sorry, it was misplaced parens |
| 02:05 | Jomyoot | Is there an example on how to structure project folders/name spaces and etc? |
| 02:05 | Jomyoot | is it similar to how I would do packages in Java? |
| 02:05 | kotarak | Jomyoot: I structure my projects like this: |
| 02:06 | kotarak | Jomyoot: toplevel build.xml, ivy stuff, README, etc. |
| 02:06 | Jomyoot | since' there is no objects in clojure. |
| 02:06 | Jomyoot | do I still need to keep that package/folder relationship? |
| 02:06 | Jomyoot | like in java? |
| 02:06 | Jomyoot | com.what.here |
| 02:06 | kotarak | Jomyoot: src subdir contains all sources (I mix .java and .clj if there is any .java...), layout below src is dictated by the namespace dir convention |
| 02:06 | Jomyoot | goes into src/com/wht/here |
| 02:07 | kotarak | Jomyoot: compiled stuff goes into classes, jars etc. in build |
| 02:07 | Jomyoot | kotarak: I use intelliJ |
| 02:07 | Jomyoot | with La Clojure |
| 02:07 | Jomyoot | Hope it's good enough |
| 02:07 | kotarak | Jomyoot: Don't know about IntelliJ. Do everything manually and work with Vim. |
| 02:08 | kotarak | But the layout proved it's usefulness. |
| 02:08 | kotarak | To your questions: namespaces follow Java conventions. |
| 02:08 | Jomyoot | Do I need to use Maven? |
| 02:08 | kotarak | No. I use eg. Ivy. But even that is optional. |
| 02:08 | Jomyoot | for many of the plugins? |
| 02:08 | kotarak | You can use make if you like. |
| 02:09 | kotarak | (ns foo.bar-baz.frobincator) must go to (considering the structure above) src/foo/bar_baz/frobnicator.clj |
| 02:10 | Jomyoot | ok |
| 02:11 | Jomyoot | I tried Scala |
| 02:11 | kotarak | Jomyoot: don't forget the - vs. _ translation. |
| 02:12 | Jomyoot | Didn't see enough Magick |
| 02:12 | Jomyoot | it's like a terse version of Java |
| 02:12 | Jomyoot | but that's it |
| 02:12 | Jomyoot | Was trying to find magick in it |
| 02:14 | Jomyoot | clj file names aren't capitalized? |
| 02:15 | kotarak | It depends. |
| 02:15 | kotarak | (ns foo.bar.Baz) must be capitalised. |
| 02:16 | kotarak | (ns foo.bar.baz) not. |
| 02:18 | Jomyoot | hmm |
| 02:37 | Jomyoot | does clojure get compiled to .class? |
| 02:37 | Jomyoot | clj --> .class? |
| 02:37 | Jomyoot | Should I expect it to? |
| 02:37 | cmvkk | if you use genclass. otherwise, when clojure is compiled, every function becomes its own class. |
| 02:38 | Jomyoot | so when i hit compile, i should be getting bunches of .class files right? |
| 02:38 | Jomyoot | so my IDE is not set up right |
| 02:38 | Jomyoot | nothing comes out |
| 02:39 | cmvkk | yeah if nothing comes out that's probably wrong. |
| 03:46 | Ali_ | How does this form run inside the jvm? |
| 03:46 | Ali_ | (reduce + (take 1000000000 whole-numbers) |
| 03:46 | Ali_ | Does it take the first number add it, throw it, take the next, take the next and add it, .... |
| 03:46 | Ali_ | Or does it realize the first billion numbers and then add all the numbers in the seq? |
| 03:47 | kotarak | Ali_: No. It realises as needed. |
| 03:47 | Ali_ | the first one? |
| 03:47 | kotarak | But whole-numbers retains the head. |
| 03:48 | kotarak | The the intermediate results will stay in memory. |
| 03:48 | Ali_ | how can one make whole-numbers not retain the head? |
| 03:48 | kotarak | Rewrite it like this: (reduce + (take 10000000000 (whole-numbers))), whole-numbers is a function returning a fresh sequence of all numbers. |
| 03:49 | kotarak | So instead of (def whole-numbers (iterate inc 0)) do (defn whole-numbers [] (iterate inc 0)) |
| 03:49 | Ali_ | thanks. let me try it. |
| 03:50 | Ali_ | in this case, it takes the next number, add it, throw it and so on without keeping it in the heap? |
| 03:50 | kotarak | Yes. |
| 03:50 | Ali_ | cool |
| 03:51 | kotarak | But when you make whole-numbers a constant not a function, it will hold the head of the sequence. Then the results get cached and stay in heap. |
| 03:51 | kotarak | But the function returns always a new sequence, so the intermediate results can get garbage collected. |
| 04:21 | lenst | '(1 2 3) |
| 06:41 | sayyestolife | hm |
| 06:41 | sayyestolife | I'm thinking of doing a small 2d game in Clojure. What graphic library would you guys suggest? |
| 06:55 | sayyestolife | I don't mind it being quite low level (like SDL) |
| 06:58 | sayyestolife | I guess I might aswell go with sdljava |
| 07:40 | yakov2 | hm |
| 08:08 | yakov2 | is there a "instanceof" in Clojure? |
| 08:10 | hiredman | ,(doc instance) |
| 08:10 | clojurebot | "/;nil; " |
| 08:10 | hiredman | ,(doc instance/) |
| 08:10 | clojurebot | Invalid token: instance/ |
| 08:10 | hiredman | ,(doc instance?) |
| 08:10 | clojurebot | "([c x]); Evaluates x and tests if it is an instance of the class c. Returns true or false" |
| 08:10 | hiredman | it is really early |
| 08:11 | hiredman | late, whichever |
| 08:13 | yakov2 | thanks |
| 08:52 | Jomyoot_ | how do I run .clj from command line? |
| 08:55 | Jomyoot_ | how would I run .clj from java |
| 09:00 | Raynes | Jomyoot_: java -cp <path to clojure.jar>;<path to source files needed by file you want to run> clojure.main <path to source file you want to run> |
| 09:01 | Jomyoot_ | does clojure.Lang.Script work anymore? |
| 09:01 | Jomyoot_ | I keep finding references to clojure.Lang.Script |
| 09:03 | slaney | Jomyoot_: yes, it works |
| 09:04 | slaney | I am using it right now |
| 09:04 | hiredman | slaney: :( |
| 09:04 | slaney | heh |
| 09:04 | slaney | I am just getting started |
| 09:04 | hiredman | clojure.main |
| 09:05 | slaney | I see |
| 09:05 | hiredman | Script is old, and less liked |
| 09:06 | slaney | well, this is a 4 line shell script I wrote to either fire up the repl, or exec a file...will be trivial to change |
| 09:10 | Jomyoot_ | where is the contrib place |
| 09:11 | Jomyoot_ | clojure.contrib |
| 09:11 | Jomyoot_ | is it at google or sourceorge? |
| 09:11 | Chousuke | it's at assembla too |
| 09:11 | Jomyoot_ | most recent one where? |
| 09:11 | Chousuke | and github |
| 09:11 | Chousuke | http://www.assembla.com/spaces/clojure-contrib |
| 09:38 | Jomyoot_ | Caused by: java.sql.SQLException: Value '[B@4de35d1a' can not be represented as java.sql.Timestamp |
| 09:39 | Jomyoot_ | I get this using the sql contrib |
| 09:39 | Jomyoot_ | Is there something i should know? |
| 09:39 | hiredman | what are you trying to do? |
| 09:40 | hiredman | anyway, it looks something is trying to turn a byte array into a sql timestamp |
| 09:40 | hiredman | (and cannot) |
| 09:40 | Jomyoot_ | hmm |
| 09:41 | Jomyoot_ | (with-connection db |
| 09:41 | Jomyoot_ | (with-query-results rs ["select * from entries where is_hidden = 0 AND type = 'Story'"] |
| 09:41 | Jomyoot_ | (dorun (map #(println (:id %)) rs)))) |
| 09:41 | Jomyoot_ | Seems simple enough |
| 09:41 | Jomyoot_ | I do not have a byte array in that table |
| 09:42 | Jomyoot_ | i do have quite a lot of timestamps in there |
| 09:51 | Jomyoot_ | am I supposed to use Java's Hashtable? |
| 09:51 | Jomyoot_ | can't find something provided by clojrue |
| 09:51 | hiredman | uh |
| 09:51 | hiredman | really? |
| 09:52 | hiredman | http://clojure.org/data_structures |
| 09:53 | Raynes | He desperately needs a copy of Programming Clojure. :) |
| 10:05 | Jomyoot_ | waiting for mine to arrive |
| 10:05 | Jomyoot_ | hhave the PDF version |
| 10:05 | Jomyoot_ | waiting for paper one |
| 10:15 | Raynes | Since when does Clojure have a while loop? O_o |
| 10:17 | Chousuke | since: Wed Nov 26 23:13:57 2008 |
| 10:18 | Raynes | Chousuke: I didn't get the memo ;) |
| 10:18 | Raynes | And, way to be accurate! |
| 10:18 | Chousuke | that's from git log |
| 10:19 | Raynes | I figured that. :) |
| 10:19 | Chousuke | while has considerably less use in Clojure than in other languages, though |
| 10:19 | Chousuke | but you could have a (while @running ...) :) |
| 10:27 | Jomyoot_ | (with-connection db |
| 10:27 | Jomyoot_ | (with-query-results rs ["SELECT id, name FROM tags WHERE SITE_ID = 1"] |
| 10:27 | Jomyoot_ | (dorun (map #(dosync (assoc tags (:id %) (:name %))) rs)))) |
| 10:27 | Jomyoot_ | What's wrong with my code |
| 10:27 | Jomyoot_ | I do (def tags (hash-map)) earlier |
| 10:28 | Jomyoot_ | I wish there are more examples |
| 10:30 | Raynes | Chousuke: Good for infinite loops I imagine. |
| 10:45 | Jomyoot_ | omg i got it |
| 10:45 | Jomyoot_ | (ref) and (deref) and (dosync) |
| 10:51 | maacl | Lau_of_DK: hejsa |
| 10:52 | Lau_of_DK | maacl: Hejsa :) |
| 11:01 | maacl | Lau_of_DK: I cannot figure out how to generalize this recursive call to work for s1 being anything else than a string: (str (traceback-lcs m s1 s2 (- i 1) (- j 1)) (nth s1 (- i 1))) - any ideas? I would like for it to return a collection of the same type as s1. |
| 11:02 | Lau_of_DK | maacl I'd love to, but I gotta run, if you havent worked it out by tomorrow when I get back - we can have a look at it |
| 11:37 | StartsWithK | hi |
| 11:38 | StartsWithK | is there a standard practice for using :arglists metadata to fix args for documentation on fns and macros? |
| 11:39 | StartsWithK | how do i write :arglists '([name #{deps*}]), it that ok for sets? |
| 11:41 | Jomyoot_ | simple question: how do apply (str) to ("a" "b" "c") |
| 11:41 | Jomyoot_ | to combine the result |
| 11:41 | StartsWithK | how do i indicate that #{} is optional to, but can be empty if specified? |
| 11:41 | StartsWithK | Jomyoot_: (apply str (list "a" "b" "c")) |
| 11:42 | Jomyoot_ | thanks |
| 11:45 | StartsWithK | so is #^{:arglists '([name #{task-deps*}? [property-deps*]? [property-bindings*]? & body])} ok? |
| 11:46 | StartsWithK | or & in front of body is not needed, i see that defn dosn't have it |
| 11:47 | Jomyoot_ | last question: how to (apply str (list "a" "b" "c")) but seperate each "a" "b" "c" by a " " space |
| 11:49 | StartsWithK | Jomyoot_: (apply str (interpose " " ["a" "b"])) |
| 11:51 | Jomyoot_ | well Clojure is awesome |
| 11:51 | Jomyoot_ | Lisp is awesome actually |
| 11:51 | Jomyoot_ | my code is so short now |
| 11:51 | StartsWithK | :) |
| 11:52 | Jomyoot_ | wonder why Lisp was not that popular |
| 11:52 | Jomyoot_ | recently |
| 11:52 | Jomyoot_ | it wasn't popular recently |
| 11:52 | Jomyoot_ | probably was like long itme ago |
| 11:54 | justin` | anyone know how I might reset a "deck" to its original state? It's a var pointing to a sequence |
| 11:55 | justin` | in other words I'm trying to set "deck" to (shuffle (make-deck)) but I'm having trouble figuring out how to do this in a transaction |
| 11:56 | Chouser | if you plan to change a reference |
| 11:56 | Chouser | (like a var) |
| 11:56 | justin` | yup |
| 11:57 | Chouser | in the normal course of a program, then a var is probably not the right choice |
| 11:57 | Chouser | unless each change is local only to one thread |
| 11:57 | StartsWithK | justin`: maybe (binding [deck (.getRoot deck)] ...) |
| 11:57 | justin` | hmm |
| 11:59 | Chouser | that binding is right if you want the change to be in effect only within the ... part |
| 11:59 | StartsWithK | (def deck 3) |
| 11:59 | StartsWithK | (binding [deck 4] (println deck) (binding [deck (.getRoot #'deck)] (println deck))) |
| 11:59 | StartsWithK | prints 4\n3 |
| 11:59 | Chouser | otherwise a ref or atom may work better for you. |
| 11:59 | StartsWithK | but that may not be what you realy want |
| 12:00 | justin` | yeah I'll try with a ref |
| 12:10 | ceninan | how do I stop a macro expansion from namespace-qualifying? |
| 12:12 | StartsWithK | ceninan: (defmacro x [] (list 'println "hi")) no namespace-qualifing, (defmacro x [] `(println "x")) namespace qualified for println |
| 12:13 | ceninan | StartsWithK: thanks! |
| 12:48 | StartsWithK | http://paste.pocoo.org/show/128073/ i tried to fix arglists, but new declaration is not shown with doc |
| 12:48 | StartsWithK | am i doing something wrong? |
| 12:51 | cmvkk | seems like arglists is probably auto generated by defmacro, and it's overwriting your declaration. |
| 12:52 | Chousuke | StartsWithK: try just putting the metadata map as a regular map after the name of the macro |
| 12:52 | Chousuke | (doc defmacro) |
| 12:52 | clojurebot | "([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]); Like defn, but the resulting function name is declared as a macro and will be used as a macro by the compiler when it is called." |
| 12:54 | StartsWithK | Chousuke: that worked, thanks |
| 12:56 | StartsWithK | cmvkk: yes, strange as it uses defn to declare a macro with straight (defn name args) call |
| 13:27 | larryjoe | I have a question regarding eval and local bindings... using clojure.contrib.macros/const, (let [x 1] (const x)) gives an UnsupportedOperationException... how does eval know about the external lexical bindings, and why does it not use the dynamic bindings (BTW I like that it exceptions) |
| 13:53 | bradford | ,(let [foo 5] (str (:name (meta #'foo)))) |
| 13:53 | clojurebot | java.lang.Exception: Unable to resolve var: foo in this context |
| 13:54 | bradford | k, that doesnt work...in my repl i already bound foo beforehand :-) |
| 13:54 | bradford | i'm trying to get the string name corresponding to a vars symbol |
| 13:55 | bradford | the other problem is that i need to do it for a collection. |
| 13:56 | bradford | obviously i can not do this (for [x something] (str (:name (meta #'x)))) |
| 14:31 | IKelvin | hi there, |
| 14:31 | IKelvin | i'm trying to assign a public class variable. |
| 14:31 | IKelvin | public class Foo { |
| 14:31 | IKelvin | public int a; |
| 14:31 | IKelvin | } |
| 14:31 | IKelvin | void function(){ |
| 14:31 | IKelvin | Foo foo = new Foo(); |
| 14:31 | IKelvin | foo.a = 5; // how to write this in clojure? |
| 14:31 | IKelvin | } |
| 14:31 | IKelvin | Clojure: |
| 14:31 | IKelvin | (foo (Foo.)) |
| 14:31 | IKelvin | (.a foo 5) ; obviously doesn't work |
| 14:31 | Chouser | (set! (.a foo) 5) ; I think |
| 14:31 | hiredman | ,(doc set!) |
| 14:31 | clojurebot | "/;nil; " |
| 14:31 | hiredman | #@$@# |
| 14:34 | IKelvin | it worked! Thanks! |
| 14:38 | Chouser | that's an instance member, by the way |
| 14:39 | Chouser | I guess "class" may be right too, but I thought you meant static at first |
| 14:40 | IKelvin | i see |
| 15:39 | schaefer_ | i have a smalltalk background and i'm a big fan of named arguments. i like the defnk macro available in contrib and i've been thinking about its performance: it is at least one object allocation followed by several "puts" to a map for making the call and then several "gets" as the function begins executing |
| 15:39 | schaefer_ | if the compiler (or reader in clojure's case) is smart enough, all that overhead could be eliminated and turned into a direct stack based call |
| 15:40 | schaefer_ | my question is: is there a way (in user space) to smarten up clojure's reader to avoid all that overhead? conceptually, i can see how to write a macro to handle the function side, but i don't know how to do it on the caller side |
| 15:41 | maacl_ | Is there a function that works like empty but also works for strings? |
| 15:42 | hiredman | ~javadoc java.lang.String |
| 15:42 | maacl_ | i.e works both for collections and strings at the same time ? |
| 15:44 | hiredman | why would want that? |
| 15:44 | hiredman | presumably you want an empty of something so you can build onto it, and none of the datastructure building functions work on string either |
| 15:45 | maacl_ | because I need to return a collection or string depending on what was passed into the function |
| 15:46 | hiredman | sounds like you want defmulti |
| 15:47 | hiredman | d |
| 15:49 | maacl_ | yeah, was trying to find a clever way around it |
| 15:49 | hiredman | why? |
| 15:49 | maacl_ | that is clever as in "clever" |
| 15:49 | hiredman | defmulti is nice |
| 15:50 | maacl_ | sure, but thought this might be more elegant |
| 15:50 | hiredman | the set of operations on String and on Collections are different, so you need two code paths anyway |
| 15:51 | maacl_ | well, conj got me part of the way :-) |
| 15:51 | hiredman | erm |
| 15:51 | hiredman | conj does not work on strings |
| 15:52 | maacl_ | no but on characters which I build the string from |
| 15:53 | hiredman | so why do you need an empty string then? if you are operating on a list? |
| 15:54 | maacl_ | well it turns out I don't because it was a dead end |
| 15:56 | maacl_ | looks like defmulti is the way to go - thanks t´for the tip |
| 16:01 | Chouser | schaefer_: I think you could do what you want for simple fn calls just using macros |
| 16:02 | schaefer__ | oh? how do you mean? |
| 16:02 | Chouser | schaefer_: that is, write (defmacro my-defnk ...) such that (my-defnk foo ...) expands to (defmacro foo ...) |
| 16:04 | Chouser | then (foo :a 1 :b 2) would call that generated macro and would figure out at compile time the right way to call the positional args |
| 16:04 | schaefer__ | ah... i think i follow you |
| 16:05 | Chouser | I guess (my-defnk foo ...) might actually expand to both (defn foo* ...) and (defmacro foo ...) |
| 16:05 | schaefer__ | yes, that makes sense |
| 16:05 | Chouser | so that a call (foo :a 1 :c 3) could expand to (foo* 1 nil 3) or whatever. |
| 16:06 | Chouser | the problem would be you couldn't pass foo to high-order fns |
| 16:06 | Chouser | (map foo [1 2 3]) wouldn't work. |
| 16:07 | schaefer__ | why not? would that just be seen as one 'token' to the macro? |
| 16:08 | Chouser | map isn't a macro -- it's first args needs to be an actual fn, not a macro |
| 16:08 | schaefer__ | oh, sorry, i misunderstood your example. i see the problem now |
| 16:09 | Chouser | not even sure how you'd want that to look (even if there were no restrictions imposed by Clojure) |
| 16:09 | Chouser | (map foo :a [1 2 3] :b [4 5 6]) ? |
| 16:09 | Chouser | (map foo [{:a 1 :b 4} {:a 2 :b 5}]) ? |
| 16:09 | schaefer__ | well, you could have an arbitrary rule that says use positional args when named args aren't available |
| 16:10 | Chouser | hm... actually, in that case you might be able to abuse the :inline metadata |
| 16:10 | schaefer__ | or, you could disallow (map foo [1 2 3]) in favor of declaring a new function: (map (fn [x] (foo :a x)) [1 2 3]) |
| 16:11 | Chouser | ok. that would be fine too using the multiple macro idea, I think. |
| 16:11 | schaefer__ | yes, i think so |
| 16:11 | Chouser | I'm very intruiged by named args, so let me know if you pursue this. |
| 16:11 | clojurebot | this is not a bug |
| 16:12 | schaefer__ | instead of the macro approach, is there a way to influence the reader to teach it new tricks? or is that what the docs mean by "the symbole table isn't available in user space" ? |
| 16:12 | schaefer__ | (or something like that) |
| 16:13 | Chouser | right, no adjusting the reader without actually patching the clojure code itself |
| 16:13 | schaefer__ | i'm going to play around with this. i see it mainly as a way to dig into macros and understand the innards of clojure |
| 16:13 | Chouser | which is an option, of course, but reduces your target market a bit. |
| 16:14 | schaefer__ | exactly. whatever i come up with, i want to be within the mainstream |
| 16:20 | Chouser | what I'd like to experiment with at some point is named args that somehow default to picking up same-named locals from the calling scope |
| 16:21 | schaefer__ | interesting, but i can imagine it being very confusing to someone reading the code |
| 16:21 | schaefer__ | in java, i've wished for something similar, particularly for constructors where there is a lot of: |
| 16:22 | schaefer__ | public Constructor(Object a, Object b) {this.a=a; this.b=b;) |
| 16:23 | hiredman | Chouser: sounds like binding |
| 16:25 | Chouser | I was thinking something more like (defnk foo [a b c] ...) defining a fn that takes named args a, b and c. You could call this using (foo :a a :b b :c c), but if the names of your locals actually match the arg names like that, there'd be some kind of shortcut |
| 16:25 | Chouser | not sure what it would look like. Maybe (foo ~a ~b ~c) or something :-/ |
| 16:26 | Chouser | because of course you'd want to still be able to do (foo ~a ~b :c (+ 4 5)) or whatever as needed |
| 16:26 | Chouser | I have no idea if this would end up being useful or not, but it seems to me like it *might* be. |
| 16:26 | schaefer__ | yes. i was afraid you were talking about (let [a 1 b 2 c3] (foo)) |
| 16:26 | schaefer__ | that would be a little too weird, imo |
| 16:27 | Chouser | oh, no. That's too open-ended for me. |
| 16:27 | kotarak | too much context to remember... |
| 16:27 | schaefer__ | exactly my thinking |
| 16:27 | Chouser | yes |
| 16:27 | Chouser | too much |
| 16:28 | Chouser | in that case an arg could be "given" at a top level, not mentioned in several calls deeper, and used at a low level. |
| 16:28 | Chouser | well, like 'binding', but even less explicit. Too scary. |
| 16:28 | schaefer__ | i do like the notion of (foo ~a ~b :c (+ 4 5)) primarily because it encourages common variable names across code. one of the things i miss in clojure (god help me for saying so) is the self-documenting that goes along with strong typing |
| 16:29 | kotarak | naa.. I found clear names just as good.. |
| 16:29 | Chouser | schaefer__: well, if you get the compile-time named arg expansion working, we can try tacking ~a on top. |
| 16:30 | hiredman | :/ |
| 16:30 | schaefer__ | kotorak: agreed. i think chouser's idea helps to encourage common names across code code and, assuming you start with good names... |
| 16:30 | sgtarr_ | anyone here using Clojure in enterprise settings? |
| 16:30 | kotarak | sgtarr_: me, as some kind of secret weapon |
| 16:31 | schaefer__ | chouser: i'm going to play around with it this week. i'll post whatever i come up with in the forum. |
| 16:31 | sgtarr_ | kotarak: sounds good |
| 16:31 | Chouser | schaefer__: cool |
| 16:43 | sgtarr_ | kotarak: are you making them believe it's actual java code? |
| 16:44 | sgtarr_ | it all compiles into java bytecode anyway :) |
| 16:44 | kotarak | sgtarr_: no, but it's not really professional. :] Some local, home-grown utility. My boss just knows, that it will solve our problems and run where ever Java 1.5 is installed... |
| 16:47 | sgtarr_ | I would like to take Clojure to an enterprise setting |
| 16:47 | sgtarr_ | I work for a medical tech company and we use various technologies; .NET/C#, Java, C, Python, depending on the product |
| 16:50 | kotarak | sgtarr_: sorry, can't help you on that, I'm not a programmer, more an "engineer"... |
| 17:22 | pokey19 | Hello |
| 17:22 | pokey19 | how do I write Clojure code in an external file and then have Clojure interpret it? |
| 17:26 | technomancy | pokey19: spit and load-file |
| 17:53 | lisppaste8 | ceninan pasted "Next time I will learn-_before_-doing..." at http://paste.lisp.org/display/83479 |
| 17:54 | ceninan | *shudder* |
| 17:54 | ceninan | learning-by-learning is a better idea |
| 18:44 | syamajala | is there anything like html-template for clojure? |
| 18:45 | syamajala | i looked at enlive, but its not quite what i want |
| 18:50 | Chousuke | clj-html or compojure.html perhaps? |
| 19:33 | mattrepl | added tests for clojure-cassandra, but when running 'run-tests nothing is printed out |
| 19:33 | mattrepl | anything obviously wrong? http://github.com/mattrepl/clojure-cassandra/blob/812fb1339ce170a468c8578c274f1aec10c9c6a8/src/cassandra/test.clj |
| 19:34 | mattrepl | I just use the test namespace and clojure.test, then call run-tests with the test namespace as the only arg |
| 19:47 | mattrepl | love it... changed my init and had forgot to add output redirection back in |
| 22:59 | technomancy | wow, this is pretty slick: http://ideolalia.com/rendering-textures-in-clojure-0 |
| 22:59 | technomancy | (using the penumbra openGL library) |