#clojure logs

2011-12-12

00:00fhdamalloy: Reminds me of memory management in OS theory. Read-only pages are normally shared in a similar manner.
00:03Scriptorstructural sharing is also helped out by clojure not changing the actual tree unless it has 32 elements it can add all at once
00:03ScriptorI think that's right
00:04amalloyeh?
00:04Scriptorer, not change the tree
00:04amalloythat sounds basically untrue
00:04ScriptorI meant creating a new tree
00:05Scriptoruntil 32 elements are added, it just does copy-on-write and creates new arrays
00:06amalloyi'd love to be proven wrong, but that doesn't sound like anything clojure does that i'm aware of. do you have a reference?
00:06Scriptorthe above-mentioned link
00:07Scriptoramalloy: wait, not that link, this one http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/
00:07Scriptorspecifically in the 3rd code listing there
00:08ScriptorSystem.arraycopy(tail, 0, newTail, 0, tail.length);
00:08Scriptor
00:08Anniepoohowdy - I'm returning to Clojure after an absence. My dev environment's on 1.2 I'm upgrading to 1.3
00:08Anniepoois there still a separate clojure-contrib jar?
00:10Scriptoramalloy: direct link to the current code https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/PersistentVector.java#L170
00:11amalloyah, interesting. so it keeps a second direct pointer to the last chunk-of-32 elements of the vector, no matter where in the tree those are located
00:12amalloyand can therefore avoid doing copying on the way back to the root until those are finished
00:12Scriptoramalloy: they're not actually in the tree in the first place, when you do something like (cons 1 []) it just makes an array
00:13amalloyright
00:13Scriptorand yep, this avoids copying the nodes going up to the root every time you cons
00:14Scriptorsame with conj, it seems
00:14amalloyScriptor: (conj x y) == x.cons(y)
00:15amalloypretty cool, thanks. it's been a long time since i read that article and i didn't get the significance at the time
00:15Scriptoramalloy: not with vectors though, righT?
00:15Scriptorregarding conj and cons
00:15amalloyScriptor: the .cons method is just named badly - it's conj
00:16amalloy&(.cons [1 2 3] 4)
00:16lazybot⇒ [1 2 3 4]
00:16Scriptorah
00:16amalloywell. "badly". it's named in a way that is only accurate historically
00:20Scriptoramalloy: heh, better to actually know clojure and be hazy on this than the reverse :)
00:26devnI know about fnparse and parsatron -- I seem to remember a few other parsers out there in clojure land. Anyone know what I'm forgetting?
00:26devnparsley just came to mind
00:26duck1123does gloss count?
00:26devngot a link?
00:27devnwoops, parsley is not what i was looking for
00:27Scriptorthis gloss? https://github.com/ztellman/gloss
00:27devnyeah gloss isn't really what i'm looking for
00:27devnim looking for parsec clones/rewrites
00:27devni forgot clarsec, but it's a little difficult to read
00:27duck1123it's for parsing binary data, but wouldn't serve the purpose?
00:28devnduck1123: im looking for PEG stuff
00:29devnparser combinators
00:30devnhttp://brehaut.net/blog/2011/fnparse_introduction -- you know, when i read the tests i wasn't sure about fnparse, but it looks really nice
00:30Raynesdevn: Also abandoned.
00:30Raynesdevn: If you plan to use it, might want to also plan to maintain it.
00:30Scriptorwhat's the currently maintained one, if any?
00:30RaynesParsley.
00:31ihodeswhat about clj-peg? http://lithinos.com/clj-peg/
00:31ihodeswas recently updated, if memory serves
00:36Raynesorg.apache.commons.compress.archivers.tar.TarArchiveInputStream
00:36RaynesJesus.
00:36Anniepooanybody know where the clojure version is stored for slime/swank for windows?
00:39duck1123Raynes: seems perfectly reasonable
01:02ben_mI need to make a nicely organised list of libraries I discover from just idling here.
01:03ben_mI bet sometimes in the future I'll think to myself "Mhh, I need to fiddle with some bits, but that's a pain in Clojure. Meh, seems like I'll use C." because I won't think about gloss.
01:12tomojis there a workaround (e.g. lein feature?) for http://dev.clojure.org/jira/browse/CLJ-322
01:14accelif you do, you should make it into a big index
01:14acceland call it clojure_yahoo
01:15accelthen, when you use eigenvectors to rank (based on which libraries use which other libraries), it cal be called clojure_google
01:15tomojI mean, am I correct that: if project A and project B both depend on project C, A depends on B, C is not AOT'd, B is; then A may get B's version of C because B includes C's classfiles in the jar, barring manual cleanup of B's jar?
01:48spoon16what is the appropriate way to "forward" kw-args to another function?
01:48spoon16,(letfn [(a [& kw-args] (b kw-args)) (b [& kw-args] (apply hash-map kw-args))] (a))
01:49clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No value supplied for key: null>
01:59amalloyspoon16: my personal opinion is: try not to do that. make your "real" functions take actual hashmaps, and add variadic keyword versions of them as sugar only
01:59amalloyit's both inefficient and awkward to do this forwarding, as you've discovered
02:00spoon16yeah, that's the direction I ended up going… but I was wondering if there was some way to do it cleanly that I was missing
02:00spoon16thanks
02:00amalloywell, if you changed a to (apply b kw-args) it would be fine
02:03spoon16amalloy: that only works in this example though, if you have any other arguments you end up having to build do something like (apply b (flatten [arg1 arg2 kw-args]))
02:03spoon16which seems a bit gross
02:03amalloyuh. no, and also flatten is 100% wrong there
02:04amalloy(apply b arg1 arg2 kw-args)
02:05spoon16sorry… I meant (filter (not nil)) not flatten
02:05spoon16if kw-args is nil then apply will pass it through… which I guess is ok here… but if you want to destructure kw-args into a map it will fail
02:06spoon16because (= kw-args '(nil)) instead of nil
02:07spoon16(apply hash-map '(nil)) also fails
02:07spoon16the right thing to do is do what you recommended earlier and make b just take kw-args as a first class arg instead of & kw-args
02:08amalloyit is not the case that kw-args is (nil)
02:13spoon16you are right… let me figure out what's going on in the larger piece of code I have and see if I can distill it down
02:16spoon16amalloy: in my case I'm not using apply appropriately
02:17spoon16so using apply does work pretty nicely
02:18spoon16still, I think it's even cleaner to just have b explicitly take a kw-args parameter instead of making it optional
03:36lnostdali read http://cemerick.com/2009/11/03/be-mindful-of-clojures-binding/ , then tried -- but i get different results: http://paste.lisp.org/display/126429#1
03:36lnostdalperhaps a clojure 1.2.x vs. 1.3.x thing? .. i'm testing with a 1.4 snapshot though
03:36lnostdalwhat do you guys get?
03:38tscheibl.
03:42kralwhen does 1.4.x will be released as stable?
03:47Chousukelnostdal: that looks like the correct result to me, because of the set!
03:51raeklnostdal: I think work has been done to address the "Bindings do not migrate across thread boundaries." problem
03:52raekiirc, bindings migrate to a new thread if you use 'future' (which pmap does internally)
03:52raek...since clojure 1.3
04:08lnostdalgetting really tired of nullpointerexception, unknown location ..
04:08lnostdalraek, that's good news i guess
04:09raeklnostdal: unknown location? have you looked in the stack trace?
04:09raekit should point to the exact point where it was thrown
04:09lnostdali wonder if it migretes with regards to agents too
04:10lnostdalyeah, i guess it can't find location because the stacktrace ends up some other place (perhaps related to data for it not migrating across threads :P)
04:10lnostdalor some slime/swank try block doesn't get included in spawned threads or something
04:11raekyou cannot catch an exception thrown by one thread in a catch block in another thread
04:11raeksince the control flows are unrelated
04:12raekif you use a future, you will get the exception when/if you dereference it
04:13lnostdalyeah, but i guess slime or swank-clojure or something handles some cases; sets up the context needed to catch from some threads but not all
04:13lnostdalbecause it does catch e.g. (future (/ 42 0)) .. that ends up in the slime debugger
04:13lnostdalat least on clojure-1.4 here
04:13raeklnostdal: that's because the repl prints the future
04:13raekwhich will dereference it
04:14raeklnostdal: try this: (def x (future (/ 42 0)))
04:15lnostdaluh, a future doesn't execute before it is derefed? ..
04:16lnostdalin that case the docstring is wrong i think
04:16raekno, it does. but the exception is stored in the future.
04:16lnostdalah, cool
04:16raekyou get that exception when you try to look at the result of the future
04:17lnostdali guess that makes sense in a world without restarts anyway
04:17raekfutures are really made for asynchronous tasks where you want to start a bunch of processes in the background and then retrieve their values
04:18raekif you want a long running background thread, you should include your own try/catch block at the top level of the future body
04:18raeksince in that case there is usually not another thread that "waits for the result"
04:19lnostdalyeah, loop+recur .. with a sleep at the outside in case something gets stuck in fail-over-and-over-again mode :P
04:19lnostdal(potentially flooding logs or *out* / *err*)
04:24tscheiblreally funny are exceptions thrown when a lazy sequence gets realized ...
04:26lnostdalyeah, sometimes i wonder if what i really want is just green threads (spread over hardware threads; like done in e.g. haskell, would be nice) so i can do classic blocking i/o and exceptions and other things "make sense" again
04:26lnostdalno epoll .. no async .. just blocking calls with regards to http and socket i/o .. log i/o .. and db i/o .. simple
04:27lnostdalbut i don't know .. i haven't thought about this much .. perhaps it won't solve any problems
04:28tscheibldon 't think so... real life is async, too... and we managed to handle it somehow for some thousend
04:28tscheiblyears now :)
04:28tscheibl..thousand
04:29lnostdalwhile i'm on a roll; "Unable to resolve symbol: blabla in this context" ..what context??? give me a file name at least! :>
04:29tscheibl.. and using clojure it becomes quite manageable
04:29tscheibli do a (print-stack-trace e*)
04:29tscheiblin these cases
04:31tscheibl..just do a (use 'clojure.stacktrace) beforehand
04:34lnostdalyeah, or sometimes evaling the core.clj buffer with the (ns ...) in it will yield a proper message with filename and even line numbers
05:05AWizzArdMoin moin.
09:53TimMcSo... the EPL doesn't have a viral clause?
10:15raekTimMc: it explicitly says that a piece of code that merely uses the EPL'ed code as a library is not a derivative work of the EPL'ed code, so the library does not place any restrictions on the licence of code that uses the library
10:18raek(this is in contrast to the GPL, which interprets "derivative work" differently)
10:19raekso the EPL is not a viral license
10:42TimMcAh, it's in the definition of derivative work, then. I see.
11:01raekTimMc: why would that be unenforcable? this is the case for all strong copyleft licenses, if I understand you correctly...
11:02raekI don't think there i any difference between "X is bolted onto Y" and "Y is bolted onto X" in legal terms
11:03raekit's more like "Z = the union of X and Y. Z is a derivative work of both X and Y."
11:05TimMcraek: Imagine a license that said that since your program links to libc (or whatever), libc has to be relicensed.
11:05TimMcUgh, still didn't express that well. Never mind, it's a stupid joke,
11:06TimMcand I hate hitting comma instead of period at the end of a message, because it makes me feel like I have to type more.
11:07raeka crazy license indeed... :-)
11:42sirnWhat's the best way to check if item exists in a coll? e.g. in Python I could do "5 in [1, 2, 3, 4, 5] #=> True"
11:42lucianany idea if i could find videos for http://clojure-conj.org/schedule ?
11:42gtrak`,(doc contains?)
11:42clojurebot"([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."
11:42sirngtrak`: thanks!
11:42gtrak`keys though
11:43gtrak`,(doc some)
11:43clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
11:43sirnah
11:43Wild_Catsirn: that won't work
11:43Wild_Catcontains? checks whether the *index* exists
11:43sirnyeah, just tried it
11:43Wild_Catthat is, (contains? n vector) just checks whether the nth item exists
11:44gtrak`,(some #{:theKey} [1 2 3 4 5])
11:44clojurebotnil
11:44gtrak`,(some #{:theKey} [1 2 3 :theKey 5])
11:44clojurebot:theKey
11:44Wild_Cat,(some #(= %1 2) [2 3 4 5])
11:44clojurebottrue
11:44Wild_Cat,(some #(= %1 1) [2 3 4 5])
11:44clojurebotnil
11:45sirnthat one works, thanks!
11:45cmiles74You could do a list comprehension...
11:46TimMc&(.contains [:a :b :c] :b) ; sirn
11:46lazybot⇒ true
11:47gtrak`cmiles74, some does that for you: https://github.com/clojure/clojure/blob/f5f827ac9fbb87e770d25007472504403ed3d7a6/src/clj/clojure/core.clj#L2353
11:47cmiles74Gotcha'.
11:47sirnTimMc: nice! Is that .contains a Java stuff?
11:48gtrak`yes
11:48TimMcsirn: It uses the fact that all the Clojure collections implement the java.util.Collection (or whatever) interface.
11:49sirnTimMc: ah, I see.
11:49TimMc&(instance? java.util.Collection [])
11:49lazybot⇒ true
11:49blakesmithTimMc: That's useful to know, thanks.
11:53TimMcI can't tell where it gets that interface from, though.
11:56TimMcOh, got it: ##(isa? (class []) java.util.List)
11:56lazybot⇒ true
11:57Wild_Catdoesn't List specify .add, though?
11:57Wild_CatI thought vectors were immutable?
11:58TimMcYeah, but java.util.Collection specifies that some operations may be rejected.
11:58cemerick,(.add [] "foo")
11:58clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException>
11:58Wild_Catgood point.
11:59TimMcWild_Cat: cf. java.util.Collections#unmodifiableMap
12:00TimMc&(.containsAll [1 2 3 4] [2 3])
12:00lazybot⇒ true
12:00Wild_Cat&(.contains [2 3 4] 2])
12:00lazybotjava.lang.RuntimeException: Unmatched delimiter: ]
12:00Wild_Cat&(.contains [2 3 4] 2)
12:00lazybot⇒ true
12:00Wild_Cat&(.contains [2 3 4] 1)
12:00lazybot⇒ false
12:00TimMcIt's a sight nicer than using "some".
12:01TimMc*abusing
12:01Wild_Cataye.
13:03micahmartin,*ns*
13:03clojurebot#<Namespace sandbox>
13:04micahmartin,(binding [*ns* (the-ns 'clojure.core)] (do (println *ns*) (lazy-seq [*ns*])))
13:04clojurebot#<Namespace clojure.core>
13:04mbacwhat's the right way to terminate repeatedly?
13:04clojurebot(#<Namespace sandbox>)
13:05micahmartinDoes anyone know why lazy-seq looses it *ns* binding (see above clojurebot)?
13:06micahmartinmbac: what do you mean "terminate repeatedly"?
13:06gtrak`,(doc repeatedly
13:06clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: EOF while reading>
13:06gtrak`,(doc repeatedly)
13:06clojurebot"([f] [n f]); Takes a function of no args, presumably with side effects, and returns an infinite (or length n if supplied) lazy sequence of calls to it"
13:06Bronsamicahmartin:
13:06Bronsa,(with-redefs [*ns* (the-ns 'clojure.core)] (do (println *ns*) (lazy-seq [*ns*])))
13:06clojurebot#<Namespace sandbox>
13:07clojurebot(#<Namespace sandbox>)
13:07Bronsano wait
13:07Bronsathis is worse
13:07micahmartinmbac: ahh. it's an infinite sequence. Try 'take or 'take-while.
13:08micahmartinBronsa: interesting.. didn't know about with-redefs
13:12micahmartinBronsa: Do you know the history of with-redefs? Why is binding not sufficient?
13:15dnolenmicahmartin: lazy sequences and bindings do not work well together.
13:15micahmartindnolan: incidentally? or Intentionally?
13:16mbaci see
13:18dnolenmicahmartin: if you consider how lazy sequences work, how can they interact with dynamic binding?
13:18micahmartinbinding and with-redefs seem like the same thing.
13:19dnolenmicahmartin: they are not, with-redefs is about dealing with vars that are not dynamic.
13:20micahmartindnolan: with-redefs allows rebinding of non-dynamic vars?
13:20technomancytemporary redefinition, not rebinding.
13:20micahmartinI see it just redefines them.
13:20technomancyit's mostly intended for test-time use; I would be deeply suspicious of any code that used it at runtime
13:21micahmartindang, I wish I know knew about this a few weeks ago… it's helpful
13:22micahmartintechnomancy: makes sense… but in the case where I need to rebind/redefine *ns*, should I be using something other than with-redefs?
13:22micahmartineg. (with-redefs [*ns* (the-ns 'clojure.core)] (do (println *ns*) (lazy-seq [*ns*])))
13:23technomancyyeah, definitely something different; the seq will escape the scope of with-redefs. you need lexical scope if you want it to stay.
13:24dnolenmicahmartin: you don't need with-redefs w/ *ns*, *ns* is dynamic
13:24dnolenmicahmartin: you might be able to solve your problem by forcing the lazy sequence inside binding
13:25micahmartindnolen: I was just thinking the same thing
13:25dnolenmicahmartin: I've found that technique useful when writing macros.
13:26micahmartindnolen: yes, doall did the trick.
13:26dnolenmicahmartin: cool
13:28TimMcIf I ever write a regex lib, it's going to be called "two-problems".
13:29TimMcdnolen: Seems like a kind of ugly surprise. So... bindings only applies inside the current stack-tail?
13:30TimMcand seqs escape that?
13:30technomancywell yeah, that's why you shouldn't use bindings any more than you have to.
13:31technomancydynamic scope doesn't compose well
13:35gtrak`TimMc, bindings to vars follow a threadlocal stack discipline
13:36dnolenTimMc: its really is not surprising if you consider lazy sequences and dynamic binding. There was some discussion about special casing IO lazy seqs but nothing much has evolved on that front.
13:36gtrak`hmm, what if you do the binding in a map call?
13:37gtrak`like, (map fn2 (map fn1 coll)) where fn1 does a binding, would fn2 see the binding?
13:38gtrak`wait, that doesn't make sense
13:38dnolengtrak`: was about to say that :)
13:38gtrak`you'd have to split the binding :-)
13:39TimMcSomeone write a "Clojure pitfalls" thngy and put this on it.
13:42gtrak`something like (map pop-bindings (map your-fn (map push-bindings coll)))
13:46technomancyhas anyone used clojure.java.jdbc with postgres hstore columns?
13:46technomancyI'm too unfamiliar with postgres to tell the difference between unsupported features and pebkac.
14:00technomancylooks like the two options for jdbc+hstore are either some jar file checked into an openstreetmap subproject's git repo or a couple pages of java code someone who claims to be bad at java has posted to a mailing list.
14:00technomancyexciting.
14:08cmiles74I had never heard of this hstore thing before I read the HN article this morning.
14:09technomancyit's a pretty well-kept secret
14:09technomancythere's a single page of reference docs with zero "getting started" material
14:12rlbI thought it was pretty new, too.
14:13technomancyI think it was distributed as a contrib pre 9.x
14:13cmiles74I see an article on the PG mailing list from 12/2009 with some prototype code, but it doesn't look like it's made it into the actual driver.
14:16technomancyyeah, I have no idea what to make of that. could you just compile it and start using it, or would you have to register it as a new type with the jdbc driver?
14:16technomancyalso: is there a reason it was never added to the driver itself?
14:21cmiles74My guess is that you can compile and then start using it. PG has a bunch of their own datatypes and I think it'd work in a similar way.
14:22technomancyit turns out the jar in osmosis's git repo is that very code: https://github.com/oschrenk/osmosis/commit/84a5fc574717b3c5bc41520f370b9fc8807798cd
14:22cmiles74((org.postgresql.PGConnection)conn).addDataType("geometry",Class.forName("org.postgis.PGgeometry"));
14:22technomancyaha; thanks!
14:23cmiles74Section 5.2 of this document has more sample code: http://postgis.refractions.net/docs/ch05.html
14:23cmiles74It's not exactly the same thing, but at least it's something.
14:24technomancywhat better way to reintroduce myself to postgres after four years of not using it?
14:24cmiles74:P
14:28mrb_bkhey everyone, i'm working on a redis rdb file parser in clojure, i'm a complete clojure noob
14:28mrb_bkhere's what i have going so far https://gist.github.com/6dcba245ab08354a0a8d
14:28mrb_bkit doesn't do much :) just reads the magic number
14:29mrb_bkif anyone has any comments, that would be great
14:31technomancy_cmiles74: for the record, it's as simple as this: (sql/insert-rows :mytable [(PGHStore. my-map)])
14:31technomancy_since PGHStore has a j.u.Map constructor
14:31technomancy_(this is with the jar from the osmosis project)
14:31technomancy_which is extremely sketchy, but whatever
14:32cmiles74Gotcha'. Thank you, I've been thinking about trying this out. :)
14:36technomancy_https://clojars.org/org.clojars.technomancy/osmosis-hstore for the record
14:46TimMcmrb_bk: Have you looked into using gloss?
14:47mrb_bkTimMc: I did, but I found it to be way too complex for me at this point
14:47mrb_bkTimMc: for example I was having a difficult time even getting file --> lazy seq --> gloss
14:48mrb_bkit looks like a good solution and in general i get it, but it's a lot of extra cognitive dissonance for me right now as I'm also trying to learn the language
14:50amalloyi just discovered git checkout has a -p option, mirroring the -p in add/reset. <3 git
14:50mrb_bkTimMc: does that make sense?
14:54technomancyis there a better way than (apply sql/do-commands (.split (slurp (io/resource "hstore.sql")) ";")) to run all the sql in a given file?
14:54technomancythat feels a bit gross
14:55TimMcmrb_bk: Makes sense.
14:55technomancyI guess it's fine.
14:55TimMctechnomancy: Not if you have ; in strings.
14:56TimMcor comments
14:56technomancyTimMc: yeah, fine in this case I mean.
14:56TimMcAre you feeling lucky?
14:57technomancyseancorfield: is that something that should be added to the c.j.jdbc API?
15:02duck1123Has anyone had issues with delimiters and the newer versions of korma? It insists on either giving me a NPE or escaping the table names with double quotes
15:04duck1123I love asking a question. It's a sure fire way to make sure it works on the very next test
15:21powrtocI'm having some problems with clojure-mode and clojure-jack-in :-()
15:22powrtocI get the following error: error in process filter: Search failed: "(run-hooks 'slime-load-hook) ; on port"
15:22powrtocany ideas?
15:22technomancypowrtoc: try swank-clojure 1.3.3 or 1.3.4-SNAPSHOT
15:23powrtocI'm on 1.3.3, but I'll try the 1.3.4-SNAPSHOT
15:24powrtocI also tried 1.4.0-SNAPSHOT
15:25powrtoctechnomancy: cheers... 1.3.4-SNAPSHOT works
15:25powrtoc:-)
15:26technomancybetter get that released I guess
15:26powrtocI knew I should've logged in here and asked, rather than spend 35 minutes faffing with it :-)
15:53ibdknoxlol
15:53ibdknoxwhoops :p
15:54amalloyibdknox: (apply f (cons a (list* b [c]))) for good measure?
15:54ibdknoxamalloy: that would be the safest.
15:54ibdknox;)
15:59ilyakhttps://gist.github.com/1469066
15:59ilyakHi *
15:59ilyakI have this slow function
15:59ilyakprofiler tells me clojure spends most of its time by converting long to int and vice versa
15:59ilyakhow should I write this code to it become efficient?
16:03dnolenilyak: did you (set! *warn-on-reflection* true) ?
16:04ilyakdnolen: One sec
16:04ilyakBut I don't thing it would tell anything meaningful
16:05ilyakdnolen: No lines in this fn trigger any warnings
16:08dnolenilyak: can you add the defn for color to your gist?
16:09ilyakdnolen: https://gist.github.com/1469066
16:09ilyakbut it's basically instant
16:10ilyakrange seems to be a pretty inefficient function
16:11ilyakBut I don't really know what to replace it with
16:11dnolenilyak: I see reflection warnings.
16:11ilyakexplicit loop seems meh ugly
16:11ilyakdnolen: in create-image?
16:12dnolenilyak: in two places, you need to figure that out first - https://gist.github.com/1469123
16:12dnolenilyak: explicit loops for perf is fine, especially for something like this.
16:13dnolenilyak: using seqs for control when you're dealing with side-effects like this is a waste.
16:14Wild_Cathrmm. Why is there no Leiningen 1.6.x Windows distribution at https://github.com/technomancy/leiningen/downloads ?
16:14ilyakdnolen: Color ctor and getRGB are both called exactly once
16:15ilyakNo reason to bother, except perhaps I should fix the white as (int )
16:16dnolenilyak: ah you're right, but looking at the Javadocs setRGB is suspect
16:17ilyakexplicit loop is much much faster
16:18dnolenilyak: setRGB seems strange to me, you have boxed longs in range, but setRGB takes prim int
16:18ilyakNo, it isn't
16:19ilyakI'm so dumb
16:19dnolenilyak: if explicit loop isn't faster then consider my last point.
16:21ilyakI suddently decided to stop caring about performance because it takes more human time than reduces computer time
16:21TimMchaha
16:23dnolenilyak: what are you basing your setRGB call on? The javadocs say, int int int for the signature
16:38technomancyWild_Cat: the windows maintainer is just behind schedule
16:38Wild_CatOK, nothing to worry about then. Thanks.
16:45cemerickOdd: this emits a reflection warning for .equiv: (= (.charAt "f" 0) (.charAt "f" 0))
16:49hiredmanthere is equiv inline for characters
16:49hiredmanor wasn't last I looked
16:49cemerickright, and .charAt returns a char
16:50hiredmanand Utils.equiv may take Object Object
16:50weavejesterI've just updated clojure-mode and I can no longer connect to SLIME...
16:50hiredmanupdated to what, the lastest master?
16:51weavejesterJust 1.11.4
16:51djhworld
16:51djhworld
16:51djhworld> hello world
16:51hsbot Not in scope: `hello'Not in scope: `world'
16:51djhworldwhoops
16:51weavejesterVia marmalade, I believe.
16:51weavejesterDoes: error in process filter: Search failed: "(run-hooks 'slime-load-hook)
16:51weavejesterseem familiar to anyone?
16:51hiredmanlatest according to git is 1.11.2
16:52weavejesterpackage-list-packages claims 1.11.4...
16:53weavejesterAnd the latest commit on technomancy's repo is "Release 1.11.4.
16:53weavejesterSo I think the release is correct :)
16:53weavejesterI wonder whether I need to update swank-clojure or something?
16:54technomancycrap, yeah I need to fix that
16:54technomancyswank-clojure 1.3.4-SNAPSHOT should fix it
16:54technomancybut it's dumb for it to require a snapshot.
16:55weavejesterI'll try that :)
16:55weavejesterMight want to put a notice on it or something, or release a new version...
16:55technomancywait... it should work with 1.3.3 actually
16:55technomancywhat are you on?
16:56weavejester1.3.2
16:57weavejesterOr I was. I've just upgraded the plugin
16:57weavejesterAh, it works now.
16:59technomancyjust pushed a new clojure-mode; I think it should be more forgiving of earlier swank versions now
17:01weavejesterAwesome :)
17:01weavejesterBy the way, is there anything I need to do to enable SLIME completions?
17:01weavejesterI've never been able to get that to work.
17:02technomancyin the repl or in clojure-mode?
17:03weavejesterIn clojure-mode
17:03technomancyM-TAB works for me, but I don't remember if I did anything special to set it up
17:04weavejesterM-Tab is my window switcher :) - I think by default it's M-\ ... or is that something else?
17:05technomancythere are a number of completion mechanisms; some of which can multiplex to others composably. M-TAB is a way to directly access the slime-specific one.
17:06technomancyyou can tie the slime completion mechanism into hippie-expand, for instance
17:06weavejesterEmacs completions are a bit of a mystery to me. I was thinking of smart-tab, which I assume completes on tab
17:07technomancyhm. I am deeply suspicious of rebinding TAB to mean anything other than indent.
17:07weavejesterI think it either indents or completes depending on the context.
17:07technomancyC-i is another way to invoke TAB without triggering your WM
17:08technomancyso you can try C-M-i
17:08amalloyyeah, C-M-i is one way
17:08weavejesterOh yeah, that works.
17:08weavejesterI need to find a better key combo though. Maybe I'll try hippie
17:09amalloyi wind up doing something similar on occasion, using C-j to insert a newline. i configured RET to automatically reindent (arguably because i'm stupid), so when i don't want to i can use C-j
17:09technomancyIIRC hippie-expand is the one that can cycle through a number of different completion mechanisms
17:09weavejesterNot sure I really need that, then
17:20weavejesterAha, got it working.
17:28bhenryi need to add to the end of a list? how should i do this?
17:30dnolenbhenry: you should use a vector, otherwise concat might work for you.
17:30bhenryi have headers = [:a :b :c] and am cons-ing them to the beginning of the data formatted as a list of vectors like [1 2 3]. then i want to add the footers [6 5 4] at the end, so i can run a nice little tab-formatting function over the result.
17:30bhenryah i was thinking that. didn't know if it would be super frowned upon to turn them all into vectors.
17:42TimMctechnomancy: Hey, lein 1.6.2 is defaulting to 1.3.0 in new projects -- did 1.6.2 just get released or something?
17:43technomancyTimMc: a few weeks ago
17:43TimMcnice
17:43Turtl3boiwhy is clojure used for web programming?
17:43TimMcWhy not?
17:44Turtl3boihaha i dunno just wondering. i thought php/javascript and all that was rather entrenched
17:47brehautTurtl3boi: nothing is 'entrenched' on the server side
17:49brehaut(except for existing projects)
17:49weavejesterTurtl3boi: Lots of languages are used for web development.
17:50Turtl3boihow can i start using clojure on a free web server?
17:50Turtl3boior would i have to get a paid hosting and then set it up myself
17:50weavejesterI believe Heroku has a free tier
17:50cemerickAs does GAE and Amazon Elastic Beanstalk.
17:50Turtl3boiemm what is techomancy
17:51Turtl3boiis that a bott
17:51weavejesterAmazon only have it for the first year
17:51cemerickright
17:51Turtl3boiwhat's amazon elastic beanstalk?
17:51weavejestertechnomancy isn't a bot :)
17:51technomancyweavejester: is it because of your childhood that you say technomancy isn't a bot :)?
17:51weavejesterOr if he is, he's a sentient AI and we're only years away from Skynet
17:51Turtl3boii had never seen someone's name italicized b4
17:51weavejesterClearly of superior intelligence to us mere mortals :)
17:52technomancynot if I can't pass the reverse turing test.
17:52weavejesterElastic Beanstalk is Amazon's cloud-hosting platform.
17:52weavejesterBasically you can host Java servlets without having to worry about infrastructure, and Clojure web apps can be packaged as servlets.
17:53technomancyweavejester: congrats on the 1.0 release btw
17:53weavejesterweavejester: Of Ring? Took us long enough to get there :)
17:53weavejesterBut then I guess stability is a good thing for a project like that!
17:53technomancyyeah, definitely want that slow-moving stability at that layer of the stack
17:54brehautweavejester: its not like the pre 1.0.0 releases were shonky though
17:54weavejesterCompojure should be going 1.0.0 soon, too. I've just released an RC version. Not much change.
17:54weavejesterbrehaut: True. That's why we figured we should go and release an official stable version :)
17:54brehauthah fair enough :)
17:55technomancyis there still a plan to move it to a contrib, or was that just a rumor?
17:55Turtl3boiso what would clojure be used for in web design? the backend or the frontend
17:55Turtl3boidoes it replace the PHP kinda
17:55weavejestertechnomancy: Weeeell... there was, and it still might happen, but not everyone who's contributed to Ring is on the Clojure's contributor agreement.
17:56technomancyyeah, I fail to see the upside for such a thing
17:56weavejesterI don't really see much of an upside either, reallly...
17:56weavejesterI mean, it would be more official, but it would take a lot of work to get people to sign or replace code.
17:56technomancyit's not like it needs the Blessing of the Chosen for people to realize ring is where it's at.
17:56weavejesterAnd it would impede future patches.
17:57technomancyand you'd have to use jira.
17:57weavejesterTurtl3boi: It's more the back end, yeah
17:57weavejesterTurtl3boi: But Clojurescript compiles into Java, so potentially the front end too. That's still a little experimental though.
17:57weavejesterEr, Javascript I mean
17:57Turtl3boiahh ok interesting
17:58weavejestertechnomancy: Oh yeah. I prefer Github really. Clojure's process seems a little too formal, which is good for a language, but maybe not for a library.
17:58technomancygood to know
17:59weavejestertechnomancy: By the way, I was thinking of creating a ragtime.leiningen subproject
17:59weavejesterwhich would add leiningen tasks like "lein migrate" and "lein rollback"
17:59weavejesterBut I haven't quite figured out how people would hook their libraries into that.
18:01technomancyweavejester: I wonder if it wouldn't be better to run migrations via "lein run -m ragtime.migrate" or the like
18:01weavejesterOr... maybe I could keep it simple, and just provide functions that people could use in their Leiningen plugins.
18:01technomancythen the function can still be invoked from an uberjar or war file when leiningen isn't present
18:01technomancyat deploy time
18:01weavejestertechnomancy: Oh sure
18:01cemerickweavejester: Congrats, and thanks for everything :-D
18:01weavejesterBut having a small leiningen plugin to wrap around that might be nice...
18:02weavejestercemerick: Thanks :)
18:02weavejesterI'm thinking that a library like Migratus could just pass a list of migration maps to Ragtime
18:02weavejesterAnd then Ragtime handles all the rest
18:02weavejesterKinda like a Ring for migrations.
18:03cemerickweavejester: I'll have to bug you re: a lein-beanstalk release now.
18:04weavejestercemerick: Do you want to be added to the lein-beanstalk project? :)
18:04weavejestercemerick: As a maintainer
18:04cemerickRisky move. ;-)
18:05cemerickFine by me.
18:05cemerickI just don't want -SNAPSHOT versions floating around in the book.
18:05weavejesterI'm probably not going to be personally invested in lein-beanstalk for a while, so if you are, then better to have someone who is using it
18:05weavejesterOr at least intested in its development.
18:06cemerickI use beanstalk quite a bit, and will be using lein more and more…so, sure. :-)
18:07weavejestercemerick: Perfect :)
18:07weavejestercemerick: Your github account is "cemerick" too, right?
18:07cemerickNope, that's my doppelganger that creates bugs all the time.
18:08cemerickMight use a lein-beanstalk branch to figure out the new lein profiles / plugins / etc. action, actually.
18:08cemerick(Yes, cemerick is me nearly everywhere.)
18:08weavejesterJust making sure
18:09cemerickSorry for the out-of-place not-really-humor. It's shaping up to be an odd week.
18:09weavejesterOkay, you should be added.
18:09weavejesternp :)
18:09weavejesterLet me add you to clojars as well...
18:10weavejester(I'm assuming you're cemerick on clojars, too :)
18:11weavejesterYou're now added on Clojars too. Feel free to push out releases.
18:11cemerickyup
18:11cemerickGreat, thanks. I'll be sure to ping you on anything more than patch-level stuff.
18:12gtrak`Turtl3boi, take a look at noir for a full framework or ring and moustache for a minimal one
18:13Turtl3boigtrak but that can't run on a free web host usually right?
18:13gtrak`though noir is pretty minimal too
18:13gtrak`Turtl3boi, yea, you can run all this stuff on heroku
18:13Turtl3boiso i can go setup a byethost free web server account and install heroku on it
18:13gtrak`Turtl3boi, no, get a heroku account: http://thecomputersarewinning.com/post/clojure-heroku-noir-mongo
18:14gtrak`doubtful you'll get a free web host that does jvm stuff
18:14gtrak`but heroku does it
18:15gtrak`is TimMc a bot?
18:16Turtl3boiyes Tim lol
18:16Turtl3boii'm an IRC IDIOT so far
18:16gtrak`TimMc, how'd you do that?
18:16Turtl3boii need to stop using chatzilla
18:16TimMcTurtl3boi: The first thing was me using /me to do an action.
18:17TimMcgtrak`: That was /notice, which is the thing clojurebot uses to announce clojars news.
18:17gtrak`ah
18:17TimMc/notice #channel message
18:18TimMcIt's supposed to come in at a lower priority than privmsg.
18:18TimMc...although apparently some clients make it stand out *more* for no good reason.
18:19amalloymine just treats it like a regular message with the string "(notice) " prepended to it. kinda silly but useable
18:20Turtl3boiholy crap that's so cool!
18:20TimMchaha
18:20TimMcTurtl3boi: And if you need to start a message with a slash, use /say
18:21Turtl3boiProgram Files/SexGame/hornyphoto.jpg
18:21gtrak`/
18:21Turtl3boiwhat did i do wrong
18:21gtrak`/say ...
18:21Turtl3boi/Program Files
18:22Turtl3boioh right....... lol see how slow i am with computer syntax
18:22Turtl3boiwhy is that guys who generally work on Clojure and other cutting edge stuff are less smug than the guys in the #C and #C++ channels
18:23Raynesweavejester: Being able to accept contributions > being official.
18:23lancepantzTurtl3boi: i like to think it's because we have a higher quality of life, due to clojure :)
18:24Rayneslancepantz: I think you just canceled what he said out by being smug.
18:24gtrak`maybe it's just harder to notice the smug b/c of the lang
18:24RaynesThe politically correct response is "Aw, shucks. I don't know!"
18:24Turtl3boiROFL
18:25Turtl3boibtw gtrak i'm finally starting to understand fully that python code you gave me for that graphics course you took
18:25Turtl3boilol see how slow i am
18:27Turtl3boido you guys all use Linux for main OS?
18:30gtrak`Turtl3boi, i think it has some mistakes in it
18:30Turtl3boihaha possibly
18:30Turtl3boiit's ok i get the gist of it now
18:30gtrak`and it was like the first python i ever wrote
18:30Turtl3boistill haven't been called back for an interview for that graphics position i applied for
18:31Turtl3boilol ya
18:31Turtl3boii think i'm gonna give up on graphics
18:31gtrak`it's not a large market
18:32Turtl3boiyeah but Nvidia does pay well if you can get in
18:32gtrak`yea, i have a buddy there
18:32Turtl3boibut yeah it isn't a large market at all
18:33gtrak`enterprise and web will keep you fed while you're learning
18:33Turtl3boiwhat's enterprise?
18:33Turtl3boilike just making apps that run locally
18:33gtrak`enterprise is like pornography, you know it when you see it
18:34Turtl3boihaha
18:35gtrak`enterprise is a pretty big term, like something that isn't exactly just web
18:44sridis there a library like lamina for ruby (preferably using eventmachine)?
18:47Turtl3boiwhat's the easiest way of writing a web app
18:47Turtl3boiwith HTML5 and Javascript?
18:48technomancyfirst you should take a working web application, read its source, and attempt to modify it.
18:48technomancyyou can start with the sample at http://devcenter.heroku.com/articles/clojure-web-application
18:49Turtl3boiwhere's the sample?
18:50technomancyit's linked to in the article
18:52rickmodeI'm toying with the idea of deploying clojure via source file *outside* of jar files. I tried clojure.lang.Compiler.loadFile, however that doesn't work when using or requiring forms from other source files (refer does work).
18:52rickmodeSo I know adding my source path to the app's classpath works. Is there another way that doesn't involve changing the hosting app's classpath?
18:53technomancyyou can go in and mangle clojure.core/*loaded-libs* if you want to really go nuts
18:54technomancyjust don't tell anyone I told you that
18:54cemerickrickmode: are you trying to update a running app, or something else?
18:55rickmodecemerick: ya - I'd like to be able to edit the source, then reload it via a REPL.
18:55cemerickrickmode: if you make sure some directory is on the app's classpath, then you can dump source files in there to your heart's content, and load (or reload) them remotely from the REPL.
18:56rickmodeImagine code running on a customer site that you may want to tweak. So you extract the source from the jar, do some magic, and (perhaps after restarting the app), the app now uses the files rather than the version inside the jar
18:56cemerickAlternatively, you could just load all the code you want through the REPL.
18:56technomancyrickmode: just put a directory on the classpath ahead of the jar
18:56technomancythen you can place the modified source there
18:56cemerickwhat technomancy said
18:57technomancy(assuming you're squeamish about editing the jar directly)
18:57qbgrickmode: load-file doesn't work foryou?
18:57rickmodecemerick / technomancy: ya that sounds like the best option. And the upside is there is no config change needed.
19:00rickmodeqbg: if I have code in two source files, then use and require fail, since those both *only* use the classpath. I *thought* using load-file dependencies first would work, but even though the dependence source loads fine (imagine it's a utils.clj thing), using require in my core.clj still searches the classpath rather than realize the namespace is already available. It makes sense actually. It's just a drag something like load-file w
19:00rickmodeIt's just a drag something like load-file would _not_ work.
19:01technomancyit would work if everything downstream was also implemented in terms of load-file
19:02rickmodetechnomancy - ya - but that means using (refer ..) and such. The code won't look the same as the jar'd version.
19:02technomancyright, I mean, people use that stuff because it's much more convenient than thinking in terms of files all the time
19:02rickmodeit's a subtle distinction - the load-file / script style vs. the classpath / use / require style
19:03bloopforgive me if this is a dumb question, but what is the difference between 1N and 1?
19:03qbg1N is a bigint
19:03seancorfield,(type 1N)
19:03clojurebotclojure.lang.BigInt
19:04bloopwhy does (/ 1/2 1/2) produce a bigint?
19:04rickmodetechnomancy / cemrick / qdb: Ok cool - I was just making sure I hadn't missed something.
19:04alexbaranoskyany of you all use Marginalia? I'd be excited to hear more about what it does
19:05Turtl3boialex what exactly do you do now for a living
19:05qbgbloop: Ratios are ratios of bigints, so it makes sense...
19:05brehautit rejiggers your documentation and code to be equals
19:05Turtl3boiwould you say it's hard to do what you do
19:06bloopqbg: ok then...
19:06alexbaranoskyTurtl3boi, program on a piece of software called the Trade Idea Monitor, a kind of network for equity (mostly) brokers and buyers
19:06alexbaranoskyin Java and Scala, we do pretty much XP, with some twists
19:06Turtl3boiomg you do programming for the finance industry
19:06Turtl3boii heard that can be a nice industry
19:06Turtl3boiwhat's XP?
19:06alexbaranoskyTurtl3boi, hard? I guess, but fun
19:07qbgXP = extreme programming
19:07alexbaranoskyprogramming is hard if you do it right :) Because you are always optimizing out the easy bits
19:07qbghttp://en.wikipedia.org/wiki/Extreme_programming
19:07alexbaranoskynot sure if I really believe that last statement
19:08bloopqbg: but numerator and denominator don't always return bigints... eh, whatever
19:09qbgbloop: Might be a bug around here
19:09bloopprogramming should be hard like mathematics is hard; it should not be hard like lifting a box with your ears is hard
19:09qbg(inc bloop)
19:09lazybot⇒ 1
19:11Turtl3boihaha thx alex
19:11Turtl3boialex can you tell me what are some of the difficult questions you've been asked at an interview
19:13Turtl3boiwell this is a long term question
19:13Turtl3boino rush alex
19:13rickmodesimple != easy. Programming the easy way leads to big messes. Programming the easy way in OO languages results to an object orgy (https://en.wikipedia.org/wiki/Object_orgy). I've yet to see a OO project of any age that isn't a mess of slightly wrong hierarchies and broken encapsulation.
19:13Turtl3boii always thought OOP was kind of messy but i couldn't quite put my finger on it
19:14Turtl3boii just really never understood other people's code very quickly
19:14alexbaranoskyrickmode, I personally avoid inheritence until I'm physically forced to use it
19:14mbacwhat's the least horrible way to turn a byte array into integers
19:15alexbaranoskyTurtl3boi, can you email me? Seems like a better forum for answering specific questions, and I also have to go eat now... don't want to forget
19:15mbaci'm decoding signed shorts
19:15rickmodeFlat inheritence hierarchies help. Clojure-style OO is essentially flat.
19:16Turtl3boilater alex
19:20rickmodembac: check out DataInput in Java : http://docs.oracle.com/javase/6/docs/api/java/io/DataInput.html
19:20mbacblah, i already have the data loaded sadly
19:21rickmodembac: it's still usable via an input stream around your data
19:22rickmodembac: http://docs.oracle.com/javase/6/docs/api/java/io/DataInputStream.html
19:23alexbaranoskyrickmode, I prefer to favor composition over inheritence almost always
19:23rickmodembac: if you're brave you can also use bit shifting on the elements of the byte array
19:23qbgByteBuffer?
19:23mbacbit shifting is a much more familiar beast to me than java libraries
19:24qbghttp://docs.oracle.com/javase/6/docs/api/java/nio/ByteBuffer.html
19:24qbgMakes Java more like C land
19:25rickmodembac: if you're data is a 4 byte array, then something like this works: (((unitbuf[0] & 0xFF) << 24) | ((unitbuf[1] & 0xFF) << 16) | ((unitbuf[2] & 0xFF) << 8) | (unitbuf[3] & 0xFF))
19:25mbacyeah, i was wondering if clojure had magic already to do that
19:25mbacno worries
19:26qbgByte buffer lets you turn it into a ShortBuffer, and from there into a short array
19:26rickmodembac: the bitwise operators are there... however Clojure is much happier creating longs than ints, so be careful
19:26mbaccool
19:26mbacthanks
19:35Turtl3boiwhat's the purpose of Heroku?
19:36gtrak```it's a cloud platform
19:36gtrak```they sell cpus and dbs for you to deploy on, the first one is free
19:36Turtl3boiinteresting
19:40Turtl3boidid you write a web app and deploy it on heroku?
19:41gtrak```nah, not yet
19:41gtrak```i'm sure lots of guys here have though
19:42brehautTurtl3boi: http://clojuresphere.herokuapp.com/ http://github.com/jkk/clojuresphere
19:44replore_and this is a good tutorial using clojure in heroku.. http://thecomputersarewinning.com/post/clojure-heroku-noir-mongo
19:48alexbaranoskyreoku + noir is very smooth
19:48alexbaranoskycorrection: heroku
19:49alexbaranoskyso none of you all are using Marginalia? I'm wondering if it might be useful somehow for Midje
19:50brehautim pretty sure some of us are using marg
19:50technomancyit's useful for potential contributors. not so sure how useful it is for users.
19:50alexbaranoskytechnomancy, that's still a useful thing though
19:51technomancyabsolutely.
19:52Turtl3boiwhat do u mean by "smooth" alex?
19:53alexbaranoskyTurtl3boi, just that you can get a deployed webapp up in 5 minutes or something
19:53alexbaranoskyand then you can redeploy with `git push heroku master`
19:53alexbaranoskyalso smooth on the noir side, you can easily refresh your runnign web server just with `:reload` to see changes you've made
19:54alexbaranoskyall around just easy to work with
19:55Turtl3boiwhat does it mean to 'deploy' a webapp? like have it appear in a browser when you type in the URL?
19:55alexbaranoskyTurtl3boi, yes. It has to run on a machine somewhere
19:56mbacare seqs memoized or does clojure re-synthesize them for each consumer?
19:57technomancymbac: they're memoized
19:57mbaccool
19:58Turtl3boido you write web apps alex? or mainly just ones that run on the local machine
19:58alexbaranoskythe application I write at work is a webapp, so yeah
19:58bloopso, I've been redesigning my personal GUI library in Clojure and I'm considering the possibility of having a "single mutable root" and no other mutations in the rest of the scene graph (so using custom zippers instead of refs for things that 'change') I'm not very experienced with hardcore functional programming and was wondering what you guys think of this idea. Is it mostly a performance vs. capability concern?
19:59Turtl3boiumm do i have to be pretty decent with network programming (understanding TCP/IP) to be able to write web apps
19:59mbacnot as a rule, no
20:00brehautbloop: have you had a look at seesaw ?
20:00bloopbrehaut: nope, I'll look into that
20:00brehautTurtl3boi: web apps are about as airy fairy as you can get
20:01brehautbloop: its inspired by enlive and built on swing i believe
20:01Turtl3boiyou mean easier to write than other apps
20:01brehautTurtl3boi: no
20:01Raynestechnomancy and I are trying to gauge how widespread the usage of nested vectors as :java-source-path in Leiningen is. Does anyone here use it or know of projects that use it?
20:01brehautTurtl3boi: just that theres very few picky details
20:01RaynesExample: :java-source-path [["foo"] ["bar"]]
20:01brehautTurtl3boi: you can get away without even knowing http when you start out
20:02Turtl3boihahaha that would be me
20:02amalloyclojurebot: web apps |are| about as airy fairy as you can get
20:02clojurebotAck. Ack.
20:02bloopbrehaut: the cool thing about single-mutable-root is that any state of the whole GUI can be revisited just be holding on to the value... but I'm not sure if this is really a realistic goal... or useful. It seems like "how grainular should I make my side effects?" is a question I just don't have a good instinct for, because previously, avoiding side-effects was so tough that I just took what I could get.
20:02brehautapropos of nothing: http://www.rimmell.com/bbc/news.htm
20:03alexbaranoskyRaynes, technomancy I've not seen nested vectors used in my limited exposure
20:03Turtl3boibbl
20:03brehautTurtl3boi: have you looked at ring yet?
20:04Turtl3boinope what's that
20:04Turtl3boiwell yeah i saw something about ring on the heroku site
20:04brehautTurtl3boi: its the web / http abstraction that basicly all clojure web stuff uses as the 'lowest level'
20:04brehautbasicly its just an interface for functions that talk http
20:04brehaut'just'
20:04Turtl3boihaha yeah that's what made me start worrying about knowing network programming
20:05brehautTurtl3boi: you get given a map of (mostly) strings, and you return a map of (mostly) strings
20:05Turtl3boiwow that sounds easy maybe i should try writing a lil appsy
20:06brehautTurtl3boi: its a little old now (its for clj 1.2 and pre 1.0.0 ring) but http://brehaut.net/blog/2011/ring_introduction
20:06brehautapologies for tooting my own trumpet
20:07Turtl3boiwow thanks i'll read up on it.... btw i hope you realize how newb i am. i was not a CS major and i shunned programming for quite a while
20:08Turtl3boii was a geek who was into analog electronics
20:08Turtl3boianyways i shall be back later
20:15burngregAnybody have any experience in using SQL Korma with postgres schema's ?
20:19TimMcbrehaut: That was pretty random.
20:19brehautTimMc: ?
20:20leo2007is clojure slow? (http://shootout.alioth.debian.org/u32/compare.php?lang=clojure)
20:20TimMcbrehaut: The article by Dr. Sloof. :-)
20:20technomancyleo2007: alioth benchmarks are well-known for being biased against languages that use JIT.
20:21technomancythey're about as useful as the tiobe index
20:21technomancyplatforms that use jit, rather
20:22leo2007alright, thanks for the note.
20:22TimMcAlso, the Clojure should probably be rewritten -- there is not way it takes more lines of code than Java.
20:23amalloyTimMc: if you can't use any HOFs because that means boxing and lazy-seq overhead, which is too slow for the shootout...
20:24TimMchmm
20:27cemerickleo2007: The shootout allows (and therefore demands) the use of native libraries in e.g. python/ruby/java/clojure/scala/etc.
20:27cemerickMakes it a total sham AFAIC.
20:28cemerickSomeone (besides me) should start a "No Bullshit Programming Language Benchmarks Game".
20:28technomancycemerick: not sure "no bullshit" and "game" can go together in that context
20:28hiredmancemerick: isn't there a T at the end of AFAIC
20:29cemerickAs Far As I'm Concerned.
20:29hiredmanah
20:30cemericktechnomancy: it can be gamified while still providing some value.
20:32technomancycemerick: it's just so subjective; people are always going to look at absolute speed rather than the maintainability/speed tradeoff that they actually care about because the former is quantifiable.
20:33cemericktechnomancy: maybe sort by a Speed / AST nodes column? :-P
20:34technomancythe proportion of people who should be picking a language based on _ato-style squeezing-blood-from-a-stone (http://meshy.org/2009/12/13/widefinder-2-with-clojure.html) is tiny, but those kind of stats are always going to be where people look.
20:34technomancyalso: most people are going to come to the site looking for data to justify conclusions they've already made
20:34cemerickMost people just want to know they're within 20% of the fastest they can go, given platform limitations.
20:35technomancyI suspect you're looking for a technical solution to a social problem. =)
20:35cemerickI'm not looking at all, thank goodness.
20:35technomancyheh
20:35cemerickAnnnyway…travisci is pretty slick.
20:35technomancyso good
20:35cemerickhttp://travis-ci.org/#!/cemerick/clutch/builds
20:36cemerickIt lives!
20:36bloopmy biggest issue is that it treats optimization the wrong way: as something you do early in the project (by choosing a language)
20:36cemerickUses a travis-provided couchdb instance for testing *everything* too.
20:36cemerickI figured I'd have to go set up a clutch-specific account at cloudant or something.
20:56alexbaranoskyis there any standard way to mark a Clojure function deprecated using metadata or something else?
20:56TimMcamalloy: It turns out the site doesn't compare SLOC, it compares gzipped size. :-P
20:58technomancyalexbaranosky: I came up with this: https://github.com/technomancy/leiningen/blob/1.x/src/leiningen/core.clj#L12
20:58brehautalexbaranosky: use :deprecated as the key and "version number" as the string
20:59technomancyif you're deprecating it in favour of the same function in another ns, anyway
20:59brehauthttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L2010
20:59technomancybrehaut: :will-remove-in "2.0.0" if you want to really get them worried =)
20:59brehautlol :)
21:00alexbaranoskythanks guys, will check those links
21:01brehauttechnomancy: defdeprecated is a nice trick
21:04cgrayi asked this the other day, but why is `last' not defined as #(nth % (dec (count %))) for types with O(1) count?
21:06brehautif i were to guess, its because last is a sequence function, rather than a polymorphic function
21:07brehautand not all datatypes with O(1) count are random access? (although i guess it probably wouldnt matter)
21:07cgraytrue, for lists, nth is O(n), but so is last
21:08brehautcgray: so really, you are asking why isnt vector special cased?
21:08cgraykind of :)
21:08brehaut(you could always use peek if you knew you had a vector)
21:09cgrayaha, cool
21:10cgrayhmm, it also looks like last is defined very early in core.clj, but i guess it could be redefined later
21:11brehautcgray: only if the var was defined dynamically though right?
21:11cgraybrehaut: oh good point
21:11brehautalthough…
21:11brehautslowdown due to var lookup on a O(n) function might be a silly thing to optimize?
21:12cgraytrue
21:13cgrayi always get confused because i assume that last is clever about different types like so many of the other seq functions
21:13cgraysomehow i'll have to start remembering to use peek instead of last
21:23arohneris there a programmatic way to turn off swank?
21:34tensorpuddingturn off swank?
21:36tensorpuddingyou can do (slime-repl-quit) to kill a running swank process and remove the slime buffers
21:39arohnertensorpudding: that calls (System/exit 0), right?
21:39arohnerI'd rather just stop the swank threads, and let the process figure out whether it's time to quit or not
21:39arohnerthe problem is, swank is keeping the process from dying
21:40duck1123try stopping the agents?
21:41alexbaranoskyhow does {:deprecated "x.y.z} get used in the attr-map? part of a defn ?
21:41arohnerduck1123: yes, I've tried that. I'm quite certain it's only swank that's keeping the process from dying
21:42duck1123you're starting swank in your tests, right?
21:42arohnerright
21:43duck1123looks like swank.commands.basic/get-thread-list might get you the threads. You could halt each one maybe
21:59bobhopewhere can I learn about clojure's agent scheduling algorithm?
21:59bobhopeon the heavyweight threads?
22:09alexbaranoskycould anyone take a look at a gist of something I'm trying to do and explain why it is failing for me?: https://gist.github.com/1470342
22:11mindbenderIn my recent ritz update, I get these errors when I run the tests: https://gist.github.com/1470339
22:12amalloyalexbaranosky: well, "doesn't seem to work" is pretty dang vague. it looks to me like your alter-meta! should be quoting name: '~name
22:14alexbaranoskyamalloy, hmmmm the alter-meta version applies the meta-data fine, the second version with the meta data done this way: ^{....} fails to apply the metadata to the unfinished defs
22:15amalloyalexbaranosky: you want to replace the former with the latter? but the latter works and the former doesn't? are you sure you don't have something backward?
22:15alexbaranosky?
22:15amalloyyou said the alter-meta version works fine, but your gist says it's the version that doesn't work
22:16alexbaranoskythe key is I'd like to understand why it doesn't work, I guess
22:17alexbaranoskyamalloy, sorry, I put them backwards
22:17alexbaranoskyjust fixed it
22:18amalloyin that case the problem is (probably) that ~name here resolves to the function itself, not the name. and the function has not been def'd yet in the ^ version
22:18alexbaranoskyfixed the gist, not the code
22:19alexbaranoskyhmm, even if I replace ~name, with '~name it still doesn't get the meta-data
22:19alexbaranoskybut that does sound like it might be why it is behaving this way
22:19alexbaranoskymakes sense at least
22:22alexbaranoskyammaloy: thanks for the suggestions I will just stick with the original
22:31blakesmithHrm. I'm implementing a decompression algorithm that operates on (potentially) large files, and would like the file IO and decompression to only happen when that part of the file is asked for (lazily). Has anyone else encountered a problem like this before?
22:31blakesmithSeems like a job for a lazy-seq, or writing against the ISeq interface...
22:32blakesmithBut I'm unsure.
22:34brehautblakesmith: it sounds like you want a buffered reader or something from clojure.java.io over some java class ?
22:35blakesmithbrehaut: Yes, but I'd like it to wrap decompression as well.
22:35blakesmithSo, buffered reading and decompression wrapped together, for easier usage.
22:36blakesmithIt'd be nice to be able to use idioms like 'take' on it as well..
22:36blakesmithSince this is for a clojure library.
22:38brehautblakesmith: still seems like it probably should be a java reader class to do the decompression
22:39blakesmithbrehaut: Would that then need to be wrapped in some way to support Clojure idioms like 'take'?
22:39brehautblakesmith: well it'd be in the IO layer not the seq layer; i think the readers are lazy anyway
22:40brehautso you wouldnt worry about making it support a seq operations, just reader operations. then you can use the standard clojure java io stuff to go from the reader to other stuff
22:43brehauti might well be talking out my arse though
22:43blakesmithhehehe
22:43blakesmithAight, I'll see if I can drum up some code, since that's easier to talk about.
22:43blakesmithWill report back. ;-)
22:45alexbaranoskydoes anyone know, how {:deprecated "x.y.z} gets used in the attr-map? part of a defn ?
22:46amalloyalexbaranosky: afaik it gets recorded and ignored
22:47alexbaranoskyrecorded by whom?
22:47amalloyit's in the var meta
22:47amalloy&(meta #'struct-map)
22:47lazybot⇒ {:ns #<Namespace clojure.core>, :name struct-map, :arglists ([s & inits]), :added "1.0", :static true, :doc "Returns a new structmap instance with the keys of the\n structure-basis. keyvals may contain all, some or none of the basis\n keys - where values are not ... https://gist.github.com/1470470
22:48amalloy&(meta #'agent-errors) ;; this one should actually have it
22:48lazybot⇒ {:ns #<Namespace clojure.core>, :name agent-errors, :arglists ([a]), :deprecated "1.2", :added "1.0", :doc "DEPRECATED: Use 'agent-error' instead.\n Returns a sequence of the exceptions thrown during asynchronous\n actions of the agent.", :line 2003, :file "clojure/core.clj"}
22:48alexbaranoskytried to add it to a couple macros in Midje, and it doesn't seem to show up in the var meta
22:50alexbaranoskyamalloy, dang, I'm on a roll of dumb tonight, oh well, it looks like I missed it and it is clearly in the var meta
22:50alexbaranoskytake it easy time to relax my brain for the night with some tv :)
22:52Turtl3boihi
22:53tmciveralexbaranosky: are we meeting at Sprout on Wednesday?
22:58Turtl3boican i meet up too?
23:00tmciverTurtl3boi: Are you in the Boston area?
23:00Turtl3boinope i live in california =(
23:00Turtl3boii assumed most ppl here were from san francisco
23:01tmciverNope, east coast
23:01tmciverClojurians better than west coast. ;)
23:05Scriptoryes east coast, that's why they have the east coast conferences at the most reachable placee :p
23:07Turtl3boii wonder why that is
23:07Turtl3boimaybe i should relocate to boston
23:08Scriptorwell, the confs are in north carolina of all places
23:09tmciverYeah, but I didn't mind; I liked driving in NC better than Boston.
23:09tmciverI've lived in Mass my whole life and I still can't find my way through Boston.
23:11Turtl3boiis boston a good place to meet girls
23:11Turtl3boior is that more new york
23:12tmciverNot bad but probably not as good as NY or SF.
23:13Turtl3boiwhat's a better place to get a programming job? SF or boston
23:14Scriptorhmm, I wonder how fast I could whip up basic clojure->php
23:14Turtl3boiwhat's clojure -> php? you mean a translation program
23:15Scriptorsomething like that
23:15tmciverNot sure, but if you want to do Java web dev, you'd have no trouble getting a job in Boston.
23:15Turtl3boican i watch you as you program it
23:15Turtl3boican i view your desktop or something
23:15Turtl3boijava web dev? you mean like javascript web apps?
23:15Turtl3boior JVM related web apps
23:15Scriptorsure, it's just going to have a lot of alt tabbing to irc, email, or reddit
23:16Scriptorjvm web apps
23:16Turtl3boidoesn't that mean just embedding an applet? ( i vaguely remember this from my old programming course)
23:17tmciverbackend: Servlets, JBoss, Tomcat
23:18Scriptoryep, there's a huge market for server-side java
23:18Turtl3boithat sounds hard haha
23:27amalloyScriptor: isn't that what pharen was/is?
23:27amalloyclojure->php, that is
23:38Scriptoramalloy: a lot of it is inspired by clojure, but not completely
23:38Scriptorno sequences, no keywords, some syntax differences
23:38Scriptormostly calling it clojure would set too many expectations :)
23:39amalloyheh
23:39amalloyif you're serious about doing it, you should check in with ambrosebs - i imagine his cljs compiler/analyzer work would be relevant
23:40Turtl3boiwhat's the purpose of translating clojure into PHP
23:42tmciveryou don't have to write PHP
23:42amalloyit's easy to think in clojure, and easy to run php in an enterprisey setting :P
23:43Turtl3boiso clojure is easier to think in?
23:43Turtl3boiit seems a pain in the butt for me
23:43Turtl3boii thought it was just better in terms of multi threaded
23:44amalloyTurtl3boi: bro, if you want people to answer "no" to that question, you should hang out somewhere other than #clojure
23:44Turtl3boiLoL
23:44Turtl3boisorry man i'm still a newb
23:45tmciverTurtl3boi: me too. It is hard at first if you don't have a functional programming background, as I didn't. But it's worth the mental strain.
23:46amalloyat my last job there were a few hard problems that i wrote first in clojure and translated to php, because it's easier to experiment in clojure, and you don't have to shout so loud to get the computer to understand what you mean
23:46Turtl3boiwhat's the best way to get started in functional programming?
23:47amalloyread code, write code. hang out in #clojure or #haskell
23:47tmciverTurtl3boi: and take a look at 4clojure.com
23:48tmciverin fact, I have to get back there myself.
23:48Turtl3boithanks
23:48Turtl3boii meant to buy joy of clojure today but didn't get back to the store
23:49tmciverTurtl3boi: Halloway's Programming Clojure is a great starter book.
23:49amalloyTurtl3boi: the store!!!!? get it from manning.com, they have pdf and mobile download versions to go with your pBook
23:50amalloythough to be fair i believe you get the pdf when you buy the book, even if you get a hard copy from some store
23:50Turtl3boilol you serious
23:50ScriptorTurtl3boi: for me, the best way to get started with functional progamming was reading learn you a haskell and trying to implement functions it described before seeing the source
23:50Scriptoryou could probably do the same with some clojure books
23:51Turtl3boiwow that's a good idea
23:51Scriptorlyah does a pretty good job of teaching functional basics, especially good recursion
23:52Turtl3boiamalloy are you saying it's free at manning.com?
23:52Turtl3boior are you saying just don't go drive to the store to buy it
23:52Scriptorand lyah online is free
23:52amalloyTurtl3boi: the pdf is free if you get the book
23:52Scriptoramalloy: does cljs use a custom-built parser?
23:52amalloyScriptor: no, it just uses clojure.core/read
23:53Scriptoroh right, I remember reading it a little
23:53amalloyTurtl3boi: also, i think someone recommended SICP to you already. it's an excellent book and enjoyable read, and free online, though IMO a bit heavy
23:53ScriptorI remember hearing of a good precursor to sicp
23:54ScriptorTurtl3boi: http://news.ycombinator.com/item?id=2115756
23:55ScriptorTurtl3boi: also, clojure and lisp in general is definitely easier to think in for many things
23:55skeeterbugis practical clojure any good?
23:55Scriptormacros are fun too