#clojure logs

2011-04-20

00:00technomancyit looks like that class is in the default package; consider moving it to a package instead
00:00technomancyunclear if that's the cause, but it's good hygiene
00:00xcvok
00:00technomancyhrm; gotta take off for a few; might be able to look more later.
00:00xcvthanks for the help!
00:00xcvI'll try hacking at it a bit more
00:09carllercheif 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:10brehautcarllerche: if its a pair of things rather than an association then a vector
00:10brehautcarllerche: it makes for more natural destructuring for instance
00:10carllerchehmm... true
00:11brehautcarllerche: MapEntrys look like vectors too ;)
00:11brehaut,(type (first (seq {:a 1})))
00:11clojurebotclojure.lang.MapEntry
00:11brehaut,(first (seq {:a 1}))
00:11clojurebot[:a 1]
00:11carllerchecool, thanks
00:11carllercheI guess I'll go w/ a vector for now and see where it goes
00:12brehautcarllerche: go with a vector until a) other requirements emerge or b) it gets to be a performance issue then use a record
00:13carllerchewill do
00:19KirinDaveHum
00:19KirinDaveYegge _does_ have a point about Clojure's community being more scheme and haskell expats than Common Lisp expats.
00:19KirinDaveAlthough, you'd think we'd have MBE by now if that were an overwhelming bias.
00:21xcvtechnomancy: I moved the java files into a package as you suggested, but 'lein uberjar' hangs just the same.
00:26technomancyxcv: ok, if you send me the java file I can try it here
00:26technomancyxcv: you probably want to get this into version control soon though.
00:27technomancyin fact, learning that may be more important than learning clojure =)
00:27ataggartjohnmn3: enlive might do what you want. http://github.com/swannodette/enlive-tutorial
00:27technomancynot to say you can't do them at the same time
00:30technomancyKirinDave: he did kind of get goaded into posting before he was ready.
00:30KirinDavetechnomancy: Probably true.
00:31technomancyI'll wait for the director's cut before I get offended.
00:33xcvtechnomancy: 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:34xcv(these are the only java files, that is)
00:35mecWhat do I do if I'm using a deftype with 2 protocols that both have the same fn
00:36technomancyxcv: that should even compile; your java file says the class is lexer.SchemeLexer, but Clojure is looking for just SchemeLexer
00:37amalloymec: (extend-type MyType Proto1 (the-fn [this] ...) Proto2 (the-fn [this] ...)), i think
00:38xcvtechnomancy: sorry about that, I updated the import statement to match the packaging: http://pastie.org/1814234 (it compiles on my end)
00:38amalloyie, just what you would do if they had different names
00:39amalloythough i don't think the two protocols can be declared in the same namespace - they'd both try to define myns.the-fn
00:41technomancyxcv: 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:41technomancyin general you should just base your projects off the skeleton that "lein new" gives you.
00:43amalloytechnomancy: down with the man! don't let lein tell you what to do!
00:43technomancyamalloy: if you sayjure so
00:43ataggartamalloy: deftype emits the protocol fns as methods, so it'll fail on duplicate method signature (assuming they have the same arity)
00:44amalloyataggart: that's why i used extend-type
00:44ataggartah very good
00:45amalloybut thanks for clarifying the fact that that's a necessary component
00:46ataggartjust checked, and you are correct, extend type lets you do it no prob
00:48xcvtechnomancy: that worked!
00:48xcvtechnomancy: I guess I mangled the project file while getting it working initially
00:50xcvtechnomancy: thanks a million for the help!
00:51technomancyxcv: sure thing
00:52technomancyxcv: I don't use javac myself; if you have suggestions how to make its docs clearer, please post 'em to the list.
00:54brehauttechnomancy: which particular alan moore?
01:01mecbah github dead
01:08amalloylong love github
01:12ataggarthmm, ^:cost
01:12ataggart^:const
01:17seancorfield__anyone here working with mongoDB?
01:17seancorfield__i'm considering it for a project and wondered about clojure wrappers for it...
01:20ataggartthe only one I know of is congomongo
01:23seancorfield__that seemed to be the only one i could find that is getting updates...
01:25amalloycongomongo has worked fine for me
01:26amalloysexpbot and 4clojure both using it, though not super-heavily in either case
01:28seancorfield__thanx... i'll try it and see what i think
01:32KirinDaveHell yes. Very stoked I got patches for clothesline from an outside-of-banksimple source.
01:32KirinDaveNice to know someone else is using it.
01:34amalloyseancorfield__: also, the last guy who asked about congomongo hasn't come back to complain afaik :)
01:36ataggartah cool, didn't know BS was using clojure
01:37seancorfield__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:38seancorfield__not going to happen any time soon but i want to start experimenting
01:38KirinDaveataggart: Truth be told, we are not going to use it so much going forward.
01:39KirinDaveataggart: It's a bummer, but evidently I was more willing to learn scala than some of my peers were willing to learn clojure.
01:40ataggartI 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:40KirinDaveWhy?
01:40clojurebotwhy not?
01:40KirinDaveIt's...
01:40ataggartsyntax
01:40Deranderclojurebot: <3
01:40clojurebot<3 is </3
01:41KirinDaveI 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:41amalloypoor clojurebot is depressed
01:41KirinDaveAnd it lacks something analogous to clojure's generic methods.
01:41KirinDaveOr haskell's typeclasses
01:41KirinDaveWhich is a BIG hit in my opinion.
01:41ataggartwell, to be fair, I can't speak to any of scala's non-aesthetic qualities
01:42ataggartit's just so much visual noise to me
01:42KirinDaveAs for aesthetics, you gotta admit the _ syntax for simple lambdas is so much nicer than Clojure's #() ass soup.
01:42ataggarthaven't gotten that far
01:42KirinDaveI love you clojure, but your lambda syntax...
01:42KirinDaveataggart: e.g., (map #(+ 100 %) someNumbers) => someNumbers.map(_ + 100)
01:43seancorfield__we're using scala for performance-critical low-level stuff but i wouldn't want my whole team trying to learn it
01:43KirinDaveseancorfield: It is broad and deep, as they say
01:44ataggartKirinDave: but is this not also true: (map + someNumbers) vs someNumbers.map(_ + _)
01:44KirinDaveHeck, the finer points of its type system make haskell's monomorphism restriction error look positiviely readable.
01:44KirinDaveNo.
01:44KirinDaveataggart: Nope.
01:45KirinDaveataggart: You may be thinking of a fold there
01:45ataggartah possibly
01:45KirinDaveIn which case still no. :)
01:45ataggartI coulda sworn there was somewhere saw (_ + _)
01:45KirinDaveYeah _ + _
01:45KirinDaveThat's for fold
01:46KirinDavesomeNumbers.reduceLeft( _ + _ ) // == someNumbers.sum
01:46KirinDavePlease pardon me, I gotta get to the gym or I won't go today.
01:46ataggartisn't it like 2am for you?
01:46amalloyataggart: KirinDave is in sf, not ny, iirc
01:46ataggartah k
01:47seancorfield__my team just plain ol' prefers dynamic languages
01:47seancorfield__so scala is reserved for corner cases
01:47KirinDaveseancorfield: Fair enough
01:47KirinDaveScala can be onerous about that.
01:47ataggartwhat perf corner cases was scala faster than clojure?
01:48KirinDaveataggart: Pre-1.3 there are many many.
01:48ataggartI don't doubt it, just don't know what they are
01:48seancorfield__we started uses scala in production in early 2010
01:48KirinDaveNgh. I really should go.
01:48ataggartgo
01:48seancorfield__i only just got the green light to go to production with clojure
01:48KirinDavegone
01:53livingstonwhy does this say "_" is not a ns (defmacro foo [x] (let [fv (symbol "_" (str (gensym)))] `(~x ~fv))) when called (macroexpand-1 (foo 'bar))
01:53livingstonbut this works just fine: (let [x 'bar] (let [fv (symbol "_" (str (gensym)))] `(~x ~fv)))
01:54amalloy&(symbol "_" "foo")
01:54sexpbot⟹ _/foo
01:54amalloyyou probably want ##(symbol (str "_" "foo"))
01:54sexpbot⟹ _foo
01:55livingstonI 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:56amalloyinteresting
01:56livingstonit's somehow trying to evaluate my symbol, but I can't tell why? is there something wrong with the structure of my macro
01:57amalloyi don't see anything wrong
01:57amalloybut i'm open to second opinions
01:57seancorfield__ataggart: any thoughts on what the clojure job market is really like out there?
01:57livingstonso if I go to my repl and (ns _) now I get: "No such var: _/G__4235" as an error
01:57ataggartwhich "there"?
01:58seancorfield__the clojure mailing list has nearly 5,000 people on it, all using clojure in some form
01:59livingstonDOH *livingston fails to quote the thing inside the call to macroexpand*
01:59ataggartlivingston: the yeah
01:59ataggartjust about to say
02:01livingstonsign it's time for bed probably
02:05seancorfield__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:06ataggartrelative to other languages, it does seem that way
02:07ataggartnot sure why though.
02:07livingstonseancorfield__: a little bird told me it has appeared inside the walls of google, but not how much or for what.
02:07ataggartthe banksimple case is an interesting one. I'd be curious to know why scala was preferable over clojure
02:08livingstonyou'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:08seancorfield__the main scala-user maling list has only 1200 people on it
02:08ataggart#clojure is always more populated than #scala
02:08hiredmanclojurebot: tell use about scala
02:08clojurebotchouser is ruthless about breaking other people's code
02:09hiredmanclojurebot: really?
02:09clojurebotIt's greek to me.
02:09hiredmanclojurebot: tell use about scala
02:09clojurebotuse vs require is (:use [lib :only [a b c]) or (:require [lib :as alias]) -- (:use lib) is only for playing around
02:09hiredmanclojurebot: you seem kind of borked
02:09clojurebotkind of interesting if unfold is the intermediate steps of a fold
02:09ataggartclojurebot: tell us about scala
02:09clojurebotthe scala compiler | is | <reply> see: http://harrah.github.com/browse/samples/compiler/scala/tools/nsc/typechecker/ConstantFolder.scala.html#65760
02:10hiredmananyone used jffi?
02:10livingstonscala has been around since 2003 -- twice as long as clojure. it's also probably easier for a random java programmer to pick up.
02:11hiredmanit would be nice to be able to call posix_spawn from clojure, but jffi is not well document
02:11ataggartdoesn't JNA sit on top of jffi?
02:11hiredman(Runtime.exec being borked if the jvm has a decent heapsize)
02:12hiredmanno
02:12hiredmanjffi may sit on top of jna
02:12hiredmanhttps://github.com/wmeissner/jffi
02:12hiredmanjruby uses it
02:12ataggartah, I was thinking of libffi
02:13hiredmanjffi sits on top of libffi
02:13ataggartand apparently so does JNA
02:13hiredmanI doubt that
02:13hiredmanI think libffi is relatively new
02:14ataggartI just go by what wikipedia tells me
02:14hiredmanhuh, I guess so
02:14hiredmanthats kind of neat
02:15ataggartmay be of interest: https://github.com/Chouser/clojure-jna
02:24ataggartholy crap! I can finally edit jira tickets
02:40seancorfield__you got a promotion :)
02:42amalloyataggart: now, mark my ticket as accepted so i can finally say with a straight face that i've contributed to clojure.core
02:42ataggart#?
02:43amalloy757
02:44ataggartas with many tickets, there is an open question.
02:45amalloyyeah, i know. i was really just hoping for magic fairy dust
02:45ataggartit's "waiting on" rich though, so it might get answered some day :)
02:46ataggartand my ticket has been around since september
02:46ataggartCLJ-445
02:47ataggarthad to rewrite the damn Reflector
02:48amalloyyuck
02:49ataggartit was fun though, and it sets up adding support for calling vararg methods
02:51amalloyataggart: 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:51ataggart714
02:52markomanis it possible to use clojure with gdb on ecams?
02:53kriyativeHi 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:53ataggartamalloy: I just use #_"my multi-line comment here"
02:54amalloyso do i, but i'm not really a fan
02:54markomangdn docs says i need to compile app with -g option. and then point gdb to the executable file
02:54markomans/gdn/gdb/
02:54sexpbot<markoman> gdb docs says i need to compile app with -g option. and then point gdb to the executable file
02:54amalloygdb will never debug clojure
02:55amalloyyou want swank/slime, and probably the cdt to plug into swank
02:55markomanhow so?
02:55amalloyyou would be debugging the native-compiled jvm executable
02:55amalloyclojure is not native code
02:56markomanim using swank and slime. how do you set breakpoints with it for example?
02:56amalloy$google clojure cdt george jahad
02:56sexpbotFirst out of 9 results is: CDT - The Clojure Debugging Toolkit
02:56sexpbothttp://georgejahad.com/clojure/cdt.html
02:57amalloyit'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:57livingstonthe 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:57amalloylivingston: uh
02:58amalloyyou are perhaps thinking of |symbol thingy| without #?
02:58livingstonamalloy: yeah, but I thought they shared parts of the reader, I could be grosly confused
02:59amalloythey well might. i've never looked at CL's impl of...anything
03:00amalloybut there's no particular reason they would share code in the clojure compiler
03:01markomanalright, need to test cdt then
03:02ataggartamalloy: I'm inclined to agree with those in the nay column
03:02ataggartshort of some compelling example which couldnt; readily be met with existing features
03:03amalloyataggart: i just think it's grotesque that i can't write TODO: in my multi-line comment, really
03:03ataggartmultiline comments lead people to write them, which leads to red herrings
03:03ataggartamalloy: get a better editor?
03:03amalloyataggart: huh?
03:03hiredmanamalloy: doesn't your editor place ;; when needed?
03:03livingstonthe 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:03amalloyhiredman: for sure, i can do it with more than one single-line comment
03:04amalloybut we might as well throw away ##(doc comment) if it's not usable for at least two reasons
03:04sexpbot⟹ "Macro ([& body]); Ignores body, yields nil"
03:04hiredmanoh, sure
03:04amalloythat's my second-best, if i can't have #|..|#
03:04hiredmanwell, I dunno, it's kind of useful to keep code for testing functions in as you write them
03:05amalloyhiredman: but it yields nil. at anything but the top level it will break things
03:05ataggartis there a usecase for comment that's not met by #_
03:05hiredmanamalloy: which is where I use it
03:05amalloyataggart: commenting out something that isn't a balanced sexp
03:06amalloywrap it with a "string", sure
03:06amalloythen escape all the "s in your string...
03:06ataggartamalloy: good point about the non-sexp
03:06amalloyor even commenting out multiple balanced sexps at once
03:07amalloythe list of very-small gains for #| is longish, but they're all quite small
03:07amalloyjust little things about (comment) and #_ that will surprise you
03:07ataggartno one uses comment for comments though, right?
03:07amalloyi did
03:07ataggartah
03:08amalloyanyone who sees the language for the first time will
03:08amalloyi mean, we put a macro called comment into clojure.core, people should know not to use it?
03:08ataggartheh
03:08ataggartwell poor naming of comment aside, ; seems to do what we need for actual comments
03:09livingstonok, 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:09amalloyataggart: 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:10amalloylivingston: the CL reader really just sees #, then looks at the next *character*, not next *symbol*
03:10ataggartamalloy: meh, in every case where /* */ is useful is for documentation, and clojure has doc strings
03:10livingstonamalloy: I know that - (I've actually mucked with the CL reader more than most, but it's been so long)
03:11ataggartI'm inclined to agree with the school of thought that large in-code comments are a Bad Thing
03:11livingstonI never used that commenting style because my editor always did block comment out for me with semicolons
03:11ataggartas opposed to documentation
03:11amalloyataggart: i don't really disagree, i just wish clojure would get some consistent story for comments. add a """ multi-line-string or something
03:11amalloyor say "look, don't do multi-line comments, they're bad"
03:11amalloylike it does with inheritance
03:12ataggartamalloy: look, don't do multi-line comments, they're bad.
03:12amalloybut having multiple, broken versions of multi-line commenting is what i see when i look at (comment)
03:12livingstonamalloy: I'm actually really disappointed I can't add reader macros in clojure, it's really useful for DSLs
03:12ataggart:)
03:12amalloyataggart: indeed. put it on clojure.org for me
03:12ataggartbut then steve yegge will yell at us for being prescriptive
03:13amalloythat's how we'll get market share!
03:13ataggartor maybe proscriptive
03:13ataggartlivingston: I think the point of excluding reader macros was to stop people like amalloy from making their code unreadable to others ;)
03:14hiredmanlivingston: you can if you really want, all you have to do is know how to do it
03:14amalloyataggart: meh. i have a program that would love a reader macro in it, but i don't especially care
03:15livingstonataggart: no rich has some thing about them having the potential to need state and thus mucking with things
03:15livingstonhiredman: have a good example?
03:15amalloylivingston: the primary objection is, i think, ataggart's
03:16hiredmanlivingston: I refuse to give give examples due to various non-proliferation agreements
03:16ataggartclojure's prime directive
03:16livingstonyeah see that's what I thought
03:16amalloyyeah, seriously. the implementation hiredman refers to is so disgusting, hacky, and non-portable. you're better off not knowing
03:16amalloy(non-portable to future clojure versions, that is)
03:17hiredmanjna is such a bummer
03:17livingstonreader 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:17livingstonif people use them bad, don't use their code.
03:18ataggarthiredman: how so? is it worse than JNI?
03:18hiredmanoh, no
03:18hiredmanjust a drag
03:21hiredmanand you can't generate the interface you need with definterface
03:21ataggartrequires interface inheritance?
03:21hiredmanyes
03:21ataggartbleh
03:23amalloyseems 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:24hiredmanextension via inheritence instead of composition
03:25amalloybut not actually inheriting any code
03:26ataggartwhy won't gen-interface work?
03:26amalloy&(doc gen-interface)
03:26sexpbot⟹ "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:27ataggartit has :extends [interface ...]
03:27amalloywhen not compiling, does nothing
03:27amalloyie, it demands aot
03:27hiredmanoh, it may, definterface is just nicer
03:27ataggartwhere is definterface from?
03:27hiredmanclojure
03:27amalloy&#'definterface
03:27sexpbot⟹ #'clojure.core/definterface
03:28ataggartodd, it's not in the docs
03:32amalloyTimMc: you use findfn, right? mec added $findarg recently:
03:32amalloy$findarg map % [1 2] [2 3]
03:32sexpbot[clojure.core/unchecked-inc clojure.core/inc]
04:22talioshola - 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:27fliebeltalios: I believe they are on the Clojure server, not on the central one.
04:29taliosah cool - will hunt over there then.
04:32raektalios: I think they stop at the 1.3.0-alpha4 version
04:33taliosthey seem to yeh, wonder why/how mvnrepository.org gave me -alpha6
04:33raekhttp://dev.clojure.org/display/design/Contrib+Library+Names
04:34raeksome stuff is being considered for "new contrib"
04:34raekthe "old contrib" was an important step for clojure, but now it's largely unmaintained
04:35fliebelAny 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:39thorwilhmm, 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:39fliebelI'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:39thorwilso far the clojure influence on my pathon is that i don't want to use it anymore :)
04:40thorwil /s/pathon/python/
04:41fliebelthorwil: That is an interesting thing to say, as it would imply learning Clojure limits your career to… cool places.
04:42thorwilheh. no career in programming here, i'm more of a designer :)
04:42taliosput down photoshop and back away from the laptop!
04:50fliebelSo, when we have cinc, PyPy should be an interesting target :)
05:05hoeckfliebel: I did learn Python for my current job after mainly using clojure for about 2 years during my studies
05:06hoeckand pypy is definitely a nice clojure target, I'm on the boat when cinc is ready, or even before
05:07hoeckI just don't know yet how to (efficiently) implement method overloading on python targets
05:07fliebelhoeck: So, what is your Python like, ofter writing Clojure for 2 years?
05:08hoeckfliebel: more like clojure :)
05:08hoecknot that I'm using filter & map or itertools everywhere - thats just a pain in python, imo
05:09hoeckbut I try hard to avoid stateful classes, and try more to create clean interfaces and referential transparent functions
05:11fliebelSo you do use for loops and mutation and all that…
05:12fliebeloh, neat: http://docs.python.org/release/3.1.3/howto/functional.html
05:12hoeckof course, you have to, in python, there is just not enough infrastructure to give that up
05:12fliebelghehe
05:12opqdonut_generators are quite nice actually
05:13opqdonut_capture some of the use cases of lazy lists
05:13fliebelyea, yield is magic :)
05:13hoeckI'm not trying to write unidiomatic python, but I strongly dislike those typical python oo-apis foo = create_object(); foo.set(prop); ...
05:15hoeckespecially now that I know that 80% of the mutation there is just unnecessary and makes code more complex :/
05:16hoeckbut I'd currently rather work with python than taking a java job
05:16fliebeloh, shit comas.
05:16fliebelyea, Python is nice...
06:09raekdoes @planetclojure tweet all clojure tagged questions on stack ocerflow?
06:20taliosraek: i hope not
07:09noidi_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:10ambrosebs_i guess they would all implement the java interface Callable .. and there's another one
07:11ambrosebs_runnable?
07:11noidi_thanks!
07:11fliebelnoidi_: ifn?
07:11noidi_even better! >(
07:11noidi_:)
07:48ilyakhi *
07:49ilyakHow would I pass a record constructor /Track./ as a parameter to higher order function?
07:54hoeckilyak: 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:55ilyakSad
07:55ilyakWhy isn't it a function by itself?
07:59raekilyak: this is being though upon: http://dev.clojure.org/display/design/defrecord+improvements
08:00ilyakIs 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:02raekilyak: yes, clojars.org is the place
08:02raekthough it doesn't look like David McNeil has uploaded it there...
08:03raekbut apparently someone else did: http://clojars.org/me.hspy/defrecord2
08:19ilyaklooks like defrecord2 doesn't accept n arguments
08:19ilyakonly one map
08:19ilyakI mean, defrecord2-s constructor
08:19ilyakso you can't say (apply new-track seq)
08:19ilyakwhich sucks
08:37ordnungswidrig1hi all
08:37fliebelhi
08:38ordnungswidrig1I need a way to detect bindings which a not local to a macros body.
08:39ordnungswidrig1say, e.g. if have (let [a 1] (foo-macro (let [b 2] (* a b)))
08:40fliebeldetect?
08:40ordnungswidrig1then during macro expansion I need to know that a is bound outside of the macro body
08:43Chousukeordnungswidrig1: the &env magic parameter of the macro *might* be of use
08:44ilyakThere is (if-not bool on-false on-true)
08:44ilyakbut is there (if-something bool on-true on-false)?
08:44ordnungswidrig1Chousuke: 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:44Chousukeilyak: what's wrong with just if?
08:44fliebelilyak: Just drop the not?
08:45ordnungswidrig1Chousuke: during replay of the body I must make sure that all bindings that are referenced by the body are in place
08:46Chousukeordnungswidrig1: that sounds difficult
08:46ilyakcheatsheet doesn't have if
08:46fliebelordnungswidrig1: What does your macro do?
08:46ilyakfor some reason
08:46fliebelilyak: Then do (if-not (not bool) true false) :P
08:47ordnungswidrighttps://gist.github.com/931238
08:47ilyak(map #(if (= % "NULL") % nil) '("foo" "NULL" "NULL" "bar" "NULL"))
08:48ilyakreturns (nil "NULL" "NULL" nil "NULL") for some reason
08:48ilyakwhy?
08:48ordnungswidrigyou can do (in-log l (do something nice here) and "(do something nice here)" will be logged and executed
08:48ilyakoops, it should be wrong way around
08:48ilyakdisregard that
08:48ordnungswidrigafterwards you can do (replay l) and it should execute all forms that have been logged in l before
08:50Chousukeordnungswidrig: examine &env in your macros
08:50ordnungswidrigChousuke: that sounds good
08:50Chousukeit's pretty much undocumented but you can access all locals and the forms that define them
08:50Chousukenote: not the values. those are only known at runtime :)
08:51fliebelChousuke: There is &env, and another one… &form or something like that?
08:51Chousukeyes
08:51chouserand not the "source code" forms, but the analyzed forms, iirc.
08:51fliebelchouser: Difference?
08:51ordnungswidrigwhen I know which bindings exists I need to replace them by hand. e.g.
08:52fliebelordnungswidrig: Easier would be to log env as well :)
08:52ordnungswidrigfliebel: nice idea!
08:53fliebelordnungswidrig: Is this for debugging? Sounds really nice to log stuff, and then rerun it later to see what it does.
08:55ordnungswidrigfliebel: it's for recording and restoring the state of the application
08:55ordnungswidrigfliebel: like a database or filesystem log
08:56chouserfliebel: 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:57fliebelchouser: Oh, so will that go away with cinc?
08:57ordnungswidrigchouser: that's not what I want
08:58fliebelordnungswidrig: Someone made a printable fn, or fn literal. Maybe that does what you want.
08:58chouserwell, I think the hope is that LocalBinding, NumberExpr, etc. will be immutable records rather than mutable non-collection Java objects.
08:59ordnungswidrigmerely 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:59ordnungswidrigSuch that the logged (and executed) form is (alter foo + 557)
09:00ordnungswidrigIs clojure.walk of any help here?
09:00fliebelordnungswidrig: But are these even avaliable at macro time?
09:00Chousukeordnungswidrig: that's not possible in general
09:00chouserordnungswidrig: 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:00ordnungswidrigfliebel: 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:04chouser(defmacro in-log [& block] `(do (prn (zipmap '~(keys &env) ~(cons `list (keys &env)))) ~@block))
09:05chouser(let [x 5, y (rand-int 100)] (in-log (prn (+ x y)))) ;=> {x 5, y 39} 44
09:05chouserSomething like that?
09:05ordnungswidrignot so bad
09:06ordnungswidrig(let [b 3] (in-log2 (let [a (+2 b)] (inc a))))
09:06ordnungswidrig; => java.lang.Integer cannot be cast to clojure.lang.IFn
09:06freiksenethi! 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:08ordnungswidrigah, sorry, (+ 2 b) not (+2 b)
09:10Chousukefreiksenet: you can use the declare macro to declare functions before defining them
09:10freiksenetfrankly it's just a fucking shame that clojure can't do a pass over the file before compilation to do that declare automatically
09:10ChousukeI guess it could, but it won't.
09:10fliebelchouser: I love that macro
09:11freiksenetChousuke: I know that. that's tedious. I was wondering if there is something (maybe in some build system) that arleady does that
09:11Chousukefliebel: for simplicity. No-one wants to do anything to the compiler beyond what is necessary anymore, because it's written in Java :P
09:11Chousukethe long-term plan is to replace it anyway, perhaps Clojure will get two-pass compilation then
09:12ChousukeThough I don't know what that implies for the repl
09:12freiksenetwell, nothing I guess.
09:12matthias_mayube someone should rewrite it in clojure ;)
09:12freiksenetI mean twopass compilation won't really modify how repl works
09:12Chousukefreiksenet: what harm is one declare at the top anyway :)
09:12freiksenetChousuke: well I need to declare all functions on top
09:13freiksenetor most of them
09:13Chousukeyeah, but declare takes multiple functions
09:13chouserI'm pretty sure Rich has rejected having Clojure accept the use of vars before they're declared.
09:13freiksenetmaybe it's my haskell/cl background, but I am used to writing stuff from top to bottom
09:13chouserin long conversations on the google group.
09:13freiksenetchouser: it just needs an autodeclaration for all def and defns, no need to make clojure accept undeclared vars
09:14freiksenetlike CL does I guess
09:14freiksenetthouhg CL I think doesn't mind undeclared vars or functions too
09:14chouserI'm pretty sure CL allows use of undefined symbols at the REPL
09:14fliebelfreiksenet: You can do #'var as long as you *use* them in the correct order.
09:15Chousukethat's ugly though :/
09:15fliebelQuite, and slow even :)
09:16chouserfliebel: really?
09:16chouser, #'foo
09:16clojurebotjava.lang.Exception: Unable to resolve var: foo in this context
09:16chouseroh
09:16chouserI see what you mean
09:17freiksenetin any case that adds up to list of annoying things in clojure :D
09:17chouseryeah, I think even that doesn't work
09:17freiksenetnot like show stoppers, but thinks that annoy you every time you encounter them :)
09:17chouserfreiksenet: 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:18ilyakWhat 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:18ilyakWhat should I use?
09:18matthias_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:19Chousukethat's not possible
09:19fliebelmatthias_: You mean like… (true 1) > 1?
09:19Chousuketrue and false are java objects
09:20fliebelAnd probably final too
09:20matthias_(true 1 2) would return 1, (false 1 2) would return 2
09:20fliebelOh, what was that stinking pit called "making your own boolean"?
09:20raekmatthias_: 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:21matthias_yeah i know. make it a special form then or whatever
09:21raekso the compiler would need to know that in (a b c), a will be a boolean
09:21fliebelmatthias_: Boolean a special form?
09:21opqdonut_this doesn't make sense, matthias_
09:23fliebel(def true #(do %1)) (def false #(do %2)) :P
09:24Fossithat has no condition
09:25Fossiso "true" would have to be something that evaluates to true or false
09:25fliebelFossi: That is nonsense altogether.
09:25fliebel(mything, not what you said)
09:26Fossii guess you have to have some kind of sugar in there
09:26ordnungswidrigChousuke: I still need a way to determine the binding that are actually used in the form
09:26Fossilike ?((condition?) (thenpart) (elsepart))
09:27ordnungswidrigin (let [a 1 b (make-big-graph-of-data)] (in-log (ref-set ref a))) b should not be recorded
09:27Fossiwithout the ?() it would be real funky
09:27fliebelFossi: What is the advantage?
09:28Fossinone
09:28Fossii think it would be pretty fucked up :)
09:28fliebelordnungswidrig: Why not?
09:28Fossiit would also mess with ordering
09:29ordnungswidrigIn my case b is really big / not recordable
09:29ordnungswidrigIn my special case b is the reference to the form log.
09:30ordnungswidrigand I get a Stackoverflow while printing
09:32ordnungswidrigI 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:32ordnungswidrigbut then I need to make sure that all needed bindings are declared.
10:36cemerickLOL @ http://groups.google.com/group/seajure/browse_frm/thread/18baa18ffdbdd790
10:40ejacksoneep! I guess ->> could be interpreted as a very mean stare
10:41Fossinow, where's that shotgun operator?
10:42ejackson:get-off-my-lawn
10:43ejacksonsee the two dots, thats you, looking down the barrel of Clint's shotgun
10:44Fossii tried to come up with something, but rediscovered that my ascii art skills are far below mediocre
10:45Fossidon't know whether that's a bad thing though ;D
10:46ejacksoni'd say you should rejoice in that deficiency
10:46Fossiweird rantish post
10:46Fossiinteresting read though
10:50Fossiimho the "yes" part is bs
10:50Fossibut, i guess arguing the points here goes nowhere
10:51Fossithe best example of a "yes" type language i can think of is c++
10:51Fossiand if you want clojure to be where that ended up then thanks, but no thanks
10:52Fossiearning money and all
10:54xcvI'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:54cemerickAs long as you (declare foo) before using it, you'll be good.
10:55cemericks/using/referring to
10:55sexpbot<cemerick> As long as you (declare foo) before referring to it, you'll be good.
10:55Fossiit prolly works in the repl because you defined it once before
10:55Fossiand you have an "old" reference lying around
10:57xcvI'm using declare on each function beforehand, and it works on a fresh repl, but that doesn't seem to be enough
10:57cemerickMaybe paste what you have?
10:58Fossiyeah, sounds weird then
10:58cemerick(in a pastebin, of course)
10:58xcvok, http://pastie.org/1815696
10:59cemerickheh, ok, and the error is where?
11:00xcvno 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:01manutterdoes it give you a line number?
11:01xcvthat's the first function call in the code that references a function that is defined later on
11:01xcvno, but I think it's in the walk-over function
11:01xcvline 190
11:01xcvevals the string (reduce-form)
11:02xcvthat's the first call to a function with a body defined later on
11:03xcvthat's the only explanation I could think of for that particular error coming up
11:05cemerickI have to run, but there's no need to use eval there
11:05cemerickuse resolve to get the var, and call it straight off
11:05manutterhmm, wonder if you changed that to (str "(compy.core/reduce-" symbol ")" ) ...?
11:06manutterthough I like cemerick's answer better :)
11:38xcvhope 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:39manutterhmm
11:39manutter,(doc resolve)
11:39clojurebot"([sym]); same as (ns-resolve *ns* symbol)"
11:41manutterI'm just guessing but I think you could just use ((resolve (str "foo" bar "baz")) arg-list)
11:41manutteror ((resolve (symbol (str ... etc
11:52dnolenxcv: you want to get the value in the var? like a fn or something?
11:52xcvthe value in the var is "form"
11:52xcvand I want to call reduce-form with no arguments
11:53xcvso I make a symbol out of (str "reduce-" form)
11:53xcvused to work with eval, but after lein compile + lein uberjar it doesn't work anymore
11:54xcvthat is, can't get it to work with (apply (resolve (symbol (str "reduce" var))) [])
11:55manuttercemerick mentioned using resolve just before he left, and I made a guess, but I don't really know how to use resolve
11:56manutterif it returns the var instead of the contents of the var, though, this might work:
11:56dnolenxcv: I mean *Clojure var*, var in your example is just a local variable.
11:56amalloyit returns the var
11:56manutter(apply ((resolve (symbol (str "reduce-" var)))) [])
11:57dnolenxcv: resolve will get you the var, but you want the *value* contained in the var, in your case an fn I believe, right?
11:58xcvthat's right
12:00dnolenxcv: have you looked at, var-get ?
12:00dnolen,(doc var-get)
12:00clojurebot"([x]); Gets the value in the var object"
12:00xcv(apply (resolve (symbol (str "print" "ln"))) ["hello"]) ->
12:00xcvhello
12:00xcvhum
12:01raek(<var> ...), ((deref <var>) ...) and ((var-get <var>) ...) are equivalent
12:01xcvso (apply (var-get (resolve (symbol (str "reduce-" var)))) []) ?
12:01raekvars implement IFn by calling whatever they contain
12:01xcvdoesn't work either
12:02raek,(apply (resolve 'print) ["hello"])
12:02clojurebothello
12:02xcvevery time I get "java.lang.String cannot be cast to clojure.lang.IFn"
12:02raek,(apply (resolve (symbol "print")) ["hello"])
12:02clojurebothello
12:02raekxcv: sounds like you have (def x "foo") instead of (defn x ...)
12:03raekxcv: do you have multiple levels of indirection?
12:04raekin what people has said before, "the var" has been refering to the var that contains the function you want to call
12:04amalloy,((resolve 'print) "hello") ; don't need apply
12:04clojurebothello
12:05raekxcv: in other words, it looks like your reduce-... function is not a function, but a string
12:07xcvthat's strange, I declared every function ahead of time with declare, shouldn't that yield functions?
12:08xcvor should I use defn-s with empty bodies?
12:10manutter,(let [reduce-foo (fn [] (println "foo")), foo2 "foo"] (apply ((resolve (symbol (str "reduce-" foo2)))) []))
12:10clojurebotjava.lang.NullPointerException
12:10manuttero snap
12:10manutter,(let [reduce-foo (fn [] (println "foo")), foo2 "foo"] (apply (resolve (symbol (str "reduce-" foo2))) []))
12:10clojurebotjava.lang.NullPointerException
12:11xcv,(let [reduce-foo (fn [] (println "foo")), foo2 "foo"] (apply (resolve (symbol (str "reduce-" foo))) []))
12:11clojurebotjava.lang.Exception: Unable to resolve symbol: foo in this context
12:12xcv,(let [reduce-foo (fn [] (println "foo")), foo2 "foo"] (apply (resolve (symbol (str "reduce-" foo2))) []))
12:12clojurebotjava.lang.NullPointerException
12:13manutterxcv can you re-post the link to your pastebin with the source code?
12:14xcvhttp://pastebin.com/sFimY4mX
12:15xcvthe problem occurs on line 190
12:15xcvwith symbol = "form"
12:15xcvah
12:15xcvthat might be it
12:15xcvsame name as the loop variable
12:15raekxcv: (declare a b c) is the same as (def a) (def b) (def c)
12:16raekxcv: oh. I see that you have defs in your defns. that will not wotk
12:16raek*work
12:16raekdef should only be used at the top level
12:16raeksince it defines/mutates *global* variables
12:18raekxcv: 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:20manutteroh 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:20raekyou 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:20xcvI'm redefining the globals inside functions (not good style, I know, but has worked fine so far)
12:21xcvafter I changed symbol to sym in the doseq head it works, but I get another error after compilation
12:21manutteraha
12:21raekxcv: it will break as soon as multiple thread call the function the same time, or a single thread calls the function recursively
12:22raekclojure is not meant to be used this way. you have no guarantees that anything will work.
12:22xcvI know
12:22xcvit's not functional
12:23raek(def inside a function in clojure is like static local variables in C)
12:24raekaslo, taking user-supplied string and unconditionally calling a function with that name is most probably a *serious* security issue
12:24xcvof course
12:25xcvbut this is only a small school project that I had to hack together very quickly
12:25xcvand 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:25xcv:P
12:25xcvI would never do this sort of thing in production code
12:27raekit's not just an issue of style... it's an issue of understating what the program even does
12:36raekxcv: sorry for ranting. I'm convinced that you are aware of the issues ;-)
12:36xcvof 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:37xcvit'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:38manutterboy do I know the tune to that song... :/
12:38__name__xcv: How do you think the MS folks felt about ME?
12:44xcvI wonder why it works in the repl but not after compilation?
12:44xcvthat's somewhat of a surprise
12:44xcvthat is, if I just read the whole file into a clean repl
12:44xcvand run the -main function with the same args, it works
12:45manutterwhat are the symptoms of the failure?
12:47xcvI'm getting a null pointer exception from line 187 here http://pastebin.com/XaWEuuSv
12:47xcvbut the same works fine in the repl
12:47xcvit's from the call to apply
12:49manutterI think you can get rid of that apply, since you're only calling it on a constant empty list
12:49manutterMight change the error msg at least (?)
12:50manutter:else ((resolve (symbol (str "reduce-" sym)))))))))
12:51raekperhaps the NPE is from resolve (since it returns nil if there is no such var)
12:51raek,(str nil)
12:51clojurebot""
12:51raek,(symbol (str nil))
12:51manutteror for maintainability: (let [other-fn (resolve (symbol (str "reduce-" sym)))] (other-fn))
12:52manutterheh, raek had a good thought while I was counting parens in my post
12:53raekxcv: you could try to print the value of 'sym' there
12:53manutterkill 2 birds with one stone: (if-let [other-fn (resolve (symbol (str "reduce-" sym)))] (other-fn))
12:54manutterdoes if-let allow you to specify an else clause (like for error handling)?
12:54manutter,(doc if-let)
12:54clojurebot"([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:54manutterguess so
12:54raek(if-let [other-fn (resolve (symbol (str "reduce-" sym)))] (other-fn) (throw (Exception. (str "this symbol is crazy, I tell ya: " sym))))
12:55amalloymanutter: when-let is for when you don't need an else clause
12:56manutterthat makes sense
12:57manutterI don't quite follow the reference to & oldform in the docstring for if-let, can someone explain what that means?
12:57amalloymanutter: if-let used to have some different syntax. don't use it
12:58amalloysomething like (if-let x 10 true false)
12:58raekI think it's a remnant from old times when if-let didn't have a vector around the symbol and the expression
12:58xcvguys, thanks for all the help
12:58xcvbut I've run out of time
12:58manuttercool, thanks
12:58manuttergood luck xcv
12:58xcvnice community here
12:58xcvvery friendly :)
12:58xcvgl hf
13:10ev4lgood morning guys
13:11manuttermorning?
13:11manutterOh, right, internet...
13:11manutterGood morning :)
13:11ev4lmanutter: UGT ;)
13:13kephalehrm...
13:13kephale, (let (into [] (mapcat seq {'a 5 'b 7})) (+ a b))
13:13clojurebotjava.lang.IllegalArgumentException: let requires a vector for its binding
13:24ev4lwow, just experienced the reader going crazy when feeding it a messy-spaced multiline map
13:24ev4lit pointed me to an error to my ns declaration
13:25amalloypics or it didn't happen :P
13:27amalloy(maybe "gist or it didn't happen" is more appropriate here?)
13:29ev4lamalloy: lol, i'm preparing one :D
13:50ev4lamalloy: https://gist.github.com/932121
13:50ev4li just used the map in the same format as the gist
13:51ev4lwhen i removed it, the code would get compiled without errors
13:51ieureev4l, I think your issue is that you didn’t include the [] for the arguments to your method.
13:51clojurebot'Sea, mhuise.
13:51ieureSo it’s trying to use the map as the docstring for that fn
13:52amalloyieure: eh? he doesn't have a method
13:52amalloyit's a def
13:52ieureAh, I see.
13:52ieureThat’s what I get for parachuting in.
13:53amalloy&(let [m {"1" 2}] (m "1"))
13:53sexpbot⟹ 2
13:54ev4lamalloy: when i laid out the map the same way you did now it worked
13:57jkkramerev4l: what repl are you using?
13:57ev4ljkkramer: hmm... i was using lein repl
13:58freiksenetis there an analog of asdf:load-op in lein?
13:58jkkramerev4l: and you got this error when calling (test) or when loading the file?
13:58ieureev4l, For whatever it’s worth, the last Gist you pasted works fine for me.
13:58ev4ljkkramer: loading the file
13:59jkkramerworked for me too. I regularly spread defs/maps over multiple lines
14:00ev4lhmmm... let me try again here
14:04ieureev4l, I just fired up `lein repl' and pasted the code in.
14:11ev4ljkkramer: 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:12ev4lev4l: and called lein repl from the project directory
14:12amalloyev4l: 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:14ieureev4l, That code also works for me when I paste it into `lein repl'. How are you loading the file?
14:18patrkrisnå da
14:18patrkrisoops
14:37ev4lieure: In the lein repl i type (use 'crazy-reader)
14:37amalloyev4l: i doubt it matters here, but don't use single-segment namespaces
14:38ev4lamalloy: oh , i used only for the demonstration. In the original, i use a full one :D
14:39ev4lamalloy: but it's a good thing to know
14:41ieureev4l, Is there perhaps another crazy_reader.clj on your classpath?
14:42ieureev4l,h ttps://gist.github.com/7ab089e7e4e0ab16096e
14:42ieureEr, https://gist.github.com/7ab089e7e4e0ab16096e
14:43ev4lieure: no, that's the only file actually.
14:43ieureHm.
14:43ieureSorry, I’m not sure what to tell you. Everything you have pasted works fine for me.
14:44ieureI’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:48ev4lieure: Leiningen 1.4.2 on Java 1.6.0_24 Java HotSpot(TM) 64-Bit Server VM & Clojure-Contrib 1.2.0
14:53ev4lamalloy: ieure: surroundng code => https://gist.github.com/932309
14:53ev4li'm just toying around with the enlive-tutorials
14:53ev4ladd : [enlive "1.0.0-SNAPSHOT"] to the project.clj
14:54ev4land try to run (require 'crawlers.core) in the lein repl
14:55ev4lif this code compiles in your machines, that's probably some environmental issue
14:56raekev4l: if you run "file core.clj", what does it say?
14:56raek"UTF-8 Unicode text"?
14:57ev4lraek: wow
14:57ev4lraek: it gives me nothing
14:58raeknothing? which operating system are you using?
14:58ev4lraek: i've never seen that empty output before with 'file'
14:58ev4lmac os x leopard
14:58ev4li'll try to save the gist into the project directory
14:58raekanyway, clojure source files are encoded using UTF-8
14:59raekand JLine (which lein repl uses if rlwrap is not installed) has broken UTF-8 support
15:02raekif you eval (seq "Suíços") in the repl and don't get (\S \u \í \ç \o \s) back, then you have an encoding problem
15:05ev4lraek: it seems you are right
15:06ev4lraek: When typing the same map manually it works
15:06ev4lraek: I bet there's a funny character in the text i've copied/pasted initially at the map
15:07raekthe dreaded "byte order mark"?
15:08raekas 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:08ev4lraek: I evaled at the Lein repl, and ? appeared at the places of í and ç
15:09ev4l(when i pasted the code)
15:09LauJensenAny OSX users in here with a Danish/Nordic keyboard setup ?
15:09raekev4l: that has happened for me too with JLine
15:11raek(since leiningen 1.5.something, a warning is printed if you don't have rlwrap installed)
15:14raekev4l: have you tried installing rlwrap?
15:14ev4lthat's what i'll do =]
15:14ev4lthanks a bunch guys
15:21kolektiv`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:21kolektiv`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:22kolektiv`can anyone give me a word of advice? thanks!
15:26TimMckolektiv`: I certainly don't hear much of anything about it.
15:27TimMcDon't know if that's due to paucity of implementation or interest.
15:27kolektiv`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:28kolektiv`...which may not exist in the jvm sphere
15:34cemerickkolektiv`: 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:35cemerickFWIW, 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:48dnolencemerick: I see you've got your controversy quota for the next month or so settled :)
15:48cemerickdnolen: Ooh, what'd I say this time? :-) Or do you simply mean the HN submission?
15:49dnolencemerick: the submission
15:49cemerickheh, yeah. It's not often I get to go karma-whoring.
15:49cemerickThe balance of the discussion panned out nicely, I thought.
15:49cemerickCouple of silly sideshows, but all-around positive.
15:50dnolencemerick: I see steve_yegge is now an HN User.
15:50cemerickExcellent!
15:50cemerickHe should pop in here and we could hash it all out in about 3 minutes. :-P
15:51ataggartRich gave a good coverage about the single-pass thing, which was edifying.
15:51cemerickdnolen: is there some kind of feed for new handles being registered or something?
15:52cemerickYeah, that was great.
15:52dnolencemerick: no his handle is green, signifies new user.
15:52ataggartwhere did this "clojure users hate macros" meme come from?
15:52dnolenataggart: unknown.
15:52ieureataggart, A misunderstanding at best.
15:53ieureA deliberate mischaracterization at worst.
15:53ataggartI blame Christophe's thick accent
15:53chouserataggart: clojure_conj, I suspect, which had a recurring theme of "beware the overuse of macros"
15:53osolevewhy can I not recur outside of the tail position, and why are self-calls discouraged?
15:54chouserosoleve: recur is only slightly more powerful than a goto, and thus only makes sense in a tail position
15:54chouserosoleve: self-calls are perfectly all right, but consume JVM call stack space which is finite
15:54cemerickchouser: afternoon :-)
15:54cemerickbah
15:54chousercemerick: howdy!
15:55osolevechouser, so I should use self-calls, save for in tail position, when I should recur?
15:55osoleveok, thanks
15:55cemerickdnolen: Good luck with the talk tonight.
15:55cemerickBeg someone to record it. :-)
15:56dnolencemerick: it's gonna be a bit ... rough I think.
16:00Raynescemerick: 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:01osolevegeneral computed science, 0x123 is hex, 0110b is binary...
16:01osolevewhoops, wrong channel :[
16:01choffsteinHow can I make sure my maven repo is added to my clojure class path?
16:02cemerickRaynes: you mean: do X, Y, and Z, or "Clojure's dead at the starting gate"?
16:02cemerickYeah.
16:02bultersRaynes: Is he officially against clojure now? :S
16:03Raynesbulters: Looks like it, comrade.
16:03bultersOnly thing I got from that thread is that he doesn't agree with the way the language is designed.
16:03ataggartchoffstein: you don't. lein will pull the jars into your rojects classpath
16:03bultersi.e. the process of ~
16:03choffsteinataggart: but what if I want to use clj?
16:04choffsteinataggart: so if I just want to play with a script or not have to create a whole lein project
16:04choffsteinsorry -- I mean the clj repl
16:04opqdonut_link to yegge's messages?
16:04ieureopqdonut_, http://news.ycombinator.com/item?id=2466731
16:04bulters+ surely; the fact that he 'agitates' in such a way only indicates he want clojure to 'succeed' (definition pending)
16:04Rayneshttp://groups.google.com/group/seajure/browse_thread/thread/18baa18ffdbdd790/917004da1b517f11 This whole thread, opqdonut_
16:04ataggartchoffstein: you'd have to do what lein does, but manually
16:04opqdonut_thanks
16:05choffsteinAck. That's ... horrible.
16:05choffsteinI assume that is a legacy java issue ?
16:05ataggartchoffstein: if you want a common set of dependencies, separate from a lein project, try using cake
16:06choffsteinataggart: basically, I want to do "lein install ...", then jump into the clj repl and play around with the new library
16:06Raynes"If you embrace users, then Rich won't have to publicly beg for money. The
16:06raekataggart: this you can do with cake
16:06Raynesmoney will come naturally as an emergent ecosystem. But you need users!"
16:07RaynesMethinks that was a bit too far.
16:07cemerickchoffstein: isn't that what `lein repl` is for?
16:07choffsteincemerick: I'm obviously a moro
16:07choffstein*moron
16:08cemerickchoffstein: no worries :-)
16:08choffsteinherm ... but maybe it isn't working the way I expect it to.
16:09ataggartok, back to portal2
16:10bultersRaynes: 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:10choffsteinCan 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:10dnolenbulters: people are generally nice here, such statements are overblown.
16:10Raynesbulters: 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:11choffsteinbulters: as a clojure moron and local village idiot, I have never once gotten laughed at here
16:11bultersdnolen: I guess so, have been leeching for a while now, didn't see any laughing yet ;-)
16:11choffsteinor, at least not while I have been in the chat
16:11cemerickbulters: I cannot remember a single time that anyone has ever been laughed at here.
16:11ataggartchoffstein: lein install doesn;t do what you think it does
16:11hiredmancemerick: really?
16:11dnolenbulters: 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:12choffsteinataggart: I figured. It seemed to -- doing 'lein install inflections 0.4.3' put it in my maven repo ...
16:12cemerickhiredman: The log may prove me wrong, I'm sure, but I can't think of a time when it's happened.
16:12bultersdnolen: can't vouch for #python... but am too aware of #ruby
16:12choffsteindnolen: yeah, #ruby and #ror got vicious a couple years back
16:12ataggartchoffstein: lein help
16:12osolevein #lisp they're very mean, too.
16:12hiredmanI must have laughed at some point
16:12cemerickhiredman: People certainly have been rude before, which sucks, and I do whatever I can to tamp that down.
16:12choffsteinataggart: lein install can install the project specified...
16:12bultersSeems to be a tendency of rubyists (or rails-ists more particular) to smack down 'newbies'.
16:13choffsteinbulters: I think it is because the space is so competitive now
16:13bultersCan see it happening in the office sometimes.
16:13ataggartchoffstein: the missing part of that sentence is "... into your local maven repo"
16:14choffsteinataggart: ...but it did
16:14bulterschoffstein: which sucks... the only competition i see in programming (itself) is against a deadline; or your competitors
16:14KirinDaveI knew I shouldn't have gotten involved in that news.ycomb thread. :(
16:14KirinDaveIt is only a mistake when I talk to people.
16:15choffsteinbulters: 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:15ataggartchoffstein: 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:15bultersKirinDave: why is it a bad thing? Did someone get hurt
16:16bultersI mean... physically!?
16:16KirinDavebulters: No.
16:16choffsteinataggart: 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:16hiredmanKirinDave: 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:16KirinDavehiredman: Yes. You were the one I was referring to. Directly.
16:16ataggartchoffstein: well it doesn;t work that way.
16:17hiredmanKirinDave: :)
16:17choffsteinataggart: 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:17choffsteinataggart: I'm assuming my ignorance is getting in my way
16:17KirinDavehiredman: Seriously man. Why you gotta hate on macros? Esp when it ended up being a known issue with aot-compilation in 1.2.
16:17arohnerchoffstein: you can java -cp clojure.jar:your_new_jar clojure.main
16:17ataggartchoffstein: lein is a tool for projects. you don;t want a project. so there's a mismatch
16:18KirinDaveMacros: Not dumb sometimes. Anyways.
16:18hiredmanKirinDave: hate macros?
16:18choffsteingotcha. alright...
16:18dakronehiredman hating on macros?
16:18KirinDaveI am just stunned weavejester prefers %1 + %2 * 2 vs _ + _ * 2.
16:18KirinDavePretty bummed that we're in such opposed opinions.
16:18hiredmanKirinDave: what happens when you want to refer to the first argument twice?
16:18bultersKirinDave: _'s just look more like prologs anonymous variables ;-)
16:18KirinDavehiredman: You use fn.
16:19KirinDavehiredman: It's a convenience syntax.
16:19KirinDaveBut 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:19cemerickKirinDave: 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:20hiredmandakrone: apparently I hate macros
16:20KirinDavecemerick: Well the degree of discourse far outweighs my actual passion for the subject at this point.
16:20ataggartKirinDave: _ + _ is a scala lambda?
16:20KirinDaveataggart: yes.
16:20KirinDavehiredman: Not quite what I said.
16:20KirinDavehiredman: Let's not get into it.
16:20KirinDavecemerick: But yes.
16:21hyperboreeanhi guys, how can I find out the absolute path of a file from clojure ?
16:21KirinDavecemerick: I feel the utility of a convenience syntax for anonymous functions is in the readability & brevity it offers.
16:21ataggarthyperborean: (.getPath file)
16:21hiredmanKirinDave: "The clojure version is obviously more noisy." doesn't actually seem to be obvious given the disagreement about it
16:21KirinDavecemerick: While #() is very brief, I consider it less than a stellar performer in the reability part.
16:21ataggartor .getAbsolutePath or .getCanonicalPath
16:21KirinDavehiredman: I don't think people are saying, at any point, that the scala version is arguably more noisy.
16:22ChousukeI don't find #() noisy :/
16:22KirinDavehiredman: The question is the value judgement of reducing the power of the syntax to make it contain less hash.
16:22KirinDaveChousuke: It's a relative thing.
16:22bultersKirinDave: so how DO (for emphasis) you would like to see anonymous functions?
16:22Chousukethe scala version is weird. does _ always refer to the same argument?
16:22cemerickChousuke: they're positional
16:22KirinDaveChousuke: Nope. it's a blank. It's positional.
16:22KirinDaveYes, that reduces the power of them.
16:22cemerickNo rest args either, if memory serves.
16:23KirinDaveCorrect.
16:23ChousukeThat sounds confusing to be honest.
16:23KirinDaveChousuke: I think that evidence suggests it is not.
16:23KirinDaveChousuke: Esp for very simple cases.
16:23ataggartFor very simple cases, who cares?
16:23hyperboreeanataggart: thanks
16:23KirinDaveataggart: They come up a lot.
16:23cemerickI don't think there's much of anything like "evidence" re: programming language design.
16:23ataggartde gustibus non est disputandum
16:24ataggartI don;t see how you could have a "better" syntax for an anonymous function.
16:24ataggartI'd like to see it though
16:24ataggartone that isn;t just syntax magic
16:24ChousukeI can sort of see how #() might get unreadable if you overdo it but usually it's pretty easy I think.
16:25KirinDaveWhat is #() but syntax magic anyways?
16:25hiredmanthere was just some ibm article linked somewhere about quantitative language design
16:25bultersChousuke: then don't overuse it :P
16:25Chousukebulters: yeah :P
16:25KirinDaveI just don't get why people like having perlisms in their code.
16:25ataggartKirinDave, from the examples you gave on hn, it seems your problems were with parenthesis/prefix-notation
16:25KirinDave%1 %2, etc.
16:25KirinDaveSo perlish.
16:26KirinDaveataggart: hardly.
16:26bultersChousuke: I thing in about every language you can overuse some features, perl has sigils, python has whitespace (sorry :P), ruby has prettification
16:26ataggartthen please suggest a workable alternatuve
16:26bultersthink**
16:26cemerickKirinDave: I think it was originally intended to align with e.g. format
16:26stabinHi 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:27KirinDavecemerick: Okay.
16:27ChousukeKirinDave: you need to change your font so that % is something more visually pleasing :D
16:27KirinDaveChousuke: Like unicode snowman
16:27KirinDaveataggart: We could start by making % substitutable with _ for single argument lambdas.
16:27bultersNow THAT would be a huge improvement
16:27ChousukeYes, ☃ for everyone
16:28hiredman·!
16:28cemerickstabin: The "lone dot" form of interop is the most primitive, and rarely used; try (.getSuperclass java.util.ArrayList)
16:28ataggartKirinDave: except that woud break the community standard of using underscores for ignored parameters
16:28KirinDaveataggart: It doesn't have to.
16:28KirinDaveataggart: How would that ever collide?
16:28ChousukeKirinDave: it wouldn't but it'd overload the meaning of _
16:28stabincemerick: thanks, it works and looks nice enough :)
16:28hiredman(fn [_] #(+ _ _))
16:29KirinDaveChousuke: No one asked for a perfect solution, only a workable one.
16:29hiredmancollision
16:29bultersKirinDave: It introduces 'ambiguity' the accepted use of _ as a throwaway placeholder, or as a language construct in the case of a lambda
16:29Chousukehiredman: not really, in that case the _ function parameter is just shadowed
16:29Chousukehiredman: and since you're ignoring it, closing over it is not what you want
16:30bultersKirinDave: no sweat; nobody got hurt (yet ;))
16:30KirinDavehiredman: Besides, I said in % cases.
16:30KirinDaveFew people would actually WANT that piece of code, so if it's an ugly edge case, it's probably not a foul.
16:30ataggartso to be clear, #(foo _(bar _ _) _) is cool?
16:30KirinDaveWhat is _(
16:30ataggarta missing space
16:31KirinDaveAh
16:31Chousukeso does that take 4 arguments or just one? :/
16:31ataggart4
16:31KirinDaveI suppose, although again few people would write #(foo % (bar % %) %)
16:31bulters#(foo % (bar % %) %)
16:31bultershmm
16:31ataggartbut % is an alias for %1
16:31KirinDaveActually for now, we're saying _ means first argument. So it'd be _ => %1
16:32ataggartI;m trying to guage what you find distasteful, aesthetically
16:32ataggartI bet you could write a macro to do that underscore/positional thing
16:33KirinDaveYes.
16:33KirinDaveIts easy.
16:33ataggartdo eet
16:33KirinDaveIt's in com.banksimple.clj-utils. Will be open sourced soon enough.
16:33KirinDaveIt's just... it's of more value to readers than writers.
16:34ataggartI'm inclined to think anything like that should probably not be an anonymous fn
16:34cemerickKirinDave: Perhaps it's fair to say that the underscore syntax is most valuable with those that are used to underscore syntax…
16:34cemericks/with/to
16:34sexpbot<cemerick> KirinDave: Perhaps it's fair to say that the underscore syntax is most valuable to those that are used to underscore syntax…
16:34bultersataggart: that's a complete different discussion i guess.
16:34KirinDavecemerick: Of which there is probably a greater number than those familiar with #( %1) syntax, as that's like pretty much only clojure. :)
16:35ataggart%1
16:35ataggartnor #(%1)
16:35ataggarts/nor/not
16:35sexpbot<ataggart> not #(%1)
16:35ataggartsonce we'd keep the #(), right?
16:35KirinDaveataggart: Maybe?
16:35cemerickKirinDave: positional underscores being the most widely-known anon fn syntax?
16:36ataggartcould we mix and match _ with %n?
16:36KirinDavecemerick: I suspect the most widely known fn syntax is function() {} or perhaps { |x| ... }
16:36KirinDaveataggart: Perhaps.
16:37technomancy% clearly has more pixels than _
16:37KirinDaveIt has a higher ascender too.
16:37KirinDave:)
16:37cemerickKirinDave: I know, I was being sarcastic re: how _ is so well known :-)
16:37KirinDavecemerick: Haskell and ocaml, right?
16:37KirinDaveAlthough for slightly different meanings
16:37KirinDaveLike I said tho, the degree to which the debate has grown far outstrips my personal passion for this issue.
16:37cemerickKirinDave: Clearly evidentiary. ;-)
16:37Chousukewhat was that quote about the relation between the amount of discussion and the importance of an issue? :)
16:38KirinDaveIt's easy to spiral off into endless debates about syntax minutiae .
16:38KirinDaveSomething I care far more about is scheme-style pattern macros.
16:38bultersbut the fact that you can change it yourself says enough about clojure I guess...
16:38ChousukeWell those you can implemen as a library I think
16:39cemerickKirinDave: someone was working on those in here just a little while ago…
16:39ChousukeI'm sure some people would welcome such an effort. Personally, I find Clojure's system nice enough.
16:39KirinDaveChousuke: You can, and clojure actually does a lot of the work for you.
16:39dnolencemerick: as qbg, it's now abandoned as far as I can tell, and the scope was too large.
16:39ataggartI'll say this much: KirinDave's kvetching seems to have more substance than yegge's
16:39dnolens/as/was
16:39sexpbot<dnolen> cemerick: was qbg, it's now abandoned was far was I can tell, and the scope wwas too large.
16:39ChousukeThough it might just be that I don't know what I'm missing.
16:40KirinDaveataggart: I actually know a few dialects of lisp, Yegge doesn't really.
16:40ataggartrelease that macro!
16:40dnolenKirinDave: 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:40cemerickhttps://github.com/qbg/syntax-rules
16:40KirinDaveChousuke: 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:40cemerickdnolen: abandoned, really?
16:40KirinDavednolen: I should.
16:40KirinDaveOh rad.
16:40KirinDaveI hadn't seen this yet.
16:41ataggartKirinDave: I thought clojure had pattern macros
16:41ataggartcoulda sworn
16:41bultersKirinDave: That's more of a debugging thing right? :P
16:41dnolencemerick: last commit in Jan, I followed it closely.
16:41KirinDavebulters: No, they often are shorter and more declarative than defmacro macros, too.
16:41cemerickdnolen: maybe it's simply perfect as it is. :-P
16:41ataggartKirinDave: is this what you mean? http://clojure.github.com/clojure/clojure.template-api.html
16:41KirinDaveataggart: That's kinda the start of it.
16:41bultersKirinDave: I was referring to the error thing
16:42technomancydidn't clojure.template get promoted solely to support clojure.test? it's my recollection nobody else has ever used it.
16:42KirinDavebulters: Well yeah, but an error in a macro can be a terrible thing. See also enlive when your html file is missing.
16:42KirinDavebulters: See http://pre.racket-lang.org/docs/html/guide/pattern-macros.html
16:42KirinDavebulters: rotate is a good macro to check out the implementation in defmacro of.
16:43KirinDaveit's _much_ less obvious what's going on there.
16:43choffsteinOkay. 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:43dnolenKirinDave: 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:43ataggartchoffstein: because you local maven jars are not made available to every java instance
16:43technomancychoffstein: you probably want cljr or jark or some such. leiningen is for managing projects.
16:43KirinDavednolen: I should get on that. Having a serious startup job has really kicked the legs out from under my independent hacking efforts.
16:43ataggartchoffstein: that's what the classpath is for
16:44choffsteinataggart: But can I make them?
16:44ataggartthem?
16:44choffsteinataggart: my jars available to every java instance.
16:44KirinDaveA lot of people from common-lisp vampire bloodlines are not familiar with how badass syntax rules can get.
16:44ataggartno
16:44choffsteinI obviously am having trouble comprehending the "java way"
16:44ataggartbad idea is bad
16:45technomancychoffstein: it certainly comes down to a weakness of the JVM
16:45choffsteinCan you explain why, por favor? I assume something to do with how the JVM works?
16:45dnolenKirinDave: for day-to-day macros, they are much more readable, for more involved transformations, yuk.
16:45bultersKirinDave: 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:45technomancychoffstein: you can't reliably change the classpath at runtime
16:45ataggartchoffstein: get cake, configure the default project.clj and be done with it
16:45ataggartunless lein aded support for a default project.clj
16:46KirinDavednolen: Yep. That's why one needs both.
16:46choffsteinataggart: how does that help if I install a new library?
16:46bultersKirinDave: 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:46KirinDavednolen: defmacro is the portable particle cannon. syntax-rules is the raygun.
16:46KirinDavebulters: Syntax rules macros are based on pattern matchers.
16:46choffsteinataggart: 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:46Chousukebulters: clojure's macros are pretty simple... Just a datastructure transformation, basically
16:46KirinDaveChousuke: yes.
16:46KirinDavebulters: So you basically define little declarative programs to do syntax transformation
16:46ataggartchoffstien: it doesn;t work like that. sorry.
16:47KirinDavebulters: The generation of these programs could include error reporting.
16:47Chousukebulters: syntax-quote and such things are just tools to make creating code data structures easier
16:47cemerickchoffstein: I'm not familiar with Ruby; what happens when you have multiple versions of the same library installed?
16:47KirinDavecemerick: You suffer in despair. OR you know about it and use gem_require with a version tag. Which usually works. Not always.
16:48ataggartchoffstien: 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:48choffsteincemerick: do you mean libraries A and B depending on different versions of C? All taken care of behind the scenes.
16:48choffsteincemerick: And you can specify a version you want to use when you require the library
16:49bultersKirinDave: So a syntax rule is like a - and please excuse my oversimplification - syntactic sugar macro?
16:49ataggartchoffstien: why the aversion to specifying what your dependencies are explicitly?
16:49cemerickchoffstein: ah -- you want something like Groovy's grape, but for Clojure.
16:49choffsteinataggart: okay. So if you want to try out a new library in isolation, how do you do it?
16:50ataggartopen project.clj, add the dependency, run cake
16:50KirinDavebulters: Yes, but it's not exactly a 1:1 translation
16:50KirinDavebulters: Most syntax-rules macros produce program fragments which can then be fed to defmacro
16:50choffsteingotcha. so just create a 'playground' project, add the dep, install, run the repl and have fun
16:50KirinDave(and when I say this I say this in a conceptual sense, it is not literally what happens)
16:50bultersKirinDave: but that's true for normal macro's as well right?
16:51cemerickchoffstein: no need to install in that context
16:51KirinDavebulters: Yes, but normal macros are imperative.
16:51ataggartchoffstien: no install; delete install from your vocabulary
16:51choffsteinokay. removing it from my vocabulary.
16:51KirinDaveSyntax-rules are declarative, so you end up with a more powerful (albeit somewhat restricted) set of functionality.
16:51choffstein;)
16:52choffsteinAnd that process is necessary because of JVM requirements, or just because nobody has built the right tool?
16:52Rayneschoffstein: 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:52cemerickchoffstein: the latter
16:52KirinDavechoffstein: Some from column a, some from column b. We are bound, at some point, to the ecosystems of the java world.
16:52RaynesThat process is necessary because you aren't using cake or jark, from what I can gather.
16:52choffsteinRaynes: 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:53KirinDaveAs interesting as this has been, I really should get back to work. For those I offended, I beg pardon. :)
16:53RaynesRight, understood.
16:53cemerickchoffstein: 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:54choffsteincemerick: taking on that project may be above my clojure abilities, but I'll check it out. Thanks :)
16:54bultersKirinDave: Sorry for being such a noob on this. Thanks for putting up :P
16:54Raynescemerick: It should be. It would be so much easier to explain things with something like that around.
16:55cemerickRaynes: Oh, I'll get right on it, then. ;-)
16:55RaynesGood boy. :p
16:55bulters*keeps refreshing cemerick's github page*
17:00hyperboreeanI need some help with this issue: http://pastebin.com/fVikhX5Y ; is it coming from lein or is just me doing something wrong ? Thanks :-)
17:05arohnerhyperboreean: try lein run -m gen-bundle.core
17:05arohneri.e. - rather than _
17:06ataggart(ns gen_bundle.core)
17:07arohnerdoesn't lein run require there be a main method?
17:08raekthe lein run that comes with leiningen nowadays does, the plugin it was based on doesn't
17:09raekhyperboreean: quick fix: change (ns gen_bundle.core) into (ns gen-bundle.core) and rename do-something to -main
17:09bulters*off to work*
17:10raek(the filename should still be gen_bundle/core.clj and the command as arohner showed)
17:13hyperboreeanraek: that worked, thanks
17:21raekhyperboreean: oh, and remove the call to (-main), since lein will call it for you
17:35semperostrying 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:47devncemerick: hurry up with the atlas already!
17:49cemerickdevn: :-D
17:49cemerickI'm burning down the rough cut of the ontology right now.
17:49devncemerick: also, anything I/we can do to help?
17:50cemerickOnly ~300 vars to go.
17:50devnjust core at the moment or are you taking it further?
17:50cemerickYeah, just the standard lib.
17:51cemerickOnce I have a rough cut of the ontology, I'm bringing in a couple of beta testers.
17:51cemerickOnce 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:51cemerickLots of content to be written.
17:51devnpick me!
17:52cemerickdevn: Shoot your email to help@clojureatlas.com :-)
17:52cemerickThe private beta list is now closed.
17:52amalloyhah
17:54cemerickdevn: 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:55devncemerick: *nod*
17:56cemerickI've yet to formulate a proper plan for third-party libs though. Lots of options.
17:58devnhttp://news.ycombinator.com/item?id=2467809
17:58devn^cool.
17:59devncemerick: Yeah, not an easy one I'm sure
17:59devncemerick: i would imagine there's an extremely active effort to avoid scope-bloat on your first pass
18:00cemerickdevn: if things go *really* well, I'd like to build similar services for other languages. That will necessitate some process for collaborations, etc.
18:00devncemerick: reporting programs vs transactional programs and all of the inherent complexity that falls out of the combination of those systems...
18:01devncemerick: 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:02devnI was thinking about it while playing with Racket -- I really enjoyed the way you could mouseover and see arrows between bound vars, etc.
18:02cemerickI haven't touched racket / PLT in sooo long…
18:03devnI've just been toying around going back to the "roots" so to speak
18:04devnSo much history to glean ever since I began to <3 lisp
19:01osolevehow do i test if a character is a digit-char?
19:01osolevee.g. \3 => true, \a => false
19:01amalloy&(Character/isDigit \a)
19:01sexpbot⟹ false
19:01amalloy&(Character/isDigit \b)
19:01sexpbot⟹ false
19:01amalloy&(Character/isDigit \1)
19:01sexpbot⟹ true
19:01osolevethank you
19:02osoleveamalloy, you missed my substantive question earlier! D:
19:02amalloyoh, on SO? yeah, i was asleep when you posted it and the answers seemed adequate by the time i saw it
19:02osoleveno, here.
19:03osolevedid i post on s/o? hm
19:03amalloyno, probly not
19:03osoleveweird thing is, i dreamt i did
19:03osoleveso i genuinely wasn't sure
19:03amalloyosoleve: 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:03amalloyfigured maybe it was you
19:04osolevehahaha
19:04osoleveno, i'veyet to post anything Clojure-related on there
19:29seancorfieldi have a situation where i need a particular symbol to only exist after another function is called
19:29seancorfieldmy temptation is to put the (def some-symbol ...) inside the body of (defn other-fn ...)
19:29seancorfieldit works but ... it feels dirty
19:29hiredmandef has nothing to do with symbols
19:30seancorfieldbad phrasing on my part
19:30hiredmandef creates vars
19:30seancorfieldyes, i know really
19:30hiredmanthere are other ways to create vars
19:30seancorfieldpretend i said var instead of symbol :)
19:30hiredmanyou may be better over using something like a promise
19:31seancorfieldwell, this is part of an API that is called from outside
19:32seancorfieldif i have a top-level (def my-var ...) then it is defined and bound when the ns is loaded, right?
19:32hiredmanyes
19:32seancorfieldbut i need it to be an error to attempt to reference my-var until other-fn has been called by the external code
19:33KirinDaveWell, I may be wrong...
19:33hiredmansounds like a bad idea
19:33KirinDaveBut at least I am not outdated.
19:33seancorfieldi did say it felt dirty :)
19:33KirinDaveLike this guy, who is both wrong and terribly outdated: http://corbinsimpson.com/entry/take-a-bow
19:33seancorfield(but it does work)
19:33hiredmanwhat you want is somethine like (def x (delay do stuff)) then (force x) at the start of your functions
19:34hiredmanand x should be :private
19:34seancorfieldwhy :private ?
19:34hiredmanif it isn't part of the api, don't expose it
19:35seancorfieldit _is_ part of the API but it isn't valid until the other-fn has been called
19:35pdk,(* (/ 770 1024) 100)
19:35clojurebot9625/128
19:35hiredmanseancorfield: part of in what sense?
19:35pdk:|
19:35pdk,(double (* (/ 770 1024) 100))
19:35clojurebot75.1953125
19:35hiredmanis it a function?
19:36seancorfieldthe 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:36hiredman:(
19:36hiredmanwhy?
19:36clojurebotwhy not?
19:36seancorfieldit's a weird edge case but them's the requirements
19:36hiredmanI doubt it
19:37hiredmanit sounds kind of like a resource that you open, get some kind of 'cookie' passthrough another set of functions, then close
19:37hiredmanin which case there are ways to do that (with-open [..]) etc
19:37seancorfieldafter calling other-fn, my-var is valid and can be accessed for the rest of the life of the program
19:37seancorfieldthe outside code is _not_ clojure
19:37hiredmanso?
19:38hiredmandoesn't mean it has to be bad
19:38seancorfieldthere is no "close" here
19:38seancorfieldconsider other-fn to be some sort of initialization for the rest of the stuff in that namespace
19:38hiredmanif you really want this, as I said, I would use a promise, which would atleast avoid race conditions
19:40seancorfieldi don't think outside code can deal with a deref'able object but i'll check
19:42alekxhi all! Is Compojure still the simplest web framework in Clojure?
19:42seancorfieldhmm, actually i might be able to use a derefable
19:43trptcolinalekx: define simple :)
19:43technomancyvars are IDeref.
19:43brehautalekx: i think that depends on how you measure simple
19:43alekxbasic (?)
19:43brehautalekx: if you mean easiest to get off the ground quickly, then yes
19:43alekxlet's say something that would allow a Clojure newbie to get started easier
19:43trptcolincompojure's great, yeah
19:44brehautalekx: i personally find that moustache is actually simpler in practise, but it comes at a cost of being a little less… obvious
19:44alekx(the Clojure newbie is me is there're any doubts :)
19:44alekxused moustache before... but isn't that just a template engine?
19:44brehautalekx: i have a blog draft about all this if you would be interested in proof reading
19:44brehautalekx: different moustache i believe
19:45brehautalekx: moustache in clojure fills a very similar role to compojure
19:45alekxbrehaut: absolutely
19:45alekxbrehaut: I'm not much into moustaches so the only one I knew about is the templating engine
19:46alekxsomeone told me about #clothesline... any feedback?
19:46alekxshort story: Clojure newbie with new CloudFoundry account willing to push both forward
19:47trptcolinthat sounds like a question for KirinDave ^
19:47KirinDaveWhat does?
19:47trptcolinalekx was asking about clothesline
19:47KirinDaveAhh
19:47KirinDaveI like it. :)
19:48trptcolini hear you had something of a hand in that
19:48trptcolin:)
19:48KirinDaveyes, there are many of my opinions in that code.
19:48KirinDaveAlthough excitingly enough, I just got some good patches for it.
19:48KirinDaveMost of my projects die in obscurity.
19:48trptcolini've been wanting to look into it, just haven't had a chance to yet
19:49brehautlikewise
19:49alekxsummarizing: 1) compojure seems to remain the top one; 2) there's also (some) moustache and clothesline
19:49alekxbut for a #Clojure newbie Compojure should be quite easy to get started
19:50alekxthanks
19:50brehautalekx: its important to note that none of them are frameworks in isolation
19:50trptcolinalekx you might also take a look at http://mmcgrana.github.com/2010/03/clojure-web-development-ring.html
19:50technomancyalekx: doesn't cloudfoundry already support Clojure via war deployment?
19:50brehautalekx: they are all libraries in an ecosystem
19:51trptcolincompojure is built on top of ring
19:51trptcolinor ring extracted from compojure, or some similarly close relationship
19:51alekxtechnomancy: I assume you should be able to deploy it with a war... but I still need to build my app right? :)
19:51brehautring grew seperately to compojure, andthen compojure was rewritten in terms of it
19:52alekxring is something related to request/response processing?
19:52brehaut(at 0.4.0, at which is also when clout and hiccup became their own projects)
19:52technomancyalekx: the lein-ring plugin turns ring projects into war files
19:52alekxwell, I'll have to read first, as I don't want to abuse your time
19:52ieureI have hacked on some Compojure/Ring stuff, and it has been incredibly pleasant.
19:52KirinDavelein-ring is pretty cool for elastic beanstalk deploys.
19:53brehautalekx: its an interface for http functions
19:53ieureThe lein-beanstalk plugin is also amazing.
19:53ieureYeah.
19:53KirinDaveI've sent clothesline services To The Cloud that way.
19:53technomancyalekx: not to say there's nothing to be done, but it might involve more documentation than coding
19:53ieureif __name__ == '__main__': print "Wrong channel"
19:53__name__Wrong channel.
19:54alekxthanks a lot guys
19:55seancorfieldhiredman: 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:55hiredmandefinitly
20:11devn,(doc reify)
20:11clojurebot"([& 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:23osolevewhat's the call stack limitation on the JVM?
21:30amalloyosoleve: 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:31chewbran1ahi 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:31osolevehmm, okay. then there must be a show-stopping bug somewhere in my code that's causing this.
21:31osolevethanks
21:42brehautchewbran1a: lein install will install a local version
21:43brehautchewbran1a: but there is no way to depend on a repo in lein (by design) if i recall correctly
21:43amalloybrehaut: checkout dependencies?
21:44brehautamalloy: pass
21:44amalloyi don't use lein, but isn't that what they're for?
21:44brehauti didnt think it had them. im likely wrong though
21:45brehauthuh
22:02devnchewbran1a: figure it out yet?
22:04devnchewbran1a: fwiw you could setup a really simple FTP repository for your version and set :repositories {"my-repo" {:url "http://.../foo&quot;}}
22:04devnchewbran1a: https://github.com/technomancy/leiningen/blob/master/sample.project.clj
22:16chewbran1abrehaut: 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:16chewbran1asorry 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:27johnmn3hi
23:33gjahad__hey phil, i sent you email
23:35gjahad__about swank-cdt
23:36gjahad__the problem is it can't find tools.jar