#clojure log - Apr 29 2013

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

3:18 rodnaph_: is it possible to specify leiningen options (eg :source-paths) via the shell? lein -Dsource-paths=X or something... (doesn't seem to be but asking incase i've missed it in the docs)

3:22 thm_prover: dumb question, suppose I have something like (cond (test1) (expr1) (test2) (expr2) (test3) (expr3)) .. suppose furthermore that testX is an expensive op. Is there a way to refer to the result of testX in exprX ?

3:26 ucb: thm_prover: you could memoize testN and re-use that in exprN?

3:26 thm_prover: ucb: whoa, this is a neat trick

3:26 how would I do this?

3:26 ucb: thm_prover: (def m-test1 (memoize test1))

3:26 thm_prover: i.e. eventualyl, I need to gc the memoizaition right?

3:27 ucb: then (m-test1) (expr1 (m-test1))

3:27 the first time m-test1 is eval'ed, it'll be expensive, the second time it won't be

3:27 thm_prover: oh boy, what if, I want these tests to be anonymous

3:27 so I don't have to do a def ... for every line of my cond

3:27 ucb: a word of caution is that testN has to be idempotent or you're going to have a bad time

3:27 thm_prover: i.e. I'd want to refer to the testN as "it"

3:28 somethign like: (testN) (exprN ... it ... ); where the "it" takes on the value evaluation of (testN)

3:28 ucb: then you're probably better of with a let or something along those line

3:28 lines*

3:29 tomoj: thm_prover: what's a testN actually look like?

3:29 thm_prover: http://hpaste.org/86801

3:29 maybe I am solving the wrong problem

3:30 tomoj: use condp

3:30 thm_prover: hmm, the :>> to a #( ... % ) ?

3:31 this looks badass

3:32 tomoj: so (condp re-find line #"^user" :>> println ...) ?

3:32 I don't think I've ever used :>>

3:33 thm_prover: this is fucking amazing

3:37 tomoj: you should write a (short < 20) page of clojure idioms. I would read it.

3:39 arrdem: tomoj: defuq is :>>?

3:39 ,(doc :>>)

3:39 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.Symbol>

3:39 tomoj: just a keyword :)

3:39 condp magic

3:39 arrdem: I noticed :p

3:39 tomoj: :/

3:40 noidi: ,(doc condp)

3:40 clojurebot: "([pred expr & clauses]); Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, i...

3:40 thm_prover: :>> looks like santa claus

3:41 arrdem: oh so :>> implicitly applies the fn..

3:41 thm_prover: someday, clojure will have more syntax than Perl.

3:41 arrdem: awesome

3:41 thm_prover: as long as we don't have sigils I'll be OK.

3:42 tomoj: thm_prover: I'm working on a theorem proved called "thm", coincidentally (-- or did I subconsciously steal the name from you?)

3:42 thm_prover: tomoj: let's talk, I want to implement a basic verifier in clojure too (rather than Coq)

3:42 tomoj: prover

3:43 thm_prover: I feel like Isabelle/Coq hides the "simple verifier core"

3:43 arrdem: ok so the question I hopped on to ask: static HTML in files, or static HTML in a database as I'm rewriting my blag?

3:43 thm_prover: and instead, like sicp has a 10 line scheme interpreter, similarly theorem proving should have a 10-20 line verifier

3:43 on which all else can be built

3:44 arrdem: thm_prover: looked at ACL2?

3:45 tomoj: so far I have core.logic relations for wffs and substitution

3:45 thm_prover: tomoj: is this on github

3:45 arrdem: does it have a short core?

3:45 tomoj: nope, just started working on it

3:46 thm_prover: is this related to Milner's LCM system?

3:46 and the type system that ended up being Ocaml's type system?

3:46 tomoj: I dunno much of anything about non-manual theorem proving so I'll probably run out of steam soon

3:47 I was planning to try the tableaux method next

3:49 arrdem: thm_prover: nope ACL2 is big as hell. I just mentioned it 'cause the author teaches here and it seems to be one of the few automated proof systems which is used at all.

3:49 ticking: if you guys want to start a clojure acl solver please do so

3:50 I needed one 2 days ago but couldn't get one

3:51 tgoossens: is it correct to say that for managing data in clojure. I should think more like in a relational database. More concrete: less refs: more id keywords on maps ?

3:51 and put everything in one big atom then or what?

3:53 arrdem: tgoossens: the "big atom" is to be avoided where possible, but yes keywords and "id" values in stead of references is a Good Idea (TM)

3:53 tomoj: I think I remember looking at ACL2 long ago now that I think about it

3:53 tgoossens: arrdem: i have a lot of difficulties "grasping" it.

3:53 I mean in java i create an object that references another object etc

3:54 in clojure if you have a ref that refers to another ref. then the concept of value makes no sense anymore

3:54 tomoj: ticking: what's a "clojure acl solver"?

3:55 arrdem: tgoossens: the important thing here is that Clojure is all about data. The paradigm is to draw a line in the sand between data (state) and the code which manipulates it.

3:56 consequently a common design pattern is the "god map", which is functionally an object representing the state of the program.

3:56 ticking: tomoj: sorry by brain mixed up alc with acl. alc is the logic behind owl.

3:56 tgoossens: And what does that give me?

3:56 what is for example I want to be notified when a certain part gets updates of the ref

3:56 (add-watch)

3:57 if i have a god map and i'm only interested in certain parts

3:57 then i have to filter everytime another part gets updated

3:58 tomoj: I have a case where (apply = (first (run 1 [x y] (fooo x y)))) but not (seq (run 1 [x y] (fooo x y) (== x y)))

3:58 gotta be a bug, right? or is there some way that makes sense..

3:58 arrdem: hum... that suggests that you want to be chaning updates to the map unless you intend to deal with user defined code

3:58 *chaining

3:59 tgoossens: hmm?

4:00 arrdem: rather than have bar which is invoked on an update and foo which produces an update, you want to use baz which composes foo and bar.

4:00 the arrow macro is a beautiful thing for this.

4:03 * arrdem realizes it's 3am and dies

4:04 tomoj: pedestal's god map has some kind of focus thingy

7:12 edoloughlin: ,

7:12 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

7:12 juxovec: hi, I created file sprint_is/modules/json.clj, inside is text (ns sprint-is.modules.json)

7:13 when I try to import it in test with (:use sprint-is.modules.json), I tells me the namespace doesn't exist

7:13 hanDerPeder: any one here using lein-junit? Trying to spit out xml format with one file per test class, but im only getting it to write all output to stdout.

7:13 juxovec: I get only: Exception in thread "main" java.lang.Exception: No namespace: sprint-is.modules.json found

7:36 now I got really confused. when I leave only (ns sprint-is.test.json) in my test, it still throws the Exception, do you have any idea why this is happening?

7:37 I run it with lein midje :autotest

8:39 Damn, I was trying to import 1 fucking ns for two hours. Unsuccessfully. Next try tomorrow.

8:44 ucb: juxovec: mind pasting the code somewhere?

8:46 juxovec: here it is https://bitbucket.org/jiriknesl/sprintis

8:53 clgv: is it possible to use definline with primitve type hints?

8:55 juxovec: there is no namespace called "sprint-is.modules.json"

8:55 juxovec: I renamed files, moved files from folder to parent folder and tried a lot of things

8:55 clgv: juxovec: maybe you meant sprint-is.json-export" ?

8:56 ucb: yeah

8:57 juxovec: And I still get http://pastebin.com/zFNMU6XB

8:57 No namespace: sprint-is.json-export found

8:57 When I remove (ns sprint-is.json-export) and let the file without any NS, midje runs but does nothing

9:04 murtaza52: how do I find the index of a given element in a seq ? (index? [:a :b :c] :b) => 1

9:10 florianover: @dakrone can you help me out again?

9:12 ucb: murtaza52: don't know if there's a core fn for that, but you could try with something like this (second (first (drop-while #(not= :b (first %)) (partition 2 (interleave your-seq (range))))))

9:13 florianover: From the documentation it looks like i have to use multipart like this:

9:14 or let's do this simpler….

9:15 curl https://bla.com -H "Authorization: Bearer myAccessToken" -F filename=@test.jpg -F parent_id=740143156

9:15 what would it look like in cli-http?

9:18 clgv: murtaza52: why would you want to do that? remember that you cannot access that element with the index efficiently for arbitrary sequences

9:18 florianover: when i try it this way: {:multipart [["title" "Foo"]

9:18 ["Content/type" "text/plain"]

9:18 ["file" (clojure.java.io/file "/tmp/missing-file")]]

9:19 gdev: [ANN] my code is bad and i feel bad

9:19 florianover: i get the error: java.lang.IllegalArgumentException: Name may not be null

9:19 murtaza52: clgv: I have a seq of 2-3 elems, and need to know the position of the elem

9:20 gdev: protip, if you're trying to prevent the database from doing all the heavy lifting, don't put your update statement in a doseq

9:21 clgv: murtaza52: what do you do with the index afterwards?

9:22 murtaza52: clgv: I process the elem differently given its index in the seq. There is a diff fn for each index.

9:23 clgv: murtaza52: ok.

9:24 gdev: here is the tkprof of my trace file, 1:1 ratio of rows and sql queries...no good http://pastebin.com/cxH3L9H7

9:25 murtaza52: ucb: thanks

9:26 ucb: murtaza52: keep in mind that that can be simplified probably

9:27 krl: anyone using the disk-storage of clucy? i'm getting errors, and it's not really covered by the tests it seems

9:29 or are there any other nice text-indexing databases around? preferably in-process

10:12 pl6306: How do I use the pr function to save an object to a text file? Do I overwrite *out* first?

10:12 I meant clojure map i.e. data structure

10:16 rbxbx`: pl6306: you can just use `spit` http://clojuredocs.org/clojure_core/clojure.core/spit

10:16 tomoj: I don't understand why pr-on is private

10:17 pl6306: Man that was simple. Thanks!

10:18 tomoj: if you use spit you'd better pr-str

10:18 pl6306: how do I read it back into a data structure?

10:19 tomoj: https://www.refheap.com/paste/92a555b5987606bc69d0819d0

10:21 to match (spit f (pr-str x)) you'd do (read-string (slurp f))

10:22 (btw, you must trust f)

10:22 pl6306: Thanks! It is all my work so it is safe

10:25 tcrayford: as in, none of that comes from user data whatsoever?

10:25 you're probably ok then ;)

10:25 just to be safe, you prolly want to (binding [*read-eval* false] (read-string (slurp f))) anyway

10:26 nDuff: Using a Clojure too old to have an EDN reader?

10:27 pl6306: How do I use EDN?

10:27 I heard about it but I thought it was just built into the clojure reader

10:28 tcrayford: if you're on clojure 1.5, clojure.edn/read

10:28 pl6306: Thanks

10:28 tcrayford: (that was from google, no idea if/how well it'll work)

10:33 pl6306: Any libraries in clojure that can let me work with zip files?

10:34 nDuff: pl6306: What's your actual use case? (The answer is "yes", but details matter re: deciding which is appropriate)

10:34 pl6306: I just want to compress and decompress text files

10:34 Nothing fancy

10:35 nDuff: pl6306: One to an archive? Multiple?

10:35 pl6306: Is this for consumption by 3rd-party tools?

10:35 pl6306: one to one

10:35 nDuff: If it's one-to-one, zip is actually a pretty bad format choice

10:36 GZip would be better if you care about portability / library availability, and an LZMA-based algorithm otherwise.

10:36 pl6306: yeah but I want to be able to unzip it using some other tools

10:36 nDuff: pl6306: Right -- that's why I suggested gzip.

10:37 pl6306: I will try that is there a clojure lib or should I just the java one

10:37 nDuff: pl6306: zip is an archival format which happens to have compression tacked on, not a compressor; among other things, that means there's more code involved in working with it (you have to figure out what file(s) you want within the archive, what you want to name things going in, how to handle corner cases when there are more files than you expect or directory structure, etc).

10:38 pl6306: yup, just the java.util.zip.GZIP{Input,Output}Stream utilities

10:38 tomoj: my example with gzip https://www.refheap.com/paste/ad21887e84351ca13e73936c7

10:38 pl6306: I will try that one first thanks

10:45 ppppaul: why aren't numbers and strings functions in clojure?

10:45 danlarkin: because java

10:46 ambrosebs: ,(let [do 1] do)

10:46 clojurebot: nil

10:47 danlarkin: ppppaul: numbers and strings in clojure are java.lang.String/Double/etc and those don't implement IFn

10:47 so that's why

10:49 tcrayford: also, what sensible IFn instance have you got for numbers?

10:50 I guess they could index like nth

10:50 (sorta like keywords do with maps)

10:50 but that seems weird as heck to me

10:51 danlarkin: tcrayford: I'd imagine they could behave like keywords. That is, look themselves up in a map

10:51 but it's a moot point because they can't be IFn :)

10:52 tcrayford: yeah, I guess. It still seems weird, there are so many more things that you use numbers for other than accessing collections (wheras keywords are really only used for map keys (or maybe hierarchical tags occasionally))

10:52 I guess strings could behave exactly like vectors (call them with an i

10:52 ... an number, they index themselves at that point)

10:55 ppppaul: i don't know what i was thinking

10:55 forgive me

10:55 tcrayford: no offence, was just curious, I've thought about it before ;)

11:30 gfredericks: does reply let me embed a repl in my uberjar, with readline-y features? i.e., why would I use it instead of running clojure.main?

11:30 trptcolin: https://github.com/trptcolin/reply/wiki/Embedding-REPLy

11:30 :)

11:31 gfredericks: (inc trptcolin)

11:31 lazybot: ⇒ 2

11:32 gfredericks: twoptcolin

11:32 rbxbx``: trptcolin: neat, I didn't realize you rewrote lein's repl

11:36 trptcolin: i actually just wrote that wiki last week - thanks to kim kinnear for some good questions & pointing out some bugfixes

11:38 hoping to get 0.2.0 out very soon. just an nrepl release away, i think.

11:39 gfredericks: which is the standard unit of time in clojureland

11:46 ticking: I wonder why clojure.zip/root never became clojure.zip/unzip, with root returning the root loc

11:46 seems like the better api

12:08 dnolen: anybody ever tried to AOT the CLJS compiler and looked into the issues?

12:09 silasdavis: rails

12:09 ppppaul: rails?

12:11 silasdavis: missing a /join #

12:11 technomancy: ~praetorian guards

12:11 clojurebot: forget chouser: it's tougher with guards (arbitrary tests), where grouping is less clear. I need to work that out still.

12:11 technomancy: argm

12:11 argh

12:12 jaley: is there something I should use as content-type for edn?

12:12 llasram: argc, argv, argm, argh

12:13 ambrosebs: dnolen: does it work?

12:13 dnolen: ambrosebs: I haven't tried myself but I've heard in the past that there are issues

12:14 ambrosebs: if CLJS was AOTable I think it would cut down times for one time compiles and the first compile.

12:14 when auto building.

12:15 wkelly: jaley: application/edn seems to be in the proper rfc1341 spirit

12:15 ambrosebs: dnolen: yes. Hard to predict AOT problems, so hopefully someone's tried it.

12:16 jaley: wkelly: cool, thanks!

12:26 gfredericks: maybe clojurebot should forget everything it knows that starts with "forget"

12:36 jjttjj: I'm trying to build an executable jar from a clojure program. I have a -main fn that set up and is working correctly when i do lein run, and I have a (:gen-class :main true) line in the ns declaration of that file, but i'm getting an error in ubuntu saying it's not marked as executable when i try to run it. Anything i might be missing?

12:37 rlb: jjttjj: how are you trying to run it?

12:38 jjttjj: right click jar, open with OpenJDK Java6 runtime

12:38 nDuff: jjttjj: Does it have the executable (+x) file permission?

12:38 rlb: nDuff: hmm, does it need them if it's being run via java?

12:39 jjttjj: what happens if you just do "java -jar foo.jar" from the command line?

12:39 nDuff: rlb: Depends on how Ubuntu implements its GUI.

12:39 rlb: (assuming it's a jar)

12:39 nDuff: rlb: ...but "not marked as executable" is how I'd read that error as a user.

12:39 rlb: (assuming it's a jar you can execute via -jar)

12:40 * nDuff nods; the answer to rlb's question is relevant/useful.

12:40 rlb: nDuff: I'm just not sure why the jar being executable would matter since it has to be run via java? (unless they're trying to run it via kernel exec signatures...)

12:40 nDuff: rlb: ...some Linux distros use binfmt_misc to execute jars that are +x, but if it isn't set up for java -jar, that won't work even with the executable permission set.

12:41 rlb: nDuff: ahh, exactly...

12:41 ok.

12:41 jjttjj: anyway, I'd try making sure you can run it from the command line first.

12:42 jjttjj: rlb: chmoding +x causing it to fail silently, running from command line causing a NoClassDefFoundError: my/mainns exception

12:43 dnolen_: hmm

12:43 rlb: jjttjj: well, if you haven't created an uberjar, then you'll need to handle classpath issues.

12:43 i.e. "lein uberjar"

12:44 gdev: I got the same issue as jjttjj when I did an uberjar of my project

12:44 rlb: but, the uberjar may be bigger than you want (if you want to rely on any shared /usr/share/java jars...

12:44 jjttjj: rlb: yeah I've made an uberjar

12:45 gdev: calling lein run gives the same error, exception in thread main, java.lang.classnotfoundexception in myproject.core

12:46 rlb: well, if lein run doesn't work, the uberjar's not likely to either

12:46 afaik

12:47 gdev: rlb:) yea, doing java -jar <mysatandalone.jar> gives an error: could not find or load main class

12:47 also, it changed the dash in my namespace to an underscore, is that normal?

12:47 jjttjj: gdev: yes that's normal

12:48 gdev: the filenames should have undescores instead of dashes (the namespaces should have dashes instead)

12:49 gdev: jjttjj:) thanks, it was just weird because that's what my namespace was at first until i caught it and changed it; so seeing that again freaked me out

12:52 arcatan: i don't know if scope if the right word for this.. but what's the scope of protocol extensions?

12:52 if i extend a protocol for some type in namespace a, when can namespace b see it?

12:54 gfredericks: after the code runs

12:54 it's a side-effecty thing

12:54 so once namespace a is loaded you should be good

12:54 arcatan: okay, thanks

12:54 gfredericks: or if you're talking about scope rather than time, then the answer is "globally"

12:55 arcatan: yeah

12:55 gfredericks: I'm starting to feel like protocols and multimethods are insufficient for library customization purposes :/

12:56 I keep wanting to use binding to temporarily extend something

12:57 arcatan: if two namespaces extend the same protocol for the same type, i guess the namespace that is loaded last wins?

12:57 gfredericks: yep

12:57 dnolen_: stuartsierra: hmm, does data.json AOT?

13:01 jjttjj: do all my namespaces need to be AOT compiled to use as an executable?

13:01 technomancy: jjttjj: you don't have to do any AOT compilation if you can use clojure.main's -m option

13:02 stuartsierra: dnolen_: you mean, is it possible to AOT it?

13:02 dnolen_: stuartsierra: yes

13:02 stuartsierra: I don't see why not.

13:02 dnolen_: stuartsierra: when I try to (compile 'clojure.data.json) I get a ClassNotFoundException JSONWriter

13:03 stuartsierra: dnolen_: Do you have a clean 'classes' dir?

13:03 gfredericks: technomancy: thanks for that reminder. No more AOT for me.

13:04 well. a tiny bit of acceptable AOT for me, rather.

13:04 technomancy: there is also lein-otf if you don't have control over your CLI args which might be the case in GUI situations

13:04 dnolen_: stuartsierra: yes I do, I'm looking into AOTing the CLJS compiler

13:05 stuartsierra: it would be nice to ship CLJS AOTed to avoid these startup time issues

13:05 gfredericks: technomancy: is there any reason to keep a :main around?

13:05 stuartsierra: dnolen_: Make a ticket and I'll look into it.

13:05 technomancy: gfredericks: elaborate plz?

13:05 dnolen_: stuartsierra: thx

13:07 gfredericks: technomancy: :main implies AOT, which I think I can disconfigure. I assume it also enables `lein run`. But the uberjar-main thing won't work w/o AOT; which is fine cause I don't need it, but was wondering if there's any reason really not to remove the :main option altogether

13:07 technomancy: gfredericks: remove it from your own project.clj file or from Leiningen?

13:08 gfredericks: my own, sorry

13:08 those are definitely different questions :)

13:08 technomancy: yeah, the ":main implies AOT" thing is a bug. I tried to remove it from 2.0 but someone added it back without my noticing.

13:09 dnolen_: stuartsierra: is it difficult to setup build to produce a AOTed jar if these kinds of issues get ironed out?

13:09 gfredericks: that's how you know you've made it

13:09 technomancy: if you're not using it then you should remove it I guess? =)

13:09 stuartsierra: dnolen_: You mean, you want a release JAR in the Maven repository that has been AOT-compiled?

13:09 gfredericks: technomancy: I can't argue with that

13:11 haha hooray for aliases

13:11 dnolen_: stuartsierra: yes

13:12 stuartsierra: dnolen_: Easy enough to do. Not sure it's going to make that much of a difference in start-up time.

13:13 dnolen_: stuartsierra: it takes 3 seconds to compile CLJS

13:13 on my MacBook Air 11

13:13 stuartsierra: dnolen_: Rich is also interested in speeding up the Clojure compiler.

13:15 dnolen_: stuartsierra: I think by caching a precompiled CLJS core lib + AOTing, I think we can dramatically decrease CLJS compile times.

13:16 stuartsierra: I won't argue with that.

13:18 dnolen_: The Maven builds for contrib libraries do AOT-compilation as a sanity check, so in theory there's no reason why it wouldn't work.

13:18 dnolen_: and above I really meant that (require '[cljs.closure :as cc]) takes 3 seconds, so that's a bit of a hit.

13:18 stuartsierra: OK cool

13:19 krl: in general when a lib pulled from lein complains about missing ava

13:19 *Java classes

13:19 gfredericks: technomancy: was there a ^:skip-aot option for :main?

13:19 krl: what could be wrong?

13:20 lein deps finishes without problems

13:20 technomancy: gfredericks: yes, I removed it when I removed :main-implies-aot, but I think I added it back in 2.1

13:20 krl: usually a bug in the library

13:21 krl: it depends against clojure 1.3, so it could be breaking changes in the Java interaction stuff?

13:22 arohner: when using clojure-test mode, I'm getting "namespace not found", when trying to run a single test

13:22 but run all tests (C-c ,) works just fine

13:22 stuartsierra: dnolen_: In a fresh REPL with bare Clojure 1.5.1, (compile 'clojure.data.json) works for me.

13:23 dnolen_: stuartsierra: hmm, I'm also trying this with Clojure 1.5.1

13:24 stuartsierra: dnolen_: Perhaps you have some other issue with stale .class files or the classpath.

13:24 dnolen_: stuartsierra: basically I bootstrap CLJS, creates the classes directly, script/repl, (compile 'clojure.data.json)

13:24 stuartsierra: no .class files that I'm aware of.

13:26 noncom: i now, i've been asking a similar question before, but... how do I just all jars from " jME3_2013-04-29.zip 29-Apr-2013 00:07 96M " at http://jmonkeyengine.com/nightly/ into my leiningen project without wasting a lot of time on pshing every single file to repository or stuff.. or how do I push them to my repo in 1 click/command?

13:27 i just want to use the java game engine in my project..

13:27 stuartsierra: dnolen_: Is the `classes` directory on the classpath?

13:27 ClojureScript's script/repl doesn't set that.

13:27 noncom: without much irrelevant workings

13:28 please help.. :)

13:28 dnolen_: stuartsierra: oh right, checking that

13:29 stuartsierra: works! I'll close that ticket

13:29 stuartsierra: :)

13:30 dnolen_: stuartsierra: thx

13:30 stuartsierra: np

13:30 dnolen_: sweet, CLJS appears to AOT just fine

13:36 Glenjamin: can anyone tell me what Reflection warning in `lein check` means?

13:36 gfredericks: Glenjamin: that the compiler can't tell what jvm types its dealing with and has to emit (slow) reflection code

13:36 presumably you would consider adding type hints to fix the issue

13:37 Glenjamin: makes sense, cheers

13:37 what happens if i end up passing a different type than the hint?

13:38 gfredericks: a jvm cast error I believe

13:38 I think the only reason you'd be in that situation is if you're intentionally doing some kind of weird jvm duck-typing

13:40 dnolen_: stuartsierra: so if I want to AOT CLJS + add cached CLJS core lib to the jar, do I need to provide an Ant build.xml to do this?

13:41 stuartsierra: dnolen_: No.

13:41 dnolen_: stuartsierra: so how should those steps be done?

13:42 stuartsierra: dnolen_: The release build in hudson just runs script/build in the repo. You can do whatever you want there.

13:42 dnolen_: stuartsierra: oh, sweet

13:43 stuartsierra: However, I would recommend against releasing AOT-compiled code, at least for now, without some special signifier in the version string.

13:43 Clojure 1.4-1.5 is the first version change with documented binary compatibility.

13:43 technomancy: stuartsierra: why not use a classifier?

13:43 Glenjamin: hrm, can't seem to get rid of the reflection warning for this: (.println ^Writer *err* ^String msg)

13:43 stuartsierra: technomancy: A classifier is what I meant.

13:43 technomancy: gotcha

13:43 Glenjamin: oh, nevermind - i see why

13:44 stuartsierra: Couldn't remember the term.

13:44 technomancy: I haven't done that myself but it seems like a good fit.

13:45 stuartsierra: But I'm not sure there's much value in releasing a library JAR that is AOT-compiled. If you're invoking CLJS from within your app then you've already paid the start-up cost.

13:46 If you're invoking CLJS from the command-line, then you can build a local binary with AOT-compilation.

13:48 dnolen_: stuartsierra: I think a number of people don't invoke CLJS from their app

13:49 stuartsierra: dnolen_: Then they're building CLJS locally, I assume?

13:49 dnolen_: stuartsierra: and it's not clear to me that a lot of people understand that you can build your AOTed CLJS. most people use lein cljsbuild - and startup time there is quite bad.

13:49 stuartsierra: dnolen_: That seems like a problem for lein-cljsbuild to solve, then.

13:51 dnolen_: stuartsierra: hmm, true - like it could pull it's own AOTed jar?

13:51 stuartsierra: dnolen_: Yes, or build it once and cache it locally.

13:52 Jambato: https://www.refheap.com/paste/14046 > does somebody know why the repl loops when next-player is called?

13:53 amalloy: Jambato: nobody is going to read 118 lines of code to tell you why your program doesn't work

13:53 Jambato: for example with (next-player [1 2 3 4]) the function should not enter the loop

13:54 amalloy: try finding a more minimal reproduction case

13:54 Jambato: amalloy: I'm not expecting to do so

13:54 dnolen_: stuartsierra: hmm I suppose lein-cljsbuild could cache the precompiled core lib this way as well ...

13:54 Jambato: *expecting you

13:55 at worst just read the next-player function at the end of the file and call the function

13:55 if it bothers you that much

13:55 it is just that the last function I wrote doesn't behave the way I expected

13:56 tcrayford: does clojure GC strings?

13:56 uh

13:56 strings

13:56 keywords

13:56 does clojure GC keywords?

13:57 llasram: Yes

13:57 tcrayford: I ran this a bunch at a repl and it died eventually:

13:57 (doall (map (fn [_] (keyword (str (rand)))) (range 100000)))

13:57 Like so

13:57 stuartsierra: Clojure doesn't GC anything.

13:57 tcrayford: Exception in thread "nREPL-worker-2" java.lang.OutOfMemoryError: PermGen space

13:57 Ember-: doall keeps the head

13:58 try with (doseq [_ (map (fn [_] ....

13:58 dnolen_: tcrayford: keywords are interned into a WeakMap far as I know

13:58 gfredericks: tcrayford: permgen is for classes, no? keywords are all instances of one class

13:59 stuartsierra: Clojure does interns the string names of keywords, which means they may get stored in the JVM's "Permanent Generation" heap, which gets garbage-collected far less often.

13:59 * gfredericks might not know anything about the jvm

13:59 Ember-: GC can't collect anything which is held by reference and with doall you're keeping reference to the whole collection you're iterating through, no matter it's lazy originally

13:59 stuartsierra: ,(identical? (name (keyword "foo")) (name (keyword "foo")))

13:59 clojurebot: true

13:59 tcrayford: stuartsierra: so the usual advice from other languages about not keywordizing arbitrary user data probably still holds, right?

13:59 stuartsierra: tcrayford: correct

14:00 justin_smith: Jambato: not the bug you mention, but fyi here is a simpler redef for player-represented: (fn [n s] (#{n} s))

14:00 that will break if you decide a player should be represented by nil or false

14:00 but otherwise is good

14:00 tcrayford: stuartsierra: it's kinda wonderful that there is ring middleware that does this for compojure, along with a bunch of json parsers that do this by default (amongst other libs, those are just what I'm aware of)

14:01 justin_smith: Jambato: n/m, I misread the code

14:01 stuartsierra: I've argued in the past that keywordization should not be a default.

14:01 Jambato: justin_smith: I do not plan to implement a player as nil but thanks anyways

14:02 justin_smith: so I misread: (fn [n s] (#{s} n)) will do what player-represented? does in your code

14:02 Jambato: the bug comes from the next-player funtion

14:02 justin_smith: yes, I know

14:02 Jambato: even when (all-players-represented?) evals to true, the reml hangs

14:02 *repl

14:03 gfredericks: tcrayford: I use cheshire and a json middleware, neither of which do that by default

14:03 technomancy: I guess keywordization of params could open you up to a DOS slightly more easily, but it seems like a pretty low risk

14:04 tcrayford: gfredricks: cheshire does if you pass "true" into the params :/

14:04 wink: anyone got a clue regarding mysql character sets and clojure.java.jdbc?

14:04 gfredericks: tcrayford: yes, that's about the opposite of "by default", no?

14:04 technomancy: heh

14:05 tcrayford: gfredericks: except for libs that call cheshire with that without asking you ;)

14:05 gfredericks: damn those libs

14:06 let's switch the keyword impl to use ReallyWeakReferences

14:06 tcrayford: (I patched welle, which used to have this, but it still does pass true by default unless you override it)

14:06 stuartsierra: tcrayford: data.json in the 0.2.x line does not create keywords by default.

14:06 technomancy: keywords as keys sounds like the right thing for a riak lib?

14:07 Jambato: justin_smith: (fn [n s] (not (#{s} n))) rather

14:07 tcrayford: technomancy: when you're deserializing json from values? It really depends what you're planning on storing (in my case some keys in json maps I store are user generated)

14:07 Jambato: got to stop writing if true then true else false

14:07 --'

14:08 technomancy: tcrayford: oh yeah; I'm just thinking of top-level keys

14:09 justin_smith: Jambato: with this def (defn player-represented? [n s] ((into #{} s) n)) I can make the true case come

14:09 * make that "I can trigger the true case" (I am englishing bad today)

14:13 Jambato: also, it would have been helpful if you pasted only the code for next-player, all-players-represented, and player-represented? - the rest of the file is just noise as far as this problem is concerned

14:14 tieTYT2: man, clojure.typed seems more complex than the java type system to me

14:14 gfredericks: it probably is

14:14 tieTYT2: I wish it could work like haskell

14:15 antares_: tcrawley: next Welle version will be 2.0 so we may use the opportunity and change it

14:15 justin_smith: tieTYT: you mean Hindley-Milner?

14:15 antares_: oops

14:15 tieTYT2: justin_smith: I probably do, I'm not sure though

14:15 technomancy: justin_smith: if only =(

14:15 antares_: tcrayford: ^^^

14:15 tcrawley: antares_: glad to hear it :)

14:15 tieTYT2: I mean type inference where I define the type separate from the impl

14:15 justin_smith: yeah, Hindley-Milner is how Haskell does that

14:16 antares_: tcrayford: I just need to write a blog post to see how many people freak out by other breaking changes it will have :)

14:17 Jambato: justin_smith: found it : ((comp not nil?) ((into #{} s) n))

14:17 justin_smith: why comp not nil? nil is already false

14:18 and everything else is already true

14:18 metellus: (except false0

14:18 )

14:18 justin_smith: yes :)

14:18 that is why I asked him above if any player would ever be represented by false or nil

14:19 Jambato: justin_smith: nil? evals to false when a player isn't represented in a pile

14:19 err wait a sec

14:22 ah yes there it is

14:22 justin_smith: (into #{} s) acts as a function returning nil if none of its members are in the argument

14:22 nil acts as false

14:23 Jambato: justin_smith: without the not the function evals to false if a player is represented in a pile

14:23 and true if he isn't

14:23 it's reversed

14:23 justin_smith: I mean why test for nil

14:23 nil is already false

14:23 so drop the not and the nil? and you get the same logic

14:24 the reason I argue for that is because the less your code does, the fewer places bugs can hide

14:24 so if you can remove two function calls and get the same result...

14:25 Jambato: what's the point of testing nil if it's false then?

14:25 why does nil? exist then?

14:26 justin_smith: because sometimes you specifically want to test for nil, separate from false

14:26 antares_: Jambato: what if you need to tell between nil and false?

14:26 Jambato: hm ok

14:27 justin_smith: (:apple {:apple false :orange true})

14:27 in this case, :apple not being in the map may be different from apple being in that map and false, two different actions called for

14:28 which is why I asked if false would ever be a valid player

14:28 nil? makes sense there if a player may be false, otherwise it is just needless complication

14:28 Jambato: no nil or any bool won't be a player

14:29 *no,

14:31 so I don't need nil?

14:31 I got it

14:31 thanks justin_smith

14:31 justin_smith: np, sorry to be such a pedant about it

14:36 Jambato: another way to do all-players-represented: (defn all-players-represented? [s] (let [s-set (into #{} s)] (-> #{1 2 3 4} (set/difference s-set) empty?)))

14:37 Jambato: justin_smith: that's fine really

14:37 justin_smith: the advantage: instead of having to add a clause to and if you have more players, you can just add to the set

14:37 or make the set another arg if the player list were dynamic

14:38 noidi: you can do (set s) instead of (into #{} s)

14:38 justin_smith: true, that would probably be better

14:38 in that case

14:38 noidi: so you can get rid fo the let and use (set s) instead of s-set

14:38 *of

14:38 justin_smith: good point!

14:40 Jambato: ok all done

14:40 thanks for the help but I got to go, I'll be back later

15:23 gfredericks: I'm pretty habitually putting a docstring in my deftest, which is presumably ignored

15:25 Glenjamin: gfredericks: http://richhickey.github.io/clojure/clojure.test-api.html mentions a (testing) form, which might be relevant

15:25 amalloy: gfredericks: i don't think it's a docstring, so much as a string evaluated for side effects while testing

15:31 antares_: Elastisch 1.1.0-rc1 is out: http://blog.clojurewerkz.org/blog/2013/04/29/elastisch-1-dot-1-0-rc1-is-released/

15:32 gfredericks: amalloy: it's a docstring to _me_

15:32 Glenjamin: yeah, I avoid that due to the extra nesting

15:33 Glenjamin: you could do (defmacro defdoctest [desc & body] `(deftest (testing desc ~@body)))

15:41 rlb: what's the relationship if any between clojure.data.zip and clojure.zip?

15:45 Glenjamin: data.zip provides more functions for zipping around structures produced by zip

15:45 i think

15:50 rlb: Glenjamin: ok, right, thanks

15:58 weavejester: Oh wow, some of the clojure.core.cache functions are really, really slow

15:59 amalloy: weavejester: they do reflection

16:00 a great property for performance-improving code

16:00 weavejester: A basic fifo cache is 100xto 150x slower than clojure.core/memoize

16:00 No wait, I'm reading that wrong.

16:01 1000x

16:01 gfredericks: phew

16:01 that 5 went down to a 0

16:03 pl6306: How do I get this to return Integers instead of long (iterate inc 0)?

16:03 Glenjamin: oh wow, that sounds slow :o

16:03 weavejester: Oh, that's odd… the performance has changed again. Maybe there's something in the cache that causes it to get slower over time. I reset back to memo-fifo and it seems to be reasonable performance again.

16:03 I have had this REPL open a while.

16:04 gfredericks: ,(->> 0 (iterate inc) (map int) (map type) (take 5))

16:04 clojurebot: (java.lang.Integer java.lang.Integer java.lang.Integer java.lang.Integer java.lang.Integer)

16:05 weavejester: Huh, yeah, somehow the performance problems cleared themselves when I changed memoize caches and re-evaluated.

16:05 Something must have been getting slower over time. I'll need to keep an eye on that and see if it happens again.

16:17 * gfredericks runs kibit for the first time

16:22 justin_smith: weavejester: hash collisions in a map?

16:22 just a theory

16:25 weavejester: justin_smith: Well, it's a fifo queue of length 1, so in theory the map just contains one item.

16:25 justin_smith: oh, that probably rules that out then

16:25 weavejester: Yep :)

16:26 justin_smith: maybe there is a function that could theoretically still access old fifo elements, preventing proper gc?

16:26 weavejester: Maaaybe? I think I'll need to see if it happens again, and then run a few tests.

16:27 justin_smith: yeah, having the jvm trace memory allocation / gc will likely be informative, that is the most likely slowdown in a fixed length fifo

16:29 weavejester: There seem to be a few issues with the memoize library when used aggressively. memo-ttl has a race condition that causes a NPE under rare circumstances, for instance.

16:30 Overall it's pretty good though

16:39 mthvedt: i'm profiling code, and there's a class in my stack traces that i don't know where it came from.

16:39 only thing i can think of is if loop/recur created anonymous fns… does it?

16:40 hiredman: if you nest a loop/recur in a loop/recur it (sometimes?) hoists the inner loop/recur in to a fn

16:40 shriphani: clojure users. what is the best way to do string interpolation? Is that the wrong way of doing things ?

16:41 mthvedt: hiredman: thanks, that's probably what is happening

16:41 nDuff: shriphani: http://clojuredocs.org/clojure_core/clojure.core/format

16:41 shriphani: If you want a judgment about "right way" / "wrong way", though, you'll need to describe your use case.

16:43 shriphani: nDuff, I have a url where I need to keep updating exactly 1 parameter.

16:43 justin_smith: depending on what you are doing, there are also things like moustache

16:43 SegFaultAX: shriphani: There is also the simple version of ##(let [a "foo" b "bar"] (str "Hello " a ", how are you? -" b))

16:43 lazybot: ⇒ "Hello foo, how are you? -bar"

16:43 justin_smith: ok, yeah, you don't need a templating utility like moustache for creating a URL

16:44 SegFaultAX: shriphani: There are libraries specifically suited to working with URIs.

16:45 shriphani: For example, https://github.com/cemerick/url

16:45 shriphani: SegFaultAX, it is just 1 parameter so I didn't bother.

16:46 SegFaultAX: shriphani: Depending on the complexity of the URL, it might just be worth it.

16:48 pl6306: How would I get map to return  ((1 a 4) (2 b 5) (3 c nil) for (map list  [1 2 3] '(a b c) '(4 5))?

16:49 gdev: I have a lazy seq of persistentArrayMaps. I need to modify values in those maps. I'm just defining a new vairiable and storing the output of a doseq in it but I'm not exactly sure how to do it

16:51 ugh, nevermind, I'll pastebin it in a second; keep forgetting that's easier than trying to write out explanations

16:53 SegFaultAX: ,(list* (map vector [1 2 3] '(a b c) '(45)))

16:53 clojurebot: ([1 a 45])

16:54 SegFaultAX: ,(list* (map vector [1 2 3] '(a b c) '(4 5)))

16:54 clojurebot: ([1 a 4] [2 b 5])

16:54 SegFaultAX: Oh a lists of lists

16:54 Duh

16:55 ,(map #(list* % ()) [1 2 3] '(a b c) '(4 5))

16:55 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: sandbox$eval104$fn>

16:59 gdev: http://pastebin.com/GhAWZ4K9

17:00 arrdem: ~pastebin

17:00 clojurebot: No entiendo

17:00 arrdem: gdev: clojurebot's failure asside, please use refheap over pastebin.

17:01 SegFaultAX: I'm drawing a blank, does something like (fn [& more] more) already exist?

17:01 S11001001: gdev: doseq doesn't have any results

17:02 technomancy: SegFaultAX: clojure.core/list maybe?

17:02 S11001001: gdev: so mutated-sample will always be nil

17:02 gdev: use map instead

17:04 gdev: S11001001:) thanks, yeah, the doseq is incomplete, I'm thinking that the same way that the database call was creating an sql string, it could just create the updated map

17:04 arrdem:) is there a reason for the preference?

17:05 S11001001: gdev: Billions of ads/dogfooding. And not everyone does/can run adblock.

17:05 amalloy: ~nduff

17:05 clojurebot: Please don't use pastebin.com: there are lots of annoying animated ads. Instead, try http://refheap.com, an ad-free pastebin written in Clojure.

17:05 S11001001: amalloy: nice

17:05 SegFaultAX: technomancy: Huh, that's what I thought too. But when I ran pl6306's code above it failed.

17:05 amalloy: i hope he doesn't mind that i used his nickname for that

17:05 SegFaultAX: I think it's actually because he has some weird hidden characters in there.

17:05 gdev: gotchat, yeah I forget how many annoyances adblock shields me from

17:06 nDuff: That's another issue with pastebin.com -- it does character set conversion, even in the "raw" view, so if you've got bugs on the remote end caused by odd characters, there's often no way of knowing it.

17:07 * arrdem will remember ~nduff in future

17:07 gdev: vows to never use pastebin again

17:07 * nDuff doesn't know that refheap is safe from that either, though, and usually uses sprunge.us when wary of charset issues.

17:07 * SegFaultAX prefers gist for its edit history and the fact that the paste can be cloned.

17:07 arrdem: ~refheap

17:07 clojurebot: refheap is gist.github.com

17:08 rasmusto: I'm trying to deleting files with (doall (map #(delete-file % true) list-of-filename-strings)), any potential problems with that?

17:08 gdev: for some reason gist was not working for me at all the other day

17:08 arrdem: rasmusto: just doseq over the file list

17:08 rasmusto: no reason to use a lazy seq and force it to evaluate

17:08 SegFaultAX: Why is ~refheap linked to gist? :)

17:08 justin_smith: rasmusto: if you don't deref the results of the map, the deletes may not happen

17:09 arrdem: SegFaultAX: THIS IS YOUR DOING

17:09 justin_smith: n/m

17:09 arrdem: justin_smith: no the doall should force it to evaluate...

17:09 rasmusto: arrdem: ok, justin_smith: that's what the doall does, right?

17:09 nDuff: justin_smith: Eh? I'd expect the doall to do that, thus the need for doseq to be principally a readability thing.

17:09 justin_smith: sorry, let me say again, n/m

17:09 I missed the doall, my bad

17:09 nDuff: ...but for readability reasons, I'd strongly prefer (doseq [filename list-of-filename-strings] (delete-file filename true))

17:09 arrdem: ^ that

17:10 amalloy: SegFaultAX: refheap is paste, paste is gist.github.com

17:10 * SegFaultAX thinks Clojure needs at least a dozen more do* forms in clojure.core

17:10 arrdem: ,(doc do*)

17:10 clojurebot: Cool story bro.

17:10 rasmusto: *maybedo*

17:10 arrdem: ... okay someone enlighten me

17:11 justin_smith: I think do* is meant to be a placeholder for doseq, doall, dosync, and then a bunch of not yet existing strict functions that start with do

17:12 rlb: is there anything idomatic like (remove #{"x" "y" "z} strs), but for regular expressions as the predicate set?

17:12 (via re-find)

17:13 technomancy: rlb: no, but not for good reasons

17:13 this is a common rant topic for me; watch out

17:13 rlb: technomancy: ok

17:13 gdev: here is the ref-heap https://www.refheap.com/paste/14052 which has the database version, the datastructure and what I'm trying to do

17:13 rlb: I'll bite...why am I bad? ;>

17:14 technomancy: rlb: no, I mean what you want is completely reasonable, and the reasons Clojure doesn't support it are silly

17:14 arrdem: rlb: it isn't you, I think technomancy is saying that core is being retarded

17:14 rlb: oh, ok.

17:14 technomancy: (remove #"hello" list-of-strings) should work, but it doesn't, because of reasons

17:14 but in this case you can just do (partial #"hello")

17:14 sorry

17:15 (partial re-find #"hello")

17:15 weavejester: Isn't the official reason because Patterns are final?

17:15 arrdem: ,(fn? #"\w+")

17:15 clojurebot: false

17:15 rlb: technomancy: ahh, right I had just tried that here, i.e. (#"a" "a").

17:15 arrdem: okay that's idiotic.

17:15 amalloy: technomancy: he's actually asking for (remove (in-regex-list #"hello" #"goodbye") list-of-strings), which wouldn't come automatically from making regexes functions

17:15 technomancy: weavejester: the official reason is because Rich doesn't want to create a new regex class for "interoperability reasons"

17:15 which no one has ever wanted

17:16 weavejester: Hum...

17:16 rlb: ok, thanks -- I suppose it's not that hard to handle -- just wanted to make sure I wasn't missing something obvious.

17:16 weavejester: Admittedly I haven't see many Java methods in third-party libs that take a Pattern as an argument

17:17 technomancy: I guess you could do it in userspace these days with reader literals

17:17 #reg.ex"hello" or something

17:17 =\

17:17 justin_smith: reader macros seem underexploited in general

17:18 SegFaultAX: But it does make regex feel second class in this case. They don't have quite the same flexibility as most of the other built in data structures.

17:18 technomancy: meh

17:18 SegFaultAX: rich says he doesn't use them, which could explain that =)

17:18 gfredericks: I want a spec for a pure edn-manipulation subset of clojure to be used as an embedded language

17:18 weavejester: Regexs are second class, in the sense that they're Java classes rather than Clojure ones.

17:18 gfredericks: first application, a quasi-port of jq to edn

17:18 SegFaultAX: technomancy: Does he have to be a direct user of every feature for it to get into core?

17:19 weavejester: I think that's precisely technomancy's gripe, though.

17:19 technomancy: SegFaultAX: not going to go there, sorry =)

17:19 arrdem: lol

17:19 SegFaultAX: technomancy: Haha.

17:19 * technomancy gestures vaguely to UUID reader literals and datomic

17:20 weavejester: SegFaultAX: Right. I'm just saying that it's not just that regexs *feel* like 2nd class, they *are* second class :)

17:20 * gfredericks uses that uuid reader literals all the time

17:20 SegFaultAX: weavejester: Oh, sure. Definitely.

17:20 technomancy: gfredericks: in your stand-up comic routines?

17:20 gfredericks: technomancy: totes

17:20 weavejester: #uuid and #inst are good additions, but #url or #uri would be pretty useful as well.

17:20 technomancy: #uuid is boggling

17:21 gfredericks: boggling?

17:21 SegFaultAX: But that's weird, considering we have special syntax to instantiate regexes, you'd think they could be better supported by the language.

17:21 technomancy: I just cannot understand it outside the context of "so you're wondering what kind of things you can use reader literals for? let me show you..."

17:21 gfredericks: technomancy: are you not a fan of reader literals in general?

17:22 technomancy: gfredericks: I'm -0 on them

17:22 SegFaultAX: technomancy: At least we have a canonical example for when we're trying to describe the utility of reader tags.

17:22 technomancy: gfredericks: having #inst return java.util.Date has prejudiced me against them. apart from returning mutable objects I don't have any concrete objections against them, but neither do I have any actual use for them.

17:23 weavejester: I guess Rich prefers UUIDs over URLs in general, at least last time we sopoke he did.

17:23 arrdem: weavejester: shame that the entire internet is built on URLs then

17:23 technomancy: weavejester: the advantage of UUIDs is that they have an immutable implementation out of the box on the JDK

17:23 weavejester: technomancy: You can override that behaviour, but it's more difficult than it should be.

17:23 technomancy: URIs don't, but neither do Dates arguhoaeusrcg,ap

17:23 * technomancy wanders off to find something more productive to do

17:24 gfredericks: (def when-technomancy-wandered-off (Date.))

17:24 arrdem: gfredericks: that's just mean

17:24 * pjstadig administers anti-date meds to technomancy

17:24 technomancy: (doto *1 (.setMonth 10))

17:24 sorry; @*1

17:24 weavejester: arrdem: Yes, although URLs are also mutable, or at least their data is :)

17:24 technomancy: and I meant 12

17:24 SegFaultAX: Haha

17:24 technomancy: because that makes Dates asplode in hilarious ways

17:24 gfredericks: technomancy: ew, look what you've done to my object

17:24 technomancy: gfredericks: serves you right

17:25 SegFaultAX: Are mutable dates fixed in Java 8? I seem to recall hearing that they're fixing date, but is that one of the changes?

17:25 technomancy: SegFaultAX: they're introducing a new class that would re-obsolete Date

17:25 fixing Date is off the table

17:25 SegFaultAX: Are they officially deprecating date?

17:26 gfredericks: has it not been?

17:26 arkx: Heh, what would that deprecation mean?

17:26 technomancy: it's been deprecated like 2 or 3 times over?

17:26 gfredericks: arkx: "don't use it"

17:26 technomancy: you're supposed to use Calendar, which is slightly less horrbile

17:26 but even that has been replaced IIRC?

17:26 * gfredericks tried several times to figure out Calendar

17:26 rlb: I thought you were supposed to use jodatime...

17:26 technomancy: rlb: FSVO "you" =)

17:26 gfredericks: rlb: depends on who's supposing

17:27 weavejester: #inst by default resolves to java.util.Date, which I guess is the complaint :)

17:27 gfredericks: weavejester: kind of a complaint against how it was implemented than the basic design though

17:27 arkx: gfredericks: hasn't most of java.util.Date already been deprecated? Hasn't slowed anyone down in the Java world afaict :)

17:27 technomancy: weavejester: yes, it would be much better if #inst threw an exception until you rebound it in data_readers

17:27 I tried to talk rich out of it but failed =(

17:27 gfredericks: arkx: rich convinced me deprecation without removal is a meaningful thing to do

17:28 technomancy: he didn't want to wait for 8

17:28 SegFaultAX: Doesn't @Deprecated generate warnings if you use the deprecated thingy?

17:28 technomancy: gfredericks: not that meaningful if new languages with no legacy excuses ignore the deprecation =(

17:28 arkx: I don't believe in that, at least when the great masses are considered. Gah, sounding elitist, but seriously. :(

17:29 gfredericks: run, it's the hoi polloi!

17:30 arkx: PHP is another language with tons of deprecated but not removed stuff. Yuck.

17:30 gfredericks: managing a language is a stinking pile of tradeoffs

17:30 I don't want to do it

17:31 SegFaultAX: Well in the case of Java we can throw warnings if you're using something that has been deprecated. If you continue to use it, that's your problem. But at least you KNOW you're purposefully doing something naughty.

17:31 dcb: I'm having trouble getting leiningen to include all of the aot'd .class files in the jar, it only includes one or two of the classes most of the time, Anyone have any ideas? Its for a library to be called from another java application

17:36 technomancy: dcb: does `lein compile` place them in `target/classes`?

17:37 dcb: technomancy: No, just the class files that are included in the jar. It is weird, sometimes I can get it to compile everything and jar it all up, but it is not consistent. Most of the time it only compiles a subset of the classes.

17:38 rasmusto: does "while" act like a doseq in terms of producing side-effects?

17:39 SegFaultAX: rasmusto: while just wraps a normal loop in a when.

17:40 dcb: technomancy: it seems to always compile a file that has a defrecord in it, but I have other files with gen-class and deftype that do not consistently compile. I have :aot :all in the project.clj

17:40 rasmusto: SegFaultAX: okay, thanks

17:41 technomancy: dcb: if you can create a repro case please open an issue

17:41 doesn't ring any bells though

17:41 dcb: technomancy: ok I'll see what I can do, thanks

17:53 technomancy: tracked it down to a circular dependency between the clojure and java application, the compile target would change depending on the state of the installed dependency. Thanks for the help

17:54 technomancy: tricky

18:13 seangrove: $lastseen aphyr

18:15 justin_smith: any clue why lein would be creating an osx APP instance for my process? or more to the point how to make that not happen? I assume some dep causes it to happen, because it only gets spawned by our webapp framework

18:16 Raynes: justin_smith: Are you running it with `lein ring`?

18:16 justin_smith: by "osx app instance" I mean it is creating an icon on the task bar and making "clojure.main" an app you can switch to

18:16 yeah

18:16 lein ring server-headless

18:16 Raynes: justin_smith: That's why.

18:16 hiredman: justin_smith: yeah, if anything init's the swing gui subsystem using the osx java that happens

18:16 Raynes: What he just said.

18:16 hiredman: justin_smith: there is a headless option you can pass

18:16 justin_smith: yeah I use lein ring server-headless

18:16 Raynes: `lein ring` does this so that it can open a browser window.

18:16 hiredman: -Djava.awt.headless=true

18:17 Raynes: No, he means java.awt.headless

18:17 justin_smith: ahh

18:17 cool! thanks

18:17 that is so annoying when it does that

18:17 hiredman: yep

18:17 I dunno why you would ever want lein ring to popup a browser

18:17 Raynes: Me either. I hate that it is the default.

18:17 weavejester: Make it the damned not default already,.

18:17 technomancy: srsly

18:18 well, I never use lein-ring, so don't listen to me

18:18 Raynes: Please listen to technomancy.

18:19 technomancy: Raynes: which time though

18:19 Raynes: I do use lein ring, and I lose a small bit of my soul every time I type `server-headless`

18:19 The first time.

18:19 weavejester: Raynes: You can add :open-browser? false in your project.clj or profiles.clj

18:20 Raynes: Bah, you rebel non-conformist.

18:20 justin_smith: good to know, thanks!

18:20 weavejester: Raynes: I've also been meaning to change it to "lein ring server :headless", for more consistency

18:20 gf3: You would

18:20 Raynes: Meet me outside at once for a duel.

18:20 hiredman: you should make headless the default

18:20 "lein ring server :con-cabasa"

18:21 Raynes: You may choose one weapon, but no firearms or projectile devices.

18:21 weavejester: I guess I could make :open-browser? default to false

18:21 technomancy: :aliases {"ring" ["update-in" ":ring" "assoc" ":open-browser?" "false" "--"]}

18:21 pl6306: How do I keep the trailing empty strings in (split "A|B|C||||" #"\|")?

18:21 Thanks

18:21 weavejester: But if you guys feel strongly about it, there is a global ~/.lein/profiles

18:22 technomancy: There's an update-in command?

18:22 technomancy: weavejester: new in 2.1

18:22 hiredman: cabeza I guess

18:22 Raynes: weavejester: Could you also make it so that if it isn't opening a browser window it doesn't pull in the stuff that causes the app icon to pop up?

18:22 technomancy: it's slightly indulgent

18:22 pl6306: I..e how do I get an output of ["A" "B" "C" "" "" "" ""]

18:22 Raynes: Just conditionally require it, i gues?

18:22 I guess*

18:22 weavejester: Raynes: Hum, I thought it was...

18:23 Raynes: justin_smith's problem seems to indicate otherwise. I can test myself.

18:23 justin_smith: maybe I am using an out of date version

18:23 Raynes: weavejester: Oh, I guess you're right.

18:23 $latest lein-ring

18:24 lazybot: [lein-ring "0.8.5"] -- https://clojars.org/lein-ring

18:24 weavejester: Raynes: No, looks like it's not

18:24 Raynes: I'm using 0.8.2, justin_smith. What are you on?

18:24 weavejester: Or is

18:24 https://github.com/weavejester/ring-server/blob/master/src/ring/server/standalone.clj

18:24 I mean, it requires it regardless. It probably shouldn't do that.

18:24 justin_smith: we have a big dependency hell where changing versions of things is messy, let me check

18:24 weavejester: Changing the version of plugins shouldn't make things messy...

18:25 justin_smith: I'll update to the latest lein ring in my profiles.clj anyway, can't hurt

18:25 yeah, forgot this was a plugin thing (oops!)

18:25 weavejester: lein-ring works best as a per-project plugin, rather than as a global plugin

18:26 justin_smith: I'll look into doing it that way

18:28 0.8.5 creates a clojure.main osx app (that steals the UI focus without creating a window) even when server-headless is provided as an argument

18:28 weavejester: That might be because it requires clojure.java.browse regardless

18:28 Patches welcome

18:28 technomancy: is that specific to Apple's JDK or does OpenJDK do it on OS X too?

18:28 justin_smith: hmm

18:30 I'll make a note to install openjdk and check it out, alongside the possibility of submitting a patch to fix the issue

18:30 it is more an annoyance than a bug anyway

18:30 hiredman: it is really annoying

18:31 it steals focus and everything

18:32 justin_smith: for a while we were using lein-sub for a cms and api, so running an app meant three separate clojure.main apps got created, lol

18:44 shriphani: Hi. I have a tiny piece of code like this that uses recursion. What would be the clojure way of doing it? https://www.refheap.com/paste/14053

18:52 nDuff: shriphani: Looks like tail recursion, so you could use loop/recur to avoid consuming stack space. If you wanted to be more Clojure-y, one might think about making your functions map over lazy sequences... though the Thread/sleep (as a side effect) is a bit of a complicating factor.

18:52 Raynes: shriphani: https://www.refheap.com/paste/14055

18:53 shriphani: Changes are you should be using doseq for this.

18:53 Take a look at it.

18:54 shriphani: Raynes, so the http call will return a seq ?

18:55 justin_smith: Raynes: recur works like that without a loop?

18:55 gf3: justin_smith: Yes, rebinds the function

18:55 justin_smith: cool, I had no idea

18:57 shriphani: gf3 what do you mean by rebind? I don't quite follow how it manages to loop without consuming stack and tail-call optimization. Am I missing something here ?

18:59 tomoj: that aset with more than one arg applies is sort of mind-boggling

18:59 Raynes: He means nothing.

18:59 tomoj: more than one idx I mean

18:59 justin_smith: shriphani: I think he means that without a loop recurs as an optimized tail call ot the same function

18:59 Raynes: If you put a recur in the tail position it just translates it into a loop under the hood.

19:00 Thus avoiding consuming the stack.

19:01 justin_smith: loop, optimized tail call, tomäto, tomâto

19:01 gtrak: ... how.. would I walk two trees in parallel? Alternatively, how could I record paths in a tree during a walk?

19:08 hfaafb: can I get some tips on my clojure code? question in comments https://www.refheap.com/paste/14056

19:08 gtrak: apply vector = vec

19:08 gf3: Raynes: R U SURE

19:08 Raynes: According to the docs it rebinds the whole function

19:09 Raynes: gf3: Write my LA Clojure meetup talk for me.

19:09 gf3: Raynes: I already have it done

19:09 gtrak: hfaafb: looks amenable to a 'for' comprehension

19:09 Raynes: gf3: Email it to me plz.

19:09 gf3: Raynes: UGHHH

19:10 hfaafb: thanks gtrak, i'll try that

19:11 justin_smith: also map already means 2 things in clojure, so naming something x-map that is neither of those 2 may be less than ideal

19:12 if mailbox-map is absolutely the one normal thing to call the vector, disregard

19:13 hfaafb: thanks justin_smith, didn't even think about naming, i'll think of something better

19:14 gf3: Raynes: Turns out I don't have your email

19:14 gtrak: hfaafb: (partition 8 (for [x (range 8) y (range 8) :let [z (+ x (* 8 y))]] z))

19:14 ((0 8 16 24 32 40 48 56) (1 9 17 25 33 41 49 57) (2 10 18 26 34 42 50 58) (3 11 19 27 35 43 51 59) (4 12 20 28 36 44 52 60) (5 13 21 29 37 45 53 61) (6 14 22 30 38 46 54 62) (7 15 23 31 39 47 55 63))

19:15 it's just rotated :-)

19:15 Raynes: gf3: It's gf3sendsfakepresentations@raynes.me

19:16 gtrak: hfaafb: doh, ignore that... silly me. I looked at your code again.

19:16 hfaafb: :D

19:17 Raynes: gf3: This is perfect. I'll definitely use this.

19:17 gf3: Raynes: Took me a couple nights to get the wording right

19:19 pl6306: I have string that I want to use regex to find that a line starts with an exact literal for example given string "abc=66\ndef=25\nhij=99" how do I find the line that starts with "ABC" and the one that starts with "def"?

19:22 gtrak: hfaafb: here's a start i think: https://gist.github.com/gtrak/5485591

19:26 hfaafb: gtrak: thanks a lot, the cons/conj part was the real pain point, that makes a lot more sense

19:27 brehaut: ,(map #(re-find % "abc=66\ndef=25\nhij=99") [#"(?i)(\n|^)ABC" #"(?i)(^|\n)def"]) ;; pl6306, its a bit sloppy but it works. im sure theres probably flags thing you could use, or alternatively split the string first but whatevs

19:27 clojurebot: (["abc" ""] ["\ndef" "\n"])

19:27 seangrove: In emacs I've done nrepl-jack-in, and nrepl appears to start (*nrepl-server* buffer looks good), but the *nrepl* buffer itself is completely blank

19:28 pl6306: wow I there might have been simplier way. Thanks!

19:28 gtrak: hfaafb: maybe get rid of the flatten, and switch the following map to mapcat

19:28 brehaut: thers probably a simpler way still

19:28 justin_smith: pl6306: if it always starts with a literal (defn match-prefix [s] (condp (fn [b a] (= (subs a 0 (min (count b) (count a))) b)) s "def" :a "ABC" :b :c))

19:29 hfaafb: gtrak: woah cool. i have much to learn about the stdlib ;_;

19:30 gtrak: full of treasures

19:31 brehaut: ,(for [line (.split "abc=66\ndef=25\nhij=99" "\n") pref ["abc" "def"] :when (-> line .toLowerCase (.startsWith pref))] line)

19:31 clojurebot: ("abc=66" "def=25")

19:31 brehaut: pl6306: ↑

19:32 l1x: hi guys, is there a way to shift/turncate an integer in clojure?

19:32 brehaut: ,(apropos 'shift)

19:32 clojurebot: (bit-shift-left bit-shift-right)

19:33 gtrak: hfaafb: can do one better/worse :-) https://gist.github.com/gtrak/5485628

19:36 hfaafb: gtrak++ go back to work now :P

19:46 amalloy: you can do it rather more nicely without the filthy flatten and #(do ...), gtrak, hfaafb: https://www.refheap.com/paste/ad314fe5ce4338d9da6b351ff

19:48 djwonk: Any tips on this? http://stackoverflow.com/questions/16289991/outofmemoryerror-when-parsing-xml-in-clojure-with-data-zip

19:53 amalloy: djwonk: the entire <mediawiki> tag is read into memory at once in xml/parse, long before you even call count

19:53 djwonk: @amalloy you sure it isn't lazy? that would the sane thing to do -- and that is what others have hinted at

19:54 amalloy: clojure.xml uses the ~lazy sax parser to produce an eager concrete collection

19:54 you say it would be the sane thing to do, but processing xml lazily requires a lot more work than you think - and it would be work *you* do, not some magic clojure.xml could do for you

19:55 feel free to disprove by calling (count (xml/parse data-whatever))

19:57 djwonk: ok, thanks. I don't see any conceptual limitation with processing XML lazily with the data.zip interface

19:58 maybe processing XML lazily requires more work than I think, yes... but so much in Clojure just works, I wouldn't have put it past Clojure for it to work out of the box

20:01 any tips on how to change it to handle larger files?

20:01 SegFaultAX: Does clojure.xml use javax.xml.parsers.SAXParser?

20:02 Because that's really good for large XML files.

20:04 djwonk: @SegFaultAX looking at the source, I see :import (javax.xml.parsers SAXParser SAXParserFactory)

20:05 SegFaultAX: Then I'm surprised you're running into issues unless your or Clojure is doing something lame. I've processed multi-gig XML files with that library.

20:05 djwonk: that's why I don't see any fundamental reason why what I'm trying isn't sane

20:05 SegFaultAX: you or Clojure

20:05 djwonk: right! amalloy above said "clojure.xml uses the ~lazy sax parser to produce an eager concrete collection"

20:06 brehaut: "…produce an eager concrete collection…"

20:06 nDuff: djwonk: You have vars holding onto the heads.

20:06 brehaut: for emphasis

20:06 amalloy: SegFaultAX: the point is that clojure.xml uses SAX to produce for you a collection that's easy to work with, and that has to be eager. if djwonk wants to use SAX himself, he can do so, and that will be as lazy as he wants, but it will be a lot more work

20:06 nDuff: true, but not really relevant

20:06 nDuff: ...oh, no

20:06 I misread.

20:08 SegFaultAX: Well if it's just ease of use, you can't get much easier than DOM.

20:09 And if it's using SAX to eagerly load the collection anyway, does SAX provide any benefit at all?

20:09 brehaut: weeell, python has an interesting lazy-semi dom library called pulldom i think

20:09 SegFaultAX: brehaut: Yea but lxml

20:09 brehaut: you tell it what nodes you are interested in and you get them as a lazy stream

20:09 djwonk: brehaut: that sounds like what I want

20:10 brehaut: i have no idea if there is a clj equiv atm

20:10 SegFaultAX: brehaut: Woudln't it still have to process the entire document to extract the stuff you want, though?

20:10 brehaut: SegFaultAX: nope; it produces a generator that

20:10 only tries to find another sub node on demand

20:10 SegFaultAX: brehaut: Cool!

20:11 brehaut: theres obviously cases where a large node will still let you swallow all your ram, but its a nice middleground

20:11 SegFaultAX: That's why using SAX to incrementally process your XML is awesome, though. :)

20:11 brehaut: its also one of the few libraries ive seen that makes processing XMPP/Jabber not completely crazypants

20:12 yeah, obviously if you hit one of those cases, you need something like sax

20:13 djwonk: nice discussion here: http://stackoverflow.com/questions/9939844/huge-xml-in-clojure

20:13 SegFaultAX: djwonk: That looks closer to what you're looking for!

20:15 Assuming you're doing read-only operations.

21:12 Raynes: gf3: What ever happened to your refheap stuff?

21:12 You get me all excited and then take it all away?

21:12 What kind of monster are you?

21:19 callen: Raynes: what sorta stuff?

21:19 Raynes: also you should convert Refheap to using Clabango. >:D

21:19 Raynes: callen: He was working on a redesign of sorts. Changing colors and such.

21:19 callen: sounds awesome.

21:20 gf3: Raynes: Fucking work, man

21:20 Raynes: callen: Man, I can't do that until at least after I give my laser talk at the LA clojure meetup on the 9th.

21:20 gf3: Raynes: Crazy project past the deadline :(

21:20 callen: Raynes: did you convert it to Laser?

21:20 Raynes: "Hey, here is this really cool library I wrote called Laser that I don't actually use cause lolbad, but you totally shoul."

21:20 callen: Yes, ages ago.

21:20 I showed you in fact because you were curious IIRC.

21:22 sw2wolf: Can clojure be used to build a Window Manager as stumpwm built with Common Lisp ?

21:23 Raynes: Probably, sure, but hell if I know why you'd want to.

21:23 sw2wolf: The stumpwm is great but seems not active now

21:23 Raynes: https://github.com/abrooks/prion This is ancient, but was the beginnings of such a project

21:24 You should look into xmonad though. It's configured with Haskell instead of Lisp, but it's really quite spectacular.

21:25 sw2wolf: Raynes: xmonad is great. but i misses swank similar thing

21:29 adu: xmonad++

21:31 sw2wolf: adu: what is xmonad++ ?

21:32 adu: sw2wolf: it means I would like to show my respect for xmonad

21:32 sw2wolf: adu: would you like show me your xmonad.hs ?

21:33 s/like/mind

21:33 my poor English :)

21:36 adu: sw2wolf: I don't use xmonad now

21:38 sesam123: can i ask why arguments are not evaluated lazily when passed to functions .. in that case it could replace a macro?

21:41 tomoj: sesam123: you're suggesting ((fn [x]) (println "hello")) should not print anything?

21:43 callen: Raynes: I figured but my memory is poor.

21:43 sw2wolf: I use Xmonad, it's great.

21:43 statically compiled native binaries ftfw.

21:43 sesam123: tomoj: I'm not suggesting anything

21:43 callen: sw2wolf: github.com/bitemyapp/dotfiles/

21:44 sesam123: is it just for side effects?

21:45 sw2wolf: callen: thanks

21:45 tomoj: sesam123: not sure I have a good answer, but I think side effects definitely have something to do with it, and sympathy with the jvm

21:49 xeqi: sesam123: lazy argument evaluation allows some macros to be functions, but not all

21:49 tomoj: curious how rich would answer that. if there were no implementation difficulties would pervasive laziness be appealing?

21:51 lack of type system to guarantee purity seems problematic?

21:52 sesam123: xeqi: do you have an example?

22:08 xeqi: sesam123: it is possible to write a `my-if` as a function in a lazy arg language, but would require a macro in clojure.

22:08 but something doing syntax changes, such as ->, requires more then lazy arguments

22:11 tomoj: or take clojure.core/for vs monad notation? :)

22:11 hmm. s#:)#:/#

22:13 shriphani: hi. does the io library contain routines for writing to gzip files? I want to write a string to a gzip file.

22:16 arohner: shriphani: you'll probably need to go into java for that

22:16 look at http://docs.oracle.com/javase/1.5.0/docs/api/java/util/zip/GZIPOutputStream.html

22:17 ekoontz: question about lazy-cat… i know i can do e.g. (lazy-cat (range 1 5) (range 5 10))

22:18 but how can i do (lazy-cat (range 1 n) (range n n2) … )

22:18 for arbitrary arguments..i guess i am needing a macro or something

22:19 i want to "explode" a list e.g. (a b c) into (lazy-cat exploded-list)

22:19 tomoj: shriphani: incidentally I have this lying around from earlier https://www.refheap.com/paste/ad21887e84351ca13e73936c7

22:19 ekoontz: ..so that (lazy-cat a b c) is evaluated

22:20 brehaut: sadly lazy-cat is a macro, not a fn so you cant just (apply lazy-cat a-lazy-seq) :(

22:21 its possible (apply mapcat identity a-lazy-seq) would work though

22:21 ekoontz: brehaut: surely there's some way to turn "(foo '(a b c)" into "(foo a b c)"

22:21 brehaut: wee, without apply

22:21 s/wee/err/

22:21 yes, apply

22:21 ekoontz: let me try that..

22:21 brehaut: but it doesnt work on macros

22:22 tomoj: isn't that apply concat?

22:22 brehaut: hah yes it probably is

22:22 ekoontz: tomoj but i want it lazy

22:22 tomoj: I don't think that makes sense

22:22 ekoontz: concat is not lazy afaik

22:22 brehaut: concat is lazy

22:22 but lazy-cat doesnt evaluate its arguments until needed

22:22 which makes it more lazier

22:23 i think is the difference

22:23 ekoontz: yeah

22:23 that makes sense

22:23 tomoj: but if you already have a seq of seqs to concat, the second kind of lazy doesn't make sense?

22:23 ekoontz: tomoj: but the seqs are lazy

22:23 brehaut: tomoj: that makes sense

22:24 ekoontz: themself

22:24 themselves

22:24 brehaut: im with tomoj; concat should be fine

22:24 ekoontz: so (apply concat?)

22:24 tomoj: unless you have a list of _expressions_ and you want `(lazy-cat ~@exprs)

22:25 ekoontz: ok let me play with it a bit..thanks guys

22:26 ok here's the thing i don't get about ~@

22:27 http://pastebin.com/4d8Cgq7m

22:28 why am i getting a ClassCastException

22:28 brehaut: because 1 is not a function, it is an integer

22:28 ekoontz: ah ok

22:28 brehaut: but you see what i'm trying to do there..

22:28 how can i do it

22:29 brehaut: ,`(foo ~@'(1 2 3))

22:29 clojurebot: (sandbox/foo 1 2 3)

22:29 brehaut: `(foo ~@[1 2 3])

22:29 ekoontz: ah thanks

22:29 brehaut: ,`(foo ~@(list 1 2 3])

22:29 clojurebot: #<RuntimeException java.lang.RuntimeException: Unmatched delimiter: ]>

22:29 brehaut: bah

22:29 anycase, many are the ways

22:29 ekoontz: thanks

22:29 brehaut: but you should never really need to be unquote splicing a literal list

22:30 ,(let [l (list 1 2 3)] `(foo ~@l))

22:30 clojurebot: (sandbox/foo 1 2 3)

22:30 tomoj: here's a silly example https://www.refheap.com/paste/79e55f5594776b5bbb8a33bd7

22:31 ekoontz: brehaut, true, not a literal list but something like (eval `(foo ~@(range 0 3)))

22:31 tomoj: when I said (lazy-cat ~@exprs) I wasn't suggesting that's what you want, though!

22:34 lfranchi: hey guys :) i'm trying to encrypt (for fun) some data in clojure w/ aes ecb 128, using BouncyCastle jars. The issue is I can't get my clojure/bouncycastle code to interop with openssl---i can't decrypt data that is output by the other, no matter what I try

22:34 any crypto nerds around who can help? :)

22:34 i can decrypt it with BC in clojure (and i can decrypt openssl with openssl), but not vice versa

22:40 xeqi: I've been disappointed by the lack of documentation for BC

22:40 lfranchi: yeah, i have not really found much on line

22:40 *online

22:40 aes-ecb-128 should be the same whether it's BC or openssl doing it...

22:41 no salt, turned off padding, how can it be different :)

22:42 I'd be happy with a way to do calls to openssl from clojure/java, but that seems even more of a PITA

22:44 murtaza52: can anyone explain what does the lazy-seq macro do in plain english ?

22:44 this is from the doc - Takes a body of expressions that returns an ISeq or nil, and yields

22:44 a Seqable object that will invoke the body only the first time seq

22:44 is called, and will cache the result and return it on all subsequent

22:44 seq calls. See also - realized?

22:48 xeqi: it takes a form that will return a seq, and only evaluates the form when it needs to

22:48 maybe http://clojuredocs.org/clojure_core/clojure.core/lazy-seq helps

22:53 murtaza52: xeqi: thans

22:55 ekoontz: murtaza52: what helped me is looking at range

22:55 e.g. (range 5)

22:55 (source range)

22:55 shows that it's using a lazy-seq

22:58 murtaza52: ekoontz: thanks let me have a look

23:04 tomoj: range is obscured by chunkiness though

23:04 I wish you could take unchunky code and automatically make it chunky

23:23 j4x0n: As a clojure newb, (:require ... and (:use ... are confusing. I see projects use one or the other, or a mixture of the two. Is there a definitive reason for using one way or the other?

23:23 technomancy: j4x0n: :use is old; don't use it

23:24 j4x0n: technomancy: thanks

23:24 I guess there was a transition period where people were unsure?

23:25 technomancy: j4x0n: prior to clojure 1.4, :require didn't do everything, but these days :use is redundant

23:26 j4x0n: technomancy: Excellent. And hey, thanks for lein...it's a pleasure to use and makes using Clojure much easier for newbs like me.

23:27 technomancy: glad it's working out for you =)

23:34 murtaza52: technomacy: so is the usage of :require recommended over :use in all cases ? Any reasons its not preferred?

23:35 technomancy: murtaza52: the only time :use makes sense is if you need to target earlier versions of clojure

23:35 which you probably shouldn't =)

23:35 but use as a function makes sense in the repl because it's short

23:36 murtaza52: technomancy: :) cool . Just for my understanding, why is require preferred over use?

23:38 technomancy: murtaza52: because it's confusing to have both, as evidenced above =)

23:39 j4x0n: It's things like require vs use that really screw up new users. When you run into a few issues like that in an hour, a voice in the back of your head says "You could have been done with this whole thing in your comfy language". Persistence!

23:55 Here's another fun one: unsupported major/minor version 51.0. I'm guessing one of my dependencies was compiled using Java 7.

23:56 technomancy: ouch, yeah =(

23:56 j4x0n: It's amazing anything works.

23:56 I hate running into this stuff in my playtime hours.

23:56 brehaut: version 51? is that chrome or ffx?

23:57 j4x0n: It's an internal number for java 7

23:59 It was the postgres jdbc driver.

Logging service provided by n01se.net