#clojure log - Nov 05 2012

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

0:08 ambrosebs: Here's my final poster advertising Typed Clojure and my honours dissertation. Hopefully I did the Clojure logo justice, thanks to those that proof-read it! https://github.com/downloads/frenchy64/papers/poster.pdf

2:14 bbloom: am i crazy... or is there no 'boolean? predicate?

2:15 wingy: bbloom: there is no

2:15 bbloom: bwha? crazy town....

2:15 wingy: you have to create an own one

2:16 bbloom: wingy: surely it's as simple as (instance? Boolean x)

2:16 hence my surprise at it's absence...

2:17 wingy: cool

2:46 tomoj: huh, (and (= entity-a entity-b) (not= (:foo entity-a) (:foo entity-b))) can be true for datomic entities

2:53 * josteink tries to run leiningen on his raspberry pi using openjdk... this doesnt look too well

2:53 josteink: tomoj: that sounds extremely odd.

2:54 foodoo: tomoj: Are these entities hash-maps or custom datatypes? (I'm not a datomic user)

3:00 josteink: lol

3:00 http://pastebin.com/W1RutyKT

3:08 wingy: isn't it better to just use live HTTP responses from a service rather than mocking the responses?

3:29 tomoj: my pprint'd .dtm schema is 900 lines long

3:29 my datomic-simple-esque definition of the same schema is 198 lines with comments and whitespace

3:31 but stu said datomic-simple's schema helper is 'not to his taste'

3:33 feel like I am going to get laughter if I show someone a 900 line schema

4:00 ejackson: 900 lines ! wow

4:02 quadrocube: Hi all!) Suspecting it is a popular newbie question, but nevertheless I am not able to answer it myself: is there an equivalent for concat func which can also be used like (concat :a :b) without blasting out with errors?

4:07 wvdlaan: Are you looking for (concat [:a] [:b})?

4:07 Are you looking for (concat [:a] [:b])? Sorry, fixed typo

4:08 ejackson: or maybe (vector :a :b).... you need to specify a collection type somehow

4:11 _ulises: has anybody done any work on message passing/otp between erlang and clojure?

4:11 all I could find were wrappers around jinterface

4:13 quadrocube: @wvdlaan> almost, but in case we will call it with (concat [[:a :b]] [:c]) it'd be [[:a :b] :c], but I'll more eagerly get [:a :b :c]

4:14 the same with (vector ...). In any case, I can use e.g. flatten but it doesn't seem really idiomatic

4:42 josteink: "REPL server launch timed out."

4:42 so far openjdk is not treating my raspberry pi very well :P

5:45 maleghast: Morning All

5:45 * maleghast tips hat to room

5:47 maleghast: Has anyone else had problems with running Midje tests on a Compjure project using lein-midje? I seem to have a situation where even though Hiccup is definitely installed (if I run lein ring server the app functions fine) but I try to invoke "lein midje" and the app bombs out complaining that it can't find Hiccup on the class path.

5:49 weavejester: maleghast: It might be that Lein-Midge is adding some deps

5:49 maleghast: What's the specific error?

5:50 maleghast: Erm, hold on I'll paste it elsewhere...

5:51 weavejester: Although… a look at the source code doesn't indicate any problems to do with deps.

5:51 maleghast: weavejester: Here is the stack trace: http://pastebin.com/4xvDKM9e

5:51 weavejester: maleghast: What does your project.clj look like?

5:51 maleghast: As I said above, I have a default view on the app that uses Hiccup and if I run the app with "lein ring server" it runs fine...

5:51 Hold on *goes to make another paste*

5:52 http://pastebin.com/3VLZ2HUt

5:56 weavejester: maleghast: Um, you don't have Hiccup as a dependency

5:56 maleghast: Hiccup is a dependency of ring/ring-devel, which is pulled in by Lein-Ring when it starts

5:56 maleghast: Ah….

5:56 weavejester: Which explains why your app work when started with "lein ring server"

5:56 maleghast: That explains a LOT

5:57 algernon: weavejester: have you had a chance to look at the latest version of the html5 pull request (#71)? O:)

5:57 maleghast: I am (still) a bit of a dreadful n00b with this stuff, particularly the dependency resolution stuff - never __done__ Java at all - thanks for the help, I will add a dep for it an that should sort me out...

5:57 Er, no I haven't - I will go look now...

5:57 weavejester: algernon: No, sorry. I'm very behind with pull requests. This has been a few very busy weeks.

5:59 maleghast: weavejester: Thanks again - nailed it.

6:00 weavejester: algernon: I'll try and find some time this week. If not, next week should be relatively free for me.

6:00 maleghast: weavejester: Are you on Twitter?

6:01 weavejester: maleghast: @weavejester

6:01 algernon: weavejester: it's not urgent at all, its just that you commented on it fairly fast, and I was wondering if there's anything else I should change :)

6:01 weavejester: thanks a lot for the comments, by the way

6:01 maleghast: weavejester: Figured, but for some reason couldn't find you through Tweetdeck search - I will try again...

6:01 jml: How can I generate a normalized histogram with Incanter?

6:02 ejackson: jml: histogram doesn't do it by default ?

6:02 i guess that's a stupid question, sorry

6:02 weavejester: algernon: No problem. I'll try and look into it soon.

6:03 jml: ejackson: it doesn't.

6:03 hmm. I guess it's just a matter of changing the y axis

6:03 annoyingly, I can't figure out how to feed Incanter a map and have it just do a bar chart of that.

6:04 ejackson: jml: it has an option for density

6:04 jml: ejackson: oh. duh. thanks.

6:04 ejackson: np

7:25 antares_: New clojure-doc.org progress report: http://blog.clojurewerkz.org/blog/2012/11/05/clojure-documentation-project-progress-report-the-week-of-november-4th/

7:33 jcromartie: how could reduce be made lazy?

7:39 josteink: http://hammerprinciple.com/therighttool/items/python/clojure


7:40 Python: 9%. Clojure 91%

7:40 * josteink chuckles

7:41 Chiron: Hi, how to copy a datastructure in clojure?

7:45 _ulises: Chiron: why do you need to copy it?

7:45 josteink: Chiron: immutable datastructures are safe to keep a reference to as is

7:45 Chiron: I have a ref that holds many maps, before removing a map from ref, i need to capture it

7:46 get snapshot --> remove map from ref --> return the snapshot

7:46 _ulises: Chiron: if you need to inspect the ref you can do deref/@ before operating on it

7:47 Chiron: i know

7:47 please follow my previous line

7:47 get snapshot --> remove map from ref --> return the snapshot

7:48 at least, that is the imperative approach

7:49 _ulises: Chiron: sure, I'm just trying to figure out if there's a better way of achieving what you want; perhaps "copying" is not the best way to go about it

7:49 babilen: Chiron: Why can't you just deref the ref, give it a name (e.g. in a (let [foo @bar] ...)) and take it from there?

7:49 The approach also feels a bit unidiomatic :-/

7:50 _ulises: that's where I was trying to get to

7:53 antares_: babilen: that approach is perfectly fine

7:53 ckirkendall: does anyone have a clean way to deploy war files through lien

7:54 babilen: antares_: You mean my suggestion?

7:55 Well, probably whatever I referred to with "The approach" -- I am not saying that it is wrong, but rather that it feels as if there *might* be a better solution.

7:59 antares_: babilen: yes

8:00 babilen, Chiron: that's the point of immutable data structures, it's safe to hold references to them. So dereference, alter/swap/send to mutate the identity, return the old value. Perfectly "idiomatic" if you ask me.

8:01 clgv: Chiron: well, just make sure that you do those operations in the same transaction (dosync)

8:03 Chiron: I see, thanks fella

8:07 clgv: inside a transaction even if the type isn't ref?

8:09 clgv: Chiron: I meant that the following steps: (1) retrieve value from ref, (2) modify value to new value, (3) update ref with new value have to be in the same transaction if you want transactional guarantees. if you wrap step (1) in a transaction and step (3) in a separate transactio you wont have those guarantees

8:09 jweiss: is there an example somewhere of "code as data" (in any lisp)? I'm tempted to try this with automated test procedures. it allows easy printing of 'what the test does' and also things like after-test fixtures that wrap the test in (try (teststuff) (finally (after-test-stuff)) on the minus side, no compile time error checking.

8:09 antares_: Chiron: if you don't use refs/STM, don't worry about transactions

8:10 clgv: I read that he uses a `ref`

8:10 Chiron: I don't want to update the ref with a new value. I want to get a map object from it, remove the map from the ref, return the read map

8:11 _ulises: Chiron: by removing the map from the ref you'd be updating the ref, no?

8:11 Chiron: yes

8:11 clgv: _ulises: exactly ;)

8:11 Chiron: aa ok

8:12 speaking of STM . if one thread is updating a ref and another is reading from it (possibly the same object). should i surround the read/deref with dosync?

8:13 _ulises: Chiron: as clgv said, if you want reads that are consistent then yes

8:13 Chiron: okidokie

8:13 _ulises: Chiron: you'd have to have the reads and writes inside the same transaction

8:14 clgv: Chiron: you cant do much with a ref without a transaction (dosync). just try it on the repl

8:14 ,(let [r (ref 10)] @r)

8:14 clojurebot: 10

8:14 clgv: ,(let [r (ref 10)] (reset r 11))

8:14 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: reset in this context, compiling:(NO_SOURCE_PATH:0)>

8:15 clgv: I meant that: ##(let [r (ref 10)] (alter r inc))

8:15 lazybot: java.lang.IllegalStateException: No transaction running

8:15 _ulises: I nearly tried with swap

8:15 clgv: but seems reading is fine without a transaction

8:15 Chiron: clojurebot: edison || tesla ?

8:15 clojurebot: It's Turing complete |is| <reply>Turing completeness is the Godwin's Law of language arguments

8:15 _ulises: it's been a while since I used refs :/

8:16 clgv: _ulises: just remember you cant use the atom functions except deref ;)

8:18 _ulises: clgv: yes; incidentally, it's interesting to see that I've hardly ever needed to use refs at all and still got away with tons of stuff

8:18 only shows that sometimes you just don't need mutability at all

8:19 clgv: _ulises: my first real use case for ref was a server implementation where decisions based on state were made in a multithreaded environment

8:20 _ulises: interesting

8:34 wingy: should i have step-0 or step0 as fn name

8:34 step-1/step1 and so on

8:34 without dash seems better

8:34 step1, step2 ...

8:35 clgv: wingy: I havent see a rule for that yet

8:36 wingy: if those arent steps in a well known algorithm you probably should find better names

8:36 wingy: yeah i have a prefix before them

8:37 clgv: but why step1, step2? do the steps do nothing meaningful?

8:45 konr_trab: Is there a re-seq that returns the match locations in the string?

8:45 *re-seq-like function

9:00 ckirkendall: technomancy: how does one deploy a war file using lein, instead of the normal jar.

9:06 augustl: ckirkendall: is it common to deploy war files to mvn repos?

9:06 honest questino, I'm relatively new to the java world :)

9:09 S11001001: augustl: no

9:09 ckirkendall: augustl: in a production environment when you are versioning artifacts for deployment it is

9:11 augustl: ckirkendall: I see, so you deploy versioned wars to a maven repo for archival reasons? (Rollback, etc)

9:11 ckirkendall: yes, to make scriptable rollbacks possible

9:12 We have 72 deployable artfacts

9:12 augustl: I deploy from a jenkins server and archive and version stuff on the file system there. Using a maven repo sounds more elegant though

9:13 not sure if we could actually do it since we also archive some stuff that isn't in the wars, like JS deployed to a CDN

9:13 ckirkendall: I been looking at lein-package but I can't get it to work. I was wondering if anyone else has a solution they use.

9:16 augustl: we also archive zips and other artifacts this way.

9:17 frenchyp: ckirkendall: pardon the intrusion. The solution we are working towards at work is the following: in dev land, we use language based package source management, language specific (maven, pip, etc...). In QA/OPs land, we use .deb. We translate from maven/pip to .deb. As I said we are still prototyping this, so we may find it is not a good idea

9:19 ckirkendall: frenchyp: I like the idea but it would difficult for hot deploy environments like ours.

9:20 frenchyp: just curious: why would it specifically be difficult for hot deploy?

9:22 andrewmcveigh|wo: ckirkendall: I'm also looking for the same thing. Didn't find it yet. Was considering writing a plugin...

9:25 ckirkendall: frenchyp: if you are creating .deb file I assume this is to use apt-get or something like that as the installer. We hot deploy to weblogic and while I could run WLST from the installer it seem more complicated than just running it from a centralized build server out to the admin server.

9:26 andrewmcveigh|wo: lein-package is meant to do this but seems to be broken. It might be best to start there. I plan on working on this today so who knows we may have a plugin by the end of today. ;)

9:28 frenchyp: I see, thank you for your answer

9:33 andrewmcveigh|wo: ckirkendall: I think I'd already looked at lein-package, although not at any depth. I've got a couple of hours left at work, so I'll have a look.

10:08 ro_st: i can use every? to check for values in a map. is there a clojure.core fn to check for the existence of all the passed keys in a map?

10:08 idiot. (every? #{} (keys m))

10:12 S11001001: ro_st: not quite: ##(every? #{false} (keys {false 42}))

10:12 lazybot: ⇒ false

10:12 S11001001: guess what the other corner case is

10:17 ro_st: i want to make sure that at least those keys are present

10:17 other keys ignored

10:17 S11001001: ,(empty? (apply disj #{false} (keys {false 42})))

10:17 clojurebot: true

10:19 S11001001: ,(empty? (apply disj #{false :not-in-the-map} (keys {false 42})))

10:19 clojurebot: false

10:20 jyu: exit

10:31 AWizzArd: ,(+)

10:31 clojurebot: 0

10:34 ro_st: thanks S11001001

11:16 alexnixon: I'm curious as to why the split? argument of useful.seq/partition-between takes one argument rather than two ( https://github.com/flatland/useful/blob/develop/src/useful/seq.clj#L224 ). Anyone know of a reason?

11:25 clgv: alexnixon: that weird. since they pass two elements in as it seems.

11:32 alexnixon: clgv: it seems both weird and deliberate, which is why I'm interested :-)

11:33 clgv: alexnixon: I'd guess that the code "developed" to that stage ;)

13:24 egghead: can you put futures inside of a map inside of an atom?

13:25 I have some sort of weird queue I want to keep in memory, not sure what datastructures I should use to help me out

13:26 S11001001: egghead: are you queuing computations?

13:27 egghead: S11001001: it's a POST via clj-http that doesn't respond until it's done doing work (sometimes several mins)

13:28 S11001001: egghead: would skip the atom

13:30 egghead: what's the best way for another thing to get access to whether or not the future is complete S11001001 ?

13:31 should I just make a recursive function that waits and checks it?

13:33 S11001001: egghead: you can ask a future whether it's done

13:33 future-done? or something like that maybe

13:34 egghead: S11001001: something like this? https://www.refheap.com/paste/6423

13:34 or could I just get rid of the promise there completely?

13:35 thanks btw, I haven't done much concurrency stuff yet

13:36 konr_trab: what was that function that turns [1 2 3] into, eg, [[1 2] [2 3]]?

13:36 TimMc: konr_trab: partition, partition-all

13:36 &(partition 2 1 (range 0 3))

13:36 lazybot: ⇒ ((0 1) (1 2))

13:36 konr_trab: TimMc: yeah! Thanks!

13:36 S11001001: egghead: get rid of the promise

13:45 nbeloglazov: Is using defn inside doseq ok? I'm generating new class with gen-class and need to override many similar functions. Can I use defn inside doseq for this?

13:46 nDuff: nbeloglazov: That's... actually one of the first good use cases I've heard of for that.

13:46 raek: nbeloglazov: no, defn defines a global.

13:47 nDuff: raek: I gather that generating a group of globals is the point.

13:47 raek: wait, override?

13:47 as some kind of metaprogramming, maybe

13:48 nbeloglazov: Thanks. I'll try

13:48 nDuff: nbeloglazov: That said -- it sounds like you're doing this at runtime rather than compile time? It smells like a macro thing to me.

13:48 nbeloglazov: No, I want it work on compile time

13:49 To generate class with gen-class

13:49 nDuff: nbeloglazov: Sounds like you should be using a macro, then.

13:50 raek: (defmacro foo [...] `(do ~@(for [...] `(defn ...))))

13:50 nbeloglazov: What are benefits of using macro here?

13:51 TimMc: It'll work.

13:51 nbeloglazov: And doseq won't?

13:51 TimMc: whereas defn in a doseq won't

13:52 nbeloglazov: Hm, but why? I thought all code is evaluated before compiling?

13:54 S11001001: nbeloglazov: to boil this down, you can't pick a different name for defn to define in normal evaluation.

13:55 nbeloglazov: Ah, right. I thought I can pass symbol I constructed myself to defn. But I need to use macro for this. Thanks

13:55 TimMc: nbeloglazov: defn is a macro, so you have to use a macro. :-)

13:56 That's one reason to avoid using macros when a fn will do.

13:58 Sgeo: That's one reason to use Tcl

13:58 Erm, I mean, hi.

13:58 TimMc: haha

13:58 HOw goes?

13:59 * Sgeo learned about a language called Elixir

13:59 TimMc: nbeloglazov: When you write your macro, you'll have to do a little trick to put non-namespaced symbols into the output form: https://github.com/baznex/imports/blob/master/src/org/baznex/imports.clj#L144 (note ~'invoke)

14:00 dnolen: Sgeo: it's pretty neat. Saw a nice presentation on it from the creator at StrangeLoop

14:01 TimMc: hooray for VMs

14:01 Sgeo: TimMc, I wonder if it's usable to do useful stuff at this point. There's a lot of Erlang code, right?

14:01 TimMc: sure

14:02 Sgeo: And Erlang libraries are more likely to be idiomatic to Elixir than Java libraries to Clojure?

14:02 TimMc: I have no idea, I learned about it 3 minutes ago.

14:04 Sgeo: I still don't have a real grasp on how Erlang programs are structured, other than that it seems more stateful than Erlangers might admit?

14:05 dnolen: Sgeo: one way to find out.

14:19 antares_: Sgeo: Elixir is closer to Erlang than Clojure to Java

14:22 callen: Sgeo: Erlang is highly stateful.

14:22 Sgeo: it's very common to not work against a backing store and instead use a cluster with Mnesia

14:23 Sgeo: most of the web devs know better than to do that, and will back the Erlang app with some other persistence method, but it's very common to have stateful applications. Partly because Erlang makes it so eminently possible.

14:24 Sgeo: Hmm, I'm not too familiar, what are the problems with Mnesia?

14:24 callen: Sgeo: if Mnesia or some other explicitly stateful mechanism isn't involved, Erlang will...make you go through some pain to have statefulness baked in, but it's still an intended possibility for the platform.

14:24 Sgeo: there's no problems, I'm just opinionated.

14:24 Sgeo: I believe in discrete services solving different pieces of the puzzle. Mnesia violates that principle. It's good for some problems, bad for others.

14:25 Sgeo: Mnesia is basically "native erlang datastructures as a data store"

14:25 Sgeo: and it clusters natively with the rest of the stack, so your persistence and application runtime are one big blob.

14:25 unless you want cross-cluster communication. It's up to you how you want to structure it really.

14:25 Erlang makes it pretty easy to separate the services out.

14:26 Sgeo: one way to think about it, is that Erlang makes a lot of paths accessible, some of them sensible, some of them foolish.

14:26 it depends entirely on the problem you're solving and how you like modeling your solutions.

14:27 Sgeo: is there a specific problem you're trying to solve or question you're trying to answer?

14:28 Sgeo: No

14:28 callen: Sgeo: Elixir is nice but it's like coffeescript. You can't really use it without understanding the underlying framework.

14:28 in this case, Erlang.

14:28 Sgeo: I've read some Erlang stuff before, but still don't entirely grasp how Erlang programs are structured

14:28 egghead: grrr, what's the simplest way to make a queue of futures where one doesn't start until the other is finished?

14:28 Sgeo: Something about supervisors watching processes

14:29 But if those processes need to talk to eachother, how do they get each other's PIDs?

14:29 callen: Sgeo: http://en.wikipedia.org/wiki/Communicating_sequential_processes

14:29 Sgeo: you generally avoid referencing PIDs directly.

14:29 Sgeo: PIDs should be assumed to be ephemeral in erlang.

14:30 Sgeo: it's message-passing centric concurrency.

14:31 Sgeo: the VM is designed to be able to handle the transition from single-machine to clustered operation fluidly. So where you'd previously been spawning off processes for handling work so that you could have multi-threaded operation, that becomes a means for distributing work at the cluster level natively.

14:31 * Sgeo isn't especially interested in clustered operation

14:31 callen: As far as 'state' goes, you don't reference PIDs directly if you can help it at all, so you rely on either Mnesia or a backing store depending on your circumstances.

14:31 Sgeo: But fault-tolerance stuff seems interesting

14:32 callen: the clustering is the fault tolerance.

14:32 if you find fault tolerance interesting, you have to be running a cluster.

14:32 how do you think it retries failed work if there isn't another machine to steal the work?

14:32 stateless and disconnected erlang instances function fine, but their work is lost if the machine goes down and they're not clustered.

14:33 so I'm not really sure what you think you're accomplishing otherwise.

14:33 Sgeo: I think maybe the phrase I wanted wasn't fault tolerance

14:33 callen: Sgeo: you don't have to make excuses, just explain what you want and I'll try to answer.

14:34 Sgeo: The... idea that if something happens in a process, to let it crash and it will be restarted

14:40 Netfeed: how can you avoid doing circular imports of entities in sqlkorma if you want to have entities in different files and there's a relation between them? one-to-many and so on?

14:52 sh10151: anyone a slime/emacs user? the colors in sldb tracebacks are too pale and I can't figure out how to change them

14:52 customize-face doesn't bring up a named face

15:02 Chiron_: for working with http, do u recommend http.async.client or clj-http ?

15:03 I need it to be compatible with Clojure 1.4

15:05 dakrone: Chiron_: I recommend clj-http, but of course I'm biased

15:05 Chiron_: :)

15:05 it is great, so you aren't biased

15:08 I built Kafka and i have its jar . what is the best way to have it in my project ? i want to have it with the project at github . installing it locally is annoying since it is built with sbt and sbt submit to .ivy2

15:09 lib directory will erase it at each clean and deps

15:10 writing a lein hook to copy kafka.jar to lib if it doesn't has it?

15:12 TimMc: ~repeatability

15:12 clojurebot: repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability

15:12 TimMc: ^ this should have some approaches

15:20 antares_: wrote a short blog post on a few libraries Peter Taoussanis released earlier today: http://blog.clojurewerkz.org/blog/2012/11/05/carmine-timbre-tower-and-nippy-go-1-point-0/

15:31 egghead: what's the best way to silo some work off into another thread (a loop that will never end)

15:33 antares_: egghead: I'd use an executor (thread pool): http://clojure-doc.org/articles/language/interop.html#clojure_functions_implement_runnable_and_callable

15:33 egghead: thanks antares_

15:51 rodnaph: can anyone point me to docs about clojure's #inst - i need to do a "now"

15:52 Apage43: rodnaph: (java.util.Date.)

15:52 ,(java.util.Date.)

15:52 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ExceptionInInitializerError>

15:52 Apage43: well that's scary

15:53 &(java.util.Date.)

15:53 lazybot: ⇒ #inst "2012-11-05T20:52:03.949-00:00"

15:53 ejackson: Apage43, rodnaph: check out clj-time if you're doing anything non-trivial

15:53 rodnaph: ah right.... ok. thanks

15:57 ckirkendall: andrewmcveigh|wo: I got lein-package to work. The problem was not with the software but with the documentation. After going through the code I realized where my gap was.

15:58 Chiron_: ok, i built kafka and got its jar. is it legal to push it to clojars?

15:58 antares_: Chiron_: sure

16:00 callen: Netfeed: seems like a generic circular import issue

16:01 Netfeed: http://stackoverflow.com/questions/3084205/resolving-clojure-circular-dependencies

16:01 Netfeed: the answer is basically, "stop doing that"

16:01 mmitchell: Quick question about namespaces. I have a friend who thinks that namespaces should be used to represent more of the business interface, and less for organizing code. Any thoughts on this?

16:02 emezeske: mmitchell: What is a "business interface?"

16:02 mmitchell: i'm on the fence, i can see why that makes a lot of sense, but in some ways is very limiting for a programmer

16:02 emezeske: mostly, the public api of the application

16:02 antares_: mmitchell: you can use them for both (some namespaces then will be internal)

16:02 emezeske: mmitchell: Well, the public API namespaces should be organized nicely for the public API

16:03 mmitchell: But the internal code can be organized into namespaces however you please

16:03 mmitchell: I don't see why these things are mutually exclusive

16:03 mmitchell: yeah makes sense, that's my feeling too

16:03 ejackson: yeah, organising your own code is never a bad idea

16:04 mmitchell: is there a common way of organizing a project so that "public" namespaces are somewhere different than the internal namespaces? I guess I'm talking about a "standard"?

16:04 or... maybe metadata?

16:05 emezeske: mmitchell: You can mark internal functions as ^:private or ^:internal

16:05 mmitchell: And maybe x.y.z.api references x.y.z.api.impl or something

16:05 mmitchell: ok right

16:06 Netfeed: callen: yeah, i guess, but then you get "where should i put that" problems

16:06 emezeske: mmitchell: It might be possible to mark a namespace as private, too, but I am not sure

16:07 mmitchell: emezeske: i was kinda wonder about that, but i can see how that might get tricky with its consumers

16:07 antares_: mmitchell: all namespaces that do not have internal. in them are public

16:07 alib.* — public, alib.internal.* — private and should not be used directly

16:08 mmitchell: antares_: oh really? is this an accepted convention?

16:08 antares_: mmitchell: it is mentioned in 2 books or so

16:08 mmitchell: antares_: ahh good to know

16:11 rodnaph: does anyone have any good tutorials/video on using nrepl in emcas?

16:11 *emacs

16:50 jcromartie: help me out

16:50 is this some kind of reaction to clojuredocs.org? http://clojure-doc.org/

16:51 dakrone: jcromartie: no, it's a different project that is hoped to eventually provide a replacement; as clojuredocs isn't really maintained any longer

16:51 jcromartie: I see

16:51 unlink: How does invoking Java varargs static methods work in Clojure?

16:51 jcromartie: the fate of many things Clojure

16:51 unlink: Or more importantly, where is this documented for the next time I forget it?

16:52 technomancy: jcromartie: the fate of many pieces of software

16:52 dakrone: jcromartie: thus is the fate of all things software

16:52 jcromartie: unlink: arrays

16:52 antares_: jcromartie: it is a reaction to the state of things with Clojure contribution process that covers clojure documentation

16:53 jcromartie: http://blog.clojurewerkz.org/blog/2012/10/10/announcing-a-new-clojure-documentation-project/

16:54 clojuredocs.org covers API reference quite well, it just needs to be reworked to support multiple versions

16:54 technomancy: antares_: I noticed the web basics guide covers DB access as well; that seems kind of weird?

16:54 antares_: clojure-doc.org does not try to be an API reference

16:54 dakrone: antares_: s/reworked/rewritten/

16:54 antares_: technomancy: well, it is a tutorial

16:54 jcromartie: unlink: for example, ,(String/format "Hello, %s!" (to-array ["World"]))

16:55 ,(String/format "Hello, %s!" (to-array ["World"]))

16:55 clojurebot: "Hello, World!"

16:55 jcromartie: Not so convenient… but you could write something to wrap args in an array (unless that exists?)

16:56 unlink: but more conventionally, the Java call is wrapped in a Clojure defn

16:56 like, (defn format [fmt & args] (String/format fmt (to-array args))

16:57 unlink: jcromartie: I'm calling a bunch of different methods each with varargs only once

16:58 antares_: ,(format "Hello, %s", "world")

16:58 clojurebot: "Hello, world"

16:59 xeqi: technomancy: do you think an first step into webdev should just show compojure/hiccup/etc, and perhaps use an atom for storage?

16:59 technomancy: xeqi: yeah, definitely

17:00 bringing SQL into it muddies the waters

17:01 Urthwhyte: If I were to wrap a Java library would clj-time be a good model to go off of?

17:05 antares_: Urthwhyte: hmmm, no.

17:05 Urthwhyte: see Welle, Monger, Langohr, Cheshire, clj-http

17:06 mrevil: how does one apply with kwargs? I have a hash, or a list of k v pairs how do I pass that to a function that takes kwagrs?

17:06 antares_: clj-time has arguable APi decisions but it is too late to change it in any breaking way

17:07 mrevil: like here https://github.com/michaelklishin/welle/blob/master/src/clojure/clojurewerkz/welle/kv.clj#L124

17:07 Chiron_: hi, if i don't have to import many classes (:import [java.util Properties]) is it possible to get ride of the space before class name?

17:08 lpetit: Chiron_: you must get rid of the square brackets as well (:import java.util.Properties)

17:08 antares_: Chiron_: (:import java.util.Properties)

17:09 Chiron_: I see, thanks fella !

17:10 this is legal : (:import java.util.Properties java.io.IOException) ?

17:10 ForSpareParts: Is there a way to just pull a few loose jar files into a Lein project?

17:10 Chiron_: ,(:import java.util.Properties java.io.IOException)

17:10 clojurebot: java.io.IOException

17:11 technomancy: ForSpareParts: yes, but the fact that someone's handing you loose jars and expecting you to use them without a repository is silly

17:12 but you can use the localrepo plugin

17:13 ForSpareParts: technomancy, Well, I'm trying to use libgdx with my project. I haven't been able to find a maven repo for it yet...

17:14 technomancy: you should definitely open a bug with the upstream project if they don't publish it in a repo

17:14 ForSpareParts: OK.

17:24 DaReaper5140: Hi I have a question about clojure web servers.

17:25 I know how to add normal java libraries but what about custom non-standard ones?

17:25 where do i put the files?

17:25 all clojure web server tutorials only demonstate how to add common java files

17:26 nDuff: DaReaper5140: Create a local Maven repository. Add your custom jars.

17:27 DaReaper5140: ...thereafter, it's the exact same method.

17:27 DaReaper5140: maven, ok

17:28 egghead: mmm, refs are so neat

17:28 was able to build a simple queue with just refs and futures, viva la clojure

17:30 Raynes: LinkedBlockingQueue!

17:32 DaReaper5140: ... is there a way to do it without Maven

17:36 nDuff: DaReaper5140: Not a way that's easier than a one-line ''mvn install:install-file'' command.

17:37 DaReaper5140: ok... there is just a good chance that the person in charge of the server is not using Maven

17:37 i also might be blind

17:37 :P

17:37 nDuff: DaReaper5140: mvn install:install-file -DgroupId=you.com -DartifactId=proprietaryLibrary -Dpackaging=jar -Dversion=1.0 -Dfile=proprietaryLibrary-1.0.jar

17:38 DaReaper5140: and that'll make a local Maven repo (under the current user's home directorty) if one doesn't already exist.

17:38 DaReaper5140: ...and thereafter you can refer to [you.com/proprietaryLibrary "1.0"] in your project.clj

17:39 * nDuff is kinda' guessing on that syntax -- he's in an Ivy shop, and so can't use Leiningen.

17:41 solussd: in what version of clojurescript did "format" become available?

17:41 DaReaper5140: hmm i think he is actually using a project.clj to list all dependencies (not sure if that is a replacment for maven)

17:41 S11001001: ~leiningen

17:41 clojurebot: leiningen is always the easiest way

17:42 S11001001: ^^ DaReaper5140

17:42 DaReaper5140: i am using lein run to start the web server

17:42 nDuff: DaReaper5140: project.clj is a Leiningen config file.

17:43 DaReaper5140: ok

17:43 nDuff: DaReaper5140: It uses Maven for its dependency resolution.

17:43 DaReaper5140: ok this is making more sense

17:43 ForSpareParts: I have a follow-up to my earlier question: it turns out the lib I wanted (libgdx) is in Clojars, which is cool. But I've imported it into my projects and my imports can't find the classes I expect them to. Google suggests it's something related to the Clojars repository providing a jar containing other jars. Anyone know how to solve this...?

17:43 * DaReaper5140 goes off to read up on project.clj use

17:44 nDuff: ForSpareParts: We'd need a lot more details.

17:44 ForSpareParts: Enough to reproduce the issue, ideally. Generally speaking, transitive dependencies work just fine out-of-the-box.

17:45 ForSpareParts: nDuff, In a nutshell: http://pastebin.com/S7wYTBtd

17:46 nDuff: !pastebin.com

17:46 err, wrong channel.

17:46 ForSpareParts: Am I not supposed to be using pastebin?

17:46 nDuff: bleh. In short: Don't use that awful thing. gist.github.com or refheap, please.

17:46 ForSpareParts: OK. Thanks for telling me.

17:47 https://gist.github.com/4020908

17:47 Out of curiosity: what is it that's bad about pastebin?

17:47 * gfredericks is also curious

17:48 nDuff: flashy, animated ads, maintainership that hasn't added a new feature in years; character set conversion that doesn't guarantee that even the raw dump comes back the same as the original data...

17:49 ...newer pastebins both don't have the awful ads, and have been adding nifty new features (multi-file pastes, strong syntax highlighting, edit history, even sandboxed execution in some cases)

17:49 ...anyhow, back to the question -- trying to reproduce.

17:50 ForSpareParts: nDuff, Thanks!

17:50 callen: egghead: but is it web scale?

17:53 nDuff: ForSpareParts: ...so, the jar under that POM doesn't actually include any .class files, but only other jars, with no META-INF.

17:53 egghead: lol callen, who knows!

17:53 I didn't use mongodb so probably not

17:53 ForSpareParts: Yeah, I looked at it. And I don't know much about Maven, but I'm getting a vibe that that's... not... good.

17:53 callen: egghead: you should try exposing it as a service with clustering.

17:53 nDuff: ForSpareParts: Yup.

17:53 callen: ForSpareParts: Ant isn't any better.

17:54 ForSpareParts: callen, Didn't mean Maven itself, but rather the way this particular project was packaged.

17:54 callen: egghead: Storm has conquered similar territory in Clojure. Could be a cool evening reading some code.

17:54 ForSpareParts: Terrifying. good luck.

17:55 ForSpareParts: nDuff, So, what's the right thing to do, then? Should I just shove the jars I want into localrepo?

17:55 nDuff: ForSpareParts: That, and drop a line to the maintainer.

17:55 * ForSpareParts nods.

17:56 nDuff: ForSpareParts: ...you could also consolidate their contents into one jar, and drop _that_ in as a single unit.

17:56 ForSpareParts: (taking due care re: manifest contents, of course)

17:57 lpetit: ClojureScript question: there is an :preloaded-libs option to browser repl repl-env's function. I don't really understand what it's for and when I should care (note: just beginning with ClojureScript)

17:57 ForSpareParts: nDuff, If I did that (consolidated) and dropped the jar into my lib directory, would it Just Work? Or would I still need to work it into localrepo?

17:57 nDuff: ForSpareParts: It'd still need to be in a local repo.

17:57 ForSpareParts: OK.

17:57 nDuff: ForSpareParts: That's a very deliberate design decision (to encourage reproducible builds).

17:58 emezeske: lpetit: The docstring seems to explain it: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/repl/browser.clj#L220

17:58 ForSpareParts: nDuff, I get that, yeah. Makes sense. It's just an unbelievable pain in the ass when you have a dependency that isn't in Central or Clojars...

17:58 emezeske: lpetit: Anyway, if you don't know why you should care, you probably just shouldn't care

17:59 lpetit: I think it's perfectly safe to ignore unless you're doing something pretty specific.

17:59 nDuff: ForSpareParts: *nod*. It makes a pretty compelling case for anyone running a Clojure shop to have their own Maven repo.

18:00 ForSpareParts: nDuff, Yeah. This is just me hacking, for the moment. I shudder to think what I'll have to do to make my build reproducible if I end up distributing my library...

18:01 lpetit: emezeske: not helping. I have read the docstring, and don't understand it. that's why I'm asking here. I want to understand corner cases, I don't want to wait for the crash on the wall before caring.

18:07 emezeske: lpetit: If the "crash on the wall" never comes up, you just wasted time understanding an option you'll never use.

18:07 lpetit: That's just IMO, though, feel free to dive into the source and become an expert on it!

18:08 lpetit: emezeske: do you say this because you don't want to say "no time to explain you", or because you don't want to say "I don't know" ? ;-)

18:09 emezeske: lpetit: Irrelevant.

18:09 lpetit: I hope you don't use Leiningen, you'd have to study the subtle implications of every option in this file: https://github.com/technomancy/leiningen/blob/master/sample.project.clj

18:09 lpetit: :P

18:11 lpetit: emezeske: I'm trying to understand the current limitations of what I can expect from working with a browser repl. The other point of reference I have is clojure repl. So I will try to port knowledge from one to the other, and I know there will be things that don't work. I try to make up my mind and get some feedback from the experts.

18:11 most of the time, recently, I can read docs, but not experiment.

18:12 emezeske: I'm not gonna try to stop you!

18:14 ticking: I stumbled across a curious problem, any idea how to create a open multimethod like abstraction that uses functions instead of literals and as a relationships

18:14 lpetit: wow, it's really hard for you to just say "i don't know" or "i won't help you", or just say nothing. Maybe it's just me because it's late here, I think I'd better go to bed before upsetting all the people I try to communicate with. Good bye, tomorrow will be a better day, for sure.

18:15 emezeske: I thought I did help you, by telling you that IMO you didn't need to waste time on that!

18:16 You're welcome to the opinion that I did not, in fact, help you,

18:16 * emezeske goes back to not expressing his opinions.

18:16 ticking: great I missed all the fun… ^^

18:19 ForSpareParts: So, say I have four jars -- two with some native stuff, two with Java classes that go into the same namespace -- would it be lein localrepo install file.jar namespace/file for each file?

18:20 I know the groupID is supposed to preced the '/' but I'm not sure exactly what the groupID is in this case (since there's no real repo to refer to)

18:23 lpetit: emezeske: I didn't want to be rude, but there's clearly something that upset me in your answer, so maybe I owe you an explanation: to me you're an expert. I asked a specific question, and I got "don't bother with that". I interpreted it as a kind of exclusion. I still don't know if you yourself know about it, or if you meant to say "I never bothered myself with that in a year or so of ClojureScript development, so you probably shouldn't

18:23 either". It would have helped me better.

18:24 emezeske: Don't regard me as an expert, that's your first problem.

18:25 lpetit: emezeske: so maybe not, but the rest of my explanation still holds

18:30 emezeske: lpetit: I understand that you don't find my answer sufficient. I don't feel like elaborating.

18:30 lpetit: And I'm _definitely_ done arguing with you.

18:31 I sincerely hope that you can find someone else more motivated to help you out.

18:31 lpetit: emezeske: I wish too, thanks.

18:51 technomancy: ~gentlemen

18:51 clojurebot: You can't fight in here. This is the war room.

18:51 technomancy: oops, too late

18:53 emezeske: technomancy: Where were you before? Geez.

18:53 technomancy: dropped the ball; I know

18:54 emezeske: Someone should have called the gourds on me.

18:54 ~gourds

18:54 clojurebot: SQUEEZE HIM!

18:54 technomancy: my two favourite factoids

18:54 along with the litany against cons and j.u.c.

18:55 TimMc: j.u.c.?

18:55 technomancy: clojurebot: java.util.concurrent?

18:55 clojurebot: java.util.concurrent is "When I find myself in times of trouble / Prof. Doug Lea comes to me / Coding lines of wisdom / j.u.c."

18:57 TimMc: That doesn't scan. :-(

18:57 steerio: as inside a joke as possible, but it got the song stuck in my head now nevertheless

18:58 technomancy: TimMc: perhaps you'd prefer the alternative: "When I find myself in times of trouble / Col. Sanders comes to me / Cooking breasts of chicken / KFC"

18:59 both courtesy of ted nyman of ted.io

19:01 jonasac: is there a good way to find 'bite-sized' issues in clojure ? or any project surrounding the clojure ecosystem ?

19:02 steerio: technomancy: now i'm wondering what else rhymes with wisdom

19:02 lisbon?

19:02 emezeske: jonasac: You looking to contribute?

19:02 steerio: when i find myself in times of trouble / sun and moon align with me / causing tides in lisbon / syzygy

19:02 kinda works

19:03 technomancy: heh

19:03 TimMc: technomancy: Strangely, that *does* work better.

19:05 technomancy: glad I could help?


19:05 jonasac: emezeske: well, depends on the issues at hand, very new with clojure, but got a fair bit of experience with scheme, mostly out of curiosity atm i guess

19:05 technomancy: jonasac: maybe you could help out with clojure-doc.org

19:06 though I don't know if they're doing much coding right now, but at some point the hope is to bring clojuredocs.org into it

19:06 emezeske: jonasac: Unfortunately, it is a fair bit of a PITA to contribute to Clojure itself

19:07 jonasac: emezeske: oh, how so?

19:07 emezeske: jonasac: TONS of clojure libraries are hosted on github, though, you could poke around through their Issues pages

19:07 technomancy: yeah, you'll get way more bang for your buck contributing to a community-driven project

19:07 acagle: /flush

19:07 emezeske: jonasac: You have to actually mail in a physical agreement to contribute :)

19:07 jonasac: emezeske: copyright assignment?

19:07 TimMc: Hopefully not for long!

19:08 emezeske: jonasac: Yeah

19:08 lpetit: jonasac: joint copyright

19:08 emezeske: TimMc: I will cross my fingers

19:08 TimMc: I've heard rumors of a digital CA process.

19:09 technomancy: it's not like a digital CA will suddenly mean patches to Clojure get attention though

19:09 jonasac: technomancy: thanks for the tip, looks like something worth doing in the quiet hours at work

19:09 technomancy: jonasac: a beginner's mindset is actually a huge asset when working on docs

19:10 so if you notice anything unclear, etc; even if you don't have a fix they'd probably appreciate feedback

19:10 ^ also true of Leiningen's own docs FWIW

19:11 jonasac: cool cool, ill check them out, already using leiningen, but didn't have to read docs yet, i guess thats evidence of good design :p

19:12 technomancy: heh; wonderful =)

20:14 zackzackzack: I've got a namespace that does some database side effects but doesn't really expose anything that another namespace would ever use. How can I be sure that I get that namespace to be evaluated when I start up the JVM?

20:21 gfredericks: requiring it should do that

20:21 I've never heard of a namespace being used that way

20:22 zackzackzack: Mostly it just opens up and saves a connection. The library takes care of holding onto the state so all that you have to do is call methods to start things up.

20:26 technomancy: top-level side-effects =(

20:27 gfredericks: they make technomancy sad

20:27 and they're bad for building jarfiles and things

20:36 emcl: hi clojurebot

20:36 gfredericks: ,(println "emcl: what are the haps")

20:36 clojurebot: emcl: what are the haps

20:37 emcl: hey there r u human or written in clojure

20:37 clojurebot: i wnat to talk to the official bot

20:37 clojurebot: Thanks! Can I have chocolate next time

20:38 emcl: clojurebot: take me to your leader

20:38 clojurebot: Cool story bro.

20:58 muhoo: heh, csb. clojurebot is up on all the memes.

21:49 unnali: any ideas why clojurescript compiler doesn't seem to put things in the resulting .js file in dependency order?

21:50 I've a few namespaces, some :require the others, but the order looks arbitrary, so earlier goog.require()s fail because the goog.provide() for that is later.

21:54 ohpauleez: unnali: dependencies are checked and code is ordered

21:54 are you seeing consistent errors?

21:54 and are you deploying to node.js or the browser

21:55 unnali: ohpauleez: browser. it seems related to the recompilation by lein-cljsbuild not actually being seen in the browser.

21:55 ohpauleez: Hmm

21:55 unnali: (i.e. I am being subtly mislead.)

21:55 misled*

21:56 ohpauleez: unnali: So is everything working out?

21:57 unnali: ohpauleez: not quite. I seem to have to restart the ring server for the new .js to be seen, which I swear I didn't have to do a short while ago. (but at any rate, there's no deps problems.)

21:57 maybe* no deps problems. it's still complaining it can't find such and such, and I'm trying to work out why. :\

21:58 ohpauleez: unnali: That seems odd, cljsbuild should be rm'ing the JS stuff and building from scratch

21:58 unnali: that's what I would've figured. not sure if jetty would cache an old thing? seems unlikely.

22:01 hm, I'm back to the start again. it's put the dependency of everything else right at the bottom of the .js, and a thing earlier in the piece tries to goog.require() it and fails. arrgh :|

22:02 ohpauleez: unnali: I have to run out for a little bit, but is the code on github. I'm more than happy to take a look

22:03 unnali: ohpauleez: not at this stage. will see if I can make a SSCCE out of it. (ta!)

22:15 unlink: What does clojure.java.jdbc/update-or-insert-values return?

22:57 unnali: ohpauleez: managed to get an SSCCE out of this thing. https://github.com/unnali/cljs-sscce

22:57 ohpauleez: no idea where it lies, but thankfully it's easy enough to work around once you work out what's happening.

22:59 ohpauleez: unnali: For what it's worth, I never use incremental building

22:59 unnali: any particular reason?

23:00 ohpauleez: doing a full recompilation only takes three seconds

23:00 I can wait three seconds

23:00 unnali: well, that's not a reason to *not* use incremental building. ;)

23:00 ohpauleez: unnali: As a rule of thumb incremental stuff usually is a source of many headaches

23:00 unnali: so I'm discovering.

23:01 ohpauleez: especially in a system like ClojureScript (where deps often NEED to be recalculated)

23:01 also cljsbuild will only build if a delta is detected

23:01 so when you stop lein and start it again, it won't build until you make a change

23:02 You should file this with cljsbuild's issues

23:02 unnali: ohpauleez: thanks for the tip, will do!

23:03 and yeah, I realise it'll only rebuild if there's a delta (or if the target .js is missing), hence steps 4, 6.

23:03 ohpauleez: definitely! Thank you for generating a nice simple example, always makes things easier (unnali)

23:05 unnali: not at all! :) Glad to contribute somehow.

23:27 unlink: I may be about to convince myself that developing in Jetty and deploying in Tomcat is a terrible idea.

23:28 ajmccluskey: I think you should convince yourself.

23:29 unlink: Unfortunately I like the features in Tomcat, but lack the tooling to develop in it using Clojure.

23:30 ajmccluskey: I know very little about app servers, I just think you're signing yourself up for untold pain if you've got such major differences between your development and deployment environments.

23:32 unlink: I have another gun pointed in my foot: namely, that lein ring server and lein ring uberwar have very different live request handling codepaths.

23:33 ajmccluskey: I've been using noir to start writing a web app for about a week, so I don't even fully understand that problem :p

23:35 uvtc: unlink: do you have any reason at this point to think that Jetty isn't enough? Why not just use Jetty until/unless you need something different?

23:36 unlink: uvtc: Deploying and managing Tomcat applications is far easier (at least for me)

23:37 uvtc: With tomcat, deployment = scp

23:38 mdaines: How do I chain multiple functions against a single data object? I want something like (? data fun1 fun2 fun3)

23:39 unlink: I have little interest in setting up some sort of HTTP reverse proxy facade in front of multiple Jetty JVMs whose lifecycles I manage somehow, or whatever the best practice for deploying Jetty apps is.

23:39 metellus: mdaines: -> sounds like what you want

23:40 uvtc: unlink: Ah. Ok. Thanks.

23:40 mdaines: That's what I was thinking at first, but (-> ) seems to be returning the result of the first function. I want to pass the data to each of the functions.

23:40 unlink: (I haven't used Jetty outside of `lein ring server' in many years, it might not be that bad.)

23:41 Sgeo: http://www.reddit.com/r/funny/comments/12i0t0/accepting_criticism_on_the_internet/

23:41 (Note: Link is not funny, except in the sense that Ryan thinks it's funny, which is ... a bit sad)

23:42 amalloy: unlink: jetty has basically the same features as tomcat does in that respect, if you're willing to configure it all. i imagine the amount of configuration is about the same as for tomcat, but i don't know how to use either of them properly

23:42 i know at work we have a jetty container that can run multiple distinct servers in separate classloaders

23:43 xeqi: mdaines: doto

23:46 mdaines: xeqi thanks. If I refactor for my side effects, that can do what I want. Right now I'm assembling a list of the results of multiple functions and I've got enough repetition to flag "refactor".

23:46 amalloy: mdaines: ##(doc juxt)?

23:46 lazybot: ⇒ ------------------------- clojure.core/juxt ([f] [f g] [f g h] [f g h & fs]) Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of a... https://www.refheap.com/paste/6441

23:47 Sgeo: ,(map (juxt dec identity inc) [-1 0 1])

23:47 clojurebot: ([-2 -1 0] [-1 0 1] [0 1 2])

23:47 jvj: ,()

23:47 clojurebot: ()

23:47 Sgeo: &()

23:47 lazybot: ⇒ ()

23:47 unlink: amalloy: I see. It makes sense they would support that. I wonder if they have autoDeploy and similar management features.

23:47 Sgeo: o.O

23:47 amalloy: yes

23:48 jvj: what, there's a clojurebot on the channel? that is totally boss hog! reminds me of a minecraft REPL bot I made once.

23:48 Sgeo: jvj, two of them, one of which sometimes gives incorrect results

23:48 amalloy: aw, you so harsh. they both give bad results sometimes

23:48 jvj: very interesting

23:48 Sgeo: amalloy, hmm, when does clojurebot give bad results?

23:48 amalloy: ,(java.util.Date.)

23:48 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class java.util.Currency>

23:49 amalloy: &(java.util.Date.)

23:49 lazybot: ⇒ #inst "2012-11-06T04:48:13.661-00:00"

23:49 Sgeo: o.O

23:50 Are clojurebot's bad results more obvious, though?

23:50 jvj: ,(apply (partial map vector) (take 5 (repeat (range 5))))

23:50 clojurebot: ([0 0 0 0 0] [1 1 1 1 1] [2 2 2 2 2] [3 3 3 3 3] [4 4 4 4 4])

23:50 jvj: nifty... ok I'll stop spamming now

23:50 mdaines: sweet, thanks, that nails it.

23:52 Sgeo: Watching some idiot's Clojure course, they had an error but I'm unsure why it's an error

23:52 jvj: @Sgeo what was it?

23:52 Sgeo: (def my-coll [ 1 2 3 4 ])

23:52 Said unmatched delimiter

23:52 jvj: they look matched to me.... maybe something was wrong with some previous code?

23:53 Sgeo: Sounds possible

23:53 Or maybe it's actually a > and this screen isn't showing it?

23:53 "The (map) function is somewhat of a combination of the (for) function and the (apply) function."

23:53 jvj: hey let me try that...

23:54 &(for [x (range 5)] (apply inc [x]))

23:54 lazybot: ⇒ (1 2 3 4 5)

23:54 jvj: i guess so...

23:55 Sgeo: for is not a function, and I'd consider for to be made using map, not map to be made using for

23:55 Although that latter part is more a pedagogical difference

23:55 Unless talking actual concepts rather than very basic teaching

Logging service provided by n01se.net