2011-04-20
| 00:00 | technomancy | it looks like that class is in the default package; consider moving it to a package instead |
| 00:00 | technomancy | unclear if that's the cause, but it's good hygiene |
| 00:00 | xcv | ok |
| 00:00 | technomancy | hrm; gotta take off for a few; might be able to look more later. |
| 00:00 | xcv | thanks for the help! |
| 00:00 | xcv | I'll try hacking at it a bit more |
| 00:09 | carllerche | if I need a type / "object" that is really just a two tuple, is it more idiomatic to use a vector or a map? My guess would be map since records and such behave like maps. |
| 00:10 | brehaut | carllerche: if its a pair of things rather than an association then a vector |
| 00:10 | brehaut | carllerche: it makes for more natural destructuring for instance |
| 00:10 | carllerche | hmm... true |
| 00:11 | brehaut | carllerche: MapEntrys look like vectors too ;) |
| 00:11 | brehaut | ,(type (first (seq {:a 1}))) |
| 00:11 | clojurebot | clojure.lang.MapEntry |
| 00:11 | brehaut | ,(first (seq {:a 1})) |
| 00:11 | clojurebot | [:a 1] |
| 00:11 | carllerche | cool, thanks |
| 00:11 | carllerche | I guess I'll go w/ a vector for now and see where it goes |
| 00:12 | brehaut | carllerche: go with a vector until a) other requirements emerge or b) it gets to be a performance issue then use a record |
| 00:13 | carllerche | will do |
| 00:19 | KirinDave | Hum |
| 00:19 | KirinDave | Yegge _does_ have a point about Clojure's community being more scheme and haskell expats than Common Lisp expats. |
| 00:19 | KirinDave | Although, you'd think we'd have MBE by now if that were an overwhelming bias. |
| 00:21 | xcv | technomancy: I moved the java files into a package as you suggested, but 'lein uberjar' hangs just the same. |
| 00:26 | technomancy | xcv: ok, if you send me the java file I can try it here |
| 00:26 | technomancy | xcv: you probably want to get this into version control soon though. |
| 00:27 | technomancy | in fact, learning that may be more important than learning clojure =) |
| 00:27 | ataggart | johnmn3: enlive might do what you want. http://github.com/swannodette/enlive-tutorial |
| 00:27 | technomancy | not to say you can't do them at the same time |
| 00:30 | technomancy | KirinDave: he did kind of get goaded into posting before he was ready. |
| 00:30 | KirinDave | technomancy: Probably true. |
| 00:31 | technomancy | I'll wait for the director's cut before I get offended. |
| 00:33 | xcv | technomancy: Great! There are two java files: The lexer SchemeLexer.java (generated by jflex) is here: http://pastie.org/1814222, and Yytoken.java is here: http://pastie.org/1814225 |
| 00:34 | xcv | (these are the only java files, that is) |
| 00:35 | mec | What do I do if I'm using a deftype with 2 protocols that both have the same fn |
| 00:36 | technomancy | xcv: that should even compile; your java file says the class is lexer.SchemeLexer, but Clojure is looking for just SchemeLexer |
| 00:37 | amalloy | mec: (extend-type MyType Proto1 (the-fn [this] ...) Proto2 (the-fn [this] ...)), i think |
| 00:38 | xcv | technomancy: sorry about that, I updated the import statement to match the packaging: http://pastie.org/1814234 (it compiles on my end) |
| 00:38 | amalloy | ie, just what you would do if they had different names |
| 00:39 | amalloy | though i don't think the two protocols can be declared in the same namespace - they'd both try to define myns.the-fn |
| 00:41 | technomancy | xcv: your project.clj is pretty funny. I was able to make it work by structuring it like this: http://p.hagelb.org/project.clj.html |
| 00:41 | technomancy | in general you should just base your projects off the skeleton that "lein new" gives you. |
| 00:43 | amalloy | technomancy: down with the man! don't let lein tell you what to do! |
| 00:43 | technomancy | amalloy: if you sayjure so |
| 00:43 | ataggart | amalloy: deftype emits the protocol fns as methods, so it'll fail on duplicate method signature (assuming they have the same arity) |
| 00:44 | amalloy | ataggart: that's why i used extend-type |
| 00:44 | ataggart | ah very good |
| 00:45 | amalloy | but thanks for clarifying the fact that that's a necessary component |
| 00:46 | ataggart | just checked, and you are correct, extend type lets you do it no prob |
| 00:48 | xcv | technomancy: that worked! |
| 00:48 | xcv | technomancy: I guess I mangled the project file while getting it working initially |
| 00:50 | xcv | technomancy: thanks a million for the help! |
| 00:51 | technomancy | xcv: sure thing |
| 00:52 | technomancy | xcv: I don't use javac myself; if you have suggestions how to make its docs clearer, please post 'em to the list. |
| 00:54 | brehaut | technomancy: which particular alan moore? |
| 01:01 | mec | bah github dead |
| 01:08 | amalloy | long love github |
| 01:12 | ataggart | hmm, ^:cost |
| 01:12 | ataggart | ^:const |
| 01:17 | seancorfield__ | anyone here working with mongoDB? |
| 01:17 | seancorfield__ | i'm considering it for a project and wondered about clojure wrappers for it... |
| 01:20 | ataggart | the only one I know of is congomongo |
| 01:23 | seancorfield__ | that seemed to be the only one i could find that is getting updates... |
| 01:25 | amalloy | congomongo has worked fine for me |
| 01:26 | amalloy | sexpbot and 4clojure both using it, though not super-heavily in either case |
| 01:28 | seancorfield__ | thanx... i'll try it and see what i think |
| 01:32 | KirinDave | Hell yes. Very stoked I got patches for clothesline from an outside-of-banksimple source. |
| 01:32 | KirinDave | Nice to know someone else is using it. |
| 01:34 | amalloy | seancorfield__: also, the last guy who asked about congomongo hasn't come back to complain afaik :) |
| 01:36 | ataggart | ah cool, didn't know BS was using clojure |
| 01:37 | seancorfield__ | well, world singles needs to move some data from mysql to one of the more flexible data stores and mongoDB leads our short list for the first stage |
| 01:38 | seancorfield__ | not going to happen any time soon but i want to start experimenting |
| 01:38 | KirinDave | ataggart: Truth be told, we are not going to use it so much going forward. |
| 01:39 | KirinDave | ataggart: It's a bummer, but evidently I was more willing to learn scala than some of my peers were willing to learn clojure. |
| 01:40 | ataggart | I just don't get that. I've been trying to make myself learn scala over the last few weeks, and I just can't do it. |
| 01:40 | KirinDave | Why? |
| 01:40 | clojurebot | why not? |
| 01:40 | KirinDave | It's... |
| 01:40 | ataggart | syntax |
| 01:40 | Derander | clojurebot: <3 |
| 01:40 | clojurebot | <3 is </3 |
| 01:41 | KirinDave | I think what's most disappointing about Scala is that it has this type inferencing system which really sucks on things that are exciting about Haskell |
| 01:41 | amalloy | poor clojurebot is depressed |
| 01:41 | KirinDave | And it lacks something analogous to clojure's generic methods. |
| 01:41 | KirinDave | Or haskell's typeclasses |
| 01:41 | KirinDave | Which is a BIG hit in my opinion. |
| 01:41 | ataggart | well, to be fair, I can't speak to any of scala's non-aesthetic qualities |
| 01:42 | ataggart | it's just so much visual noise to me |
| 01:42 | KirinDave | As for aesthetics, you gotta admit the _ syntax for simple lambdas is so much nicer than Clojure's #() ass soup. |
| 01:42 | ataggart | haven't gotten that far |
| 01:42 | KirinDave | I love you clojure, but your lambda syntax... |
| 01:42 | KirinDave | ataggart: e.g., (map #(+ 100 %) someNumbers) => someNumbers.map(_ + 100) |
| 01:43 | seancorfield__ | we're using scala for performance-critical low-level stuff but i wouldn't want my whole team trying to learn it |
| 01:43 | KirinDave | seancorfield: It is broad and deep, as they say |
| 01:44 | ataggart | KirinDave: but is this not also true: (map + someNumbers) vs someNumbers.map(_ + _) |
| 01:44 | KirinDave | Heck, the finer points of its type system make haskell's monomorphism restriction error look positiviely readable. |
| 01:44 | KirinDave | No. |
| 01:44 | KirinDave | ataggart: Nope. |
| 01:45 | KirinDave | ataggart: You may be thinking of a fold there |
| 01:45 | ataggart | ah possibly |
| 01:45 | KirinDave | In which case still no. :) |
| 01:45 | ataggart | I coulda sworn there was somewhere saw (_ + _) |
| 01:45 | KirinDave | Yeah _ + _ |
| 01:45 | KirinDave | That's for fold |
| 01:46 | KirinDave | someNumbers.reduceLeft( _ + _ ) // == someNumbers.sum |
| 01:46 | KirinDave | Please pardon me, I gotta get to the gym or I won't go today. |
| 01:46 | ataggart | isn't it like 2am for you? |
| 01:46 | amalloy | ataggart: KirinDave is in sf, not ny, iirc |
| 01:46 | ataggart | ah k |
| 01:47 | seancorfield__ | my team just plain ol' prefers dynamic languages |
| 01:47 | seancorfield__ | so scala is reserved for corner cases |
| 01:47 | KirinDave | seancorfield: Fair enough |
| 01:47 | KirinDave | Scala can be onerous about that. |
| 01:47 | ataggart | what perf corner cases was scala faster than clojure? |
| 01:48 | KirinDave | ataggart: Pre-1.3 there are many many. |
| 01:48 | ataggart | I don't doubt it, just don't know what they are |
| 01:48 | seancorfield__ | we started uses scala in production in early 2010 |
| 01:48 | KirinDave | Ngh. I really should go. |
| 01:48 | ataggart | go |
| 01:48 | seancorfield__ | i only just got the green light to go to production with clojure |
| 01:48 | KirinDave | gone |
| 01:53 | livingston | why does this say "_" is not a ns (defmacro foo [x] (let [fv (symbol "_" (str (gensym)))] `(~x ~fv))) when called (macroexpand-1 (foo 'bar)) |
| 01:53 | livingston | but this works just fine: (let [x 'bar] (let [fv (symbol "_" (str (gensym)))] `(~x ~fv))) |
| 01:54 | amalloy | &(symbol "_" "foo") |
| 01:54 | sexpbot | ⟹ _/foo |
| 01:54 | amalloy | you probably want ##(symbol (str "_" "foo")) |
| 01:54 | sexpbot | ⟹ _foo |
| 01:55 | livingston | I want a symbol with the underscore namespace. it works just fine without there being a defined "_" namespace when called, but not in the macro |
| 01:56 | amalloy | interesting |
| 01:56 | livingston | it's somehow trying to evaluate my symbol, but I can't tell why? is there something wrong with the structure of my macro |
| 01:57 | amalloy | i don't see anything wrong |
| 01:57 | amalloy | but i'm open to second opinions |
| 01:57 | seancorfield__ | ataggart: any thoughts on what the clojure job market is really like out there? |
| 01:57 | livingston | so if I go to my repl and (ns _) now I get: "No such var: _/G__4235" as an error |
| 01:57 | ataggart | which "there"? |
| 01:58 | seancorfield__ | the clojure mailing list has nearly 5,000 people on it, all using clojure in some form |
| 01:59 | livingston | DOH *livingston fails to quote the thing inside the call to macroexpand* |
| 01:59 | ataggart | livingston: the yeah |
| 01:59 | ataggart | just about to say |
| 02:01 | livingston | sign it's time for bed probably |
| 02:05 | seancorfield__ | ataggart: well, we see lots of talk of Clojure on the list of course but there seem to be several calls for "Who's using Clojure?" so i get the impression that there aren't a huge number of jobs out there yet |
| 02:06 | ataggart | relative to other languages, it does seem that way |
| 02:07 | ataggart | not sure why though. |
| 02:07 | livingston | seancorfield__: a little bird told me it has appeared inside the walls of google, but not how much or for what. |
| 02:07 | ataggart | the banksimple case is an interesting one. I'd be curious to know why scala was preferable over clojure |
| 02:08 | livingston | you're probably only going to find it at small places / startups - it's a bit to new for places like accenture to pick it up |
| 02:08 | seancorfield__ | the main scala-user maling list has only 1200 people on it |
| 02:08 | ataggart | #clojure is always more populated than #scala |
| 02:08 | hiredman | clojurebot: tell use about scala |
| 02:08 | clojurebot | chouser is ruthless about breaking other people's code |
| 02:09 | hiredman | clojurebot: really? |
| 02:09 | clojurebot | It's greek to me. |
| 02:09 | hiredman | clojurebot: tell use about scala |
| 02:09 | clojurebot | use vs require is (:use [lib :only [a b c]) or (:require [lib :as alias]) -- (:use lib) is only for playing around |
| 02:09 | hiredman | clojurebot: you seem kind of borked |
| 02:09 | clojurebot | kind of interesting if unfold is the intermediate steps of a fold |
| 02:09 | ataggart | clojurebot: tell us about scala |
| 02:09 | clojurebot | the scala compiler | is | <reply> see: http://harrah.github.com/browse/samples/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala.html#65760 |
| 02:10 | hiredman | anyone used jffi? |
| 02:10 | livingston | scala has been around since 2003 -- twice as long as clojure. it's also probably easier for a random java programmer to pick up. |
| 02:11 | hiredman | it would be nice to be able to call posix_spawn from clojure, but jffi is not well document |
| 02:11 | ataggart | doesn't JNA sit on top of jffi? |
| 02:11 | hiredman | (Runtime.exec being borked if the jvm has a decent heapsize) |
| 02:12 | hiredman | no |
| 02:12 | hiredman | jffi may sit on top of jna |
| 02:12 | hiredman | https://github.com/wmeissner/jffi |
| 02:12 | hiredman | jruby uses it |
| 02:12 | ataggart | ah, I was thinking of libffi |
| 02:13 | hiredman | jffi sits on top of libffi |
| 02:13 | ataggart | and apparently so does JNA |
| 02:13 | hiredman | I doubt that |
| 02:13 | hiredman | I think libffi is relatively new |
| 02:14 | ataggart | I just go by what wikipedia tells me |
| 02:14 | hiredman | huh, I guess so |
| 02:14 | hiredman | thats kind of neat |
| 02:15 | ataggart | may be of interest: https://github.com/Chouser/clojure-jna |
| 02:24 | ataggart | holy crap! I can finally edit jira tickets |
| 02:40 | seancorfield__ | you got a promotion :) |
| 02:42 | amalloy | ataggart: now, mark my ticket as accepted so i can finally say with a straight face that i've contributed to clojure.core |
| 02:42 | ataggart | #? |
| 02:43 | amalloy | 757 |
| 02:44 | ataggart | as with many tickets, there is an open question. |
| 02:45 | amalloy | yeah, i know. i was really just hoping for magic fairy dust |
| 02:45 | ataggart | it's "waiting on" rich though, so it might get answered some day :) |
| 02:46 | ataggart | and my ticket has been around since september |
| 02:46 | ataggart | CLJ-445 |
| 02:47 | ataggart | had to rewrite the damn Reflector |
| 02:48 | amalloy | yuck |
| 02:49 | ataggart | it was fun though, and it sets up adding support for calling vararg methods |
| 02:51 | amalloy | ataggart: i can't find the issue number, and it's been declined, but i wonder whether you were a fan of my patch to add CL-style #| comments |# |
| 02:51 | ataggart | 714 |
| 02:52 | markoman | is it possible to use clojure with gdb on ecams? |
| 02:53 | kriyative | Hi all, anyone know of a clojure lib for creating Unix pipes? I've hand hacked something using code from clojure.contrib.shell-out but would rather use something better. |
| 02:53 | ataggart | amalloy: I just use #_"my multi-line comment here" |
| 02:54 | amalloy | so do i, but i'm not really a fan |
| 02:54 | markoman | gdn docs says i need to compile app with -g option. and then point gdb to the executable file |
| 02:54 | markoman | s/gdn/gdb/ |
| 02:54 | sexpbot | <markoman> gdb docs says i need to compile app with -g option. and then point gdb to the executable file |
| 02:54 | amalloy | gdb will never debug clojure |
| 02:55 | amalloy | you want swank/slime, and probably the cdt to plug into swank |
| 02:55 | markoman | how so? |
| 02:55 | amalloy | you would be debugging the native-compiled jvm executable |
| 02:55 | amalloy | clojure is not native code |
| 02:56 | markoman | im using swank and slime. how do you set breakpoints with it for example? |
| 02:56 | amalloy | $google clojure cdt george jahad |
| 02:56 | sexpbot | First out of 9 results is: CDT - The Clojure Debugging Toolkit |
| 02:56 | sexpbot | http://georgejahad.com/clojure/cdt.html |
| 02:57 | amalloy | it's not as time-tested as gdb, or as feature-complete as slime's CL debugger, but it's a big step up from println |
| 02:57 | livingston | the CL style comments is more than that though, the pipes are for making a symbol with arbitrary text in it's name - that's really useful (I don't think there is anything like that in the clojure reader is there? |
| 02:57 | amalloy | livingston: uh |
| 02:58 | amalloy | you are perhaps thinking of |symbol thingy| without #? |
| 02:58 | livingston | amalloy: yeah, but I thought they shared parts of the reader, I could be grosly confused |
| 02:59 | amalloy | they well might. i've never looked at CL's impl of...anything |
| 03:00 | amalloy | but there's no particular reason they would share code in the clojure compiler |
| 03:01 | markoman | alright, need to test cdt then |
| 03:02 | ataggart | amalloy: I'm inclined to agree with those in the nay column |
| 03:02 | ataggart | short of some compelling example which couldnt; readily be met with existing features |
| 03:03 | amalloy | ataggart: i just think it's grotesque that i can't write TODO: in my multi-line comment, really |
| 03:03 | ataggart | multiline comments lead people to write them, which leads to red herrings |
| 03:03 | ataggart | amalloy: get a better editor? |
| 03:03 | amalloy | ataggart: huh? |
| 03:03 | hiredman | amalloy: doesn't your editor place ;; when needed? |
| 03:03 | livingston | the pipes are reader macro for long symbol and the # is the dispatch function, I though that pipe comment thing was really a cool hack that just said dispatch on this symbol - noop, effectively telling the compiler to throw it away -- I thought. |
| 03:03 | amalloy | hiredman: for sure, i can do it with more than one single-line comment |
| 03:04 | amalloy | but we might as well throw away ##(doc comment) if it's not usable for at least two reasons |
| 03:04 | sexpbot | ⟹ "Macro ([& body]); Ignores body, yields nil" |
| 03:04 | hiredman | oh, sure |
| 03:04 | amalloy | that's my second-best, if i can't have #|..|# |
| 03:04 | hiredman | well, I dunno, it's kind of useful to keep code for testing functions in as you write them |
| 03:05 | amalloy | hiredman: but it yields nil. at anything but the top level it will break things |
| 03:05 | ataggart | is there a usecase for comment that's not met by #_ |
| 03:05 | hiredman | amalloy: which is where I use it |
| 03:05 | amalloy | ataggart: commenting out something that isn't a balanced sexp |
| 03:06 | amalloy | wrap it with a "string", sure |
| 03:06 | amalloy | then escape all the "s in your string... |
| 03:06 | ataggart | amalloy: good point about the non-sexp |
| 03:06 | amalloy | or even commenting out multiple balanced sexps at once |
| 03:07 | amalloy | the list of very-small gains for #| is longish, but they're all quite small |
| 03:07 | amalloy | just little things about (comment) and #_ that will surprise you |
| 03:07 | ataggart | no one uses comment for comments though, right? |
| 03:07 | amalloy | i did |
| 03:07 | ataggart | ah |
| 03:08 | amalloy | anyone who sees the language for the first time will |
| 03:08 | amalloy | i mean, we put a macro called comment into clojure.core, people should know not to use it? |
| 03:08 | ataggart | heh |
| 03:08 | ataggart | well poor naming of comment aside, ; seems to do what we need for actual comments |
| 03:09 | livingston | ok, I'm full of shit, just looked in Steele - I really thought it was some cute trick leveraging the symbol reader - it's not it's a defined comment sequence -- sorry for the bad info |
| 03:09 | amalloy | ataggart: it just leaves clojure in the embarrassing position of being practically the only language without multi-line comments. java could do fine with //, but they have /**? |
| 03:10 | amalloy | livingston: the CL reader really just sees #, then looks at the next *character*, not next *symbol* |
| 03:10 | ataggart | amalloy: meh, in every case where /* */ is useful is for documentation, and clojure has doc strings |
| 03:10 | livingston | amalloy: I know that - (I've actually mucked with the CL reader more than most, but it's been so long) |
| 03:11 | ataggart | I'm inclined to agree with the school of thought that large in-code comments are a Bad Thing |
| 03:11 | livingston | I never used that commenting style because my editor always did block comment out for me with semicolons |
| 03:11 | ataggart | as opposed to documentation |
| 03:11 | amalloy | ataggart: i don't really disagree, i just wish clojure would get some consistent story for comments. add a """ multi-line-string or something |
| 03:11 | amalloy | or say "look, don't do multi-line comments, they're bad" |
| 03:11 | amalloy | like it does with inheritance |
| 03:12 | ataggart | amalloy: look, don't do multi-line comments, they're bad. |
| 03:12 | amalloy | but having multiple, broken versions of multi-line commenting is what i see when i look at (comment) |
| 03:12 | livingston | amalloy: I'm actually really disappointed I can't add reader macros in clojure, it's really useful for DSLs |
| 03:12 | ataggart | :) |
| 03:12 | amalloy | ataggart: indeed. put it on clojure.org for me |
| 03:12 | ataggart | but then steve yegge will yell at us for being prescriptive |
| 03:13 | amalloy | that's how we'll get market share! |
| 03:13 | ataggart | or maybe proscriptive |
| 03:13 | ataggart | livingston: I think the point of excluding reader macros was to stop people like amalloy from making their code unreadable to others ;) |
| 03:14 | hiredman | livingston: you can if you really want, all you have to do is know how to do it |
| 03:14 | amalloy | ataggart: meh. i have a program that would love a reader macro in it, but i don't especially care |
| 03:15 | livingston | ataggart: no rich has some thing about them having the potential to need state and thus mucking with things |
| 03:15 | livingston | hiredman: have a good example? |
| 03:15 | amalloy | livingston: the primary objection is, i think, ataggart's |
| 03:16 | hiredman | livingston: I refuse to give give examples due to various non-proliferation agreements |
| 03:16 | ataggart | clojure's prime directive |
| 03:16 | livingston | yeah see that's what I thought |
| 03:16 | amalloy | yeah, seriously. the implementation hiredman refers to is so disgusting, hacky, and non-portable. you're better off not knowing |
| 03:16 | amalloy | (non-portable to future clojure versions, that is) |
| 03:17 | hiredman | jna is such a bummer |
| 03:17 | livingston | reader macros are like regular macros, 9 times out of 10 you don't need them and shouldn't use them, but there are some really cool places where they can change the world. |
| 03:17 | livingston | if people use them bad, don't use their code. |
| 03:18 | ataggart | hiredman: how so? is it worse than JNI? |
| 03:18 | hiredman | oh, no |
| 03:18 | hiredman | just a drag |
| 03:21 | hiredman | and you can't generate the interface you need with definterface |
| 03:21 | ataggart | requires interface inheritance? |
| 03:21 | hiredman | yes |
| 03:21 | ataggart | bleh |
| 03:23 | amalloy | seems like definterface is bound to get an :extend option sooner or later, right? i don't know any way it goes against clojure's philosophy |
| 03:24 | hiredman | extension via inheritence instead of composition |
| 03:25 | amalloy | but not actually inheriting any code |
| 03:26 | ataggart | why won't gen-interface work? |
| 03:26 | amalloy | &(doc gen-interface) |
| 03:26 | sexpbot | ⟹ "Macro ([& options]); When compiling, generates compiled bytecode for an interface with the given package-qualified :name (which, as all names in these parameters, can be a string or symbol), and writes the .class file to the *compile-path* directory. When not compil... http://gist.github.com/930595 |
| 03:27 | ataggart | it has :extends [interface ...] |
| 03:27 | amalloy | when not compiling, does nothing |
| 03:27 | amalloy | ie, it demands aot |
| 03:27 | hiredman | oh, it may, definterface is just nicer |
| 03:27 | ataggart | where is definterface from? |
| 03:27 | hiredman | clojure |
| 03:27 | amalloy | &#'definterface |
| 03:27 | sexpbot | ⟹ #'clojure.core/definterface |
| 03:28 | ataggart | odd, it's not in the docs |
| 03:32 | amalloy | TimMc: you use findfn, right? mec added $findarg recently: |
| 03:32 | amalloy | $findarg map % [1 2] [2 3] |
| 03:32 | sexpbot | [clojure.core/unchecked-inc clojure.core/inc] |
| 04:22 | talios | hola - where does one find maven artifacts for clojure-contrib these days? I don't see any 1.3.0-alpha6 or anything in maven central next to clojure-core... |
| 04:27 | fliebel | talios: I believe they are on the Clojure server, not on the central one. |
| 04:29 | talios | ah cool - will hunt over there then. |
| 04:32 | raek | talios: I think they stop at the 1.3.0-alpha4 version |
| 04:33 | talios | they seem to yeh, wonder why/how mvnrepository.org gave me -alpha6 |
| 04:33 | raek | http://dev.clojure.org/display/design/Contrib+Library+Names |
| 04:34 | raek | some stuff is being considered for "new contrib" |
| 04:34 | raek | the "old contrib" was an important step for clojure, but now it's largely unmaintained |
| 04:35 | fliebel | Any Python programmers around? I wonder how writing Clojure influenced your Python code. Do you go all functional in Python, or just go back to mutating stuff? I also just found this: http://packages.python.org/pysistence/ |
| 04:39 | thorwil | hmm, i fell in love with map, and filter in python, wasn't thrilled about lambda's limitations. gained some motivation to look at other languages that don't treat these things so stepmotherly |
| 04:39 | fliebel | I'm asking because last time I tried to do stuff as I'd do in Clojure, it was kind of slow and ugly. Another reason is that someone showed interest in hiring me for a Python job, where I'd have to collaborate with people probably writing non-functional code. (that sounds funny) |
| 04:39 | thorwil | so far the clojure influence on my pathon is that i don't want to use it anymore :) |
| 04:40 | thorwil | /s/pathon/python/ |
| 04:41 | fliebel | thorwil: That is an interesting thing to say, as it would imply learning Clojure limits your career to… cool places. |
| 04:42 | thorwil | heh. no career in programming here, i'm more of a designer :) |
| 04:42 | talios | put down photoshop and back away from the laptop! |
| 04:50 | fliebel | So, when we have cinc, PyPy should be an interesting target :) |
| 05:05 | hoeck | fliebel: I did learn Python for my current job after mainly using clojure for about 2 years during my studies |
| 05:06 | hoeck | and pypy is definitely a nice clojure target, I'm on the boat when cinc is ready, or even before |
| 05:07 | hoeck | I just don't know yet how to (efficiently) implement method overloading on python targets |
| 05:07 | fliebel | hoeck: So, what is your Python like, ofter writing Clojure for 2 years? |
| 05:08 | hoeck | fliebel: more like clojure :) |
| 05:08 | hoeck | not that I'm using filter & map or itertools everywhere - thats just a pain in python, imo |
| 05:09 | hoeck | but I try hard to avoid stateful classes, and try more to create clean interfaces and referential transparent functions |
| 05:11 | fliebel | So you do use for loops and mutation and all that… |
| 05:12 | fliebel | oh, neat: http://docs.python.org/release/3.1.3/howto/functional.html |
| 05:12 | hoeck | of course, you have to, in python, there is just not enough infrastructure to give that up |
| 05:12 | fliebel | ghehe |
| 05:12 | opqdonut_ | generators are quite nice actually |
| 05:13 | opqdonut_ | capture some of the use cases of lazy lists |
| 05:13 | fliebel | yea, yield is magic :) |
| 05:13 | hoeck | I'm not trying to write unidiomatic python, but I strongly dislike those typical python oo-apis foo = create_object(); foo.set(prop); ... |
| 05:15 | hoeck | especially now that I know that 80% of the mutation there is just unnecessary and makes code more complex :/ |
| 05:16 | hoeck | but I'd currently rather work with python than taking a java job |
| 05:16 | fliebel | oh, shit comas. |
| 05:16 | fliebel | yea, Python is nice... |
| 06:09 | raek | does @planetclojure tweet all clojure tagged questions on stack ocerflow? |
| 06:20 | talios | raek: i hope not |
| 07:09 | noidi_ | Is there a predicate like fn? that returns true for all objects that can be used like a function, e.g. sets, maps, etc.? |
| 07:10 | ambrosebs_ | i guess they would all implement the java interface Callable .. and there's another one |
| 07:11 | ambrosebs_ | runnable? |
| 07:11 | noidi_ | thanks! |
| 07:11 | fliebel | noidi_: ifn? |
| 07:11 | noidi_ | even better! >( |
| 07:11 | noidi_ | :) |
| 07:48 | ilyak | hi * |
| 07:49 | ilyak | How would I pass a record constructor /Track./ as a parameter to higher order function? |
| 07:54 | hoeck | ilyak: either wrap it into a function like #(Track. %1 %2) and pass that or use reflection if you need to call the ctor with varying arguments |
| 07:55 | ilyak | Sad |
| 07:55 | ilyak | Why isn't it a function by itself? |
| 07:59 | raek | ilyak: this is being though upon: http://dev.clojure.org/display/design/defrecord+improvements |
| 08:00 | ilyak | Is there a repository of clojure dependencies or like? For example, I can't figure whether https://github.com/david-mcneil/defrecord2 is good and supported, and no idea how to integrate it into my project |
| 08:02 | raek | ilyak: yes, clojars.org is the place |
| 08:02 | raek | though it doesn't look like David McNeil has uploaded it there... |
| 08:03 | raek | but apparently someone else did: http://clojars.org/me.hspy/defrecord2 |
| 08:19 | ilyak | looks like defrecord2 doesn't accept n arguments |
| 08:19 | ilyak | only one map |
| 08:19 | ilyak | I mean, defrecord2-s constructor |
| 08:19 | ilyak | so you can't say (apply new-track seq) |
| 08:19 | ilyak | which sucks |
| 08:37 | ordnungswidrig1 | hi all |
| 08:37 | fliebel | hi |
| 08:38 | ordnungswidrig1 | I need a way to detect bindings which a not local to a macros body. |
| 08:39 | ordnungswidrig1 | say, e.g. if have (let [a 1] (foo-macro (let [b 2] (* a b))) |
| 08:40 | fliebel | detect? |
| 08:40 | ordnungswidrig1 | then during macro expansion I need to know that a is bound outside of the macro body |
| 08:43 | Chousuke | ordnungswidrig1: the &env magic parameter of the macro *might* be of use |
| 08:44 | ilyak | There is (if-not bool on-false on-true) |
| 08:44 | ilyak | but is there (if-something bool on-true on-false)? |
| 08:44 | ordnungswidrig1 | Chousuke: a little backround information: i'm playing to event sourcing / prevalence and I'm trying to write a macro that records the body to a like before execution. |
| 08:44 | Chousuke | ilyak: what's wrong with just if? |
| 08:44 | fliebel | ilyak: Just drop the not? |
| 08:45 | ordnungswidrig1 | Chousuke: during replay of the body I must make sure that all bindings that are referenced by the body are in place |
| 08:46 | Chousuke | ordnungswidrig1: that sounds difficult |
| 08:46 | ilyak | cheatsheet doesn't have if |
| 08:46 | fliebel | ordnungswidrig1: What does your macro do? |
| 08:46 | ilyak | for some reason |
| 08:46 | fliebel | ilyak: Then do (if-not (not bool) true false) :P |
| 08:47 | ordnungswidrig | https://gist.github.com/931238 |
| 08:47 | ilyak | (map #(if (= % "NULL") % nil) '("foo" "NULL" "NULL" "bar" "NULL")) |
| 08:48 | ilyak | returns (nil "NULL" "NULL" nil "NULL") for some reason |
| 08:48 | ilyak | why? |
| 08:48 | ordnungswidrig | you can do (in-log l (do something nice here) and "(do something nice here)" will be logged and executed |
| 08:48 | ilyak | oops, it should be wrong way around |
| 08:48 | ilyak | disregard that |
| 08:48 | ordnungswidrig | afterwards you can do (replay l) and it should execute all forms that have been logged in l before |
| 08:50 | Chousuke | ordnungswidrig: examine &env in your macros |
| 08:50 | ordnungswidrig | Chousuke: that sounds good |
| 08:50 | Chousuke | it's pretty much undocumented but you can access all locals and the forms that define them |
| 08:50 | Chousuke | note: not the values. those are only known at runtime :) |
| 08:51 | fliebel | Chousuke: There is &env, and another one… &form or something like that? |
| 08:51 | Chousuke | yes |
| 08:51 | chouser | and not the "source code" forms, but the analyzed forms, iirc. |
| 08:51 | fliebel | chouser: Difference? |
| 08:51 | ordnungswidrig | when I know which bindings exists I need to replace them by hand. e.g. |
| 08:52 | fliebel | ordnungswidrig: Easier would be to log env as well :) |
| 08:52 | ordnungswidrig | fliebel: nice idea! |
| 08:53 | fliebel | ordnungswidrig: Is this for debugging? Sounds really nice to log stuff, and then rerun it later to see what it does. |
| 08:55 | ordnungswidrig | fliebel: it's for recording and restoring the state of the application |
| 08:55 | ordnungswidrig | fliebel: like a database or filesystem log |
| 08:56 | chouser | fliebel: normally when we talk about forms we mean nested lists of symbols and similar things. &env gives you the Java objects generated from that in the analysis stage, things like LocalBinding, NumberExpr, etc. |
| 08:57 | fliebel | chouser: Oh, so will that go away with cinc? |
| 08:57 | ordnungswidrig | chouser: that's not what I want |
| 08:58 | fliebel | ordnungswidrig: Someone made a printable fn, or fn literal. Maybe that does what you want. |
| 08:58 | chouser | well, I think the hope is that LocalBinding, NumberExpr, etc. will be immutable records rather than mutable non-collection Java objects. |
| 08:59 | ordnungswidrig | merely I want to have (let [a (rand-int 1000)] (in-log (alter foo + a))) such that a is expanded in the expression before the form is logged. |
| 08:59 | ordnungswidrig | Such that the logged (and executed) form is (alter foo + 557) |
| 09:00 | ordnungswidrig | Is clojure.walk of any help here? |
| 09:00 | fliebel | ordnungswidrig: But are these even avaliable at macro time? |
| 09:00 | Chousuke | ordnungswidrig: that's not possible in general |
| 09:00 | chouser | ordnungswidrig: you can use &env to get the names of the locals, and emit code that refers to them at runtime in order to collect their real runtime values. |
| 09:00 | ordnungswidrig | fliebel: no, at macrotime is expanded to (in-log (a b c)) (do (alter log-ref conj '(in-log a b c) (a b c)) |
| 09:04 | chouser | (defmacro in-log [& block] `(do (prn (zipmap '~(keys &env) ~(cons `list (keys &env)))) ~@block)) |
| 09:05 | chouser | (let [x 5, y (rand-int 100)] (in-log (prn (+ x y)))) ;=> {x 5, y 39} 44 |
| 09:05 | chouser | Something like that? |
| 09:05 | ordnungswidrig | not so bad |
| 09:06 | ordnungswidrig | (let [b 3] (in-log2 (let [a (+2 b)] (inc a)))) |
| 09:06 | ordnungswidrig | ; => java.lang.Integer cannot be cast to clojure.lang.IFn |
| 09:06 | freiksenet | hi! is it possible to make clojure behave more like haskell/CL in terms of undefined functions, so that I don't have to declare all functions in a file if I prefer to have toplevel functions on the top of the file? |
| 09:08 | ordnungswidrig | ah, sorry, (+ 2 b) not (+2 b) |
| 09:10 | Chousuke | freiksenet: you can use the declare macro to declare functions before defining them |
| 09:10 | freiksenet | frankly it's just a fucking shame that clojure can't do a pass over the file before compilation to do that declare automatically |
| 09:10 | Chousuke | I guess it could, but it won't. |
| 09:10 | fliebel | chouser: I love that macro |
| 09:11 | freiksenet | Chousuke: I know that. that's tedious. I was wondering if there is something (maybe in some build system) that arleady does that |
| 09:11 | Chousuke | fliebel: for simplicity. No-one wants to do anything to the compiler beyond what is necessary anymore, because it's written in Java :P |
| 09:11 | Chousuke | the long-term plan is to replace it anyway, perhaps Clojure will get two-pass compilation then |
| 09:12 | Chousuke | Though I don't know what that implies for the repl |
| 09:12 | freiksenet | well, nothing I guess. |
| 09:12 | matthias_ | mayube someone should rewrite it in clojure ;) |
| 09:12 | freiksenet | I mean twopass compilation won't really modify how repl works |
| 09:12 | Chousuke | freiksenet: what harm is one declare at the top anyway :) |
| 09:12 | freiksenet | Chousuke: well I need to declare all functions on top |
| 09:13 | freiksenet | or most of them |
| 09:13 | Chousuke | yeah, but declare takes multiple functions |
| 09:13 | chouser | I'm pretty sure Rich has rejected having Clojure accept the use of vars before they're declared. |
| 09:13 | freiksenet | maybe it's my haskell/cl background, but I am used to writing stuff from top to bottom |
| 09:13 | chouser | in long conversations on the google group. |
| 09:13 | freiksenet | chouser: it just needs an autodeclaration for all def and defns, no need to make clojure accept undeclared vars |
| 09:14 | freiksenet | like CL does I guess |
| 09:14 | freiksenet | thouhg CL I think doesn't mind undeclared vars or functions too |
| 09:14 | chouser | I'm pretty sure CL allows use of undefined symbols at the REPL |
| 09:14 | fliebel | freiksenet: You can do #'var as long as you *use* them in the correct order. |
| 09:15 | Chousuke | that's ugly though :/ |
| 09:15 | fliebel | Quite, and slow even :) |
| 09:16 | chouser | fliebel: really? |
| 09:16 | chouser | , #'foo |
| 09:16 | clojurebot | java.lang.Exception: Unable to resolve var: foo in this context |
| 09:16 | chouser | oh |
| 09:16 | chouser | I see what you mean |
| 09:17 | freiksenet | in any case that adds up to list of annoying things in clojure :D |
| 09:17 | chouser | yeah, I think even that doesn't work |
| 09:17 | freiksenet | not like show stoppers, but thinks that annoy you every time you encounter them :) |
| 09:17 | chouser | freiksenet: note that this is an intentional decision. You can assume it's without value if you'd like, but be aware others have almost certainly come to a different conclusion. |
| 09:18 | ilyak | What if I want to loop/recur on some array (first/rest) growing some cache during looping, but yielding sequence elements instead of collecting them and then returning the whole seq? |
| 09:18 | ilyak | What should I use? |
| 09:18 | matthias_ | true and false should be able to be used as functions so we could write ifs without "if". does anyone thing that's a good idead? :p |
| 09:19 | Chousuke | that's not possible |
| 09:19 | fliebel | matthias_: You mean like… (true 1) > 1? |
| 09:19 | Chousuke | true and false are java objects |
| 09:20 | fliebel | And probably final too |
| 09:20 | matthias_ | (true 1 2) would return 1, (false 1 2) would return 2 |
| 09:20 | fliebel | Oh, what was that stinking pit called "making your own boolean"? |
| 09:20 | raek | matthias_: if is not a function. for it to work correctly, only one of the branches should be evaluated, but for a function application *all* arguments are evaluated before the function is applied |
| 09:21 | matthias_ | yeah i know. make it a special form then or whatever |
| 09:21 | raek | so the compiler would need to know that in (a b c), a will be a boolean |
| 09:21 | fliebel | matthias_: Boolean a special form? |
| 09:21 | opqdonut_ | this doesn't make sense, matthias_ |
| 09:23 | fliebel | (def true #(do %1)) (def false #(do %2)) :P |
| 09:24 | Fossi | that has no condition |
| 09:25 | Fossi | so "true" would have to be something that evaluates to true or false |
| 09:25 | fliebel | Fossi: That is nonsense altogether. |
| 09:25 | fliebel | (mything, not what you said) |
| 09:26 | Fossi | i guess you have to have some kind of sugar in there |
| 09:26 | ordnungswidrig | Chousuke: I still need a way to determine the binding that are actually used in the form |
| 09:26 | Fossi | like ?((condition?) (thenpart) (elsepart)) |
| 09:27 | ordnungswidrig | in (let [a 1 b (make-big-graph-of-data)] (in-log (ref-set ref a))) b should not be recorded |
| 09:27 | Fossi | without the ?() it would be real funky |
| 09:27 | fliebel | Fossi: What is the advantage? |
| 09:28 | Fossi | none |
| 09:28 | Fossi | i think it would be pretty fucked up :) |
| 09:28 | fliebel | ordnungswidrig: Why not? |
| 09:28 | Fossi | it would also mess with ordering |
| 09:29 | ordnungswidrig | In my case b is really big / not recordable |
| 09:29 | ordnungswidrig | In my special case b is the reference to the form log. |
| 09:30 | ordnungswidrig | and I get a Stackoverflow while printing |
| 09:32 | ordnungswidrig | I can add a binding clause to the macro where you have to declare the bindings to be evaluated: (let [a 1] (in-log l a (alter-ref ref + a)) |
| 09:32 | ordnungswidrig | but then I need to make sure that all needed bindings are declared. |
| 10:36 | cemerick | LOL @ http://groups.google.com/group/seajure/browse_frm/thread/18baa18ffdbdd790 |
| 10:40 | ejackson | eep! I guess ->> could be interpreted as a very mean stare |
| 10:41 | Fossi | now, where's that shotgun operator? |
| 10:42 | ejackson | :get-off-my-lawn |
| 10:43 | ejackson | see the two dots, thats you, looking down the barrel of Clint's shotgun |
| 10:44 | Fossi | i tried to come up with something, but rediscovered that my ascii art skills are far below mediocre |
| 10:45 | Fossi | don't know whether that's a bad thing though ;D |
| 10:46 | ejackson | i'd say you should rejoice in that deficiency |
| 10:46 | Fossi | weird rantish post |
| 10:46 | Fossi | interesting read though |
| 10:50 | Fossi | imho the "yes" part is bs |
| 10:50 | Fossi | but, i guess arguing the points here goes nowhere |
| 10:51 | Fossi | the best example of a "yes" type language i can think of is c++ |
| 10:51 | Fossi | and if you want clojure to be where that ended up then thanks, but no thanks |
| 10:52 | Fossi | earning money and all |
| 10:54 | xcv | I'm having a problem with mutually recursive functions; I use forward declarations, and that works fine in the REPL, but after I compile and run 'lein uberjar' I get an 'Unable to resolve symbol in this context' error. Should forward declarations break like this? |
| 10:54 | cemerick | As long as you (declare foo) before using it, you'll be good. |
| 10:55 | cemerick | s/using/referring to |
| 10:55 | sexpbot | <cemerick> As long as you (declare foo) before referring to it, you'll be good. |
| 10:55 | Fossi | it prolly works in the repl because you defined it once before |
| 10:55 | Fossi | and you have an "old" reference lying around |
| 10:57 | xcv | I'm using declare on each function beforehand, and it works on a fresh repl, but that doesn't seem to be enough |
| 10:57 | cemerick | Maybe paste what you have? |
| 10:58 | Fossi | yeah, sounds weird then |
| 10:58 | cemerick | (in a pastebin, of course) |
| 10:58 | xcv | ok, http://pastie.org/1815696 |
| 10:59 | cemerick | heh, ok, and the error is where? |
| 11:00 | xcv | no error in the repl, but after lein compile and lein uberjar (the main function is in the pasted code file) I get "Unable to resolve symbol: reduce-form in this context" |
| 11:01 | manutter | does it give you a line number? |
| 11:01 | xcv | that's the first function call in the code that references a function that is defined later on |
| 11:01 | xcv | no, but I think it's in the walk-over function |
| 11:01 | xcv | line 190 |
| 11:01 | xcv | evals the string (reduce-form) |
| 11:02 | xcv | that's the first call to a function with a body defined later on |
| 11:03 | xcv | that's the only explanation I could think of for that particular error coming up |
| 11:05 | cemerick | I have to run, but there's no need to use eval there |
| 11:05 | cemerick | use resolve to get the var, and call it straight off |
| 11:05 | manutter | hmm, wonder if you changed that to (str "(compy.core/reduce-" symbol ")" ) ...? |
| 11:06 | manutter | though I like cemerick's answer better :) |
| 11:38 | xcv | hope I don't sound like an idiot, but could you explain how to call the var after I get it with resolve? Convert the string into a symbol and apply to an argument list? |
| 11:39 | manutter | hmm |
| 11:39 | manutter | ,(doc resolve) |
| 11:39 | clojurebot | "([sym]); same as (ns-resolve *ns* symbol)" |
| 11:41 | manutter | I'm just guessing but I think you could just use ((resolve (str "foo" bar "baz")) arg-list) |
| 11:41 | manutter | or ((resolve (symbol (str ... etc |
| 11:52 | dnolen | xcv: you want to get the value in the var? like a fn or something? |
| 11:52 | xcv | the value in the var is "form" |
| 11:52 | xcv | and I want to call reduce-form with no arguments |
| 11:53 | xcv | so I make a symbol out of (str "reduce-" form) |
| 11:53 | xcv | used to work with eval, but after lein compile + lein uberjar it doesn't work anymore |
| 11:54 | xcv | that is, can't get it to work with (apply (resolve (symbol (str "reduce" var))) []) |
| 11:55 | manutter | cemerick mentioned using resolve just before he left, and I made a guess, but I don't really know how to use resolve |
| 11:56 | manutter | if it returns the var instead of the contents of the var, though, this might work: |
| 11:56 | dnolen | xcv: I mean *Clojure var*, var in your example is just a local variable. |
| 11:56 | amalloy | it returns the var |
| 11:56 | manutter | (apply ((resolve (symbol (str "reduce-" var)))) []) |
| 11:57 | dnolen | xcv: resolve will get you the var, but you want the *value* contained in the var, in your case an fn I believe, right? |
| 11:58 | xcv | that's right |
| 12:00 | dnolen | xcv: have you looked at, var-get ? |
| 12:00 | dnolen | ,(doc var-get) |
| 12:00 | clojurebot | "([x]); Gets the value in the var object" |
| 12:00 | xcv | (apply (resolve (symbol (str "print" "ln"))) ["hello"]) -> |
| 12:00 | xcv | hello |
| 12:00 | xcv | hum |
| 12:01 | raek | (<var> ...), ((deref <var>) ...) and ((var-get <var>) ...) are equivalent |
| 12:01 | xcv | so (apply (var-get (resolve (symbol (str "reduce-" var)))) []) ? |
| 12:01 | raek | vars implement IFn by calling whatever they contain |
| 12:01 | xcv | doesn't work either |
| 12:02 | raek | ,(apply (resolve 'print) ["hello"]) |
| 12:02 | clojurebot | hello |
| 12:02 | xcv | every time I get "java.lang.String cannot be cast to clojure.lang.IFn" |
| 12:02 | raek | ,(apply (resolve (symbol "print")) ["hello"]) |
| 12:02 | clojurebot | hello |
| 12:02 | raek | xcv: sounds like you have (def x "foo") instead of (defn x ...) |
| 12:03 | raek | xcv: do you have multiple levels of indirection? |
| 12:04 | raek | in what people has said before, "the var" has been refering to the var that contains the function you want to call |
| 12:04 | amalloy | ,((resolve 'print) "hello") ; don't need apply |
| 12:04 | clojurebot | hello |
| 12:05 | raek | xcv: in other words, it looks like your reduce-... function is not a function, but a string |
| 12:07 | xcv | that's strange, I declared every function ahead of time with declare, shouldn't that yield functions? |
| 12:08 | xcv | or should I use defn-s with empty bodies? |
| 12:10 | manutter | ,(let [reduce-foo (fn [] (println "foo")), foo2 "foo"] (apply ((resolve (symbol (str "reduce-" foo2)))) [])) |
| 12:10 | clojurebot | java.lang.NullPointerException |
| 12:10 | manutter | o snap |
| 12:10 | manutter | ,(let [reduce-foo (fn [] (println "foo")), foo2 "foo"] (apply (resolve (symbol (str "reduce-" foo2))) [])) |
| 12:10 | clojurebot | java.lang.NullPointerException |
| 12:11 | xcv | ,(let [reduce-foo (fn [] (println "foo")), foo2 "foo"] (apply (resolve (symbol (str "reduce-" foo))) [])) |
| 12:11 | clojurebot | java.lang.Exception: Unable to resolve symbol: foo in this context |
| 12:12 | xcv | ,(let [reduce-foo (fn [] (println "foo")), foo2 "foo"] (apply (resolve (symbol (str "reduce-" foo2))) [])) |
| 12:12 | clojurebot | java.lang.NullPointerException |
| 12:13 | manutter | xcv can you re-post the link to your pastebin with the source code? |
| 12:14 | xcv | http://pastebin.com/sFimY4mX |
| 12:15 | xcv | the problem occurs on line 190 |
| 12:15 | xcv | with symbol = "form" |
| 12:15 | xcv | ah |
| 12:15 | xcv | that might be it |
| 12:15 | xcv | same name as the loop variable |
| 12:15 | raek | xcv: (declare a b c) is the same as (def a) (def b) (def c) |
| 12:16 | raek | xcv: oh. I see that you have defs in your defns. that will not wotk |
| 12:16 | raek | *work |
| 12:16 | raek | def should only be used at the top level |
| 12:16 | raek | since it defines/mutates *global* variables |
| 12:18 | raek | xcv: also, are you using resolve outside a macro? if so, consider having a single def that contains a map instead if you need to look up things at runtime |
| 12:20 | manutter | oh I see: you are using "symbol" as a local var, so when you call (symbol (str it's not executing clojure.core/symbol, it's trying to execute your local var |
| 12:20 | raek | you are not supposed to change the value of a var, i.e. use 'def', except when you are defining something for the first time, or when you fix a bug |
| 12:20 | xcv | I'm redefining the globals inside functions (not good style, I know, but has worked fine so far) |
| 12:21 | xcv | after I changed symbol to sym in the doseq head it works, but I get another error after compilation |
| 12:21 | manutter | aha |
| 12:21 | raek | xcv: it will break as soon as multiple thread call the function the same time, or a single thread calls the function recursively |
| 12:22 | raek | clojure is not meant to be used this way. you have no guarantees that anything will work. |
| 12:22 | xcv | I know |
| 12:22 | xcv | it's not functional |
| 12:23 | raek | (def inside a function in clojure is like static local variables in C) |
| 12:24 | raek | aslo, taking user-supplied string and unconditionally calling a function with that name is most probably a *serious* security issue |
| 12:24 | xcv | of course |
| 12:25 | xcv | but this is only a small school project that I had to hack together very quickly |
| 12:25 | xcv | and it's too late for me to go back and fix it now |
| 12:25 | __name__ | That's what they all say! |
| 12:25 | __name__ | That's why we had Windows ME. |
| 12:25 | xcv | :P |
| 12:25 | xcv | I would never do this sort of thing in production code |
| 12:27 | raek | it's not just an issue of style... it's an issue of understating what the program even does |
| 12:36 | raek | xcv: sorry for ranting. I'm convinced that you are aware of the issues ;-) |
| 12:36 | xcv | of course |
| 12:37 | __name__ | xcv: WINDOWS ME IS YOUR FAULT! |
| 12:37 | __name__ | Sorry for ranting, I just /had/ to say that to someone. |
| 12:37 | xcv | it's just that I was getting into FP, learning a new language and doing a big project on a very tight deadline, so I didn't follow all the rules for the sake of getting it done |
| 12:38 | manutter | boy do I know the tune to that song... :/ |
| 12:38 | __name__ | xcv: How do you think the MS folks felt about ME? |
| 12:44 | xcv | I wonder why it works in the repl but not after compilation? |
| 12:44 | xcv | that's somewhat of a surprise |
| 12:44 | xcv | that is, if I just read the whole file into a clean repl |
| 12:44 | xcv | and run the -main function with the same args, it works |
| 12:45 | manutter | what are the symptoms of the failure? |
| 12:47 | xcv | I'm getting a null pointer exception from line 187 here http://pastebin.com/XaWEuuSv |
| 12:47 | xcv | but the same works fine in the repl |
| 12:47 | xcv | it's from the call to apply |
| 12:49 | manutter | I think you can get rid of that apply, since you're only calling it on a constant empty list |
| 12:49 | manutter | Might change the error msg at least (?) |
| 12:50 | manutter | :else ((resolve (symbol (str "reduce-" sym))))))))) |
| 12:51 | raek | perhaps the NPE is from resolve (since it returns nil if there is no such var) |
| 12:51 | raek | ,(str nil) |
| 12:51 | clojurebot | "" |
| 12:51 | raek | ,(symbol (str nil)) |
| 12:51 | manutter | or for maintainability: (let [other-fn (resolve (symbol (str "reduce-" sym)))] (other-fn)) |
| 12:52 | manutter | heh, raek had a good thought while I was counting parens in my post |
| 12:53 | raek | xcv: you could try to print the value of 'sym' there |
| 12:53 | manutter | kill 2 birds with one stone: (if-let [other-fn (resolve (symbol (str "reduce-" sym)))] (other-fn)) |
| 12:54 | manutter | does if-let allow you to specify an else clause (like for error handling)? |
| 12:54 | manutter | ,(doc if-let) |
| 12:54 | clojurebot | "([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else" |
| 12:54 | manutter | guess so |
| 12:54 | raek | (if-let [other-fn (resolve (symbol (str "reduce-" sym)))] (other-fn) (throw (Exception. (str "this symbol is crazy, I tell ya: " sym)))) |
| 12:55 | amalloy | manutter: when-let is for when you don't need an else clause |
| 12:56 | manutter | that makes sense |
| 12:57 | manutter | I don't quite follow the reference to & oldform in the docstring for if-let, can someone explain what that means? |
| 12:57 | amalloy | manutter: if-let used to have some different syntax. don't use it |
| 12:58 | amalloy | something like (if-let x 10 true false) |
| 12:58 | raek | I think it's a remnant from old times when if-let didn't have a vector around the symbol and the expression |
| 12:58 | xcv | guys, thanks for all the help |
| 12:58 | xcv | but I've run out of time |
| 12:58 | manutter | cool, thanks |
| 12:58 | manutter | good luck xcv |
| 12:58 | xcv | nice community here |
| 12:58 | xcv | very friendly :) |
| 12:58 | xcv | gl hf |
| 13:10 | ev4l | good morning guys |
| 13:11 | manutter | morning? |
| 13:11 | manutter | Oh, right, internet... |
| 13:11 | manutter | Good morning :) |
| 13:11 | ev4l | manutter: UGT ;) |
| 13:13 | kephale | hrm... |
| 13:13 | kephale | , (let (into [] (mapcat seq {'a 5 'b 7})) (+ a b)) |
| 13:13 | clojurebot | java.lang.IllegalArgumentException: let requires a vector for its binding |
| 13:24 | ev4l | wow, just experienced the reader going crazy when feeding it a messy-spaced multiline map |
| 13:24 | ev4l | it pointed me to an error to my ns declaration |
| 13:25 | amalloy | pics or it didn't happen :P |
| 13:27 | amalloy | (maybe "gist or it didn't happen" is more appropriate here?) |
| 13:29 | ev4l | amalloy: lol, i'm preparing one :D |
| 13:50 | ev4l | amalloy: https://gist.github.com/932121 |
| 13:50 | ev4l | i just used the map in the same format as the gist |
| 13:51 | ev4l | when i removed it, the code would get compiled without errors |
| 13:51 | ieure | ev4l, I think your issue is that you didn’t include the [] for the arguments to your method. |
| 13:51 | clojurebot | 'Sea, mhuise. |
| 13:51 | ieure | So it’s trying to use the map as the docstring for that fn |
| 13:52 | amalloy | ieure: eh? he doesn't have a method |
| 13:52 | amalloy | it's a def |
| 13:52 | ieure | Ah, I see. |
| 13:52 | ieure | That’s what I get for parachuting in. |
| 13:53 | amalloy | &(let [m {"1" 2}] (m "1")) |
| 13:53 | sexpbot | ⟹ 2 |
| 13:54 | ev4l | amalloy: when i laid out the map the same way you did now it worked |
| 13:57 | jkkramer | ev4l: what repl are you using? |
| 13:57 | ev4l | jkkramer: hmm... i was using lein repl |
| 13:58 | freiksenet | is there an analog of asdf:load-op in lein? |
| 13:58 | jkkramer | ev4l: and you got this error when calling (test) or when loading the file? |
| 13:58 | ieure | ev4l, For whatever it’s worth, the last Gist you pasted works fine for me. |
| 13:58 | ev4l | jkkramer: loading the file |
| 13:59 | jkkramer | worked for me too. I regularly spread defs/maps over multiple lines |
| 14:00 | ev4l | hmmm... let me try again here |
| 14:04 | ieure | ev4l, I just fired up `lein repl' and pasted the code in. |
| 14:11 | ev4l | jkkramer: ieure i undoed the code to my initial state and reproduced the error. I copied the map the way it's on my editor |
| 14:12 | ev4l | ev4l: and called lein repl from the project directory |
| 14:12 | amalloy | ev4l: the map is not the problem. i don't know what the problem *is*, but saying "it breaks when the map is like this" isn't useful to reproduce - can you post the surrounding code? |
| 14:14 | ieure | ev4l, That code also works for me when I paste it into `lein repl'. How are you loading the file? |
| 14:18 | patrkris | nå da |
| 14:18 | patrkris | oops |
| 14:37 | ev4l | ieure: In the lein repl i type (use 'crazy-reader) |
| 14:37 | amalloy | ev4l: i doubt it matters here, but don't use single-segment namespaces |
| 14:38 | ev4l | amalloy: oh , i used only for the demonstration. In the original, i use a full one :D |
| 14:39 | ev4l | amalloy: but it's a good thing to know |
| 14:41 | ieure | ev4l, Is there perhaps another crazy_reader.clj on your classpath? |
| 14:42 | ieure | ev4l,h ttps://gist.github.com/7ab089e7e4e0ab16096e |
| 14:42 | ieure | Er, https://gist.github.com/7ab089e7e4e0ab16096e |
| 14:43 | ev4l | ieure: no, that's the only file actually. |
| 14:43 | ieure | Hm. |
| 14:43 | ieure | Sorry, I’m not sure what to tell you. Everything you have pasted works fine for me. |
| 14:44 | ieure | I’m using "Leiningen 1.4.2 on Java 1.6.0_24 Java HotSpot(TM) 64-Bit Server VM", Clojure 1.2.1, & Clojure-Contrib 1.2.0. |
| 14:48 | ev4l | ieure: Leiningen 1.4.2 on Java 1.6.0_24 Java HotSpot(TM) 64-Bit Server VM & Clojure-Contrib 1.2.0 |
| 14:53 | ev4l | amalloy: ieure: surroundng code => https://gist.github.com/932309 |
| 14:53 | ev4l | i'm just toying around with the enlive-tutorials |
| 14:53 | ev4l | add : [enlive "1.0.0-SNAPSHOT"] to the project.clj |
| 14:54 | ev4l | and try to run (require 'crawlers.core) in the lein repl |
| 14:55 | ev4l | if this code compiles in your machines, that's probably some environmental issue |
| 14:56 | raek | ev4l: if you run "file core.clj", what does it say? |
| 14:56 | raek | "UTF-8 Unicode text"? |
| 14:57 | ev4l | raek: wow |
| 14:57 | ev4l | raek: it gives me nothing |
| 14:58 | raek | nothing? which operating system are you using? |
| 14:58 | ev4l | raek: i've never seen that empty output before with 'file' |
| 14:58 | ev4l | mac os x leopard |
| 14:58 | ev4l | i'll try to save the gist into the project directory |
| 14:58 | raek | anyway, clojure source files are encoded using UTF-8 |
| 14:59 | raek | and JLine (which lein repl uses if rlwrap is not installed) has broken UTF-8 support |
| 15:02 | raek | if you eval (seq "Suíços") in the repl and don't get (\S \u \í \ç \o \s) back, then you have an encoding problem |
| 15:05 | ev4l | raek: it seems you are right |
| 15:06 | ev4l | raek: When typing the same map manually it works |
| 15:06 | ev4l | raek: I bet there's a funny character in the text i've copied/pasted initially at the map |
| 15:07 | raek | the dreaded "byte order mark"? |
| 15:08 | raek | as long as your source files are in UTF-8, you have rlwrap installed and have your terminal configured for UTF-8, everything should work |
| 15:08 | ev4l | raek: I evaled at the Lein repl, and ? appeared at the places of í and ç |
| 15:09 | ev4l | (when i pasted the code) |
| 15:09 | LauJensen | Any OSX users in here with a Danish/Nordic keyboard setup ? |
| 15:09 | raek | ev4l: that has happened for me too with JLine |
| 15:11 | raek | (since leiningen 1.5.something, a warning is printed if you don't have rlwrap installed) |
| 15:14 | raek | ev4l: have you tried installing rlwrap? |
| 15:14 | ev4l | that's what i'll do =] |
| 15:14 | ev4l | thanks a bunch guys |
| 15:21 | kolektiv` | hi all, i'm tempted to have a play with clojure, but i'm probably more comfortable in the clr world than the jvm one |
| 15:21 | kolektiv` | i don't really have a feel for whether clojure-clr is at parity, or whether it's likely to bite me in some way |
| 15:22 | kolektiv` | can anyone give me a word of advice? thanks! |
| 15:26 | TimMc | kolektiv`: I certainly don't hear much of anything about it. |
| 15:27 | TimMc | Don't know if that's due to paucity of implementation or interest. |
| 15:27 | kolektiv` | TimMc: that's my hunch - there seems to be very little said, and i'm thinking that will translate in to a lack of support or help if i run in to odd issues... |
| 15:28 | kolektiv` | ...which may not exist in the jvm sphere |
| 15:34 | cemerick | kolektiv`: It's kept pretty up to date with changes happening in HEAD, and I know there are people using it for real work, but there's definitely far less activity around it. |
| 15:35 | cemerick | FWIW, I know of a couple of .NET shops that are now using Clojure and Eclipse for some new projects with success. The transition is apparently reasonable enough, at least in those cases. |
| 15:48 | dnolen | cemerick: I see you've got your controversy quota for the next month or so settled :) |
| 15:48 | cemerick | dnolen: Ooh, what'd I say this time? :-) Or do you simply mean the HN submission? |
| 15:49 | dnolen | cemerick: the submission |
| 15:49 | cemerick | heh, yeah. It's not often I get to go karma-whoring. |
| 15:49 | cemerick | The balance of the discussion panned out nicely, I thought. |
| 15:49 | cemerick | Couple of silly sideshows, but all-around positive. |
| 15:50 | dnolen | cemerick: I see steve_yegge is now an HN User. |
| 15:50 | cemerick | Excellent! |
| 15:50 | cemerick | He should pop in here and we could hash it all out in about 3 minutes. :-P |
| 15:51 | ataggart | Rich gave a good coverage about the single-pass thing, which was edifying. |
| 15:51 | cemerick | dnolen: is there some kind of feed for new handles being registered or something? |
| 15:52 | cemerick | Yeah, that was great. |
| 15:52 | dnolen | cemerick: no his handle is green, signifies new user. |
| 15:52 | ataggart | where did this "clojure users hate macros" meme come from? |
| 15:52 | dnolen | ataggart: unknown. |
| 15:52 | ieure | ataggart, A misunderstanding at best. |
| 15:53 | ieure | A deliberate mischaracterization at worst. |
| 15:53 | ataggart | I blame Christophe's thick accent |
| 15:53 | chouser | ataggart: clojure_conj, I suspect, which had a recurring theme of "beware the overuse of macros" |
| 15:53 | osoleve | why can I not recur outside of the tail position, and why are self-calls discouraged? |
| 15:54 | chouser | osoleve: recur is only slightly more powerful than a goto, and thus only makes sense in a tail position |
| 15:54 | chouser | osoleve: self-calls are perfectly all right, but consume JVM call stack space which is finite |
| 15:54 | cemerick | chouser: afternoon :-) |
| 15:54 | cemerick | bah |
| 15:54 | chouser | cemerick: howdy! |
| 15:55 | osoleve | chouser, so I should use self-calls, save for in tail position, when I should recur? |
| 15:55 | osoleve | ok, thanks |
| 15:55 | cemerick | dnolen: Good luck with the talk tonight. |
| 15:55 | cemerick | Beg someone to record it. :-) |
| 15:56 | dnolen | cemerick: it's gonna be a bit ... rough I think. |
| 16:00 | Raynes | cemerick: Wow @ Steve Yegge's group posts. It's amazing how quickly he went from high praise in the Joy of Clojure forward to... whatever this is. |
| 16:01 | osoleve | general computed science, 0x123 is hex, 0110b is binary... |
| 16:01 | osoleve | whoops, wrong channel :[ |
| 16:01 | choffstein | How can I make sure my maven repo is added to my clojure class path? |
| 16:02 | cemerick | Raynes: you mean: do X, Y, and Z, or "Clojure's dead at the starting gate"? |
| 16:02 | cemerick | Yeah. |
| 16:02 | bulters | Raynes: Is he officially against clojure now? :S |
| 16:03 | Raynes | bulters: Looks like it, comrade. |
| 16:03 | bulters | Only thing I got from that thread is that he doesn't agree with the way the language is designed. |
| 16:03 | ataggart | choffstein: you don't. lein will pull the jars into your rojects classpath |
| 16:03 | bulters | i.e. the process of ~ |
| 16:03 | choffstein | ataggart: but what if I want to use clj? |
| 16:04 | choffstein | ataggart: so if I just want to play with a script or not have to create a whole lein project |
| 16:04 | choffstein | sorry -- I mean the clj repl |
| 16:04 | opqdonut_ | link to yegge's messages? |
| 16:04 | ieure | opqdonut_, http://news.ycombinator.com/item?id=2466731 |
| 16:04 | bulters | + surely; the fact that he 'agitates' in such a way only indicates he want clojure to 'succeed' (definition pending) |
| 16:04 | Raynes | http://groups.google.com/group/seajure/browse_thread/thread/18baa18ffdbdd790/917004da1b517f11 This whole thread, opqdonut_ |
| 16:04 | ataggart | choffstein: you'd have to do what lein does, but manually |
| 16:04 | opqdonut_ | thanks |
| 16:05 | choffstein | Ack. That's ... horrible. |
| 16:05 | choffstein | I assume that is a legacy java issue ? |
| 16:05 | ataggart | choffstein: if you want a common set of dependencies, separate from a lein project, try using cake |
| 16:06 | choffstein | ataggart: basically, I want to do "lein install ...", then jump into the clj repl and play around with the new library |
| 16:06 | Raynes | "If you embrace users, then Rich won't have to publicly beg for money. The |
| 16:06 | raek | ataggart: this you can do with cake |
| 16:06 | Raynes | money will come naturally as an emergent ecosystem. But you need users!" |
| 16:07 | Raynes | Methinks that was a bit too far. |
| 16:07 | cemerick | choffstein: isn't that what `lein repl` is for? |
| 16:07 | choffstein | cemerick: I'm obviously a moro |
| 16:07 | choffstein | *moron |
| 16:08 | cemerick | choffstein: no worries :-) |
| 16:08 | choffstein | herm ... but maybe it isn't working the way I expect it to. |
| 16:09 | ataggart | ok, back to portal2 |
| 16:10 | bulters | Raynes: I'm more worried about the discussion on HN; I'm new to Clojure and will probably need all the help I can get. But indications of people getting "laughed at" always worry me a bit. |
| 16:10 | choffstein | Can I not start a new project and simply do a 'lein install' and 'lein repl' in any directory and have access to the libraries I installed? |
| 16:10 | dnolen | bulters: people are generally nice here, such statements are overblown. |
| 16:10 | Raynes | bulters: I've been here for a while, and I've never seen anything like that. I think people are beginning to make up things about the Clojure community because they have trouble finding real issues. |
| 16:11 | choffstein | bulters: as a clojure moron and local village idiot, I have never once gotten laughed at here |
| 16:11 | bulters | dnolen: I guess so, have been leeching for a while now, didn't see any laughing yet ;-) |
| 16:11 | choffstein | or, at least not while I have been in the chat |
| 16:11 | cemerick | bulters: I cannot remember a single time that anyone has ever been laughed at here. |
| 16:11 | ataggart | choffstein: lein install doesn;t do what you think it does |
| 16:11 | hiredman | cemerick: really? |
| 16:11 | dnolen | bulters: people also don't talk to you like you're stupid here. Can't say count how many times that's happened to me in #python and #ruby. |
| 16:12 | choffstein | ataggart: I figured. It seemed to -- doing 'lein install inflections 0.4.3' put it in my maven repo ... |
| 16:12 | cemerick | hiredman: The log may prove me wrong, I'm sure, but I can't think of a time when it's happened. |
| 16:12 | bulters | dnolen: can't vouch for #python... but am too aware of #ruby |
| 16:12 | choffstein | dnolen: yeah, #ruby and #ror got vicious a couple years back |
| 16:12 | ataggart | choffstein: lein help |
| 16:12 | osoleve | in #lisp they're very mean, too. |
| 16:12 | hiredman | I must have laughed at some point |
| 16:12 | cemerick | hiredman: People certainly have been rude before, which sucks, and I do whatever I can to tamp that down. |
| 16:12 | choffstein | ataggart: lein install can install the project specified... |
| 16:12 | bulters | Seems to be a tendency of rubyists (or rails-ists more particular) to smack down 'newbies'. |
| 16:13 | choffstein | bulters: I think it is because the space is so competitive now |
| 16:13 | bulters | Can see it happening in the office sometimes. |
| 16:13 | ataggart | choffstein: the missing part of that sentence is "... into your local maven repo" |
| 16:14 | choffstein | ataggart: ...but it did |
| 16:14 | bulters | choffstein: which sucks... the only competition i see in programming (itself) is against a deadline; or your competitors |
| 16:14 | KirinDave | I knew I shouldn't have gotten involved in that news.ycomb thread. :( |
| 16:14 | KirinDave | It is only a mistake when I talk to people. |
| 16:15 | choffstein | bulters: I agree. As someone who used Ruby for about 5 years now, it makes me sad. I've pretty much stopped using it for Clojure at this point. |
| 16:15 | ataggart | choffstein: ok then I'm not clear on what you want. create a project; configure the project.clj file to specify what the dependencies are; run lein repl |
| 16:15 | bulters | KirinDave: why is it a bad thing? Did someone get hurt |
| 16:16 | bulters | I mean... physically!? |
| 16:16 | KirinDave | bulters: No. |
| 16:16 | choffstein | ataggart: I don't want to have to create a project. I want to just download a library to my maven repo and run the repl and have the library available. I don't want to have to create a project |
| 16:16 | hiredman | KirinDave: I think the point is a. common lisp is dumb, and b. I will certainly laugh when people do ridiculous things, just like I laugh at america's funniest home videos |
| 16:16 | KirinDave | hiredman: Yes. You were the one I was referring to. Directly. |
| 16:16 | ataggart | choffstein: well it doesn;t work that way. |
| 16:17 | hiredman | KirinDave: :) |
| 16:17 | choffstein | ataggart: Is there any way to do it? Because there should be. I shouldn't have to create a new project just to try out a new library. |
| 16:17 | choffstein | ataggart: I'm assuming my ignorance is getting in my way |
| 16:17 | KirinDave | hiredman: Seriously man. Why you gotta hate on macros? Esp when it ended up being a known issue with aot-compilation in 1.2. |
| 16:17 | arohner | choffstein: you can java -cp clojure.jar:your_new_jar clojure.main |
| 16:17 | ataggart | choffstein: lein is a tool for projects. you don;t want a project. so there's a mismatch |
| 16:18 | KirinDave | Macros: Not dumb sometimes. Anyways. |
| 16:18 | hiredman | KirinDave: hate macros? |
| 16:18 | choffstein | gotcha. alright... |
| 16:18 | dakrone | hiredman hating on macros? |
| 16:18 | KirinDave | I am just stunned weavejester prefers %1 + %2 * 2 vs _ + _ * 2. |
| 16:18 | KirinDave | Pretty bummed that we're in such opposed opinions. |
| 16:18 | hiredman | KirinDave: what happens when you want to refer to the first argument twice? |
| 16:18 | bulters | KirinDave: _'s just look more like prologs anonymous variables ;-) |
| 16:18 | KirinDave | hiredman: You use fn. |
| 16:19 | KirinDave | hiredman: It's a convenience syntax. |
| 16:19 | KirinDave | But also the two are not mutually exclusive. Indeed any improvement to the lambda convenience syntax would require a transitional period. I just find #() prohibitively noisy in my code. |
| 16:19 | cemerick | KirinDave: Is the look of anonymous fn syntax really that much of an irritant that you'd want to pull it for something less useful? |
| 16:20 | hiredman | dakrone: apparently I hate macros |
| 16:20 | KirinDave | cemerick: Well the degree of discourse far outweighs my actual passion for the subject at this point. |
| 16:20 | ataggart | KirinDave: _ + _ is a scala lambda? |
| 16:20 | KirinDave | ataggart: yes. |
| 16:20 | KirinDave | hiredman: Not quite what I said. |
| 16:20 | KirinDave | hiredman: Let's not get into it. |
| 16:20 | KirinDave | cemerick: But yes. |
| 16:21 | hyperboreean | hi guys, how can I find out the absolute path of a file from clojure ? |
| 16:21 | KirinDave | cemerick: I feel the utility of a convenience syntax for anonymous functions is in the readability & brevity it offers. |
| 16:21 | ataggart | hyperborean: (.getPath file) |
| 16:21 | hiredman | KirinDave: "The clojure version is obviously more noisy." doesn't actually seem to be obvious given the disagreement about it |
| 16:21 | KirinDave | cemerick: While #() is very brief, I consider it less than a stellar performer in the reability part. |
| 16:21 | ataggart | or .getAbsolutePath or .getCanonicalPath |
| 16:21 | KirinDave | hiredman: I don't think people are saying, at any point, that the scala version is arguably more noisy. |
| 16:22 | Chousuke | I don't find #() noisy :/ |
| 16:22 | KirinDave | hiredman: The question is the value judgement of reducing the power of the syntax to make it contain less hash. |
| 16:22 | KirinDave | Chousuke: It's a relative thing. |
| 16:22 | bulters | KirinDave: so how DO (for emphasis) you would like to see anonymous functions? |
| 16:22 | Chousuke | the scala version is weird. does _ always refer to the same argument? |
| 16:22 | cemerick | Chousuke: they're positional |
| 16:22 | KirinDave | Chousuke: Nope. it's a blank. It's positional. |
| 16:22 | KirinDave | Yes, that reduces the power of them. |
| 16:22 | cemerick | No rest args either, if memory serves. |
| 16:23 | KirinDave | Correct. |
| 16:23 | Chousuke | That sounds confusing to be honest. |
| 16:23 | KirinDave | Chousuke: I think that evidence suggests it is not. |
| 16:23 | KirinDave | Chousuke: Esp for very simple cases. |
| 16:23 | ataggart | For very simple cases, who cares? |
| 16:23 | hyperboreean | ataggart: thanks |
| 16:23 | KirinDave | ataggart: They come up a lot. |
| 16:23 | cemerick | I don't think there's much of anything like "evidence" re: programming language design. |
| 16:23 | ataggart | de gustibus non est disputandum |
| 16:24 | ataggart | I don;t see how you could have a "better" syntax for an anonymous function. |
| 16:24 | ataggart | I'd like to see it though |
| 16:24 | ataggart | one that isn;t just syntax magic |
| 16:24 | Chousuke | I can sort of see how #() might get unreadable if you overdo it but usually it's pretty easy I think. |
| 16:25 | KirinDave | What is #() but syntax magic anyways? |
| 16:25 | hiredman | there was just some ibm article linked somewhere about quantitative language design |
| 16:25 | bulters | Chousuke: then don't overuse it :P |
| 16:25 | Chousuke | bulters: yeah :P |
| 16:25 | KirinDave | I just don't get why people like having perlisms in their code. |
| 16:25 | ataggart | KirinDave, from the examples you gave on hn, it seems your problems were with parenthesis/prefix-notation |
| 16:25 | KirinDave | %1 %2, etc. |
| 16:25 | KirinDave | So perlish. |
| 16:26 | KirinDave | ataggart: hardly. |
| 16:26 | bulters | Chousuke: I thing in about every language you can overuse some features, perl has sigils, python has whitespace (sorry :P), ruby has prettification |
| 16:26 | ataggart | then please suggest a workable alternatuve |
| 16:26 | bulters | think** |
| 16:26 | cemerick | KirinDave: I think it was originally intended to align with e.g. format |
| 16:26 | stabin | Hi all, trying to call getSuperclass() method on some Class instance. The first, straightforward code I wrote did not work - (. java.util.ArrayList getSuperclass) tries to call static method on ArrayList and fails with NoSuchMethod. Slightly modified version works: (let [foo java.util.ArrayList] (. foo getSuperclass)). Just curious - is there any way to write this without intermediate variable (which just does not seem nice to me)? |
| 16:27 | KirinDave | cemerick: Okay. |
| 16:27 | Chousuke | KirinDave: you need to change your font so that % is something more visually pleasing :D |
| 16:27 | KirinDave | Chousuke: Like unicode snowman |
| 16:27 | KirinDave | ataggart: We could start by making % substitutable with _ for single argument lambdas. |
| 16:27 | bulters | Now THAT would be a huge improvement |
| 16:27 | Chousuke | Yes, ☃ for everyone |
| 16:28 | hiredman | ·! |
| 16:28 | cemerick | stabin: The "lone dot" form of interop is the most primitive, and rarely used; try (.getSuperclass java.util.ArrayList) |
| 16:28 | ataggart | KirinDave: except that woud break the community standard of using underscores for ignored parameters |
| 16:28 | KirinDave | ataggart: It doesn't have to. |
| 16:28 | KirinDave | ataggart: How would that ever collide? |
| 16:28 | Chousuke | KirinDave: it wouldn't but it'd overload the meaning of _ |
| 16:28 | stabin | cemerick: thanks, it works and looks nice enough :) |
| 16:28 | hiredman | (fn [_] #(+ _ _)) |
| 16:29 | KirinDave | Chousuke: No one asked for a perfect solution, only a workable one. |
| 16:29 | hiredman | collision |
| 16:29 | bulters | KirinDave: It introduces 'ambiguity' the accepted use of _ as a throwaway placeholder, or as a language construct in the case of a lambda |
| 16:29 | Chousuke | hiredman: not really, in that case the _ function parameter is just shadowed |
| 16:29 | Chousuke | hiredman: and since you're ignoring it, closing over it is not what you want |
| 16:30 | bulters | KirinDave: no sweat; nobody got hurt (yet ;)) |
| 16:30 | KirinDave | hiredman: Besides, I said in % cases. |
| 16:30 | KirinDave | Few people would actually WANT that piece of code, so if it's an ugly edge case, it's probably not a foul. |
| 16:30 | ataggart | so to be clear, #(foo _(bar _ _) _) is cool? |
| 16:30 | KirinDave | What is _( |
| 16:30 | ataggart | a missing space |
| 16:31 | KirinDave | Ah |
| 16:31 | Chousuke | so does that take 4 arguments or just one? :/ |
| 16:31 | ataggart | 4 |
| 16:31 | KirinDave | I suppose, although again few people would write #(foo % (bar % %) %) |
| 16:31 | bulters | #(foo % (bar % %) %) |
| 16:31 | bulters | hmm |
| 16:31 | ataggart | but % is an alias for %1 |
| 16:31 | KirinDave | Actually for now, we're saying _ means first argument. So it'd be _ => %1 |
| 16:32 | ataggart | I;m trying to guage what you find distasteful, aesthetically |
| 16:32 | ataggart | I bet you could write a macro to do that underscore/positional thing |
| 16:33 | KirinDave | Yes. |
| 16:33 | KirinDave | Its easy. |
| 16:33 | ataggart | do eet |
| 16:33 | KirinDave | It's in com.banksimple.clj-utils. Will be open sourced soon enough. |
| 16:33 | KirinDave | It's just... it's of more value to readers than writers. |
| 16:34 | ataggart | I'm inclined to think anything like that should probably not be an anonymous fn |
| 16:34 | cemerick | KirinDave: Perhaps it's fair to say that the underscore syntax is most valuable with those that are used to underscore syntax… |
| 16:34 | cemerick | s/with/to |
| 16:34 | sexpbot | <cemerick> KirinDave: Perhaps it's fair to say that the underscore syntax is most valuable to those that are used to underscore syntax… |
| 16:34 | bulters | ataggart: that's a complete different discussion i guess. |
| 16:34 | KirinDave | cemerick: Of which there is probably a greater number than those familiar with #( %1) syntax, as that's like pretty much only clojure. :) |
| 16:35 | ataggart | %1 |
| 16:35 | ataggart | nor #(%1) |
| 16:35 | ataggart | s/nor/not |
| 16:35 | sexpbot | <ataggart> not #(%1) |
| 16:35 | ataggart | sonce we'd keep the #(), right? |
| 16:35 | KirinDave | ataggart: Maybe? |
| 16:35 | cemerick | KirinDave: positional underscores being the most widely-known anon fn syntax? |
| 16:36 | ataggart | could we mix and match _ with %n? |
| 16:36 | KirinDave | cemerick: I suspect the most widely known fn syntax is function() {} or perhaps { |x| ... } |
| 16:36 | KirinDave | ataggart: Perhaps. |
| 16:37 | technomancy | % clearly has more pixels than _ |
| 16:37 | KirinDave | It has a higher ascender too. |
| 16:37 | KirinDave | :) |
| 16:37 | cemerick | KirinDave: I know, I was being sarcastic re: how _ is so well known :-) |
| 16:37 | KirinDave | cemerick: Haskell and ocaml, right? |
| 16:37 | KirinDave | Although for slightly different meanings |
| 16:37 | KirinDave | Like I said tho, the degree to which the debate has grown far outstrips my personal passion for this issue. |
| 16:37 | cemerick | KirinDave: Clearly evidentiary. ;-) |
| 16:37 | Chousuke | what was that quote about the relation between the amount of discussion and the importance of an issue? :) |
| 16:38 | KirinDave | It's easy to spiral off into endless debates about syntax minutiae . |
| 16:38 | KirinDave | Something I care far more about is scheme-style pattern macros. |
| 16:38 | bulters | but the fact that you can change it yourself says enough about clojure I guess... |
| 16:38 | Chousuke | Well those you can implemen as a library I think |
| 16:39 | cemerick | KirinDave: someone was working on those in here just a little while ago… |
| 16:39 | Chousuke | I'm sure some people would welcome such an effort. Personally, I find Clojure's system nice enough. |
| 16:39 | KirinDave | Chousuke: You can, and clojure actually does a lot of the work for you. |
| 16:39 | dnolen | cemerick: as qbg, it's now abandoned as far as I can tell, and the scope was too large. |
| 16:39 | ataggart | I'll say this much: KirinDave's kvetching seems to have more substance than yegge's |
| 16:39 | dnolen | s/as/was |
| 16:39 | sexpbot | <dnolen> cemerick: was qbg, it's now abandoned was far was I can tell, and the scope wwas too large. |
| 16:39 | Chousuke | Though it might just be that I don't know what I'm missing. |
| 16:40 | KirinDave | ataggart: I actually know a few dialects of lisp, Yegge doesn't really. |
| 16:40 | ataggart | release that macro! |
| 16:40 | dnolen | KirinDave: my question is why don't you build this macro frontend push it into contrib? that's the only reason it hasn't happened as far I can tell. |
| 16:40 | cemerick | https://github.com/qbg/syntax-rules |
| 16:40 | KirinDave | Chousuke: Pattern-based macros great for a lot of macros because they bring error reporting to the table. Got an error in your macro? Good luck with that. |
| 16:40 | cemerick | dnolen: abandoned, really? |
| 16:40 | KirinDave | dnolen: I should. |
| 16:40 | KirinDave | Oh rad. |
| 16:40 | KirinDave | I hadn't seen this yet. |
| 16:41 | ataggart | KirinDave: I thought clojure had pattern macros |
| 16:41 | ataggart | coulda sworn |
| 16:41 | bulters | KirinDave: That's more of a debugging thing right? :P |
| 16:41 | dnolen | cemerick: last commit in Jan, I followed it closely. |
| 16:41 | KirinDave | bulters: No, they often are shorter and more declarative than defmacro macros, too. |
| 16:41 | cemerick | dnolen: maybe it's simply perfect as it is. :-P |
| 16:41 | ataggart | KirinDave: is this what you mean? http://clojure.github.com/clojure/clojure.template-api.html |
| 16:41 | KirinDave | ataggart: That's kinda the start of it. |
| 16:41 | bulters | KirinDave: I was referring to the error thing |
| 16:42 | technomancy | didn't clojure.template get promoted solely to support clojure.test? it's my recollection nobody else has ever used it. |
| 16:42 | KirinDave | bulters: Well yeah, but an error in a macro can be a terrible thing. See also enlive when your html file is missing. |
| 16:42 | KirinDave | bulters: See http://pre.racket-lang.org/docs/html/guide/pattern-macros.html |
| 16:42 | KirinDave | bulters: rotate is a good macro to check out the implementation in defmacro of. |
| 16:43 | KirinDave | it's _much_ less obvious what's going on there. |
| 16:43 | choffstein | Okay. I think I am still really confused. In ruby, I can do a "gem install" and after setting gem_path, "require" from irb and play with the new library without ever having to set up a new project. With lein, I can do "lein install library version" and get the library into my maven repo. Can I somehow set my java class path so that when I use clj I can just (use ...) the new library? |
| 16:43 | dnolen | KirinDave: I would love to see a faithful implementation of syntax-rules w/o a bunch of extra stuff. qbg was working on error detection but didn't get very far I think. |
| 16:43 | ataggart | choffstein: because you local maven jars are not made available to every java instance |
| 16:43 | technomancy | choffstein: you probably want cljr or jark or some such. leiningen is for managing projects. |
| 16:43 | KirinDave | dnolen: I should get on that. Having a serious startup job has really kicked the legs out from under my independent hacking efforts. |
| 16:43 | ataggart | choffstein: that's what the classpath is for |
| 16:44 | choffstein | ataggart: But can I make them? |
| 16:44 | ataggart | them? |
| 16:44 | choffstein | ataggart: my jars available to every java instance. |
| 16:44 | KirinDave | A lot of people from common-lisp vampire bloodlines are not familiar with how badass syntax rules can get. |
| 16:44 | ataggart | no |
| 16:44 | choffstein | I obviously am having trouble comprehending the "java way" |
| 16:44 | ataggart | bad idea is bad |
| 16:45 | technomancy | choffstein: it certainly comes down to a weakness of the JVM |
| 16:45 | choffstein | Can you explain why, por favor? I assume something to do with how the JVM works? |
| 16:45 | dnolen | KirinDave: for day-to-day macros, they are much more readable, for more involved transformations, yuk. |
| 16:45 | bulters | KirinDave: Ok, so probably this discussion is not really 'my place'; since I have little to no understanding of macro internals (i.e. how they work internally) |
| 16:45 | technomancy | choffstein: you can't reliably change the classpath at runtime |
| 16:45 | ataggart | choffstein: get cake, configure the default project.clj and be done with it |
| 16:45 | ataggart | unless lein aded support for a default project.clj |
| 16:46 | KirinDave | dnolen: Yep. That's why one needs both. |
| 16:46 | choffstein | ataggart: how does that help if I install a new library? |
| 16:46 | bulters | KirinDave: But the proplem you state is that debugging in such a macro (perhaps more complex) is difficult due to the fact that - in clojure - it's based on normal macros? |
| 16:46 | KirinDave | dnolen: defmacro is the portable particle cannon. syntax-rules is the raygun. |
| 16:46 | KirinDave | bulters: Syntax rules macros are based on pattern matchers. |
| 16:46 | choffstein | ataggart: I don't want to have to edit the projects.clj file. That's my whole point. I don't want a project. I want to just play in a repl. |
| 16:46 | Chousuke | bulters: clojure's macros are pretty simple... Just a datastructure transformation, basically |
| 16:46 | KirinDave | Chousuke: yes. |
| 16:46 | KirinDave | bulters: So you basically define little declarative programs to do syntax transformation |
| 16:46 | ataggart | choffstien: it doesn;t work like that. sorry. |
| 16:47 | KirinDave | bulters: The generation of these programs could include error reporting. |
| 16:47 | Chousuke | bulters: syntax-quote and such things are just tools to make creating code data structures easier |
| 16:47 | cemerick | choffstein: I'm not familiar with Ruby; what happens when you have multiple versions of the same library installed? |
| 16:47 | KirinDave | cemerick: You suffer in despair. OR you know about it and use gem_require with a version tag. Which usually works. Not always. |
| 16:48 | ataggart | choffstien: classpath is a pin to adapt to when youi;re used to "installing" libraries that are globally available. But it has its advantages too |
| 16:48 | choffstein | cemerick: do you mean libraries A and B depending on different versions of C? All taken care of behind the scenes. |
| 16:48 | choffstein | cemerick: And you can specify a version you want to use when you require the library |
| 16:49 | bulters | KirinDave: So a syntax rule is like a - and please excuse my oversimplification - syntactic sugar macro? |
| 16:49 | ataggart | choffstien: why the aversion to specifying what your dependencies are explicitly? |
| 16:49 | cemerick | choffstein: ah -- you want something like Groovy's grape, but for Clojure. |
| 16:49 | choffstein | ataggart: okay. So if you want to try out a new library in isolation, how do you do it? |
| 16:50 | ataggart | open project.clj, add the dependency, run cake |
| 16:50 | KirinDave | bulters: Yes, but it's not exactly a 1:1 translation |
| 16:50 | KirinDave | bulters: Most syntax-rules macros produce program fragments which can then be fed to defmacro |
| 16:50 | choffstein | gotcha. so just create a 'playground' project, add the dep, install, run the repl and have fun |
| 16:50 | KirinDave | (and when I say this I say this in a conceptual sense, it is not literally what happens) |
| 16:50 | bulters | KirinDave: but that's true for normal macro's as well right? |
| 16:51 | cemerick | choffstein: no need to install in that context |
| 16:51 | KirinDave | bulters: Yes, but normal macros are imperative. |
| 16:51 | ataggart | choffstien: no install; delete install from your vocabulary |
| 16:51 | choffstein | okay. removing it from my vocabulary. |
| 16:51 | KirinDave | Syntax-rules are declarative, so you end up with a more powerful (albeit somewhat restricted) set of functionality. |
| 16:51 | choffstein | ;) |
| 16:52 | choffstein | And that process is necessary because of JVM requirements, or just because nobody has built the right tool? |
| 16:52 | Raynes | choffstein: Cake has a concept of a default project. That is, a top-level project that you can put dependencies in like you would normally and then when you run commands (such as cake repl) outside of a project (such as just to get an REPL running), cake will use that global project. This is probably what you're looking for. |
| 16:52 | cemerick | choffstein: the latter |
| 16:52 | KirinDave | choffstein: Some from column a, some from column b. We are bound, at some point, to the ecosystems of the java world. |
| 16:52 | Raynes | That process is necessary because you aren't using cake or jark, from what I can gather. |
| 16:52 | choffstein | Raynes: Seems sort of like what I am looking for ... but I don't really want to have to specify the deps. I'd rather just everything be included by default. Or, have it dynamically get included as I use it... |
| 16:53 | KirinDave | As interesting as this has been, I really should get back to work. For those I offended, I beg pardon. :) |
| 16:53 | Raynes | Right, understood. |
| 16:53 | cemerick | choffstein: Groovy provides a dynamic classpath extension mechanism that is maven-repo-aware called grape. I've thought about giving a shot at implementing a corollary for Clojure, but it's not been a high priority for me. |
| 16:54 | choffstein | cemerick: taking on that project may be above my clojure abilities, but I'll check it out. Thanks :) |
| 16:54 | bulters | KirinDave: Sorry for being such a noob on this. Thanks for putting up :P |
| 16:54 | Raynes | cemerick: It should be. It would be so much easier to explain things with something like that around. |
| 16:55 | cemerick | Raynes: Oh, I'll get right on it, then. ;-) |
| 16:55 | Raynes | Good boy. :p |
| 16:55 | bulters | *keeps refreshing cemerick's github page* |
| 17:00 | hyperboreean | I need some help with this issue: http://pastebin.com/fVikhX5Y ; is it coming from lein or is just me doing something wrong ? Thanks :-) |
| 17:05 | arohner | hyperboreean: try lein run -m gen-bundle.core |
| 17:05 | arohner | i.e. - rather than _ |
| 17:06 | ataggart | (ns gen_bundle.core) |
| 17:07 | arohner | doesn't lein run require there be a main method? |
| 17:08 | raek | the lein run that comes with leiningen nowadays does, the plugin it was based on doesn't |
| 17:09 | raek | hyperboreean: quick fix: change (ns gen_bundle.core) into (ns gen-bundle.core) and rename do-something to -main |
| 17:09 | bulters | *off to work* |
| 17:10 | raek | (the filename should still be gen_bundle/core.clj and the command as arohner showed) |
| 17:13 | hyperboreean | raek: that worked, thanks |
| 17:21 | raek | hyperboreean: oh, and remove the call to (-main), since lein will call it for you |
| 17:35 | semperos | trying out the vim Clojure dev experience; using pathogen, trying to use paredit.vim (copied out of Slimv) with Vimclojure, can't seem to get paredit.vim loaded; any takers? |
| 17:47 | devn | cemerick: hurry up with the atlas already! |
| 17:49 | cemerick | devn: :-D |
| 17:49 | cemerick | I'm burning down the rough cut of the ontology right now. |
| 17:49 | devn | cemerick: also, anything I/we can do to help? |
| 17:50 | cemerick | Only ~300 vars to go. |
| 17:50 | devn | just core at the moment or are you taking it further? |
| 17:50 | cemerick | Yeah, just the standard lib. |
| 17:51 | cemerick | Once I have a rough cut of the ontology, I'm bringing in a couple of beta testers. |
| 17:51 | cemerick | Once it doesn't absolutely, completely suck, I'll open things up entirely. The thing probably won't be functionally done for another month or so though. |
| 17:51 | cemerick | Lots of content to be written. |
| 17:51 | devn | pick me! |
| 17:52 | cemerick | devn: Shoot your email to help@clojureatlas.com :-) |
| 17:52 | cemerick | The private beta list is now closed. |
| 17:52 | amalloy | hah |
| 17:54 | cemerick | devn: Thanks for the offer of help, but I'm going solo on this one, at least until it's out there. Then people can raise tickets and such through uservoice as needed. |
| 17:55 | devn | cemerick: *nod* |
| 17:56 | cemerick | I've yet to formulate a proper plan for third-party libs though. Lots of options. |
| 17:58 | devn | http://news.ycombinator.com/item?id=2467809 |
| 17:58 | devn | ^cool. |
| 17:59 | devn | cemerick: Yeah, not an easy one I'm sure |
| 17:59 | devn | cemerick: i would imagine there's an extremely active effort to avoid scope-bloat on your first pass |
| 18:00 | cemerick | devn: if things go *really* well, I'd like to build similar services for other languages. That will necessitate some process for collaborations, etc. |
| 18:00 | devn | cemerick: reporting programs vs transactional programs and all of the inherent complexity that falls out of the combination of those systems... |
| 18:01 | devn | cemerick: very cool -- ive had an idea for awhile that runs parallel to yours I think: a semi-agnostic relationship-finder-thing for source code |
| 18:02 | devn | I was thinking about it while playing with Racket -- I really enjoyed the way you could mouseover and see arrows between bound vars, etc. |
| 18:02 | cemerick | I haven't touched racket / PLT in sooo long… |
| 18:03 | devn | I've just been toying around going back to the "roots" so to speak |
| 18:04 | devn | So much history to glean ever since I began to <3 lisp |
| 19:01 | osoleve | how do i test if a character is a digit-char? |
| 19:01 | osoleve | e.g. \3 => true, \a => false |
| 19:01 | amalloy | &(Character/isDigit \a) |
| 19:01 | sexpbot | ⟹ false |
| 19:01 | amalloy | &(Character/isDigit \b) |
| 19:01 | sexpbot | ⟹ false |
| 19:01 | amalloy | &(Character/isDigit \1) |
| 19:01 | sexpbot | ⟹ true |
| 19:01 | osoleve | thank you |
| 19:02 | osoleve | amalloy, you missed my substantive question earlier! D: |
| 19:02 | amalloy | oh, on SO? yeah, i was asleep when you posted it and the answers seemed adequate by the time i saw it |
| 19:02 | osoleve | no, here. |
| 19:03 | osoleve | did i post on s/o? hm |
| 19:03 | amalloy | no, probly not |
| 19:03 | osoleve | weird thing is, i dreamt i did |
| 19:03 | osoleve | so i genuinely wasn't sure |
| 19:03 | amalloy | osoleve: but there was someone whose name i don't remember. he asked a question in the comments, and i was like "plz post a real question" |
| 19:03 | amalloy | figured maybe it was you |
| 19:04 | osoleve | hahaha |
| 19:04 | osoleve | no, i'veyet to post anything Clojure-related on there |
| 19:29 | seancorfield | i have a situation where i need a particular symbol to only exist after another function is called |
| 19:29 | seancorfield | my temptation is to put the (def some-symbol ...) inside the body of (defn other-fn ...) |
| 19:29 | seancorfield | it works but ... it feels dirty |
| 19:29 | hiredman | def has nothing to do with symbols |
| 19:30 | seancorfield | bad phrasing on my part |
| 19:30 | hiredman | def creates vars |
| 19:30 | seancorfield | yes, i know really |
| 19:30 | hiredman | there are other ways to create vars |
| 19:30 | seancorfield | pretend i said var instead of symbol :) |
| 19:30 | hiredman | you may be better over using something like a promise |
| 19:31 | seancorfield | well, this is part of an API that is called from outside |
| 19:32 | seancorfield | if i have a top-level (def my-var ...) then it is defined and bound when the ns is loaded, right? |
| 19:32 | hiredman | yes |
| 19:32 | seancorfield | but i need it to be an error to attempt to reference my-var until other-fn has been called by the external code |
| 19:33 | KirinDave | Well, I may be wrong... |
| 19:33 | hiredman | sounds like a bad idea |
| 19:33 | KirinDave | But at least I am not outdated. |
| 19:33 | seancorfield | i did say it felt dirty :) |
| 19:33 | KirinDave | Like this guy, who is both wrong and terribly outdated: http://corbinsimpson.com/entry/take-a-bow |
| 19:33 | seancorfield | (but it does work) |
| 19:33 | hiredman | what you want is somethine like (def x (delay do stuff)) then (force x) at the start of your functions |
| 19:34 | hiredman | and x should be :private |
| 19:34 | seancorfield | why :private ? |
| 19:34 | hiredman | if it isn't part of the api, don't expose it |
| 19:35 | seancorfield | it _is_ part of the API but it isn't valid until the other-fn has been called |
| 19:35 | pdk | ,(* (/ 770 1024) 100) |
| 19:35 | clojurebot | 9625/128 |
| 19:35 | hiredman | seancorfield: part of in what sense? |
| 19:35 | pdk | :| |
| 19:35 | pdk | ,(double (* (/ 770 1024) 100)) |
| 19:35 | clojurebot | 75.1953125 |
| 19:35 | hiredman | is it a function? |
| 19:36 | seancorfield | the outside code must be able to reference this as a variable that has been evaluated (to a map) but only after it calls other-fn |
| 19:36 | hiredman | :( |
| 19:36 | hiredman | why? |
| 19:36 | clojurebot | why not? |
| 19:36 | seancorfield | it's a weird edge case but them's the requirements |
| 19:36 | hiredman | I doubt it |
| 19:37 | hiredman | it sounds kind of like a resource that you open, get some kind of 'cookie' passthrough another set of functions, then close |
| 19:37 | hiredman | in which case there are ways to do that (with-open [..]) etc |
| 19:37 | seancorfield | after calling other-fn, my-var is valid and can be accessed for the rest of the life of the program |
| 19:37 | seancorfield | the outside code is _not_ clojure |
| 19:37 | hiredman | so? |
| 19:38 | hiredman | doesn't mean it has to be bad |
| 19:38 | seancorfield | there is no "close" here |
| 19:38 | seancorfield | consider other-fn to be some sort of initialization for the rest of the stuff in that namespace |
| 19:38 | hiredman | if you really want this, as I said, I would use a promise, which would atleast avoid race conditions |
| 19:40 | seancorfield | i don't think outside code can deal with a deref'able object but i'll check |
| 19:42 | alekx | hi all! Is Compojure still the simplest web framework in Clojure? |
| 19:42 | seancorfield | hmm, actually i might be able to use a derefable |
| 19:43 | trptcolin | alekx: define simple :) |
| 19:43 | technomancy | vars are IDeref. |
| 19:43 | brehaut | alekx: i think that depends on how you measure simple |
| 19:43 | alekx | basic (?) |
| 19:43 | brehaut | alekx: if you mean easiest to get off the ground quickly, then yes |
| 19:43 | alekx | let's say something that would allow a Clojure newbie to get started easier |
| 19:43 | trptcolin | compojure's great, yeah |
| 19:44 | brehaut | alekx: i personally find that moustache is actually simpler in practise, but it comes at a cost of being a little less… obvious |
| 19:44 | alekx | (the Clojure newbie is me is there're any doubts :) |
| 19:44 | alekx | used moustache before... but isn't that just a template engine? |
| 19:44 | brehaut | alekx: i have a blog draft about all this if you would be interested in proof reading |
| 19:44 | brehaut | alekx: different moustache i believe |
| 19:45 | brehaut | alekx: moustache in clojure fills a very similar role to compojure |
| 19:45 | alekx | brehaut: absolutely |
| 19:45 | alekx | brehaut: I'm not much into moustaches so the only one I knew about is the templating engine |
| 19:46 | alekx | someone told me about #clothesline... any feedback? |
| 19:46 | alekx | short story: Clojure newbie with new CloudFoundry account willing to push both forward |
| 19:47 | trptcolin | that sounds like a question for KirinDave ^ |
| 19:47 | KirinDave | What does? |
| 19:47 | trptcolin | alekx was asking about clothesline |
| 19:47 | KirinDave | Ahh |
| 19:47 | KirinDave | I like it. :) |
| 19:48 | trptcolin | i hear you had something of a hand in that |
| 19:48 | trptcolin | :) |
| 19:48 | KirinDave | yes, there are many of my opinions in that code. |
| 19:48 | KirinDave | Although excitingly enough, I just got some good patches for it. |
| 19:48 | KirinDave | Most of my projects die in obscurity. |
| 19:48 | trptcolin | i've been wanting to look into it, just haven't had a chance to yet |
| 19:49 | brehaut | likewise |
| 19:49 | alekx | summarizing: 1) compojure seems to remain the top one; 2) there's also (some) moustache and clothesline |
| 19:49 | alekx | but for a #Clojure newbie Compojure should be quite easy to get started |
| 19:50 | alekx | thanks |
| 19:50 | brehaut | alekx: its important to note that none of them are frameworks in isolation |
| 19:50 | trptcolin | alekx you might also take a look at http://mmcgrana.github.com/2010/03/clojure-web-development-ring.html |
| 19:50 | technomancy | alekx: doesn't cloudfoundry already support Clojure via war deployment? |
| 19:50 | brehaut | alekx: they are all libraries in an ecosystem |
| 19:51 | trptcolin | compojure is built on top of ring |
| 19:51 | trptcolin | or ring extracted from compojure, or some similarly close relationship |
| 19:51 | alekx | technomancy: I assume you should be able to deploy it with a war... but I still need to build my app right? :) |
| 19:51 | brehaut | ring grew seperately to compojure, andthen compojure was rewritten in terms of it |
| 19:52 | alekx | ring is something related to request/response processing? |
| 19:52 | brehaut | (at 0.4.0, at which is also when clout and hiccup became their own projects) |
| 19:52 | technomancy | alekx: the lein-ring plugin turns ring projects into war files |
| 19:52 | alekx | well, I'll have to read first, as I don't want to abuse your time |
| 19:52 | ieure | I have hacked on some Compojure/Ring stuff, and it has been incredibly pleasant. |
| 19:52 | KirinDave | lein-ring is pretty cool for elastic beanstalk deploys. |
| 19:53 | brehaut | alekx: its an interface for http functions |
| 19:53 | ieure | The lein-beanstalk plugin is also amazing. |
| 19:53 | ieure | Yeah. |
| 19:53 | KirinDave | I've sent clothesline services To The Cloud that way. |
| 19:53 | technomancy | alekx: not to say there's nothing to be done, but it might involve more documentation than coding |
| 19:53 | ieure | if __name__ == '__main__': print "Wrong channel" |
| 19:53 | __name__ | Wrong channel. |
| 19:54 | alekx | thanks a lot guys |
| 19:55 | seancorfield | hiredman: i was able to use a derefable object in the end - i tested it with an atom but i might look at a promise since that would be cleaner i think |
| 19:55 | hiredman | definitly |
| 20:11 | devn | ,(doc reify) |
| 20:11 | clojurebot | "([& opts+specs]); reify is a macro with the following structure: (reify options* specs*) Currently there are no options. Each spec consists of the protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodName [args+] body)* Methods should be supplied for all methods of the desired protocol(s) and interface(s). You can also define overrides for meth... |
| 21:23 | osoleve | what's the call stack limitation on the JVM? |
| 21:30 | amalloy | osoleve: question too vague? the limitation is, when you have a call stack too deep to be contained within the limits set at jvm start time, it breaks |
| 21:31 | chewbran1a | hi all, what's the best way to handle using a github repo as a dependency in leiningen? basically I need to use a patched version of clj-http not available on clojars, and to make it more complicated, I'm using other libraries that depend on a clj-http version from clojars, not sure how to handle this |
| 21:31 | osoleve | hmm, okay. then there must be a show-stopping bug somewhere in my code that's causing this. |
| 21:31 | osoleve | thanks |
| 21:42 | brehaut | chewbran1a: lein install will install a local version |
| 21:43 | brehaut | chewbran1a: but there is no way to depend on a repo in lein (by design) if i recall correctly |
| 21:43 | amalloy | brehaut: checkout dependencies? |
| 21:44 | brehaut | amalloy: pass |
| 21:44 | amalloy | i don't use lein, but isn't that what they're for? |
| 21:44 | brehaut | i didnt think it had them. im likely wrong though |
| 21:45 | brehaut | huh |
| 22:02 | devn | chewbran1a: figure it out yet? |
| 22:04 | devn | chewbran1a: fwiw you could setup a really simple FTP repository for your version and set :repositories {"my-repo" {:url "http://.../foo"}} |
| 22:04 | devn | chewbran1a: https://github.com/technomancy/leiningen/blob/master/sample.project.clj |
| 22:16 | chewbran1a | brehaut: devn yeah the local repository is a good idea, only issue is that one of the other clojars I'm using depends on clj-http 0.1.1 and I'm using a patched version of 0.1.2, so not sure how thats going to work |
| 22:16 | chewbran1a | sorry for the delayed response, in the process of messing with this I completely broke some other dependencies and now I'm trying to fix that |
| 22:27 | johnmn3 | hi |
| 23:33 | gjahad__ | hey phil, i sent you email |
| 23:35 | gjahad__ | about swank-cdt |
| 23:36 | gjahad__ | the problem is it can't find tools.jar |