#clojure logs

2011-07-11

01:19jonasenDoes records support metadata?
01:21sean_corfieldvars support metadata
01:22sean_corfieldso a var that's an instance of a record can have metadata
01:22sean_corfieldis that what you mean?
01:23hiredmansean_corfield: a var is a var
01:23seancorfield_hiredman: thank you for that :)
01:23seancorfield_jonasen: could you clarify your question?
01:23jonasennot really, maps can hold metadata as in (meta ^{:a :b} {})
01:24hiredmanseancorfield_: just saying "so a var that's an instance of a record can have metadata" is nonsense
01:24hiredmanvars are never instances of a record
01:24seancorfield_ok, sloppy terminology
01:25hiredman(nonsense)
01:25chouserrecords support metadata
01:25seancorfield_which is why i asked jonasen to clarify the question
01:25jonasenSo I would have guessed that records could too
01:25chouserjonasen: yes, they can.
01:25chouserdo
01:25hiredmanjonasen: what does ^{:a 1} do?
01:25hiredmanvs. with-meta
01:26seancorfield_chouser: so you can declare metadata with a record type and then add to it when you have a var bound to an instance of that type? i guess i'm having a hard time envisaging it without an example
01:27jonasenoh, I thought ^{:a :b} was shorthand for (with-meta ...)
01:27hiredmanthe follow up equestion is: why would with-meta and ^ appear to behave differently for records but the same for maps
01:27hiredmanseancorfield_: do you understand how metadata works?
01:28seancorfield_hiredman: do you understand how sarcastic you sound? there are ways to explain things without being so condescending
01:28chouser(defrecord R [a b]) (meta (with-meta (R. 1 2) {:foo :bar})) ;=> {:foo :bar}
01:29hiredmanthere are two ways to support metadata in clojure, mutable and immutable
01:29hiredmanseancorfield_: and?
01:30jonasenchouser: If I understand http://clojure.org/reader correctly, (meta ^{:foo :bar} (R. 1 2)) should work too?
01:30hiredmanjonasen: does (meta ^{:foo :bar} (hash-map :a :b)) work?
01:31jonasenso ^{..} only works for literals.
01:32chouser^{} is metadata that is applied to the *form* at *read time*
01:32hiredman^ is for reader metadata
01:32jonasenok, I think I got it now. Thanks all!
01:32chousersome things then take that metadata from their form and apply it to an object available at runtime. The data literals do this.
01:34seancorfield_,(meta (with-meta (hash-map :a :b) {:foo :bar}))
01:34clojurebot{:foo :bar}
01:35ibdknoxseancorfield_: sadly some people feel the need to be an ass :( Gotta just shrug it off.
01:40seancorfield_(def ^{:foo :bar} v (R. 1 2)) (meta #'v) => {:ns #<Namespace user>, :name v, :file "NO_SOURCE_PATH", :line 12, :foo :bar}
01:41hiredmanand?
01:41amalloyseancorfield_: getting vars involved clouds the picture for no clear purpose
01:41amalloydef (and defn) take the metadata of the symbol (which ^{...} applies at read time) and applies it to the var at evaluation time
01:42amalloythis is a convenience for attaching metadata to vars, which is otherwise difficult, and should not be confused with adding metadata to *values*, like a record
01:43seancorfield_right, and i wasn't sure from jonasen's question which he was asking about
01:43jonasenseancorfield_: I was asking about metadata on values (specifically maps and records)
01:44seancorfield_'k... so we have the answer to both then
01:48seancorfield_so what values can have metadata? IObj?
01:51amalloyseancorfield_: or IMeta, depending on what you mean by "have"
01:53jonasenseancorfield_: symbols and collections according to http://clojure.org/metadata
01:53seancorfield_IObj extends IMeta? (sorry, my screen is very small and Clojure Atlas's info doesn't fully fit
01:54amalloy&(supers clojure.lang.IObj)
01:54sexpbot⟹ #{clojure.lang.IMeta}
01:54seancorfield_&(supers clojure.lang.IReference)
01:54sexpbot⟹ #{clojure.lang.IMeta}
02:01amalloy&(let [m {:x 1}] (meta (reify clojure.lang.IMeta (meta [this] m))))
02:01sexpbotjava.lang.ClassFormatError: Duplicate method name&signature in class file sandbox21497$eval23915$reify__23916
02:01amalloyhuh
02:02jonasenNow I don't understand metadata anymore :). In addition to collections and symbols, all reference types support metadata. Correct?
02:02seancorfield_this little discussion has helped me understand (def ^{:foo 1} v ^{:bar 2} {:a :b})
02:02seancorfield_and why (meta v) and (meta #'v) are different
02:02amalloyjonasen: anything that implements IObj can support metadata
02:03amalloyusually it's easiest to avoid working with metadata on reference types, except for what gets added to vars when you def them
02:05amalloyhiredman, chouser: it looks like the compiler automatically imlements IObj for you when you reify an object. is there some reason for that?
02:13jonasenI think what I find confusing is that (def ^{:foo :bar} a) puts metadata on the Var, not the symbol 'a. But something like (with-meta #'a {:foo :bar}) doesn't work
02:14hiredmanwith-meta is for the immutable metadata interface
02:14hiredman,(doc alter-meta)
02:14clojurebotGabh mo leithscéal?
02:14hiredman,(doc alter-meta!)
02:14clojurebot"([iref f & args]); Atomically sets the metadata for a namespace/var/ref/agent/atom to be: (apply f its-current-meta args) f must be free of side-effects"
02:15hiredman^- is what you use for the mutable metadata interface (which is what the reference types use)
02:15amalloy~source alter-meta!
02:17jonasenSo what are the semantic differences for metadata on values vs. reference types?
02:18hiredman,(let [a {}] (identical? a (with-meta a {:foo 1})))
02:18clojurebotfalse
02:18amalloywelllll, reference types mutate their metadata in-place
02:19hiredman,(let [a (ref 1)] (identical? a (alter-meta! a assoc :foo 1)))
02:19clojurebotfalse
02:19hiredmanuh
02:19hiredmanright
02:19hiredman,(let [a (ref 1)] (identical? a (do (alter-meta! a assoc :foo 1) a)))
02:19clojurebottrue
02:19jonasenamalloy: and with values a new value is returned with different metadata
02:23seancorfield_nice example that with-meta can't be used with (ref 1) but alter-meta! can
02:36amalloyseancorfield_: an interesting exercise to make sure you know what's going on is to implement clojure.contrib.def/defalias
02:37amalloydefining an alias for a macro, with all the correct metadata copied, is harder than it looks
02:43ihodescoming into this way late; the meta hashmap on a Var is just a field in the instance of the var, right?
03:00seancorfield__amalloy: yes, congomongo used defalias and we just dropped that when moving it to clojure 1.3 since that macro has not been promoted to new contrib
03:01seancorfield__i'm not sure i really understand why defalias is all that useful
03:01seancorfield__enlightenment?
03:01amalloyihodes: yes
03:01amalloybut it's an implementation detail that could change, etc etc
03:03amalloyseancorfield__: it's not really useful, but it can be convenient. eg, if you like to use complement the long name is a pain, and you might choose to call it ! instead. or you want to re-export some var from another namespace into yours (though this usage has some pitfalls)
03:07seancorfield__so, like exporting foo* from an internal namespace to foo in the main namespace?
03:08amalloysomething like that
03:09amalloyof course you can just (def ! complement), but then you don't get the metadata like :arglists for slime, and it won't work for macros
03:10seancorfield__'k good to know the downside
03:22ihodesIFn.java has really grown hasn't it? whew.
03:23amalloy(defmacro defalias [dst src] `(let [v# (var ~src)] (doto (def ~dst @v#) (alter-meta! (constantly (meta v#)))))) is more or less what you need, if anyone is curious
03:23ihodeslet's throw in type hinting for ints and floats while we're at it. and support at least arity of 6. i mean, come on, that file can stand to grow some more ;)
03:31ihodeswhat does RT stand for? in clojure.lang
03:36amalloyruntime
03:50ihodesamalloy: ah, thanks. of course.
06:08bultersanyone here happens to get slimv working with macvim?
07:28bsod1_how can Clojure supports adding different types in a java data structure like hashmap or arraylist?
08:10peteriserinshow to see if two lists are the same object?
08:23peteriserinsok it was identical? that I needed
09:02chouserpeteriserins: Under normal circumstances you shouldn't need to know that about lists. What are you doing?
09:06gfrlogman using defrecord makes my lein workflow different
09:22chousergfrlog: really?
09:27ffailla /join #thortech yorktown
10:52bprping technomancy
11:08gfrlogchouser: yeah, I had issues with stale record definitions that required "lein clean", which I almost never have to do otherwise
11:08chouserbleh
11:13gfrlogchouser: in lein's defense, I had an older version (though I don't know which one)
11:14chouserI think it's Clojure's fault, not lein's
11:15chouserBut maybe nothing can be done
11:16chouserif you have an instance of an old defrecord around, re-running defrecord has to create a new class and the old instaces won't act the same as the new ones
11:17cemerickyeah, not a lot that can be done there
12:11Scripiologyabout time :p
12:11cemerick;-)
12:13Scripiologynoooooo
12:31tibbecemerick: I want to see it too so I can follow up with this year's Haskell survey ;)
12:45Scripiologyyay, ideas I'm learning from Clojure seem to carry over with reasonable efficiency to PHP
12:45Scripiologyactually, never mind
12:46chouserha!
12:50pyrany pallet users ?
12:50pyraround i mean :)
12:51__name__pyr: http://upload.wikimedia.org/wikipedia/commons/7/74/Wooden_pallet_with_glove.jpg that?
12:51__name__Not the glove …
12:55pyrnope, https://github.com/hugoduncan/pallet that :)
12:55sritchiepyr: yes, but you may have more luck in #pallet
12:55pyrah, nice to know it exists :) will head off there
12:55sritchiesee you there!
13:55shintakuhow should i install clojure on mac os x so that the repl doesn't suck in iTerm2? should i use rlwrap? or should i try clojure out with one of the newer jline versions out there, such as the one used for scala?
13:55amalloyjline is terrible. use rlwrap
13:56hiredmanI suggest using the repl that comes with your editor
13:56shintakuactually, the jline that ships with scala is not so bad
13:56shintakuwith scala 2.9+
13:56shintakuhiredman: you obviously haven't tried using clj in iTerm2
13:57shintakuohh
13:57shintakuyou said editor
13:57shintakumy mistake
13:57hiredmanI have yet to see a decent shell launcher script for clojure
13:58mdeboardemacs++
13:58hiredmanI think people are only interested in having one for about the first month or so using clojure and after that there is no strong desire to have one, so the onse out there are junk
13:58shintakui googled for rlwrap and clojure and was told to download a bunch of scripts so i stopped
13:58shintakuthey were all outdated too: http://trac.macports.org/browser/trunk/dports/lang/clojure/files/
13:58hiredmanugh
13:58hiredmanno
13:59hiredmananytime you are using the jvm and you say something like "I used my systems package manager to ..." you are doing it wrong
13:59shintakupretty much. i was just downloading those files separately
14:00mdeboardhiredman: ...to install OpenJDK? Serious question, can you explain?
14:00scgilardi"lein repl" works and uses rlwrap if present.
14:01hiredmanmdeboard: well no, not the jvm itsself, but in almsot all cases installing jars via the system package manager is the wrong thing to do
14:01mdeboardWhy? I mean, is there a reason apart from the general awfulness of most package managers?
14:02hiredmanmdeboard: they assume they way your language works is a global code space (see C, and C language conventions) which is not what the jvm has
14:02hiredmanthe way
14:03scgilardimaven (and maven-compatible tools) do a better job of retrieving current versions of jars than system package managers.
14:05hiredmaneach running jvm is a different virtual machine and gets a different classpath (like every application getting a unique LD_LIBRARY_PATH), there is no shared /usr/lib, etc
14:05hiredmandifferent world from what package managers are written for
14:05technomancydebian at least is strongly geared towards packaging up applications for end users. if you're a developer, that model is unhelpful because you need things like multiple versions of the same library to co-exist on a single machine
14:06technomancyso if you just want to use hudson or whatever, that usually works. if you want to use lucene, apt-get is not going to be helpful.
14:06technomancyerr--I mean jenkins. sheesh.
14:11mdeboardYeah lein reminds me a lot, at least superficially, of RVM for Ruby
14:11technomancythat's funny since I quit using ruby right before rvm was written
14:11kumarshantanucan anybody tell why does this throw FileNotFoundException — (clojure.java.io/reader "file:///tmp")
14:12amalloyyou can't read characters from a directory
14:12hiredmankumarshantanu: reader may not expect a file url
14:12hiredman"/tmp"
14:13amalloyhiredman: it's happy to take URLs
14:13amalloyit just can't read directories. you have to open them as File objects and then list them
14:13technomancyyeah, not really sure what you're expecting from that
14:14mdeboardtechnomancy: I'm a big-time beginner with Clojure (ergo Lein) and a novice iwth Ruby, but rvm is great, and I really prefer it to virtualenv for Python.
14:14kumarshantanuhmm, so it should not say "No such file or directory" in the exception then — just "No such file"
14:15amalloykumarshantanu: blame your OS
14:15amalloymine says: /tmp (Is a directory)
14:16technomancy"no such file or directory" is also the exception you get when you try to run a 32-bit executable on a 64-bit OS. it's just JDK nonsense.
14:17kumarshantanuusing the default JDK (1.6.0_26) on 64-bit Snow Leopard
14:18kumarshantanuokay
14:24brettkromkampgood afternoon
14:25brettkromkampclojure n00b
14:25brettkromkampon the block :-)
14:25tufflaxni
14:25tufflaxhi
14:25brettkromkamphi
14:26brettkromkampwell... when i say clojure noob, probably functional programming noob is a better description
14:26tufflaxstate of clojure 2011 results are not up yet, right?
14:26Scripiologytufflax: I think he's working on them today
14:26tufflaxoh nice
14:26Scripiologyor at least some time this week
14:26mdeboardWait, what?
14:26brettkromkampi hope i have come to the right place to ask some really beginners questions
14:26tufflaxmdeboard ?
14:26Scripiologybrettkromkamp: go for it!
14:27mdeboardState of Clojure? What a pointless speech. Clojure's state never changes.
14:27brettkromkampi've installed emacs
14:27mdeboardbadum-pshhhhh
14:27brettkromkampinstalled clojure mode
14:27brettkromkampinstalled swank and slime
14:27mdeboardstop
14:27mdeboardbrettkromkamp:
14:27mdeboarduninstall swank and slime
14:27brettkromkampgot some clojure books
14:27brettkromkampeverything seems to be working
14:27brettkromkamprepl responding
14:27mdeboardwhich repl?
14:27brettkromkampno apparent problems there
14:28brettkromkampno... my questions are bigger than configuration/installation issues
14:28brettkromkampmdeboard: clojure repl
14:28brettkromkampclojure 1.2.1
14:28brettkromkampall working fin
14:28brettkromkamp*fine
14:29brettkromkampgoto start on my version of "hello world"
14:29brettkromkampwhich is: http://www.quesucede.com/page/show/id/python_tree_implementation
14:29mdeboardthis is a very lengthy setup
14:30brettkromkampimplementing a tree structure
14:30brettkromkampin clojure
14:30brettkromkampi know
14:30brettkromkampby all means, bail out if you get board with me/it :-)
14:30brettkromkamptrying to make the jump from imperative programmer to functional programmer
14:30mdeboardWell, I just started teaching myself Clojure Friday so I thought I might have some help for you, just waiting for the question
14:31brettkromkampok... here goes
14:31brettkromkampin python, my tree structure is stored in a list
14:31brettkromkampand i append 'nodes' to the list
14:31brettkromkampbut in clojre
14:31brettkromkamp*clojure
14:31brettkromkampeverything is supposed to be immutable
14:31brettkromkampso... when i apped a node to this list
14:32brettkromkampwhat is actually happening?
14:32Scripiologyusing something like conj/cons?
14:32brettkromkampam i getting a *new* copy of the list with the appended node?
14:32brettkromkampyep
14:32tufflaxyou get a new list, that shares structure with the old one
14:32Scripiologyit will create a new list with the new node prepended to the old list
14:32brettkromkampah
14:32Scripiologybut the original list is unchanged, of course
14:32brettkromkampso that doesn't mean that for each newly appended node
14:33tufflaxsharing structure makes it fast, and it is safe because they are immutable
14:33brettkromkampi get a completely new list back
14:33brettkromkamp?
14:33Scripiologyyes
14:33mdeboardyep
14:33brettkromkampsay i append 100 nodes
14:33brettkromkampdo i have 100 list structures floating around
14:33brettkromkampin memory
14:33brettkromkamp?
14:33Scripiologybrettkromkamp: note what tufflax said
14:33mdeboardJoy of Clojure has an amazing explanation of immutable state, if that's one of your books
14:33dnolenbrettkromkamp: garbage collection
14:33tufflaxfor a list (linked list) you get a 100 long list, but 100 different pointers into it
14:33brettkromkampmdeboard
14:34brettkromkampmdeboard: it is
14:34mdeboardbrettkromkamp: section 1.4.1
14:34mdeboardgo read it :)
14:34Scripiologydnolen: I think he meant doing a 100 conses in a row and storing that, so gc wouldn't have come in yet
14:34mdeboardIt's so good I memorized the section
14:34brettkromkampi do
14:34brettkromkampchecking it now
14:35Scripiologybrettkromkamp: you know how a linked list works? Clojure's list is similar, except that the sequence abstraction lets you think of each node in the linked list as a list of its own
14:35brettkromkampscripiology: linked list? yes... i know how they are implemented (in high-level terms)
14:36Scripiologycool, let's start from the beginning, say you have a list of one item: '(3)
14:36brettkromkampok
14:37brettkromkampsaid list also represents a given 'state' right?
14:37Scripiologyinside the Clojure runtime this equates to having one object of class PersistentList (and an empty list object at the end of that, but that's not relevant right now)
14:37brettkromkampok
14:37Scripiologyyep, a list can be considered a 'state', but we can cover that later
14:37brettkromkampok
14:37Scripiologyso, say you do (cons 2 '(3))
14:37brettkromkampok
14:38Scripiologythis creates a new list that's the same as '(2 3), however, what Clojure does is create a new object of PersistentList which stores 2, and also stores a pointer to the original PersistentList that stores 3
14:39jonabbeyit's one of the coolest things about clojure, actually
14:39Scripiologywhen you call (first '(2 3)
14:39Scripiology)
14:39brettkromkampok
14:39mdeboardoh, awesome
14:39mdeboarddid not know that
14:39tufflaxSo if you do (def a '(3)) then (def b (cons 2 a)), the '(3) part of b is = to a
14:40Scripiologywhat happens is you call first on a PersistentList object that stores 2 and also happens to store a pointer to the list that just contains 3
14:40tufflaxwell, not just = in the clojure sense
14:40Scripiologyand that call to first() returns 2
14:40mdeboardHuh
14:40Scripiologywhen you call (rest '(2 3)) Clojure follows a pointer to that original list and returns that
14:40brettkromkampok... that makes sense
14:40brettkromkampproper linked-list
14:41Scripiologyso if you do (first (rest '(2 3))) it gets that original list and calls first on it, which returns 3
14:41mdeboardso if you've got '(2 3 4 5 6), and call (rest '(2 3 4 5 6)), it's only going to retrieve that next pointer
14:41mdeboardor rather, that next List object
14:41Scripiologymdeboard: exactly!
14:41mdeboardHuh
14:41mdeboardmind:blown
14:41brettkromkampbtw... what about performance considerations?
14:41brettkromkampwith increasingly longer and longer lists
14:41tufflaxwhat about them
14:41Scripiologywhich considerations specificlly?
14:42Scripiologya list of length 1000 is stored in memory as 1000 PersistentList objects
14:42tufflaxBtw the other data structures also share structure but it is a litte more complicated
14:42Scripiologynothing more
14:42brettkromkampdoes clojure transverse a list from beginning to end if for example i 'access' the last item in a list?
14:42Scripiologyyep, PersistentVector is a bit less efficient than PersistentList in terms of memory storage, but that's because it's optimized for appending to the end and random access
14:42tufflaxbrettkromkamp yes
14:43Scripiologybrettkromkamp: for lists, yes
14:43Scripiologybrettkromkamp: so if you know you'll do that, it's best to use a vector
14:43mdeboardvectors aren't hashed then?
14:43brettkromkampok... so does list lookups perform better for items at the beginning of a list as opposed to items at the end of a list
14:43brettkromkamp?
14:43Scripiologywhich has O(log32(n) speed
14:43Scripiologyfor accessing values inside the array
14:44Scripiologybrettkromkamp: for lists, yes, because it's in linear time, but like I mentioned above for vectors it's logarithmic time
14:44tufflaxmdeboard no, they are trees, just like hash maps, but instead on a hash they use the index to index into it
14:44Scripiologymdeboard: check out http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/
14:44tufflaxof*
14:44mdeboardtrees? Having trouble figuring that out. A tree where every node is an edge?
14:45Scripiologygreat explanation of PersistentVector
14:45brettkromkampok... making sense, guys :-)
14:45brettkromkampso... big question
14:45mdeboardbrettkromkamp: I really suggest if you're using clojure mode to also use the slime-repl inside emacs. Makes life very easy
14:45brettkromkampmdeboard: doing just that - absolutely love it
14:45jimi_hendrixis there something like the rest function that returns a string?
14:46mdeboardthen why did you install slime and swank :(
14:46jimi_hendrix(rest "foo") -> "oo"
14:46technomancy,(subs "foo" 1)
14:46clojurebot"oo"
14:46jimi_hendrixthanks
14:46brettkromkampmdeboard: for swank i'm using leiningen
14:46mdeboard,(str (rest '(1 2 3)))
14:46tufflaxjimi_hendrix not quite
14:46clojurebot"(2 3)"
14:46jonabbeyi'm still trying to figure out lein/slime/swank, etc.
14:46brettkromkampsorry if i didn't explain myself properly
14:46tufflax,(rest "foo")
14:46clojurebot(\o \o)
14:47Scripiologyyea, rest calls seq() on its argument, and for strings it returns a character array
14:47technomancyclojurebot: quit starin at me; you're creeping me out
14:47clojurebotCool story bro.
14:47brettkromkampbig question for you guys [well, it is big for me]
14:47S11001001)
14:48brettkromkampreally grokking functional programming if you come from imperative programming [like the majority of us, i suppose]... how did you guys go about that?
14:48jonabbeyyou just get your hands dirty with it
14:48hodappfirst, you find all the people who tell you you should write in C++
14:48brettkromkampjava, python, etc... all about objects with mutable state
14:48hodappthen you hit them with a clue-by-four repeatedly
14:49technomancyyou have to write code. it may be embarrassing to you later, but it's the best way to get your brain in gear
14:49Scriptorbrettkromkamp: I read a bit of LearnYouAHaskell and tried to implement some of the functions it introduced without looking at the source for them
14:49brettkromkampok
14:49mdeboardScriptor: oof
14:49mdeboardHaskell was way, way, way hairier for me
14:49brettkromkampbut haskell is too much of a brain-fuck [pardon my language] :-)
14:50hodappwell, at least it's not C++
14:50tufflaxbrettkromkamp I used python before clojure, and in python I was pretty fond of map, filter and reduce. I guess I was just progressing towards fp
14:50mdeboardbrettkromkamp: My background is in Python & JS. Like technomancy said you just have to write code. I rewrote a Python app I did a long while ago in Clojure this weekend and learned a ton.
14:50brettkromkampbut did any of you guys have a 'aha' moment when it just clicked? and, if yes, what made it click?
14:50Scriptorbrettkromkamp: heh, for functional programming it's not too bad once you get past the first couple of hurdles
14:50mdeboardtufflax: tsk tsk
14:50Scriptordefinitely
14:50mdeboardbrettkromkamp: I have had several aha moments reading Joy of Clojure
14:50Scriptorthough I needed several aha moments
14:51brettkromkampok
14:51Scriptorbrettkromkamp: start simple, like implementing a count function to return the length of a list
14:51brettkromkampso... just take an existing algorithm or app in an imperative language and convert to clojure?
14:51mdeboardbrettkromkamp: That's been a big help for me.
14:51mdeboardbrettkromkamp: And seriously, read Joy of Clojure
14:51mdeboardlike, right now :P
14:51tufflaxmdeboard brettkromkamp try this http://4clojure.com/
14:52mdeboardclojurians
14:52brettkromkampand just hit my head against the wall until i get it [or have brain a brain concussion :-)]
14:52mdeboardyeah
14:52hodappI should be writing these books down. I've messed with Lisp a bit, but not Clojure, yet
14:52mdeboardonce I got my app rewritten last night I turned off the computer and went to bed
14:52mdeboardcompletely wore me out, felt like I gave birth
14:52hodapplol
14:53brettkromkampmdeboard: lol
14:53hodappwas it Paul Graham who said that writing a program was the closest thing to giving birth that males could do?
14:53mdeboardthen woke up at 9p and read JoC for 2 hours :(
14:53brettkromkamptufflax: thanks - am checking it out as we speak
14:53amalloytufflax: whew, just finished reading the scrollback and was worried i'd have to advertise 4clojure myself. now i can just be subtle and let you do it
14:53mdeboardspent the entire weekend working on it.
14:53jimi_hendrixmdeboard, JoC?
14:53tufflax:)
14:53jonabbeythe first time i studied lisp, it wound up getting into my head so much that i found myself in bed with my girlfriend, and everything she said my brain was permuting into prefix order
14:53ScriptorI still have to write a major clojure app...:/
14:54Scriptorjust browse through some of the source every now and then
14:54jonabbeyooh, 4clojure, nice
14:54brettkromkampscriptor: that brings me to another question... who has written a major clojure app? and what kind of app is it?
14:55brettkromkampjust to get a feel for the kind of problems that are being solved in clojure
14:55tufflaxbrettkromkamp im trying, im working on a online rpg :p
14:55amalloyclojurebot: source?
14:55clojurebotsource is http://github.com/hiredman/clojurebot/tree/master
14:55tufflaxan*
14:55Scriptorbrettkromkamp: lots of people have writtens decent-sized clojure codebases, as in more than toys
14:55amalloy$whatis source
14:55sexpbotsource is http://github.com/cognitivedissonance/sexpbot
14:55hiredmanhttp://dev.clojure.org/display/community/Clojure+Success+Stories
14:55Scriptorhiredman: thanks, was about to hunt for that :)
14:55amalloybrettkromkamp: you can look at the source for #clojure's bots as examples
14:55mdeboardjimi_hendrix: Joy of Clojure
14:55jimi_hendrixah
14:56tufflaxbrettkromkamp http://cemerick.com/2010/06/07/results-from-the-state-of-clojure-summer-2010-survey/ the 2011 should be up soon too
14:56brettkromkampthx guys - you are being really helpful
14:56dnolenbrettkromkamp: Twitter's using Clojure now
14:56Scriptordnolen: they're using both clojure and scala?
14:56brettkromkampdnolen: is it? i though they had migrated to scala
14:56amalloybrettkromkamp: well, they bought backtype
14:56dnolenScriptor: Twitter bought BackType, BackType is and will continue to build out their Clojure code base.
14:56symboleScriptor: Write an Emacs killer. Put this putty to sleep already.
14:56mdeboardI feel like, "State of Clojure every year? Why? Clojure's state is immutable!" is an A+ pun.
14:56symbolepuppy*
14:57brettkromkamp;-)
14:57amalloymdeboard: c'mon, clojure lets you *manage* state
14:57cemerickmdeboard: well done :-)
14:57mdeboardI said it earlier to crickets :(
14:57amalloymdeboard: i applauded while i was reading the scrollback
14:57mdeboardAnyway brettkromkamp #clojure is a great channel. Unwashed masses haven't started showing up yet.
14:57mdeboard#python is kind of a cesspool, for example.
14:58Scriptorsymbole: I know someone in another channel who was doing a vim clone in clojure
14:58Scriptormdeboard: have you checked out ##php?
14:58hiredmanthere was a lot of talk at one point about "oh, clojure as functional dynamic language will be good for the frontend and because of scala's static nature and types it will be good for the backend" but the majority of stacks I know of are clojure on the backend and rails on the frontend
14:58jimi_hendrixmdeboard, i love how "lol" is banned in #python
14:59jimi_hendrixalso, #d is the worst language channel i have seen
14:59mdeboardScriptor: no
14:59Scriptormdeboard: lucky
15:00brettkromkampso... using clojure to build a combined marketing intelligence and scenario planning system makes sense? :-)
15:00brettkromkampthat's why i am looking into it...
15:00brettkromkampit => clojure
15:00tufflaxusing clojure to build just aboul anything makes sense, the using clojure part
15:00tufflaxat least
15:01Scriptorhow suitable would clojure be to writing a VM?
15:01Scriptorsince it's entirely based on mutating
15:01amalloybrettkromkamp: ∀x, using clojure to build x makes sense
15:01jimi_hendrixjust curious, how is clojure speed wise? how does it compare to normal java?
15:01brettkromkampok
15:02dnolenjimi_hendrix: you can get Java speed if you write nasty code.
15:02jimi_hendrixlol
15:02brettkromkampdnolen: but clojure isn't 'slow' is it?
15:02tufflaxamalloy is shows up as a back square for me, your qualifier :p
15:02jimi_hendrixthus defeating the point
15:02clojurebotthe point of moby dick is "be yourself"
15:02Scriptorbrettkromkamp: nope, it's very nice speed-wise
15:02dnolenbrettkromkamp: no, it's quite fast.
15:03brettkromkampnot like python or ruby?
15:03amalloytufflax: sad. fix your unicode support?
15:03amalloyjimi_hendrix: not at all! just write nasty code in the places where you really have to
15:03tufflaxmaybe :p
15:03jimi_hendrixbrettkromkamp, even those can be quite fast if you use the right interpreter
15:03brettkromkamppython -> cpython and ruby -> mri
15:03brettkromkampthat's what i'm using and i sometimes feel the pain
15:04dnolenjimi_hendrix: was being a bit facetious of course. what amalloy said is closer to the truth.
15:04jimi_hendrixbrettkromkamp, i know the EVE online servers use stackless python for all their processing
15:04jonabbeythe ability of clojure code to be neatly paralellized is very exciting
15:05dnolenbrettkromkamp: big draw to me for Clojure was that you didn't have leave the language to write low level fast stuff when you want/need it.
15:05jonabbeywrite in a functional manner, and then spread those functions out across all your processing resources
15:05brettkromkampjimi_hendrix: yeah... i heard... but although i like python it does seem like from an evolution point of view... it is at a dead end
15:05brettkromkampdon't know why it gives me that impression, but it does
15:06Scriptorbrettkromkamp: pypy's doing some pretty good work on the speed end, but language-design wise you might be right
15:06brettkromkampclojure gives me the impression that we haven't seen nothing yet - despite the fact that it is slow in terms of version updates
15:06brettkromkampslow version updates does not mean a bad thing
15:07mdeboardYeah agree about Python plateauing. But its ease of use and multiparadigm design will make sure it's around forever.
15:07brettkromkampif i was going on a trip to mars
15:08brettkromkampwould i take clojure or would i take python [if i was only allowed one language]... it would be clojure... without a doubt and i don't even know the language yet
15:08brettkromkampand i *really* do know python
15:08hodappI am a fan of Python.
15:08brettkromkampso am i
15:08tufflaxbrettkromkamp about having seen nothing yet: lisps have been around for quite some time :p
15:08Scriptormight be hard sending new clojure versions to mars :p
15:09hodappalthough it can be tough to write in Python after having written in C++, MATLAB, and so on for awhile, because you tend to choose harder ways to solve things before realizing Python has a one-line answer
15:09brettkromkamptufflax you are right - but i mean clojure specific -> concurrency, specifically
15:10brettkromkampanyway... thanks guys
15:10brettkromkampyou have pointed me in the right direction -> rtfm :-)
15:10tufflaxthanks for making the clojure community bigger :p
15:10brettkromkampthe manual being "the joy of clojure"
15:10tufflaxbrettkromkamp and clojure.org!
15:11brettkromkampwill do
15:11brettkromkampalready have it as my home page :-)
15:11tufflaxhehe
15:12brettkromkamptalk to you guys later - and again... thanks for all your advice
15:12Scriptorno prob!
15:13babilenbrettkromkamp: I wouldn't necessarily start with "The Joy of Clojure" but with "Practical Clojure" -- Read tjoc afterwards. :)
15:14mdeboardbabilen: Why's that? I'm new to FP in general and find JoC *extremely* accessible.
15:15babilenmdeboard: I found JoC to be better suited after you have at least a little experience and quite liked PC -- Although the "List of api calls"-Chapters in PC are bad.
15:16mdeboardI dunno, maybe. But as a beginner to Clojure, the JVM and FP in general Joy of Clojure is amazing and eye-opening. First tech book I've ever been excited to get back to after work.
15:16babilenmdeboard: I am not saying that JoC is bad or so, it is a wonderful book, but *I* started with "Programming Clojure" and couldn't quite get into it, then switched over to PC.
15:17babilenmdeboard: Indeed, it is great. I am curious what Programming Clojure 2nd Edition will be like.
15:17flazzi created a project with lein, how do i play with functions in the repl?
15:17amalloy(inc mdeboard)
15:17sexpbot⟹ 1
15:18amalloyi read JoC first
15:18babilenBut I am by no means a veteran in Clojure and there might also be technical or style-wise reasons to prefer one book over the other. I just had the impression that PC + JoC is a very good combination.
15:18amalloyno previous functional experience
15:18babilenI can not really comment on reading JoC first as I have never done that.
15:19amalloyflazz: cd myproj && lein repl?
15:19brettkromkampok...
15:20brettkromkampjust to make sure i've understood you guys [i'm slow on the uptake]
15:20flazzamalloy: right, got there; how do i load/run code i wrote in the lib dir in the repl?
15:20amalloyblerg. don't write code in the lib dir
15:20brettkromkampit's ok in clojure to use a list as the container for the 'nodes' for my tree implementation?
15:21brettkromkampappending/cons-ing nodes to a list is not 'bad' clojure practice
15:21brettkromkampor is it?
15:21mdeboardvectors are specifically designed for appending
15:21Scriptorbrettkromkamp: depends, appending is faster for vectors
15:21mdeboards/designed/optimized
15:21sexpbot<mdeboard> vectors are specifically optimized for appending
15:21brettkromkampok
15:21mdeboardlol, nice bot.
15:21Scriptorbrettkromkamp: you'd normally use conj insted of cons, actually
15:22Scriptorconj prepends to lists and appends to vectors
15:22brettkromkampregardless of the actual underlying data structure
15:22brettkromkampfrom a fp point of view
15:22Scriptoractually, conj calls the equivalent method on the list object it's given
15:22Scriptorequivalent meaning the object's own conj method
15:22brettkromkampthere is nothing wrong with using a list/vector as the container for a data structure and updating said data structure
15:22brettkromkamp?
15:22Chousukeit's fine to use any data structure that provides the operations you need :)
15:23amalloyjust avoid *mutating* data structures if you can help it
15:23brettkromkampi'm just trying to wrap my head around this whole 'immutable' state thing
15:23Chousukeevery clojure data structure is persistent and so good to use
15:23flazzamalloy: sorry src dir
15:24brettkromkampamalloy: that's exactly what i mean - what do you mean with "just avoid mutating data structures" how do i work with them if i don't mutate them???
15:24Chousukebrettkromkamp: it's not that difficult in the end; instead of "changing" something you transform it
15:24Chousukebrettkromkamp: and end up with both the original and the transformed version
15:24brettkromkampchousuke: isn't that horribly inefficient
15:24brettkromkamp?
15:24Chousukebrettkromkamp: no
15:24jonabbeyclojure's data structures are designed to work that way
15:24Chousukebrettkromkamp: clojure data structures do structural sharing
15:25brettkromkampso when i cons or conj - what am i doing? mutating? or transforming?
15:25Chousuketransforming
15:25Scriptorbrettkromkamp: remember how each PersistentList I mentioned before pointed to the next one? That's how lists share structure
15:25brettkromkampperhaps it is just the semantics that i am not understanding
15:25Scriptortransforming
15:25jonabbeyif you do a transformation that shrinkis a data structure and then just keep a reference to the shrunken transformed structure, gc will get rid of the unnecessary pieces
15:25amalloyugh transform is not a word with clear meaning here
15:26amalloyyou are creating a new version of the list/vector/whatever
15:26Chousukebrettkromkamp: it is slightly less efficient than mutating things, but it's worth the benefits:)
15:26jonabbeybut if you have a var or a thread that is still referencing the old (larger) version of the structure, it will be kept around as needed
15:26mdeboard15:26 <amalloy> you are creating a new version of the list/vector/whatever
15:26amalloy&(let [x [1 2], newx (conj x 3)] [x newx])
15:26sexpbot⟹ [[1 2] [1 2 3]]
15:26mdeboardthis
15:26brettkromkampok... this is the real head-fuck with regards to clojure
15:26jonabbeyby transform, read the output of a function that returns a modified version of a structure
15:26amalloyhere i conjed onto a vector, and the old and new versions are both still in existence
15:26Chousukebrettkromkamp: note that most programs do need mutable state. But clojure handles that with another mechanism
15:26Chousukebrettkromkamp: ie. with reference types
15:27brettkromkampok
15:27jonabbeyor by simply calling methods on java objects, if you like that sort of thing
15:27amalloyChousuke: no programs *need* mutable state. but often it's easier to write/model them if you use some
15:27Chousukebrettkromkamp: references mutate, but the data structures that they refer to do not
15:27mdeboardbrettkromkamp: It need not be a headfuck. Every time you change something about a collection, you get a new item back.
15:27brettkromkampi *think* i understand what you guys are saying - but it really does require a different way of thinking about program design
15:27jonabbeyit does
15:27hiredmanamalloy: *ahem*
15:27mdeboardChousuke's explanation is muddying the water a bit I think
15:28Scriptormdeboard: it's just explaining how the new item still shares memory with the original that's hard to explain :)
15:28mdeboardIt's all pointers right?
15:28jonabbeyreferences, yes
15:28mdeboardSo there you go :)
15:29Scriptorbrettkromkamp: maybe this'll clarify it for you: say you conj onto a vector. In Clojure terms this returns a new vector that's separate from the old one
15:29brettkromkampok
15:29Scriptorbut in implementation terms, since the new vector is almost exactly the same as the old one except for one new item, you don't need to copy the old one
15:30dnolenbrettkromkamp: but really you shouldn't even think about it like that since this all implementation-centric
15:30amalloyhiredman: am i wrong? it seems to me you can write any program as a function which takes "the universe" as input and returns a new universe, in conjunction with a loop that iterates over this, possibly doing some i/o
15:30dnolen1 + 1 - > 2
15:30Chousuke,(let [a '(a list) r (atom a)] (swap! a conj 'something) [a @r r])
15:30clojurebotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Atom
15:30brettkromkampso... under the hood clojure is inmutable but from a programming point of view... it's business as usual?
15:30Scriptorbrettkromkamp: so the new vector actually tries to share as many objects as it can with the old one without copying them
15:30dnolenyou have values and operations on values, you can't change 1 or 2
15:30Chousukewait
15:30Chousuke,(let [a '(a list) r (atom a)] (swap! r conj 'something) [a @r r])
15:30clojurebot[(a list) (something a list) #<Atom@199682f: (something a list)>]
15:31jonabbeyit's business as usual from a functional point of view
15:31dnolenyou should see (conj {} 'a) should think, that just like (+ 0 1) etc
15:32jonabbeyi.e., you write functions which take data and return results. clojure's data structures are designed under the covers to make that as efficient as possible for operations on lists, vectors, etc.
15:32mdeboardbrettkromkamp: For our purposes right now, in answer to your "business as usual" question, yes.
15:32brettkromkampmdeboard i will read the joy of clojure - sorry about this
15:32jonabbeyand clojure's persistent ("immutable") data structures have unique benefits when you're running multithreaded
15:33mdeboardYou can write a million lines of operational code in Python without ever understanding the concept of state mutability
15:33mdeboardit will augment your ability for sure
15:33brettkromkampme -> off to read the first chapters of the joy of clojure
15:33mdeboardI'm p sure it's like that in clojure too.
15:33brettkromkampsorry guys
15:33Chousukebrettkromkamp: no need to apologise for asking questions
15:33mdeboard^
15:34mdeboardI'm at work writing python or I'd be asking them myself
15:34Chousukebrettkromkamp: what you're asking might seem simple or "stupid" but it really isn't.
15:34brettkromkampwell... i must admit... i do feel a bit stupid
15:35brettkromkampi've been developing for 10 years now
15:35brettkromkampthat's why i just wanted to talk to other devs
15:35Chousukebrettkromkamp: that might be precisely why clojure's concepts are difficult for you
15:35brettkromkampin the company i work for... the other devs just aren't interested in other languages
15:35brettkromkamplet alone fp... oo is everything to them
15:35Chousukeit's easier to learn something new when you have no expectations of how things work
15:36Cozeyis it possible to call a static method of a class, when I have this class as a value ?
15:36brettkromkamptrue
15:36jonabbeylearning functional programming / lisp is almost like learning a new human language.. it takes some time to get your brain to think in it
15:36Chousukeyeah, but once you get it, it will affect the way you think about all programming
15:36brettkromkampi'll get there [cross fingers] :-D
15:36Cozeylike: (let [i Integer] (.valueOf i "123" ) ) ?
15:36technomancybrettkromkamp: it might be too theoretical, but if you're interested in an explanation for how programs can work without modifying state I recommend reading Out of the Tarpit
15:37technomancyyou'll definitely want to read it eventually
15:37brettkromkampout of the tarpit?
15:37technomancyhttp://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.93.8928&amp;rep=rep1&amp;type=pdf
15:37jonabbeynice ref
15:37technomancya short paper on FP; pretty accessible
15:37amalloyCozey: it's possible, but it might need reflection?
15:37brettkromkampwhat you say... how programs can work without modifying state -> that is hitting the proverbial nail on the head
15:38jonabbeyfor 'state', read 'heap
15:38Cozeyamalloy: mhm.. so maybe there's another way to serialize an Enum ?
15:38brettkromkampthat is exactly what i am looking for
15:38jonabbeyfunctional code involves modifying state, but it's state that is thread-private and restricted to active function stack
15:38technomancybrettkromkamp: it has a great proof that storing internal state is necessary solely for optimization (called "accidental complexity")
15:39brettkromkampout of the tarpit -> copying to my kindle as we speak :-)
15:39hiredmanamalloy: seems rather disingenuous to discount the io loop as part of the process
15:39jonabbeyfun / neat languages to learn: clojure, erlang, prolog
15:39Chousukebrettkromkamp: I think most programs need some sort of state, but most of the *code* doesn't. It's possible to separate "stateful" code from code that does things with immutable values.
15:40technomancybrettkromkamp: the second half is not as relevant fwiw
15:40brettkromkamptechnomancy :-D
15:40Cozeyah there's a (Enum/valueOf BlaBla "NAME")
15:41technomancyclojurebot: Out of the Tarpit is a short, accessible paper on FP and reducing complexity by identifying and minimising state: http://ben.moseley.name/frp/paper-v1_01.pdf
15:41clojurebotIn Ordnung
15:41amalloyCozey: hah, wish i knew about that when i was serializing enums a while ago
15:41brettkromkampthanks guys -> i'm off to do some reading
15:42mdeboardbrettkromkamp: So look, instead of feeling stupid, you really need to feel smart as hell in here because Clojure is a very big deal. As a friend of mine says, the consumer Internet has been aruond for ten years. There's no possible way that Python or Ruby is the end-all, be-all of web development. Clojure has undeniable benefits in concurrency and speed that imperative langs, and even multiparadigm langs e.g. py/rb,
15:42mdeboardwill not be able to match. I'm not saying Clojure is "the next big thing", it probably isn't, but I think the next generation of impure FP langs will be the big ones.
15:42amalloythough i think i wanted to serialize to a byte rather than a string
15:42Chousukebrettkromkamp: for example, you might have a function that removes all vowels from text. that obviously can be done with a non-stateful function. then you might have an UI with an input field where you want to apply this transition; it requires state, but that is a separate problem... The main logic is still a stateless function.
15:42Cozeyamalloy: i want to pass mine through a html form
15:44dnolenmdeboard: I don't see any serious competitors for the future FP goto langs beyond Scala & Clojure. Scala from the static typing side, Clojure from the dynamic typing side.
15:45mdeboarddnolen: Well, I think the thought patterns of FP will keep Clojure & Scala from reaching widescale adoption. OOP is pretty entrenched
15:46jonabbeya generation is being trained to a broader point of view already with python, ruby, and javascript
15:46mdeboardture that
15:46mdeboardtrue*
15:46dnolenmdeboard: I don't mean FP will replace OOP anytime soon, but I think the adoption of FP will be quite dramatic in the next few years.
15:47mdeboarddnolen: That's what everyone thought in the 70s and early 80s too
15:47dnolenmdeboard: except there were very few *production* oriented FP langs.
15:47mdeboardalso true
15:48dnolenClojure & Scala are both squarely aimed at working programmers.
15:48jonabbeywith massive pre-existing libary and tooling support
15:48jonabbeyi remember doing CLOS coding back in the early 90's.. talk about a wasteland
15:49hodappYou say "replace OOP" like we currently use OOP...
15:49jonabbeyi remember when Apple was pushing Dylan hard, too
15:49hodappbut the dominant implementations are pretty lacking in terms of actually meeting what Alan Kay had in mind in proposing the term
15:50jonabbeyisn't Objective C supposed to be pretty decent?
15:50hodappI've heard it is.
15:50hodappIt's closer to Smalltalk
15:51jonabbeyit supports dynamic method dispatch the way python does
15:51jonabbeymessage oriented
15:51hodappyeah
15:52hodappI am much a fan of Python's duck typing
15:53jonabbeyis clojure-contrib 1.2 the latest version, or is there a newer version for use with clojure 1.3.0 beta?
15:54jweiss_anyone know of a lib that would let me jump into code the way you do in emacs with M-. but generating HTML with links instead?
15:57mdeboardjweiss_: I don't understand the question
15:57jweiss_mdeboard: you know what i'm referring to with the emacs M-., right?
15:57mdeboardyeah
15:57mdeboardit's the "but" clause I don't understand.
15:57technomancyjonabbey: individual libraries may have been upgraded to work with 1.3; depends what you want
15:58jweiss_mdeboard: i want to take my set of source files, and output html so taht the fn calls are links to the functions they actually call
15:58jonabbeyokay
15:58mdeboardahh
15:58brettkromkamptechnomancy, mdeboard, chousuke... thanks guys
15:58jonabbeyi'll just clone clojure-contrib from github/clojure and go with that
15:58brettkromkampi hope to come back somewhat more enlightened
15:58jweiss_mdeboard: obviously, you need some kind of runtime to do that, you can't do it just with the source, but i'm ok with that
15:59cemerickwell, that took waaaay too long
15:59cemerickState of Clojure 2011 results: http://wp.me/p10OJi-9L
15:59amalloycemerick: you got it done before 2012, anyway
16:00tufflaxbrettkromkamp you might like this http://blip.tv/clojure/clojure-for-java-programmers-1-of-2-989128
16:00tufflaxcemerick nice :)
16:01cemerickmdeboard: your pun has been immortalized :-P
16:01mdeboardcemerick: How's that
16:02cemerickmdeboard: OH'ed on twitter
16:02mdeboardcemerick: lol
16:02mdeboardshit you could've @'d me at least, mattdeboard
16:02mdeboard(jk obv)
16:03mdeboards/sh*t/darn
16:03cemerickmdeboard: well, see, you should've tweeted it, and then I'd give you a RT
16:03mdeboardI don't use twitter anymore, G+
16:03cemerick*shrug*
16:03mdeboardlol but I'm honored, thanks :)
16:04cemerickMy G+ profile will likely languish, just like my FB account.
16:04dnolencemerick: it's interesting that people come to Clojure from dynamic langs but would switch to a static lang if Clojure didn't exist.
16:04cemerickdnolen: true. I don't think static/dynamic is as much of a divide as it's put up to be.
16:04cemerickimperative vs. functional, though, that's a biggie
16:12dnolencemerick: great stuff, thanks for putting it together.
16:15parasebaIs anybody using clj-time with clojure 1.3.0-beta1?
16:28cemerickdnolen: Thanks, and np :-)
16:28mdeboardcemerick: I can't see it at work :(
16:29cemerickreally!
16:29cemerickmdeboard: do they just block all of wordpress.com?
16:29mdeboardcemerick: probs
16:29cemerickbogus
16:31Scriptormdeboard: google cache: http://goo.gl/XbUvl
16:31Scriptorhopefully that works
16:31Scriptorwait, nvm
16:31Scriptorthat's the announcement of the end of the survey
16:32cemerickI was going to say, no way it's cached already
16:32mdeboardit did thanks Scriptor
16:32mdeboardoh
16:32mdeboardI was like "where's the survey"
16:40amalloycemerick: google caches stuff like mad
16:40amalloyeven with some fairly minor SEO you get cached within the hour, iirc
16:41Scriptoramalloy: all the more reason why g+ running out of disk space was a serious wtf
16:41kumarshantanuhi, need some help with regex-fu — can anybody verify that this (below) is correct?
16:41kumarshantanu,(re-find (re-matcher #"(.+)\-([\d\.]+)\.(\w+)" "foo-bar-1.0.6.jar"))
16:41clojurebot["foo-bar-1.0.6.jar" "foo-bar" "1.0.6" "jar"]
16:41amalloyshoulda headed over to facebook to borrow a cup of sugar
16:42kumarshantanutrying to split up arbitrary maven artifact filenames into tokens — artifactId and version
16:42Scriptorkumarshantanu: seems to work from what clojurebot printed out
16:42hiredmannot going to happen
16:42amalloykumarshantanu: fwiw, - doesn't need to be escaped, and nor does . inside of []
16:43hiredmanjars don't have the groupid in the filename
16:43kumarshantanuhiredman: right, i am just trying to get artifact-id and version
16:43hiredmanI'm not actualyl sure that the artifactId is always in the jar name, could just be most of the time
16:43hiredmanactually
16:43hiredmancemerick: ?
16:44cemerickhrm?
16:44cemerickoh
16:45cemerickNot having the artifactId in the artifact filename would be *very* rare, but can happen.
16:46kumarshantanuamalloy: thanks, yes - and . need not be escaped in []
16:46cemerickIIRC, you can attach any file to an install/deploy, with any filename.
16:46cemerickkumarshantanu: do you not have the pom's for these artifacts right next door?
16:47hugodthere are also classifiers - test, sources, etc
16:47kumarshantanucemerick: hiredman: i am only trying to guess the artifact-id and version
16:47kumarshantanucemerick: am trying to do a lein plugin…so it'll be user-assisted
16:47kumarshantanuthis is for local JARs
16:48cemerickkumarshantanu: well, just know that you're in murky territory.
16:49kumarshantanucemerick: true :)
16:50cemerickkumarshantanu: also know that, as long as you're working with local jars, you're working with jars that aren't in a repo, and the build process you're attempting to support will be unrepeatable by default
16:50cemerick:-)
16:53kumarshantanucemerick: right…am wondering if it can be streamlined a bit — (1) store local JARs in "local" dir, (2) run this lein plugin to install to local-repo, (3) lein deps, (4) lein jar
16:53kumarshantanuchecking in JARs in version control is another can of worms though
16:53hiredmankumarshantanu: there is a local repo, ~/.m2
16:54kumarshantanuhiredman: installing JARs to ~/.m2 is a chore, which is what i am trying to get rid of
16:54cemerickkumarshantanu: I don't know what you're attempting to do, and I've never written any lein-related code, I don't really want to say anything unhelpful. But if anything you're doing involves jars into version control systems, please don't.
16:54hiredmankumarshantanu: I think you would be better serverd by taking the time to get your jars into a repo
16:55hiredmaninfact, if you specify an unknown jar in your project.clj, lein will spit out the command needed to install it into the repo
16:56cemerickhiredman: can it do it itself, or is it still a mvn incantation?
16:56hiredmancemerick: it is an mvn command
16:56hiredmanfor random jars, lein can install and deploy the artifacts it produces
16:57cemerickThere was a guy around here a year ago or so that was thinking of starting a mvn repo hosting service. I wonder where he went off to.
16:58hiredman*shrug* maven repos are dirt simple, dunno how you could make money doing it
16:58hiredmanyou need GET and PUT and you're done
16:59cemerickhiredman: same goes for e.g. gitosis, yet people pay for hosted git repos.
17:00cemerickMy mvn-repo-in-github hack is consistently one of my most popular posts, surprisingly. http://cemerick.com/2010/08/24/hosting-maven-repos-on-github/
17:01hiredmancemerick: yeah, but the host github repos are git + other features you want anyway, how much is there to build on top of GET and PUT for a maven repo?
17:02cemerickThere's nothing to build at all — you can just use nexus or artifactory, and have lots more than GET and PUT for free.
17:03cemerickI think it's fundamentally a matter of admin overhead (or not).
17:03hiredmanmmm
17:18parasebaright now, clojure.contrib.condition is broken for clojure 1.3.0, it's not using :dynamic. How is this project going to be maintained? should I send a patch to contrib? should I help to migrate it to its own project?
17:20technomancyparaseba: it's in its own project already, actually
17:21technomancyclojurebot: slingshot?
17:21clojurebotIt's greek to me.
17:21technomancyclojurebot: lise
17:21clojurebotexcusez-moi
17:21technomancyI mean lies.
17:21technomancywhatever
17:21technomancyclojurebot: slingshot is the successor to clojure.contrib.condition: https://github.com/scgilardi/slingshot
17:21clojurebotOk.
17:22parasebatechnomancy: Oh, didn't know about that. Thanks
17:23parasebatechnomancy: but, don't you think this kind of problem will slow 1.3.0 adoption?
17:29ibdknoxdo you think clojure/core would be interested in a redesign of clojure.org?
17:37technomancyparaseba: yeah, but people need to move off contrib anyway
17:38technomancyit's a left-over from back when the answer to "how do I make it easy for people to use this code" wasn't "publish it somewhere that makes sense"
17:38parasebaI agree, but it's hard to know where to move to
17:39parasebamaybe adding some alternative options in contrib modules documentation
17:39technomancyslingshot is different because the author wants it to see more internal usage before making a big announcement
17:40technomancyI personally haven't seen many useful old-style contrib libraries that don't have modular replacements
17:40technomancyslingshot was kind of the last missing piece
17:41parasebac.c.def has an alternative?
17:43amalloyi think it's fair to say that c.c.def isn't "useful"
17:43replacatechnomancy: hmmm, an issue with lein repl, lein swank, etc.: if I need a big JVM and I set JAVA_OPTS=-Xmx1024m, the setting applies to both lein *and* the jvm it spins up to run the repl/swank client
17:43technomancydefalias hovers on the edge of being justified
17:44technomancyreplaca: good point; that's not terribly useful
17:44replacatechnomancy: I'm not sure if this really matter (the resident set size of lein is quite small) but I could imagine probs for very large virtual sizes
17:44technomancydo you know about :jvm-opts in project.clj?
17:44replacaahh, no. That's probably what I want.
17:44replacaworks in both those scenarios?
17:44technomancyit applies to the project JVM only
17:45technomancybut if you could open an issue to separate out JVM_OPTS and LEIN_JVM_OPTS that would be super
17:45replacaright, but both with swank or repl?
17:45technomancysince it's not always appropriate to edit project.clj
17:45technomancyyes, every project JVM
17:45replacayup (in my case it is, though)
17:45technomancyall code that needs to run in the context of the project
17:45replacatechnomancy: issue on the way, thx
17:45technomancycool
17:49parasebatechnomancy: I agree, the problem is there are lots of libraries depending on c.c.def and others. If all they had to do to move to 1.3.0 was change a namespace, it would be faster
17:49parasebabut also ... it wouldn't help moving out of c.c . So, probably the pain is justified
17:50amalloytechnomancy: "We have a policy of releasing entire Java packages in which every single class, interface and method is deprecated right out of the box, starting at version 1.0." -- http://steve-yegge.blogspot.com/2010/07/wikileaks-to-leak-5000-open-source-java.html
17:51amalloynot really relevant, i suppose, unless that's why you like defdeprecated
18:07technomancydeprecation happens
18:40dRbiGright, i have (sort-by (fn [x] (.length (new File path x))) files) - i'd like to make a macro/fn/whatever out of it where i can substitute .length with a string (i check if the string actually is a proper .method before, so no need to worry)
18:41dRbiGand this is giving me a headache :S
18:45ataggartdRbiG: is there a question?
18:45dRbiGataggart: there is, implicitly, "how would you do it?"
18:46ataggartinvoke a method on an object using the method's string name?
18:46ibdknoxdoes it have to be a string?
18:47ibdknoxnot that it really matters
18:47ibdknox&(symbol ".length")
18:47sexpbot⟹ .length
18:49cemerickor just use the lower-level form so you don't have to bother with the concatenation: (. (new File path x) length)
18:50ibdknoxeven better
18:50ataggartsmells like an xy problem
18:50dRbiGcemerick: nope,
18:51ataggartxy?
18:51clojurebotxy is http://mywiki.wooledge.org/XyProblem
18:52dRbiGindeed
18:52dnolendRbiG: methods are not first class, they are statically determined.
18:53dnolen,(doc memfn)
18:53clojurebot"([name & args]); Expands into code that creates a fn that expects to be passed an object and any args and calls the named instance method on the object passing the args. Use when you want to treat a Java method as a first-class fn."
18:53dnolendRbiG: is there any reason to use a string and not a function ?
18:54cemerickataggart: probably right, but that wiki page is unfortunate.
18:55teromAre there any good examples of memfn use somewhere?
18:56amalloy&(map (memfn length) ["test" "strings" "are" "long"]) :P
18:56sexpbot⟹ (4 7 3 4)
18:56ataggartlargely replaced with the anonymous fn synta
18:56dnolenhttp://clojuredocs.org/clojure_core/clojure.core/memfn
18:56ataggartx
18:56dRbiGhttp://en.wikibooks.org/wiki/Clojure_Programming/Examples#Invoking_Java_method_through_method_name_as_a_String
18:56dRbiGthis does it
18:57amalloysigh. yes, reflection will solve many such problems, but as ataggart says they're usually only problems because you've done something wrong already
18:57ibdknoxdRbiG: but you have to ask yourself if this is really necessary, resorting to reflection is a sad thing
18:59dRbiGmaybe as i iterate i'll see better way to do it
18:59dnolendRbiG: what advantage do you see in using strings over functions ?
19:01dRbiGquery string will have ?sort=length, or ?sort=lastModified etc. - so i just want to invoke that inside sort-by; as a chceck against stuff like sort=delete i'll check if the given str is in a predefined list of what's allowed
19:01ataggartBTW, the dot is a special form, so you could avoid reflection via a macro
19:01ataggarte.g.: (defmacro invoke-method-name [method target & args] `(. ~target ~(symbol method) ~@args))
19:02dRbiGthat's the approach i'd take with ruby/io/anything that has nice member? and send
19:02dRbiGi guess there's better way to do it here :)
19:03dnolendRbiG: if you're going to check against a predefined list, why not just have map that stores str -> fn
19:03ataggartdnolen: nah, just use eval. ;)
19:03ibdknoxlol
19:05mdeboard`Man, 4clojure.com is slow
19:06mdeboard`Not a random gripe by the way; I'm curious why it's slow. Holy cow look at the source, I assme this is auto-generated by Clojure?
19:06amalloymdeboard`: it is fast as lightning for me
19:07amalloyand yes, hiccup generates the html every time
19:07mdeboard`amalloy: page load times are intermittently horrendous and acceptable
19:08amalloymdeboard`: we serve some big javascript files, but we carefully mark them as cacheable
19:08mdeboard`Maybe that'swhy
19:08Raynesmdeboard`: We don't talk about 4clojure's performance. You're new here, so I'm going to let this slide.
19:08mdeboard`It's my first visit
19:08amalloymy browser shows a bunch of 304 Not Modified
19:08mdeboard`Raynes: Thanks
19:08Raynes;)
19:09mdeboard`You know I could rewrite this in Python on top of Flask if you'd like! :D
19:09mdeboard`I'm kidding of course
19:09ibdknoxhehehe
19:10amalloymdeboard`: if you're looking for a small project and you think the html is ugly, you could write a wrapper that pretty-prints the generated html if the url has a ?debug=true
19:11ibdknoxor just use a DOM inspector, which all modern browsers have :)
19:11ibdknoxamalloy: a winner is you ;)
19:11mdeboard`ibdknox: Dom inspectors are good for honing in on a particular bit of content but it is often helpful to me to then view source and Ctrl-F for that bit of content to get context
19:12ibdknoxhm, you can search the DOM too?
19:12ibdknoxnot sure I understand the distinction
19:13ibdknoxthe only real difference between a pretty printed version of the HTML and what you would get in firebug or webkit's inspection tools is that the JS will have run
19:13ibdknoxwhich I would think you'd want
19:13mdeboard`Plus I don't have to futz about with resizing the window and can navigate entirely by keyboard without tabbing a million times
19:14mdeboard`Just personal preferences, not syaying my way is better at all.
19:14mdeboard`or superior in some way
19:14mdeboard`It's superior to me because that's how I like doing i t:)
19:14ibdknoxmdeboard`: yep yep :)
19:19ndimiduk,(contains? [1 2 3] 2)
19:19clojurebottrue
19:19amalloyclojurebot: contains?
19:19ndimiduk,(contains? '(1 2 3) 2)
19:19clojurebotfalse
19:19clojurebotcontains? is for checking whether a collection has a value for a given key. If you want to find out whether a value exists in a Collection (in linear time!), use clojure.core/some or the java method .contains
19:20amalloyninja'd
19:20mdeboard`lol
19:21ndimidukamalloy: why does this not work on seqs?
19:21amalloyfor the same reason that (= 5 '(1 2 3)) doesn't return 2. it does a different thing
19:22Scriptor,('(0 1 2) 2)
19:22clojurebotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn
19:24mdeboard`,(closure.set/intersection #{:a :b :c} #{:b :c :d})
19:24clojurebotjava.lang.ClassNotFoundException: closure.set
19:24mdeboard`wow
19:25mdeboard`,(clojure.set/intersection #{:a :b :c} #{:b :c :d})
19:25clojurebot#{:c :b}
19:31leedaHi, I'm trying to understand binding... why doesn't this work: (binding [x 1] (println x))?
19:33hiredman,(doc binding)
19:33clojurebot"([bindings & body]); binding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before. The new bindings are made in parallel (unlike let); all init-exprs are evaluated before the vars are bound to their new values."
19:34gfrlogleeda: binding works with vars, which are normally created with (def)
19:34mdeboard`Hrm why is (fn [x] (+ x x)) not a valid answer to http://4clojure.com/problem/15 ?
19:35amalloymdeboard`: it is. you must be typoing somewhere? i jsut copy/pasted that and it works
19:35gfrlogmdeboard`: it tells me it's valid
19:35mdeboard`hm not working for me, I have it on four lines.
19:35leedagfrlog: I see, thanks. So if I do (def x 1), how can I get a per-thread binding for x?
19:35mdeboard`:\ if there's four blanks shouldn't it accept four answers?
19:35gfrlogleeda: after you've def'd it you can (binding [x ...] ...)
19:36amalloyuh. no, you supply an answer, and it uses it in all the blanks
19:36leedagfrlog: ok, I see, thanks!
19:36gfrlogleeda: note that in clojure 1.3 you have to add the ^:dynamic metadata to the var
19:36mdeboard`amalloy: Hm it works in previous answers
19:36amalloycoincidence
19:36mdeboard`lol
19:36leedagfrlog: ah ok, I'll look that up
19:36mdeboard`amalloy: Kind of like gist's random coloration?
19:36amalloymdeboard`: yeah srsly though
19:38mdeboard`I mean for new people inconsistent behavior from the UI is goingto be pretty frustrating
19:38amalloymdeboard`: it's not inconsistent
19:38mdeboard`How not
19:38amalloyi literally mean that, by coincidence, supplying an answer N times happens to work
19:38amalloybecause (= 3 3 3 3) is true
19:38amalloyon, eg, http://4clojure.com/problem/12
19:40amalloyif you supply "3 3 3" as your answer, it splices that string into each __ and then runs all the tests
19:40mdeboard`From the perspective of a user, that is 100% inconsistent behavior
19:40mdeboard`It doesn't matter if mechanically behidn the scenes it's expected behavior
19:40mdeboard`To the user it's nonsensical
19:41amalloyyou are the first user to have encountered this "nonsense", perhaps because you didn't read http://4clojure.com/directions?
19:46mdeboard`amalloy: Before I say anything else I wanna make clear that I'm not griping about the site (which I infer you maintain?). It's awesome and I'm using it. I just think that something as straightforward as fill-in-the-blank shouldn't require reading instructions. I mean, the only reason I care is because I'd hate for someone to get turned off by unpredictable behavior. If you give a human four problems and the ability t
19:46mdeboard`o enter in four solutions, I'd wager a lot will do that. I assumed every line was being evaluated individually against its corresponding form. If you like it that way, then cool. Now that I know, I know.
19:47Scriptordoes anyone know if anyone has written a netflix lib for clojure?
19:47amalloymdeboard`: i don't think a lot of people have thought of it as four problems. it's one problem, with four test cases
19:47chitsubrrich hickey's wiki page is nominated for deletion - http://en.wikipedia.org/wiki/Wikipedia:Articles_for_deletion/Rich_Hickey. sheer madness
19:48mdeboard`amalloy: Alright.
19:48amalloyif you have a suggestion for a good way to improve the UI, or to put into a readme somewhere, i can make it happen
19:48Scriptor"Clojure may be notable but its creator may be not" wow
19:49gfrlogThis feels a lot like Horton Hears a Who. I think we need to start banging pots so the kangaroo can hear us.
19:50mdeboard`Nah, I'm probably just being a dummy. Long day at work.
19:50Scriptorso...no netflix lib? I has a project!
19:50amalloyScriptor: first go find a java lib for it
19:51Scriptoramalloy: but then I won't has a project :p
19:52Scriptorah, http://www.blueleftistconstructor.com/projects/nfjc/current/
19:53mdeboard`Wow, that Artem Karimov fella really, really has a stick somewhere about Clojure.
19:53mdeboard`re: wikipedia
19:54technomancypretty typical of the deletionists crew
19:55technomancythat said, the article isn't terribly informative
19:56Scriptorheh, he's an 18-year old kid from moscow
19:56mdeboard`I wonder why, say, Guido van Rossum is notable but not Rich Hickey?
19:56mdeboard`Anywya.
19:57amalloymdeboard`: because he has rabies re: TCO
19:58amalloyand reference counting
19:58amalloythat is basically the one things i know about him: he has terrible ideas about TCO and reference counting
19:59zodiakactually, I wonder what mascot clojure would have .. you know.. a nice friendly little thing to put on t-shirts, stickers, etc
19:59zodiakit's all about propaganda ;)
19:59Scriptora lamb?
19:59mdeboard`A lamb riding a dragon
19:59Scriptora lamb saying "yes" in Russian :p
19:59zodiakI was thinking single cell organism; you know, sort of the building block of life ;)
20:00mdeboard`ಠ_ಠ
20:00ibdknoxwhy did Clojure go with a mailing list instead of a forum?
20:00Scriptormost languages do
20:01ScriptorI've also seen very little spam on the mailing list, maybe it's harder to manage on a forum?
20:01ibdknoxI would think the exact opposite
20:01mdeboard`old people love mailing list
20:01mdeboard`s
20:01ibdknoxyou can moderate a forum
20:01amalloyi would have been happy with usenet
20:02hiredmanmdeboard`: old people?
20:02Scriptoribdknox: also, the google groups website itself acts almost like a forum
20:03mdeboard`hiredman: Yeah, you know, everyone older than the person using the term "old people". (I'm in my 30s)
20:03ibdknoxScriptor: it's close, but the lack of true moderation makes that less useful I would think
20:03ibdknoxScriptor: also, the interface could be greatly improved
20:03Scriptoribdknox: hmm, it allows some moderation
20:03ibdknoxlike having code highlighting and such
20:03Scriptorbut eh, a lot of programmers like their email clients, I think,
20:03amalloyScriptor: or news clients
20:04ibdknoxindeed
20:04hiredmanibdknox: could be argued you need a better email client
20:04Scriptorthe only project I can think of off the top of my head with a forum is a PHP web framework
20:04ibdknoxhiredman: haha one that auto-syntax-highlights code? :)
20:05mdeboard`ibdknox: emacs mail
20:05Scriptoremacs os. ftfy
20:05ibdknoxlol
20:05mdeboard`srs
20:05mdeboard`:)
20:06Scriptorhmm, so there is a java netflix lib, but that means now I have to learn interop
20:06technomancythat's one of the most annoying things about Android developers; they seem to use PHPbb un-ironically
20:06mdeboard`Scriptor: Why?
20:06amalloyScriptor: that's gotta be easier than writing it yourself
20:07mdeboard`I ask that question assuming two things: 1. There's a public API for Netflix 2. it's possible to craft HTTP requests in Clojure in such a way that exploits the API
20:07Scriptormdeboard`: I figured a netflix app would be a good first project
20:07mdeboard`Scriptor: Oh, I meant using Java interop
20:07mdeboard`That is a p cool first project
20:08Scriptormdeboard`: oh, because the lib is pure java, so I'd need to use the Java interop to call it from Clojure
20:08Scriptoramalloy: I never take the easy route when learning :p
20:11mdeboard`Scriptor: Yeah the Java lib is almost certainly the best move in the long run but if you were really averse to it, the Netflix API is pretty straightforward from what I can tell in a 20-sec gloss over.
20:15gfrlogScriptor: write your own and make it somehow enable me to watch streaming video on linux
20:20mdeboard`gfrlog: Netflix allegedly has something in the works for that?
20:21gfrlogmdeboard`: I'll believe it when somebody tells me it a second time
20:21mdeboard`gfrlog: Netflix allegedly has something in the works for that?
20:21Scriptorgfrlog: what he said
20:21gfrlogah, I see
20:21gfrlogwell here's hopin
20:22hopinHey everyone!
20:22gfrloghi hopin
20:22hopinThanks for the intro, gfrlog
20:22gfrlogI do what I can
20:22Scriptorwhat
20:22Scriptorah
20:25Scriptorhmm, have to apply for a key for each application
20:26chitsubrso is lein help supposed to take 5+ minutes to run?
20:26chitsubrI downloaded the lein script, chmod +x'ed it and typed lein help, and it is taking forever to run
20:26mdeboardchitsubr: It's slow, but not that slow.
20:26amalloylein self-install first
20:27chitsubramalloy: ah so thats what I missed, thx
20:27amalloybut it should cope better if you've missed that step, i would think
20:29Scriptorwhen people interop with java libs, what do they do to keep the code from basically becoming java with parentheses, since wrapper functions are discouraged?
20:30gfrlogScriptor: moan and wail
20:31Scriptorgfrlog: that's what #clojure's for!
20:32ataggartScriptor: wrapper functions like (defn size [coll] (.size coll)) are discouraged. It really depends on the api one is working with.
20:32mdeboardamalloy: How did you say to suggest UI changes for 4clojure?
20:33amalloyuh, i didn't really specify. you can mention them here, or open an issue at https://github.com/dbyrne/4clojure/issues
20:34Scriptorataggart: makes sense, I guess I'll write a wrapper when it gets too imperative for my taste
20:35ataggartScriptor: also note that even "java with parentheses" ends up having fewer parens than straight java (e.g., the .. and doto macros)
20:36mdeboardamalloy: 1. Put a listener for Ctrl+Return (or whatever) on your "Run" button; since I can't tab out of the REPL box I have to use my mouse to click Run <firstworldproblems> 2. The "Now try %s!" element keeps suggesting the last unfinished problem; I think it would be a bit better if it either automatically suggested the next problem in the list of problems OR if there was a NEXT PROBLEM button.
20:37Scriptorataggart: I know, just using it as a figurative way of saying imperative code that happens to be written in a lisp :)
20:37amalloymdeboard: yeah, the Ace codebox annoys me no end
20:37amalloystealing all the keystrokes
20:40amalloymdeboard: for (2), why don't you try forking it yourself? i wrote that feature and iirc it would be pretty trivial to make it link to both of those
20:40mdeboardamalloy: I'm not that confident in my clojure-foo
20:46mdeboardamalloy: What the hey, I'll give it a go.
20:47amalloymdeboard: sweet. good luck
20:48amalloyyou'll feel great when you actually get something done, that's visible in a public clojure project
20:50Scriptorheh, just found out *jure names aren't allowed
20:51hiredmanwuh-pow!
20:58cemerickI thought that had been pulled lately?
21:00mdeboardHow will anyone make an RPG if they can't have names like Abjure and Conjuure?
21:00mdeboardConjure*
21:00mdeboardWait what about Compojure
21:01Scriptormdeboard: I guess it was the original
21:01Scriptorand they don't want anything competing with it name-wise?
21:03technomancyit's just a restriction on new project generation
21:03technomancyyou can work with existing projects just fine
21:03amalloywut. is this an actual thing? someone is saying not to use names ending with jure?
21:04Scriptoramalloy: it's built-in to lein, at least
21:06chouserjust lein, I believe.
21:09Scriptorwhat does it mean when something is 'grandfathered' in?
21:10mdeboardScriptor: A thing being granted an exception to a rule, on the basis that the attribute of the thing that is now forbidden by the rule predated the inception of the rule.
21:10ibdknoxhttp://en.wikipedia.org/wiki/Grandfather_clause
21:10mdeboardOr yeah.
21:12Scriptormdeboard, ibdknox: ah, thanks, was in relation to https://github.com/pjstadig/leiningen/commit/f4e4c1958d9f9d07d46f7e1c2d3ea11f6b660f72
21:12mdeboardamalloy: I'm getting an error while trying to load localhost:8080: "java.util.concurrent.RejectedExecutionException"... I'm operating under the assumption I've left something undone with clojail .java.policy
21:13mdeboardamalloy: Or am I missing something.
21:14ibdknoxScriptor: yeah, that's just saying that *jure names are no longer allowed, with the exception of compojure
21:14amalloymdeboard: hm. is it possible you just don't have mongodb running? that causes all kinds of weird not-obviously-related exceptions
21:14mdeboardHm I do have it running in a separate term window
21:15mdeboardamalloy: And shows several connections/disconnections as I start/stop the dev server
21:15amalloywell, that should be fine then. it shouldn't be related to java.policy, but sounds more like an agent issue
21:17amalloymdeboard: what command are you using to start things up?
21:17mdeboard`lein run` in 4clojure/
21:17mdeboardand it is starting up ko
21:17mdeboardok
21:17mdeboard2011-07-11 16:17:38.572:INFO::Started SocketConnector@0.0.0.0:8080
21:18mdeboardbut when I try to connect
21:18mdeboardthat's when it errors out
21:19amalloywhat if you load a different page, like localhost:8080/problems
21:19mdeboardamalloy: same
21:22mdeboardwow ps aux|grep mongo yields... interesting results
21:23amalloyi don't know what would cause a rejectedexecutionexception
21:23chouseriirc, stopping the agents and then trying to use them does that
21:25amalloyi wonder if that's related to some issues technomancy had with lein and shutdown-agents, then? i'm using some git checkout of lein from a while ago
21:28gfrlogis there a standard way to keep db-auth data in a non-versioned file?
21:30gfrlog(such that it is easy to load from clojure)
21:30amalloygfrlog: just add it to .gitignore?
21:31gfrlogamalloy: I guess I meant more the easy-to-load-from-clojure part. I.e., would you make it just another source file? or some kind of java properties thing?
21:31mdeboardamalloy: Would the ful stack trace help at all? :-\
21:36technomancyamalloy: yeah, you can't rely on the agent thread pool to keep the process alive anymore; you need to block if you want to keep non-daemon threads running
21:36technomancydue to Clojure not providing tools for dealing with the agent thread pool correctly
21:37technomancyI have a half-drafted message to the mailing list explaining this that I really should finish
21:39technomancyotherwise a single use of clojure.java.shell/sh will cause the process never to exit (!)
21:40technomancypuredanger has a good explanation of the problem: http://tech.puredanger.com/2010/06/08/clojure-agent-thread-pools/
21:41mdeboardtechnomancy: Hrm I tried out the link, blank page.
21:42mdeboardcached http://webcache.googleusercontent.com/search?q=cache:YlxRVd5mJVsJ:tech.puredanger.com/2010/06/08/clojure-agent-thread-pools/+clojure+agent+thread+pools&amp;cd=1&amp;hl=en&amp;ct=clnk&amp;gl=us&amp;source=www.google.com
21:48cesDaveHey, does anyone feel like answering a project euler question?
21:48cesDaveShould be an easy one...
21:49hiredmanthe answer is "yes it is solvable"
21:50cesDaveNot the question, question is, why would someone take (range 1 (floor (sqrt n))) when trying to find the factors of n? couldn't there be a factor of n larger than sqrt n?
21:51cesDaveguess more of a math question
21:51mdeboardproject euler is 100% math questions, not programming
21:52ScriptorcesDave: think about it, if you have n = 100, pick a number greater than the square root of it that's a factor of 100
21:52cesDave50
21:52Scriptorwhat's 100/50? :)
21:52jweiss_is there a function that 'composes' predicates using either and/or?
21:52cesDave2, but 50 is still a factor of n greater than root n
21:52Scriptorsure
21:53Scriptorbut as soon as you know 2 is a factor of 100 you immediately know 50 is as well
21:53mdeboardwhat
21:53cesDavetrue enough
21:54jweiss_if you're lookign for primes, once you know one factor, you don't care about the other
21:54jweiss_so the smaller one will do
21:54hiredmanclojurebot: sieve?
21:54clojurebotsee the genuine sieve of eratosthenes
21:55hiredmanclojurebot: the genuine sieve of eratosthenes
21:55clojurebotthe genuine sieve of eratosthenes is http://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf
21:55cesDavemkay, i'll check it out. thanks!
21:55cesDavesorry for slightly off-topic.
21:55hiredman(may include ML)
22:00chitsubrif x * y = N, then one of x or y will be less than root(n), since if both were greater than root(n), their product would be greater than n
22:00scottjjweiss_: every-pred and maybe some-pred, in clojure 1.3
22:01Scriptorchitsubr: right, there's a one-to-one mapping of x<sqrt(n) to factors>n, at least in the natural numbers
22:02chitsubrcesDave.. replace less than with "less than or equals"
22:04cesDavechitsubr: Yeah, I see that. I'll give that more consideration in terms of the problem I'm looking at. You may have guessed I'm working on project euler 3.
22:04ataggarttechnomancy: did you see any problem with using a shutdown hook to deal with the agent pools?
22:05cesDavechitsubr: I'm new to clojure and don't have a math degree so I've got a couple challenges in that regard.
22:09jweiss_scottj: thanks - still on 1.2, so i'll just use 'and' :)
22:09jweiss_or #(and ...) rather
22:10jweiss_or maybe i'll try every? and juxt
22:12chitsubrcesDave - right. I wonder if there is a companion site to project Euler that provides some math help for each of the problems.
22:28Scriptorman, just adding a jar I downloaded to my lein project seems to require a bunch of hoops
22:28hiredmanstop downloading jars
22:28Scriptorok :(
22:29hiredmanfind the groupid/artifactid and version, add it to your project.clj
22:29mdeboardsigh, I feel as though I'm missing something re: lein again. Once I do "lein new <foo>", when I go into foo/, every lein command I execute is in the 'foo' context, right? e.g. if I do `lein swank` in foo/, when I connect to that connection, all the project's dependencies will be available to me, right? (assuming I did `lein deps`)
22:29hiredmanlet lein download it
22:29hiredmanmdeboard: yes
22:31hiredmanScriptor: generally what I do is google "<projectname> maven" to find that info
22:32mdeboardhiredman: I have (require 'clojure.contrib.strint) which introduces the `<<` symbol for string interpolation in the src for this project. I have clojure-contrib 1.2.0 in my project.clj. However when i go to my project directory and run e.g. `lein repl` it gives me an "Unable to resolve symbol: << in this context" error message. Am I doing something wrong?
22:33hiredmanmdeboard: did you load the file that has the require?
22:34vkurup\q
22:34mdeboardhiredman: I was under the impression it was loaded by lein when I fired up the repl, since it was apparently parsing the file
22:35Scriptorhiredman: the repository the jar is hosted on isn't part of the default ones lein looks under, is there a way I can manually edit the pom file or do I need to fiddle with maven?
22:35hiredmanmdeboard: it wasn't
22:35hiredmanScriptor: have you read the lein readme and looked at the sample project.clj?
22:35hiredmanI suggest you do
22:36technomancyataggart: I haven't looked into it enough
22:37technomancymdeboard: if you want to "land" in a given namespace for every lein repl invocation, set it as :repl-init in project.clj
22:37mdeboardhiredman: I see. When I do (use 'change), it returns the same message again
22:37technomancymaybe that could be part of the default project skeleton in a future version
22:37mdeboardtechnomancy: I see, i.e. :repl-init foo
22:37ataggarttechnomancy: ok. I added a question to Rich about why the pools use non-daemon threads. Hopefully once we know the full reasoning, we can resolve this. http://dev.clojure.org/jira/browse/CLJ-124
22:37technomancymdeboard: foo.core hopefully
22:37mdeboardoh
22:38technomancyataggart: never going to be resolved for 1.2 unfortunately and likely not for 1.3 either =\
22:38technomancyso the hacks and workarounds will be with us forever
22:38technomancyaw geez; that issue has been around since google code days?
22:38hiredman~namespaces
22:38clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
22:39technomancyಠ_ಠ
22:39hiredmanmdeboard: don't get into a habbit of using single segment namespaces
22:39mdeboardಠ_ಠ
22:40mdeboardhiredman: So for package 'change', with change.clj being in ~/change/src/ , for example, I should do :repl-init change.change
22:40ataggarttechnomancy: it might make it into 1.3 if the change I have in mind gets accepted. It wouldn't change any actual behaviour, other than obviating the need to ever call shutdown-agents
22:40technomancyataggart: your optimism is refreshing
22:40hiredmanmdeboard: no
22:41hiredmanthere is a reason `lein new` created src/change/core.clj for you
22:41ataggarttechnomancy: it comes back to me when I stop trying to help for a while.
22:41mdeboardhiredman: Right, I figured that, but when that dir isn't on my classpath. So I assume di was doing it wrong.
22:42hiredmanmdeboard: how do you know it is not on your classpath?
22:42mdeboardI did `lein classpath`
22:42hiredmanand 'src' was not on the classpath?
22:43hiredmanplease picture me here with an eyebrow raised
22:43mdeboardsrc/ yes, but not src/change
22:43mdeboardhaha
22:43mdeboardCnsider itpictured
22:43technomancyhiredman: o_O works well for that
22:43hiredmanso you (use 'change.core)
22:43mdeboardDIdn't seem like classpath was recursive since every change/ subdr was on classpath
22:43technomancymdeboard: each classpath entry should be considered a "root"
22:44hiredmantechnomancy: far too goofy looking, you've seen my eyebrows, they are serious business
22:44mdeboardI see
22:44technomancyhiredman: true; further exploration of the unicode plane is in order
22:44mdeboardhiredman: So, should the code I have in src/change/change.clj go in core instead? core.clj is empty.
22:45hiredmanmdeboard: change/change.clj (relative to a classpath root) should have a namespace like change.change and can be loaded like (require 'change.change) or (use change.change) or …
22:47mdeboardI see
22:49mdeboardI've clearly done somehting wrong here, because things which were working last night no longer work :)
22:50mdeboardme am no good computer
22:50Scriptorhiredman: thanks for the tip, though I'd browsed it enough, :repositories was what I needed (duh)
23:32ihodeshiredman: ಠ_ಠ is what you're looking for
23:34amalloyi think his eyebrows are likely a lot more formidable than that