#clojure log - Nov 29 2013

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

0:00 bitemyapp: justin_smith: well let me know how it shakes out for you

0:00 justin_smith: sure

0:01 as far as I am concerned I am still learning, it could turn out this ends up being a failed experiment, it could be it solves a bunch of problems that I won't have to worry about any more

0:01 or more importantly, pre-empts what could be a disaster

0:04 and, if nothing else, it could replace my passwords.org.gpg with something I can look things up in using clojure

0:37 bitemyapp: justin_smith: onward and upward doesn't necessarily mean monotonically :)

0:38 justin_smith: rarely

0:38 bitemyapp: justin_smith: well, I think FP has mostly been a win so far over the course of its development

0:39 justin_smith: but I think that's only partly because it was relatively virgin territory and the alternatives were *terrible*

0:39 Raynes: bitemyapp: You use a lot of big words.

0:39 justin_smith: it had some rough days when the hardware was scarce and expensive

0:39 bitemyapp: Raynes: http://lichess.org/qoomapve lets rock.

0:39 justin_smith: though yeah, I guess the alternatives were not so great

0:44 bitemyapp: Raynes: might be the longest we've gone without a casualty.

0:46 logic_prog: let G be a directed acyclic graph, where some users are following other users. Are there better field names than "followers" and "following" ?

0:47 justin_smith: logic_prog: acyclic? how do you ensure that?

0:48 logic_prog: actually, you're right

0:48 it's not necessairly acyclic

0:48 it's a directed graph, some objects are "following" other objects

0:48 I'm wondering if there is better field names than "listeners / listening-to" or "followers / following"

0:48 justin_smith: publishers / subscribers

0:49 followers / following works

0:49 from / to

1:02 yedi: anyone have some cljs utility fns they use a lot?

1:06 bitemyapp: Raynes: little did you know, my king moonlights as an assassin.

1:07 Raynes: bitemyapp: Bawls!

1:07 bitemyapp: LOL

1:07 I was wondering if that would catch you.

1:09 Raynes: bitemyapp: Bang.

1:09 bitemyapp: Raynes: what a sack of bs.

1:09 Raynes: gg

1:09 bitemyapp: Raynes: gg

1:09 Raynes: bitemyapp: You can turn off 'time control'.

1:09 Just FYI. :P

1:09 bitemyapp: Raynes: lskdfglnkdgklh

1:13 yedi: hm, should i bother with a cljs specific dom library or just keep using google closure's/native js

1:29 bitemyapp: yedi: use Domy

1:29 Dommy*

1:35 yedi: bitemyapp: have you looked into https://github.com/lynaghk/singult at all?

1:36 bitemyapp: yedi: no but you should use Dommy if you don't have specific needs that singult addresses.

1:38 arrdem: do we have a nice way to extend a record type?

1:39 bitemyapp: arrdem: http://stackoverflow.com/questions/3589569/whats-the-rationale-behind-closed-records-in-clojure

1:39 yedi: bitemyapp: k, i think i'll go with that... i've been avoiding hiccup like templates but it seems like theyre way more useful in cljs

1:39 bitemyapp: arrdem: don't use records if you need flexibility.

1:39 arrdem: bitemyapp: I'll take that as a no

1:39 bitemyapp: arrdem: don't use protocols if you need flexibility.

1:40 yedi: I don't use hiccup-esque libraries outside of frontend/CLJS

1:48 arrdem: OH.

1:48 bitemyapp: did you get a commander on commander kill on Raynes?

1:49 bitemyapp: arrdem: no, but I did pick off the last of his non-pawn pieces with my king.

1:49 arrdem: he won due to the timer, sigh, but I was going to win. I had a second queen, he had nothing.

1:49 arrdem: oh. literal chess. I was thinking planetary annihilation

1:57 crispin: hi there people!

1:57 bitemyapp: crispin: hi

1:57 crispin: Im wondering if comeone can help me with a clojure functional approach

1:57 I can do it procedurally with refs and such, but it feels dirty

1:58 bitemyapp: crispin: so don't do that. Do you have a book?

1:58 crispin: I do. I have a few books

1:58 chas emmericks one

1:58 and some others

1:58 its a question about approach

1:58 I have two BufferStreams

1:59 bitemyapp: crispin: stop asking to ask, and just put up a refheap.

1:59 crispin: a BufferedOutputStream and a BufferedInputStream

1:59 bitemyapp: crispin: https://www.refheap.com/

1:59 crispin: whats a refheap?

2:01 https://www.refheap.com/21344

2:01 the final write/read line writes one chunk

2:01 of 1024 bytes

2:01 bitemyapp: crispin: https://github.com/dakrone/clj-http

2:01 crispin: whats the best construct to pump over something like this until its exhausted

2:01 I looked at clj-http

2:02 and at http-kit

2:02 but I need to track progress of download

2:02 bitemyapp: crispin: streaming

2:02 crispin: a very large download

2:02 thats what Im doing

2:02 bitemyapp: welp.

2:03 crispin: you could wrap it as lazy-seqs. *shrug*

2:03 crispin: ah ok...

2:03 yeah. let me try attackng it that way

2:31 dakrone: crispin: wrap it in a FilteredInputStream and override the method you want

2:57 amalloy: dakrone, crispin: if you use https://github.com/flatland/io/blob/develop/src/flatland/io/core/InputStream.java, you can reify InputStreamable rather than having to override something in a concrete class

3:22 crispin: is it ok to use clojure keywords as names? like 'count' and 'num'?

3:22 (let [count 1] (do...))

3:22 it works, but is it bad form?

3:23 clgv: crispin: it is only a problem if you want to use the function in that scope

3:23 crispin: btw. you can skuo the `do` within the `let`

3:23 *skip

3:24 crispin: cool thanks

3:25 clgv: crispin: I wouldnt do it if there are better alternatives, e.g. `n` instead of `count` ;)

3:26 crispin: bitemyapp dakrone: implemented it using recursion. https://www.refheap.com/21345

3:26 clgv: yeah, i just chenged them to byte-count and bytes-read

3:26 more meaningful now

3:28 clgv: crispin: if you are doing a lot swing gui you should check out seesaw

3:31 crispin: clgv: Im using it! Its very good!

3:31 saving heaps of time

3:31 I have to use SwingUtilities/invokeLater because proxy cant call protected methods

3:32 this is for a SwingWorker

3:33 clgv: crispin: then you probably missed the `invoke-later` function ;)

3:33 crispin: OMG yes. missed that. changing...

3:34 clgv: or wait, probably macro and not function ;)

3:52 bitemyapp: crispin: http://clojuredocs.org/clojure_core/clojure.java.io/copy

4:25 crispin_: in seesaw, how do I exit an application prematurely

4:25 (dispose! frame) closes the frame

4:25 but the app stays running

4:33 TEttinger: crispin_: System/exit ?

4:33 http://docs.oracle.com/javase/6/docs/api/java/lang/System.html#exit(int)

4:34 crispin_: TEttinger: yep very nice. Thanks

4:36 ok, another one. How do I find out (via Java Interop I suppose) what platform Im running on

4:36 Unix vs Windows etc

4:37 ok. cot it

4:37 http://stackoverflow.com/questions/3282498/how-can-i-detect-a-unix-like-os-in-java

4:37 a more clojure way? let me know...

4:43 TEttinger: crispin, I think interop is the clojure way for System stuff

4:58 oriig: #/join #julia

4:58 sorry

5:06 sm0ke: ,```y

5:06 clojurebot: (clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list (quote sandbox/y))))

5:06 sm0ke: i do not understand that?

5:07 how is ##``y ; with one more quote turns to the above

5:07 lazybot: ⇒ (quote clojure.core/y)

5:18 broquaint: Because that's the unevaluated form?

5:19 sm0ke: i mean shouldnt it be (quote (quote user/y)), like ##''`y

5:19 lazybot: ⇒ (quote (quote clojure.core/y))

5:20 sm0ke: ,''''''''''''y

5:20 clojurebot: (quote (quote (quote (quote (quote (quote (quote (quote (quote (quote #))))))))))

5:20 sm0ke: like thatif you want

5:20 broquaint: To the source!

5:20 sm0ke: hmm weird where did y go?

5:21 hold back, i am going to try synta-quotes

5:22 ,```````````y

5:22 clojurebot: #<StackOverflowError java.lang.StackOverflowError>

5:22 sm0ke: hah!

5:22 broquaint: At 6 ` I get a screen full of code :)

5:22 sm0ke: yea pretty ugly

5:23 i wonder if syntax-unqote is more than just full resolution of symbols

5:28 broquaint: I think this is where that happens - https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L816

5:30 sm0ke: does that helps?

5:31 i dont think i understand anything

5:32 broquaint: I know the feeling :)

5:32 sm0ke: you have shown me the ugly side of clojure

5:33 its a shock site for people who dont know clojure source

5:33 and wow, the indentation is shit

6:07 philandstuff: and the mix of crlfs and lfs

6:09 d11wtq: I wish you could use a regex as a predicate: (#"\d{4}-\d{2}-\d{2}" some-string)

6:10 Let Over Lambda makes a reader macro for Common Lisp to do that. Sort of.

6:12 bitemyapp: that is not a good idea.

6:23 wei__: not a fan of the clojars plugin some people are using to display the latest maven coords-- it displays an SVG which you can't copy/paste

6:24 ok, i can copy the text, but not before it opens a new link in my browser. defeats the purpose if you ask me

6:27 * ddellacosta just realized core.async has filter< and is very happy

6:31 bitemyapp: ddellacosta: they added the HOFs not too long ago.

6:32 ddellacosta: bitemyapp: I'm very pleased about the way core.async is shaping up. It's profoundly useful.

6:33 bitemyapp: ddellacosta: It's nice, I've been mostly thinking about the alternatives to channels lately.

6:33 ddellacosta: bitemyapp: I'd be interested to hear what you come up with. I still have a ways to go to wrap my head around the implications of CSP.

6:34 *in terms of wrapping

6:35 bitemyapp: ddellacosta: the implications are moderately far-reaching as long as you can actually trust it to work, which is only the case in go, haskell, clojure, and erlang.

6:35 ddellacosta: when I say alternatives, I'm talking about things like Haskell's MVars, etc.

6:35 ddellacosta: bitemyapp: btw, your help with Elm/FRP was instrumental in me understanding how this all fits together. Thanks again for that!

6:35 bitemyapp: ah, not familiar with MVars

6:35 bitemyapp: ddellacosta: glad I could be of use, did you see the wiki?

6:35 ddellacosta: !?

6:35 clojurebot: BOT FIGHT!!!!!111

6:36 ddellacosta: bitemyapp: no, sorry!

6:36 bitemyapp: MVars are an STM container type

6:36 ddellacosta: bitemyapp: link?

6:36 bitemyapp: http://clojurewiki.com/

6:36 ddellacosta: I couldn't sleep last night, so I put it up (it's git-backed) and bootstrapped some content

6:37 ddellacosta: haha, nice

6:38 I will add stuff to it as I think of it.

6:38 bitemyapp: ddellacosta: please do :)

6:38 ddellacosta: bitemyapp: just registered

6:45 bitemyapp: ddellacosta: awesome

7:41 jkj: hola

7:41 i've got some trouble wrapping my head around lamina

7:42 i want to do sql inserts in a executor pool of several threads

7:43 and i have a lamina executor-channel that does just that. i just need to figure out how to register a permanent callback

9:35 magnars: I'm using clojure.core.memoize/ttl - and I get a deprecation warning - likely coming from here: https://github.com/clojure/core.memoize/blob/master/src/main/clojure/clojure/core/memoize.clj#L327-L338 ... which says "Please use clojure.core.memoize/ttl instead." ... what am I not understanding here?

9:39 oh wait, I'm using memoize/ttl, but I'm getting a deprecation warning for memoize/lu - that it is not constructed right. But then I'm not creating any lu cache.

10:31 steerio: hi

10:32 does anyone know the reason for this weird behaviour of if/resolve/def? http://pastie.org/8517153

10:33 Bronsa: steerio: you should not use def there.

10:33 steerio: i figured that much, but there's probably an explanation behind this

10:34 Bronsa: steerio: on the third expression zazaz gets internet at compiled time

10:34 resolve runs at run time

10:34 steerio: i see

10:34 Bronsa: interned*

10:34 steerio: so by the time resolve runs, it's been interned, yet unbound. the false branch never runs.

10:34 Bronsa: well, yes

10:34 steerio: i'm trying to make my own version of defonce that can define private vars (and won't destroy this metadata on existing vars)

10:35 Bronsa: this is to allow for things like (def foo (do something with #'foo))

10:35 steerio: that makes sense

10:42 xeqi: cemerick: do I remember correctly that your using emacs again?

10:59 technomancy: xeqi: he is!

11:06 justin_smith: technomancy: leiningen question. I have a plugin that finds some data to provide to the project, what is the right way to provide that data to the project? I guess I could put it in an atom in the plugin namespace, but is there a better option?

11:06 can my project access it's own project.clj? that way I could put the data in there

11:08 steerio: justin_smith: environ (https://github.com/weavejester/environ) might help you. your lein plugin could edit the env map and environ theoretically picks it up.

11:08 it all comes down to what happens first

11:08 technomancy: justin_smith: maybe emit it into :compile-path so the project can read it from the classpath

11:08 justin_smith: ah right, I could just straight up put the stuff into the env with System/setenv too

11:08 technomancy: best prior art here is probably configleaf

11:09 steerio: your plugin editing it or lein-environ picking it up

11:09 technomancy: there is no setenv, but there are ways to do it

11:09 steerio: i believe the order in the :plugins vector is respected

11:09 xeqi: technomancy, cemerick : was wondering which version of nrepl.el / cider, and if it worked well with piggieback. trying to get an report of things working before upgrading

11:10 justin_smith: ahh, there is System/setProperty though

11:10 that could suffice

11:10 cemerick: xeqi: I'm using emacs-live, which bundles old nrepl.el. Everything works as I'd expect FWIW, though I don't think anyone should be asking me for emacs advice.

11:13 justin_smith: technomancy: OK, if I can bundle configleaf into my plugin, that would totally do it, thanks

11:13 xeqi: cemerick: ah, does M-tab cause your cpu to spike?

11:13 cemerick: xeqi: no idea what M-tab is? :-P

11:14 justin_smith: it prompts for completion

11:14 cemerick: ah

11:14 justin_smith: that happens sometimes for me after long runtimes

11:14 cemerick: emacs-live always pops completion automatically

11:14 on every keystroke

11:14 justin_smith: even worse, you would get cpu spikes from typing

11:14 if you had that bug

11:14 xeqi: hmm, and that works in .cljs files?

11:14 cemerick: something on my checklist to turn off

11:15 xeqi: yes, though it returns *clojure* results; no tools support code completion in CLJS yet, due to everyone's reliance on eval for everything tool-related

11:16 xeqi: :/

11:16 jcromart_: so I'm giving event sourcing a shot in this new system, and I wanted someone to take a look at the core code for me

11:16 https://gist.github.com/jcromartie/4ece8fbd63ef7ada6923

11:17 I want it to be as generic as possible, so that I could change to, for instance, a SQL database or Datomic

11:17 that's not really a crucial requirement though

11:18 (change to another event store, not changing away from the event sourcing model)

11:19 xeqi: cemerick: what kind of results were you expecting in cemerick/piggieback#19

11:19 lazybot: Namespaced keywords cannot be evaluated in CLJS over piggieback -- https://github.com/cemerick/piggieback/issues/19 is open

11:19 jcromart_: the data model state and the event store are tied together by the command! function, which is not really unsafe per se, so maybe that's badly named

11:19 xeqi: I've got changes to use tools.reader so I get sourcemaps all the way through, but get the same result

11:20 I'm assuming I've got to do the right thing for reader/*alias-map* still

11:27 cemerick: xeqi: Without digging into it too much, it should probably use cljs.analyzer/forms-seq

12:40 tangrammer: Hi folks, can anyone guide me (showign some sorted reading resources list ) in learning logic programming (core.logic)?

12:45 rkneufeld: seancorfield: making another round on the jdbc recipe since things have changed. How confident are you that the core namespaces will stay the same leading up to release?

12:48 amalloy: tangrammer: the reasoned schemer

12:50 jonasen: Bronsa: I'm trying to use your tools.analyze.jvm. Am I on the right track here: https://www.refheap.com/21355 ? I'm trying to analyze a file and return a sequence of ast-trees

12:50 Bronsa: is analyze-forms all I need or do I need to do something more complicated?

12:52 Bronsa: jonasen: there are a couple of issues but it looks ok

12:52 tangrammer: amalloy: thanks, I'm just reading it but … i think i need an introductory text ..

12:53 Bronsa: jonasen: one is that you cannot safely reuse the same empty-env for analyzing multiple forms

12:53 jonasen: Bronsa: ok

12:53 Bronsa: jonasen: that's a limitation due to the fact that namespaces can change at runtime

12:53 tangrammer: amalloy: i feel that I'm not understanding how to work with it

12:53 jonasen: so I'll create a new env for each call to analyze

12:54 Bronsa: jonasen: yes, that should be ok

12:54 jonasen: the other is, I'm not sure if evaluating the form *before* analyzing it will cause troubles or not

12:54 tangrammer: amalloy: and the worst thing is when i search for some fn in core.logic and i don't find it,

12:55 jonasen: Bronsa: I'm looking at what Andy's done here https://github.com/jafingerhut/eastwood/blob/try-upgrade-to-tools.analyzer.jvm/src/eastwood/analyze_ns.clj and it seems kind of complicated so I'm just trying to cut it down to its minimum in order to understand it correctly

12:56 tangrammer: amalloy: example "split"

12:56 jonasen: Bronsa: but the previous form might be a macro which is used in the following form?

12:56 that's why I call eval

12:58 Bronsa: jonasen: sure, what I'm saying is that I would (let [ast (analyze form env)] form) ast) rather than (do (eval form) (analyze form env))

12:58 err (let [ast (analyze form env)] (eval form) ast)

12:59 jonasen: Bronsa: ok. You're right. That is better.

13:01 Bronsa: jonasen: BTW if i were you, I'd add a big fat warning making people aware that eastwood evalauates the ns it's analyzing

13:03 jonasen: Bronsa: yeah. It might fire the rockets

13:04 justin_smith: side effects in ns definitions are a bad idea anyway

13:04 jonasen: as long as there are only defs in the namespace it should be ok.

13:04 and no (launch!)

13:05 Bronsa: justin_smith: it actually needs to eval the whole namespace, not only (ns ..)

13:06 jonasen: well, (def foo (launch!)) would screw you just as well :)

13:07 jonasen: Bronsa: true

13:07 Bronsa: but that's the only way to (correctly) use your analyzer? Or am I missing something?

13:08 Bronsa: jonasen: analyze does eval under the hood too

13:09 (ambrosebs's analyze i mean)

13:09 jonasen: you *could* analyze a clojure file without evaluating it but you don't get macroexpansion for macros/class validations etc

13:11 jonasen: Bronsa: and you wouldn't know if some symbol foo is clojure.core/foo or my.namespace/foo?

13:11 Bronsa: jonasen: you could tweak the macroexpander to do some magic statically recognizing defmacro/import/require et all if you really wanted though

13:11 jonasen: basically, yeah

13:12 jonasen: And then there's not much more info there than when I just read the file and traverse the s-exprs.

13:12 Bronsa: right

13:13 in the cljs case it's different, there's no runtime macros & runtime require, so file analysis is trivial

13:13 zhbfvuvabar87r: YOU MAY BE WATCHED

13:13 WARNING WARNING WARNING, WARNING

13:13 WARNING WARNING WARNING, WARNING WARNING

13:13 YOU MAYWATCHED

13:13 YOU MAY BE WATCHED

13:13 Bronsa: but for clojure code, you need it

13:13 (eval)

13:14 jonasen: well, not trivial.. you still need to find and eval the macros.

13:14 in cljs

13:14 Bronsa: yeah, but those are clojure macros not cljs macros

13:15 jonasen: Bronsa: but there is not much of a difference between compiling a file and running eval on each top level form. Right?

13:15 Bronsa: it's just a matter of (loop [forms forms file-ast []] (if (next form) (recur (next form) (conj file-ast (analyze (first form)))) file-ast)

13:16 jonasen: right

13:16 tangrammer: amalloy: i found this good resource "Relational programming in miniKanren: Techniques, applications, and implementations"

13:16 jonasen: so if your project is safe to compile it's safe to run eastwood over it... perhaps :)

13:17 Bronsa: jonasen: yes

13:18 amalloy: Bronsa: isn't that loop just (rest (reductions #(analyze %2) nil forms))?

13:18 Bronsa: amalloy: I wasn't trying to write good code, just the idea :)

13:19 amalloy: good code conveys ideas so much better :)

13:19 justin_smith: Bronsa: sorry, I shouldn't have said ns definitions, I meant "at load time"

13:19 jonasen: Bronsa: There should be a warning, but maybe not big and fat. :)

13:20 Bronsa: amalloy: I'm guilty of fogetting the existence of reductions every two days

13:20 jonasen: fair enough

13:20 jonasen: it's no more dangerous than 'lein uberjar'

13:20 justin_smith: jonasen: indeed, (def foo (launch!)) would be bad there too :)

13:23 bitemyapp: http://www.smo.uhi.ac.uk/sengoidelc/donncha/maldacht/

13:51 wei__: how do you set the isolation level for a transaction in java.jdbc?

13:55 VFe: Anyone been having issues with Light-Table? I updated it and now it throws errors connecting to projects that had no issues before.

13:55 yedi_: if anyone is bored and wants to give advice/feedback on some clj/cljs core.async code, take a look at https://github.com/yedi/chatter

13:56 it's one of my first projects and if anyone has suggestions for doing certain things better, lmk

13:59 amalloy: yedi_: https://github.com/yedi/chatter/blob/master/src-clj/chatter/chat.clj#L20-L21 is a multithreading problem; line 16 could pr-str once instead of doing it for every chatter

14:01 yedi_: amalloy: why is it a multithreading problem?

14:02 amalloy: yedi_: what if someone else swap!s the atom in between lines 20 and 21?

14:02 xificurC: I'd like to let a user input one character an read it in as a character, how can I do that the easiest way?

14:02 justin_smith: xificurC: do you want them to just type one letter, or do you want them to enter the clojure literal for a character?

14:03 xificurC: justin_smith: just one letter or number

14:03 yedi_: amalloy: the log would just get sent to the client twice, (right now im stupidly sending the entire log and rendering it each time so it should still work)

14:03 amalloy: i guess a better thing to do is to make l20-21 more transactional?

14:03 xificurC: justin_smith: let's say from 1-26 and from A-z

14:04 justin_smith: xificurC: somewhat out of date, but this should be a start http://stackoverflow.com/questions/3225025/single-character-console-input-in-java-clojure

14:04 amalloy: yes, an easy replacement is (send-log (swap! log conj user-msg))

14:05 yedi_: sweet, thanks

14:05 (inc amalloy)

14:05 lazybot: ⇒ 79

14:05 justin_smith: xificurC: you don't need clojure contrib, you should use 1.5.1 version of clojure not 1.1.0, but the jline part should be the same

14:07 xificurC: justin_smith: thanks

14:07 justin_smith: https://github.com/clojure-cookbook/clojure-cookbook/blob/master/local-io/console/read-unbuffered-keystroke/read-unbuffered-keystroke.asciidoc

14:07 more info on that link

14:07 dnolen: xeqi: have you tried your patch with austin?

14:07 justin_smith: including the fact that it won't work with lein repl, you'll need lein trampoline repl instead

14:10 xeqi: dnolen: the brepl source maps?

14:10 dnolen: xeqi: yes

14:11 xeqi: it is going to require changes in both austin and piggieback. I've got it all working locally, but was waiting till cljs changes finish before making PRs for them

14:11 basically piggieback need tools.reader

14:11 and austin needs to add :source-map true to its repl-env, and change the cljs-build call slightly to ignore that like the cljs browser repl does

14:12 I can publish this all as forks if interested

14:23 allsystemsarego: Hi all, I'm trying to solve the seating arrangement problem with core.logic, but I get an unexpected ClassCastException, this is my REPL session: http://lpaste.net/96380 Help?

14:24 `cbp: I don't know about core.logic but == is used for number comparison

14:25 maybe you want = or some other core.logic stuff?

14:25 allsystemsarego: in core.logic == means unification

14:25 `cbp: oh well I cant be of help then :P

14:29 allsystemsarego: mayne I'll try l/== then, instead of just ==

14:30 yup, sure enough

14:30 justin_smith: allsystemsarego: you could also (:refer-clojure :exclude [==]) in your ns form

14:31 unless you really think you will need the other version of ==

14:31 allsystemsarego: justin_smith, this being a repl session, does that advice still hold?

14:32 justin_smith: you can still define an ns in a repl

14:32 though it is less likely you need it :)

14:32 allsystemsarego: let me copy/paste that in my repl

14:32 justin_smith: well :refer-clojure goes in the ns form

14:33 but you can use (refer-clojure ...)

14:33 allsystemsarego: oh ok

14:34 also: is there a better way to accomplish this in clojurescript:

14:34 (js/goog.exportSymbol "cljs.core.enable_console_print_BANG_" enable-console-print!)

14:35 justin_smith: allsystemsarego: I am trying it in the repl, it is not doing what I expect

14:35 ahh, the trick is to define a new namespace

14:36 (ns user2 (:refer-clojure :exclude [==])) ; this works

14:36 if you tried that with an existing ns, it silently fails to do what it should

14:38 allsystemsarego: justin_smith, also, what if I want 2 operators, as in (refer-clojure :exclude [== !=])

14:38 that fails

14:39 justin_smith: you need a quote on the vector

14:39 allsystemsarego: ok thanks

14:39 justin_smith: but it needs to be called at the time of ns creation to really work anyway

14:39 so you should create a new ns (like I showed with user2 above)

14:39 allsystemsarego: but the one you showed me initially works as I expected

14:40 but I'll try with user2 as you said

14:40 justin_smith: wait, the (:refer-clojure ...) one?

14:40 ,(:any-key 'anything)

14:41 clojurebot: nil

14:41 justin_smith: that is just silently not doing its thing

15:09 tangrammer: amalloy: that's the path to clojure logic I'm searching for (clojure/core.logic ( friedman/reasoned-schemer (byrd/relational-programming-in-miniKanren)

15:09 jcromart_: ring-serve doesn't seem to actually work, when following the directions in https://github.com/mmcgrana/ring/wiki/Interactive-Development

15:09 I have always written my own stuff to set up a serve

15:10 server

15:10 but following these directions yields when requiring ring.util.serve ClassNotFoundException org.mortbay.log.Logger

15:10 err, yields that exception

15:12 https://gist.github.com/jcromartie/f95d94731ab0ca811a54

15:14 I even put [ring-serve "0.1.2"] in my regular old project.clj :dependencies, since I read somewhere that [:profiles :dev :dependencies] wouldn't do the trick

15:15 justin_smith: jcromart_: I just start nrepl from within ring

15:16 I luanch it in the handler init

15:16 also: jcromart_ the directions have examples for leiningen 1 and 2

15:16 [:profiles :dev :dependencies] is for leiningen 1

15:17 err, never mind that

15:18 jcromart_: justin_smith: huh, interesting

15:19 tommo: i'm kinda new to clojure, what is the typical dev pipeline, for example once i've written some code and started up a repl

15:19 is there a way to 'hotswap' my changes into the existing repl or do i have to relaunch another?

15:19 also: jcromart_: does lein classpath show jetty-util-6.1.25.jar?

15:19 llasram: tommo: In fact, the most common work flow depends on it :-)

15:20 tommo: When you recompile a namespace (usually via editor integration) all of your existing definitions are replaced and most "normal" use just picks up the new stuff automatically

15:20 justin_smith: tommo: you can (require 'some.ns :reload) to get any changes into the repl

15:20 or just evaluate new definitions

15:21 jcromart_: also: jetty-util-7.6.8.v20121106.jar

15:21 tommo: cool, ty llasram and justin_smith

15:22 jcromart_: tommo: I like to send a buffer (file) to the REPL using CIDER in Emacs with the C-c C-k command

15:23 tommo: nice to know jcromart, i'm using emacs too

15:24 justin_smith: jcromart_: I am not sure which it does, because I don't use that workflow, but send file and send buffer are not the same - send file would have it load what you last saved, send buffer would have it load the current state of the buffer even if you have not saved (even if the buffer is a buffer with no file)

15:24 also: jcromart_: lein deps :tree shows me https://gist.github.com/also/1e9393f8cfab1bbf774e

15:25 jcromart_: " cider-load-current-buffer

15:25 that's what C-c C-k is

15:25 which does depend on saving the file, yes

15:26 arrdem: ,(meta #_[1])

15:26 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: core$meta>

15:27 jcromart_: also: and you can (require 'ring.util.serve) with that setup?

15:27 arrdem: what exactly does the #_ reader annotation do? looks like it's a single form comment...

15:28 llasram: arrdem: Essentially. Causes the reader to discard the next form

15:28 justin_smith: arrdem: yeah, completely eliminates the next object (balanced form) as if it were not present

15:28 ,(+ #_(can't add this) 1 1)

15:28 clojurebot: 2

15:28 arrdem: herm. okay, good to know. thanks!

15:28 justin_smith: har har

15:28 also: jcromart_ yes. looks like you've got a newer/wrong version of org.mortbay.jetty/jetty-util from somewhere

15:29 justin_smith: arrdem: showing the thing it comments doesn't need to be valid, but it uses balancing rules to eliminate it

15:29 ,(+ #_(can't #add this) 1 1) ; though it still does need to be readable

15:29 clojurebot: #<RuntimeException java.lang.RuntimeException: No reader function for tag add>

15:31 jcromart_: also: from requiring ring 1.2.1 it would appear

15:34 also: ah, i only added ring-serve

15:35 i don't know if that dependency specifically is the problem, that's just the jar where the missing class was

15:52 dnolen: xeqi: ok cool, was just double checking, patch looks cool will give it a spin soon

16:01 cYmen: Okay, I'd like your thoughts on a common problem.

16:01 At least I assume it is common.

16:02 When I have a function that takes whichever parameter I want and I realize that I would like to apply a transformation to the result, what should I do?

16:03 This happens to me when doing 4clojure problems all the time and just wrapping around more functions just feels odd.

16:03 Maybe it's not common but a 4clojure thing. Your thoughts?

16:03 https://www.refheap.com/0d19e5eb17acdd75e4a5840d5

16:04 This is the problem I just did before and after I realized I had forgotten to turn the result into a set.

16:04 Is it just me or does this end up pretty cryptic considering how simple the idea is?

16:05 jcromart_: cYmen are you looking for ->

16:07 cYmen: I feel like saying no but I should probably just try and use that excessively to get a feel for it.

16:08 justin_smith: as-> is also great for that kind of thing

16:09 Rhymor: ,(doc as->)

16:09 clojurebot: "([expr name & forms]); Binds name to expr, evaluates the first form in the lexical context of that binding, then binds name to that result, repeating for each successive form, returning the result of the last form."

16:10 cYmen: hm

16:10 justin_smith: ,(as-> 1 ☕ (inc ☕) (* ☕ 3) [☕ ☕ ☕])

16:10 clojurebot: [6 6 6]

16:11 justin_smith: of course in real usage you wouldn't use ☕ as your placeholder

16:11 cYmen: I wouldn't? How do I show off my unicody prowess then?

16:11 Rhymor: :)

16:15 cYmen: Googling for ->> really doesn't work to well.

16:15 ,(doc ->>)

16:15 clojurebot: "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."

16:16 justin_smith: cYmen: there is a search engine for that, symbolhound

16:16 try searching ->> clojure on symbolhound

16:17 cYmen: just finds a lot of stackoverflow

16:17 not the docs, though

16:17 `cbp: hello

16:24 cYmen: Note to self "wrong arguments (0)" maybe you have too many parentheses...

16:24 amalloy: justin_smith: as-> was designed to read better inside of a -> context: (-> 1 (as-> x (inc x) (dec x)))

16:25 there it reads like "okay, take the thing we're currently threading, call it x. then..."

16:25 justin_smith: amalloy: I find myself using it instead of -> if the positioning ever changes

16:26 Raynes: justin_smith: Congrats, you invented let. :P

16:27 justin_smith: heh

16:28 amalloy: ,(-> [1 2] (as-> [x y] [(inc y) (dec x)] [y x]))

16:28 clojurebot: [0 3]

16:29 amalloy: looks kinda like a shell game

16:29 justin_smith: indeed

16:30 cYmen: It does?

16:34 amalloy: cYmen: the x and the y are swapping places every step and you have to guess which ends up where, see

16:35 (-> '[win lose lose] (as-> [a b c] [b a c] [c b a] [a c b] [b c a])) ;; where's the win?

16:35 seangrove: amalloy: Yeah, interesting.

16:36 ,(nth (-> '[win lose lose] (as-> [a b c] [b a c] [c b a] [a c b] [b c a])) 1)

16:36 clojurebot: win

16:36 seangrove: boom.

16:36 The rebinding at each step is definitely interesting.

16:46 allsystemsarego: Hi, I'm attempting to solve a logic puzzle with core.logic and it goes into an endless loop, here are the details: http://lpaste.net/96384 The puzzle I'm trying to solve is here: http://www.brainbashers.com/showpuzzles.asp?puzzle=ZJLX

16:49 dnolen: xeqi: inline source map patch landed - THANK YOU for this, it's pretty sick! :)

16:53 sweet, sweet patch, http://github.com/clojure/clojurescript/commit/f02775ebe78ef787f128e37f164763ce492927e8

16:57 bbloom: cool

16:57 seangrove: xeqi: Yes, thank you, looking forward to seeing this in action

16:58 Tiny patch too, that's great

16:58 bbloom: allsystemsarego: try using core.logic.fd

16:58 allsystemsarego: your non-relational projections might be a big part of the problem

16:58 allsystemsarego: you'll get much better perf out of fd too

16:59 seangrove: $seen sritchie

16:59 lazybot: sritchie was last seen quitting 2 days and 23 hours ago.

16:59 allsystemsarego: bbloom, thanks for the hint, I'll learn about fd and try again

16:59 Raynes: seangrove: Ain't nothing but a quitter.

17:00 mercwithamouth: so...domina vs enfocus?

17:00 seangrove: mercwithamouth: Dommy?

17:00 Raynes: I wish I could quickly hack the bot to make it say "Raynes was last seen winning 5 seconds ago"

17:00 amalloy: you mis-spelled whining, bro

17:00 bbloom: allsystemsarego: https://github.com/clojure/core.logic/wiki/Features#clpfd

17:00 seangrove: Raynes: With a 0.1 chance of "bi-winning"

17:00 mercwithamouth: seangrove: hmm really?

17:01 seangrove: mercwithamouth: Certainly my favorite, by far. Simple, fast, well made.

17:01 That said, enfocus' approach is obviously totally different, so if you're looking for a totally different philosophy, it's not a bad source of ideas

17:01 egosum: Hi y'all, pinging from KY. Any great extended finite state machine libraries in Clojure?

17:02 mercwithamouth: well i guess i'll have to play with both. starting with dommy, thanks

17:02 bbloom: egosum: state machines are pretty easy to make in clojure. what are you trying to do?

17:02 egosum: bbloom: i want an extended one that basically confirms to the UML spec

17:03 I've written a few libraries in other langs for them already, but it's always nice to see what people are doing

17:03 I haven't found one in Clojure that's very powerful (which is great! I want to make one :)

17:03 bbloom: egosum: do you have an example in another language you could share? i'm not sure what you could possibly be looking for

17:04 egosum: I haven't made my open source yet, but e.g. https://github.com/ifandelse/machina.js is a pretty good one

17:05 bbloom: egosum: you want core.async

17:06 egosum: bbloom: I don't understand how core.async solves the same problem? Could you explain?

17:07 bbloom: egosum: your "why would i use it" section discusses several use cases that you can address better with other mechanisms than explicitly coded state machines

17:07 egosum: the first thing discussed is callbacks/deferred, which is *precisely* where core.async is dramatically superior

17:07 the common pattern is a "go loop"

17:08 (go (loop [ ...] ...)) ; this is your state machine, where the loop variables are the state

17:08 you alt on inbound channels for your state transitions

17:09 RE: persistence, you can simply respond to a message to serialize by prn-ing the loop control variables to a file and using them as the initial values when you deserialize

17:09 you can build very robust message bus systems too

17:10 egosum: Some of them, sure. That's not my library, to be clear. core.async, from my understanding, can't really be used model the same problems that an extended FSM can (though it uses a FSM internally). That also doesn't model an eFSM very well, nor is it representable as "data" as nicely.

17:10 bbloom: basically everything in that "why" section gets better & easier w/ first class channels and multiplexing

17:10 egosum: That library may have been misleading. It's used for coordination, but eFSMs in general are not always just for that

17:11 bbloom: sure, there are LOTS of uses for state machines

17:11 egosum: I'm interested in FSMs as a way to describe logical processes. Along the lines of traditional UML FSMs.

17:11 core.async doesn't seem as amenable for those use-cases

17:11 CaptainLex: How can I get Clojure to recognize advanced Unicode characters like in strings?

17:12 egosum: Unless I'm missing something (and I haven't used with core.async much)

17:12 bbloom: the question is: do you want to explicitly reify your states and transitions

17:12 core.async will derive states & transitions for you from straight-line code

17:12 if you want to data-drive the compilation of a state machine, then yeah, it's not a good fit

17:13 cYmen: How do I type a newline in the REPL instead of evaluating?

17:13 egosum: Yeah, I'm very much interested in data-driven FSMs. I intend to graph them, display them live, etc.

17:15 bbloom: dnolen: http://www.scala-lang.org/news/2013/11/29/announcing-scala-js-v0.1.html

17:15 dnolen: bbloom: yep saw that

17:15 bitemyapp: it produces some really messy output though.

17:15 Fay is much cleaner.

17:15 `cbp: cYmen: whats your client?

17:15 cYmen: emacs

17:16 bitemyapp: c-j?

17:16 seangrove: We need more mutation in the dom. Not sure how we're getting by with the current status quo.

17:16 `cbp: C-j

17:16 seangrove: I'm almost able to get things to work sometimes by accident, clearly that shouldn't be possible.

17:16 cYmen: thanks :)

17:16 dnolen: bbloom: tried it on their example project w/ optimizations - OOMed after eatng up 600mb of RAM

17:16 bitemyapp: seangrove: I had to do something involving mutation and recursion in Python the other day, I eventually gave up. lol.

17:17 dnolen: totes normal for Scala. Gotta bump that Xmx

17:17 seangrove: Wow, very cool to see scala.js. Seems like they took the same closure approach.

17:18 Good omens for js as a compile target!

17:18 bbloom: dnolen: yeah, i couldn't get anything but OOM a few months ago last we discussed

17:19 dnolen: seangrove: agreed

17:21 cYmen: oooh my first NullPointerException.

17:26 allsystemsarego: why do I get this http://lpaste.net/96387 when requiring clojure.core.logic.fd in the repl?

17:27 bbloom: allsystemsarego: (require '[clojure.core.logic.fd :as fd])

17:27 justin_smith: CaptainLex: can you give me an example it does not handle?

17:27 allsystemsarego: oh, thanks

17:29 CaptainLex: justin_smith: Sure. In the REPL, (str "Hello! " " 2013") outputs "Hello! ?? 2013"

17:29 justin_smith: CaptainLex: in my usage, I have had no usage with unicode in strings, symbols, or keywords

17:30 dnolen: allsystemsarego: having seen some of your trouble might I suggest working through a thorough Clojure book/tutorial first? Your core.logic'ing will be a lot more fun productive if you do :)

17:30 CaptainLex: justin_smith: 2013 is what happens when it gets put on my website

17:30 justin_smith: CaptainLex: your irc client does not send whatever unicode you are trying to send

17:30 CaptainLex: Hahahaha oops

17:31 It's the copyright symbol

17:31 allsystemsarego: dnolen, point taken

17:31 justin_smith: ,(str "Hello! ©" " 2013")

17:31 clojurebot: "Hello! � 2013"

17:31 justin_smith: your terminal is likely messed up?

17:31 seangrove: ,(str "Hello! " " © 2013")

17:31 clojurebot: "Hello! � 2013"

17:31 seangrove: Yeah, works here just fine

17:31 dnolen: allsystemsarego: just a bit of advice, core.logic alone is challenging enough as it is

17:31 CaptainLex: Haha stupid KVIRC is not transmitting those for me

17:31 justin_smith: ##(str "Hello! ©" " 2013")

17:31 lazybot: ⇒ "Hello! © 2013"

17:32 justin_smith: lazybot has his unicode set up properly

17:32 CaptainLex: But it's not just at the REPL

17:32 justin_smith: what OS?

17:32 CaptainLex: Arch Linux. It also happens when it processes HTML strings through Ring requests

17:32 justin_smith: like I said, I have had no issues with unicode in strings, symbols, or keywords in my code

17:33 CaptainLex: Interesting

17:34 justin_smith: are your content type headers matching the string format?

17:35 http://sprunge.us/aJfH <- from my repl

17:35 CaptainLex: justin_smith: The processing all goes on in the backend. Huh. Interesting

17:36 justin_smith: if your content type headers you send to the client are wrong, it will often not display unicode properly

17:36 I don't know what the repl issue would be

17:37 is the terminal you run the repl in usually good about displaying this sort of thing?

17:38 dnolen: bbloom: bitemyapp: bumping memory allowed it to succeed - however it took 164 seconds to compile.

17:38 bbloom: dnolen: what did you compile with it?

17:38 dnolen: bbloom: sbt

17:38 CaptainLex: justin_smith: Well, it can display it when I type it!

17:38 seangrove: dnolen: The link mentioned it had support for incremental compilation, presumably it should be better after the first time.

17:38 bbloom: "with it", not "it with"

17:39 oh, you just compiled the compiler?

17:39 CaptainLex: justin_smith: echo handles it fine

17:39 bbloom: like you didn't even run the compiler let?

17:39 justin_smith: hmm

17:39 dnolen: bbloom: no the example app they suggset trying

17:39 bbloom: oh ok

17:39 justin_smith: CaptainLex: maybe your jvm is buggy or misconfigured? java is usually pretty good about handling unicode properly

17:40 and clojure just piggybacks on java for all that stuff

17:40 CaptainLex: justin_smith: That was my next thought. Arch has a tendency to require poking around sometimes, but I certainly haven't done anything to the default install

17:40 justin_smith: I have seen none of these issues on my ubuntu with openjdk or the sun jdk, fwiw

17:40 except when I sent the wrong content type header for a page

17:40 dnolen: bbloom: that said it does generate a reasonable amount of code for "hello world" that is their example app so they got their deps issues sorted out.

17:41 bbloom: dnolen: cool, but you can't draw that conclusion from hello world. try using a tree or something :-)

17:41 CaptainLex: justin_smith: I'll just ignore it until I deploy to Heroku. If it's still a problem there, I'll file a bug report with the universe :P

17:41 dnolen: bbloom: heh, yeah :)

17:42 justin_smith: CaptainLex: lol. If you have the patience for it you could start up a free tier amazon ec2 instance, and verify everything works when you ssh in

17:43 http://instantserver.io/ <- took me about 4 minutes to get a clojure repl on instantserver last I tested it out

17:43 free, no account needed, etc.

17:43 n/m, it is off line

17:44 dnolen: seangrove: I don't think incremental compilation helps advanced optimizations much - 138s for the second compile

17:44 seangrove: it might also be particular bad on my machine, not sure if I have enough RAM to do this properly

17:45 seangrove: the standard lib is 20mb, so the Closure Compiler has to churn through that

17:46 20mb of generated JS

17:46 justin_smith: CaptainLex: what does (System/getProperty "file.encoding") return in your repl?

17:47 it should return "UTF-8"

17:47 CaptainLex: It did :(

17:48 justin_smith: well that rules out that issue

17:48 seangrove: dnolen: How's that compare to cljs' stdlib?

17:48 dnolen: seangrove: 700k

17:48 seangrove: dnolen: We need more MB's to catch up, it seems.

17:48 Else how will anyone take cljs seriously?

17:49 dnolen: seangrove: :)

17:49 justin_smith: what happens when you do (spit "copied-file" (slurp "file-with-unicode")) do the files cmp as the same?

17:49 seangrove: But yeah, it seems like the amount of code core.logic + core.async generate is enough to make gclosure struggle... 20MB of stdlib is pretty big.

17:52 xeqi: dnolen: hurray 2 cljs patches in one day

17:52 dnolen: seangrove: that hasn't been my experience, cold compile of core.async, core.logic tests ~30s, recompiles <4secs

17:53 seangrove: w/ advanced optimizations

17:53 xeqi: I'll see about submitting the ones needed for austin/piggieback to cemerick in the next couple days

17:53 dnolen: on my wimpy MacBook Air 4gb of RAM 1.7ghz

17:54 xeqi: great work, CLJS easily has one of the best source map stories out there all of a sudden :)

17:55 seangrove: xeqi: Looking forward to that

17:56 dnolen: Didn't you send out a warning on the ml about using core.async and core.logic together in cljs due to possible compilation problems?

17:57 dnolen: seangrove: oh you mean core.async & core.match

17:58 seangrove: yes putting complex core.match expressions in core.async is gnarly - core.async should maybe be enhanced to avoid transforming forms that have :not-transform metadata attached

17:58 :no-transform

17:59 seangrove: dnolen: What's the upper-limit on code size for safe compilation?

17:59 Purely academic curiosity, we're nowhere near that.

17:59 dnolen: seangrove: I'm not aware of anything really

18:00 bitemyapp: seangrove: make a javascript code generator and find out :P

18:00 andyf: Bronsa: ping

18:00 seangrove: bitemyapp: That'll go under the category of pending side-projects labelled "neither useful nor particularly fun."

18:01 bitemyapp: seangrove: ¯\_(ツ)_/¯

18:01 Bronsa: andyf: pong

18:02 andyf: I just saw your comment on TANAL-9, I'm going to check that out

18:02 andyf: Bronsa: Man, you have been awesome at bug fixing. Thanks. I just wanted to let you know I added a comment to TANAL-9 with some additional info on the exception I am seeing.

18:02 Cool. Thanks. I am probably at the point of not knowing how to set up the env arg to analyze correctly, but my problem could lie elsewhere.

18:03 dnolen: tbaldridge: http://dev.clojure.org/jira/browse/ASYNC-40, something to think about - not sure how hard this would be

18:04 tbaldridge: dnolen: then you could never to a >! or <! inside a match?

18:05 dnolen: tbaldridge: updated the patch to clarify what I want to avoid

18:05 tbaldridge: (match [x y ...] ;; <-- async works here)

18:05 andyf: Bronsa: Some good news -- my latest mods to Eastwood allow it to analyze 32 contrib libraries with no errors and no obviously incorrect warnings. There are 7 contrib libraries with errors that I don't know what to do about yet, but I am still investigating those.

18:05 dnolen: tbaldridge: (match [x y] [1 2] ... async works here ...)

18:05 danielsz`: cemerick: Not AFK yet?

18:06 dnolen: tbaldridge: but (match [x y] [1 2] ;; <-- async leave this alone! ...)

18:06 cemerick: danielsz`: only here in spirit

18:06 seangrove: cemerick: We all appreciate your presence.

18:06 danielsz`: cemerick: haha.

18:07 tbaldridge: dnolen: let me think about it. my not happen until I integrate tools.analyzer into core.async

18:07 dnolen: tbaldridge: I don't expect that to work in the near term - but I think something like this important for other "serious" macros

18:07 danielsz`: cemerick: Was going to ask when or how austin will deal with the new sourcemap functionality... But I can't ask a spirit, can I?

18:08 dnolen: tbaldridge: cool to hear you're going to integrate tools.analyzer - I assume will make reasoning about the Clojure code more displined

18:09 cemerick: danielsz`: that's xeqi's ball to run. I'll keep an eye out, but no guarantees until mid-December.

18:09 Bronsa: andyf: ok now I can reproduce, I'll see if it's a tools.analyzer issue or if there's something wrong with your setup and let you know

18:09 tbaldridge: dnolen: that's the plan, it'll take a re-write of about half of ioc_macros, but I plan on doing it sometime "soon"

18:09 Bronsa: andyf: in the meantime, thanks again for the help, you've been really helpful

18:09 andyf: Bronsa: The sentiments are mutual :)

18:10 danielsz`: cemerick: Awesome. Austin + sourcemaps, that's going to be so cool.

18:11 dnolen: tbaldridge: I'm assuming using analyzer will also make source maps more sane

18:13 cored: hi

18:14 http://www.loper-os.org/?p=42 the comments in this have a flame war which let me thinking

18:14 in a lot of stuffs, like is Clojure selling itself as modern LISP it's seems that to be LISP it should be LISP all the way down, is that correct?

18:14 coventry: How's the starcraft clone coming along? Found any assistants?

18:14 dnolen: cored: loper-os is good mostly for laughs

18:16 cored: dnolen: :-)

18:16 dnolen: but is because he is telling the truth or what?

18:16 dnolen: cored: there's hardly anything resembling rhyme, reason or computer science discussed therein - just emotional garbage

18:17 cored: dnolen: I see, he post a lot of links which back up what he is saying

18:18 justin_smith: cored: citations don't back up hyperbole and vitriol

18:18 danielsz`: You should regard loper-os as a character. He's fucking brilliant some of the time. Sometimes he doesn't make sense.

18:19 The Clojure rant is just the expression of an old Lisp smug weenie not wanting to open his mind to new perspectives. Happens all the time.

18:19 cored: would like to take as much knowledge from him as I can, but every 6 words is bad things for Clojure

18:20 danielsz`: but if you are the one saying that, he can say the same a new Clojure smug weenie -> because he says that Clojure is not a real LISP

18:20 danielsz`: Forget about this rant. It doesn't make sense.

18:20 dnolen: cored: if you get your opinions about Lisp from like loper-os, not much we can do for you

18:21 cored: best to go to the real sources, like LISP BOOKS, and come to your own conclusions

18:22 xeqi: danielsz`: I'll make some PRs for austin/piggieback this weekend, and will probably publish some forks until cemerick is back

18:22 seangrove: It's pretty awesome to see tools.analyzer getting integrated into libraries, seems like an extremely powerful avenue

18:22 andyf: seangrove: Which libraries is it being integrated into?

18:23 cored: dnolen: I'm taking it slow, kinda new to the entire thing. But as I'm a follower of Michael Fogus I just found out that blog from him and start to read

18:23 dnolen: I'm reading functional programming for object oriented programmers

18:23 danielsz`: xeqi: That is so awesome.

18:23 xeqi: danielsz`: have them all working locally

18:23 tbaldridge: cored: I'm much less concerned with if Clojure is a real Lisp, and more concerned with building cool things.

18:23 Bronsa: andyf: looks like a classloader issue ouch

18:23 seangrove: andyf: tbaldridge mentioning integrating it into core.async for example

18:23 cored: dnolen: it's seems that apart from learning about the language I have to make some room to learn about the community and the history behind it

18:23 tbaldridge: good point

18:24 tbaldridge: cored: if some awesome feature of Clojure makes it "not a lisp" what to I care?

18:24 cored: tbaldridge: but what I was concerned about was that if that could make a limitation for it, I think that's what this loper-os guy is talking about

18:24 dnolen: cored: Lisp has an amazing history, I love it. And the books, they are some amazing Lisp books nearly all of them applicable to Clojure in one for or another

18:24 tbaldridge: cored: for example, the fact that "pure lisps" don't have hash-map literals is a major flaw in lisp, not a feture

18:25 justin_smith: using linked lists as if they were an associative data structure is an abomination

18:25 andyf: Bronsa: Not sure I can be of any help there, at least not given my current state of knowledge on the subject.

18:25 justin_smith: nested linked lists at that

18:26 cored: oh

18:26 I found something interesting

18:26 http://abcl.org/

18:26 isn't this the same idea as Clojure?

18:26 danielsz`: Nobody in his right mind disputes the fact that Clojure is a Lisp, as much as Lispiness goes.

18:26 dnolen: cored: no, Common Lisp is a very different Lisp dialect

18:27 justin_smith: cored: no, it wants to actually be common lisp, and so doesn't integrate as nicely with its vm

18:27 andyf: cored: I know less about abcl than Clojure, but I believe abcl is an attempt to implement Common Lisp using Java as the implementation language. Clojure has significant differences from Common Lisp.

18:27 danielsz`: Clojure vs ABCL came up recently on the CL G+ group: https://plus.google.com/+DaveTenny/posts/5ekuTDTnTWj

18:32 cored: neat

18:32 * seangrove looks at danielsz`'s link expecting bile

18:32 cored: I have to read so much stuff, quite exciting

18:33 seangrove: cored: Also good to do stuff at some point.

18:34 Great way to explore for some of the qualitative aspects of languages and their ecosystems

18:34 cored: seangrove: I have to build a list of things to do

18:35 danielsz`: /nickname danielszmulewicz

18:35 cored: btw, this catch my attention yesterday (def third (fn [list] (nth list 2))) and (def third (fn [list] (first (rest (rest list)))))

18:35 the author of the book ask to build that function mine wsa the first implementation but his solution was the second one

18:36 justin_smith: cored: (defn third [[_ _ three]] three)

18:36 cored: he teached the nth function so I just use it, but it's catch my attention on why he did the solution the way he did it and not use a more clear way

18:36 justin_smith: eh?

18:36 justin_smith: don't know about that syntax

18:36 :-(

18:36 justin_smith: ,((df third [[_ _ three]] three) (range))

18:36 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: df in this context, compiling:(NO_SOURCE_PATH:0:0)>

18:36 justin_smith: er

18:36 ,((fn third [[_ _ three]] three) (range))

18:36 clojurebot: 2

18:36 seangrove: hah

18:37 justin_smith: cored: destructuring, it matches the structure of the input collection

18:37 seangrove: ,((fn third [[first-thing second-thing third-thing]] [third-thing first-thing second-thing]) (range))

18:37 clojurebot: [2 0 1]

18:37 seangrove: Maybe better without the range...

18:38 ,((fn third [[first-thing second-thing third-thing]] [third-thing first-thing second-thing]) [:a :b :c])

18:38 clojurebot: [:c :a :b]

18:38 coventry: What do people think of this use of atoms? Abomination, or just an ugly compromise? https://github.com/coventry/troncle/blob/master/src/troncle/macroshka.clj

18:38 justin_smith: seangrove: nicely illustrative, though the name third is no longer helpful :)

18:39 seangrove: s/third/destructive power!

18:40 justin_smith: cored: destructuring can be don in fn (and thus defn) let, loop, doseq, for etc. and is often a good way to reduce verbosity / increase clarity of how you are using the input

18:40 cored: it can also destructure maps

18:40 ,((fn [{x :a}] (* x x)) {:a 12})

18:40 clojurebot: 144

18:47 cored: justin_smith: I'm lost :-(

18:48 justin_smith: are you talking on the implementation in particular on why he did what he did in his solution ?

18:48 seangrove: cored: Don't worry about it, it's a cool feature but nothing you need to worry about

18:48 justin_smith: cored: the destructuring clause matches the structure of the input

18:48 seangrove: cored: He was just showing you a cool alternative approach to the implementation of 'third'

18:48 cored: seangrove: oh ok

18:48 justin_smith: got it

18:48 thanks

18:49 have to study it

18:49 justin_smith: also, I'd say nth is better in clojure than (first (first (rest x)))

18:49 err first rest rest

18:49 cored: :-)

18:50 justin_smith: not that it does something different, but it is clearer

18:50 the compiler likely generates the same output from either

18:50 coventry: justin_smith: No, it calls a java method.

18:50 ~nth

18:51 clojurebot: Titim gan éirí ort.

18:52 justin_smith: coventry: even on a list or lazyseq?

18:52 seangrove: Would be cool if clojurebot could link to the source of clojure/clojurescript functions

18:52 coventry: seangrove: There is a syntax for that, but I have forgotten it.

18:52 justin_smith: $source nth

18:52 lazybot: nth is http://is.gd/hLMyIH

18:53 justin_smith: in the repl there is (clojure.repl/source foo) also

18:53 `cbp: ,(source nth)

18:53 clojurebot: Source not found\n

18:54 justin_smith: in your own repl, the bots don't do it

18:54 coventry: I suppose the hotspot compiler might end up with similar bytecode after a while.

18:54 seangrove: Nice, now it just needs to know how to keep track of the latest definition and also syntax for the cljs implementation

18:55 coventry: Seriously, if anyone could take a look at that macroshka macro and tell me a better way to reconstruct the macroexpand-all from recursive macroexpansions, I would be grateful. It's ugly, but I haven't been able to think of a better way.

18:57 justin_smith: coventry: I took a quick look, it was hard reading for me though that could be because my brain is momentarily on vacation for all I know. I'll let you know if I fail to find it comprehensible, or find it comprehensible enough to offer meaningful feedback.

18:57 seangrove: coventry: it's all over my head as well

19:01 coventry: Thanks for looking, justin_smith, seangrove. The idea is to use a macro which wraps itself around the evaluable components of any form it is passed, so that all macroexpansions are seen during evaluation, and the full macroexpansion can be reconstructed from them. But I couldn't think of a better way for the macro to communicate the macroexpansion components forward to the reconstruction phase without storing them in a tree of atoms.

19:02 Basically, it's trying to do the same thing as riddley.walk, but without touching compiler internals.

19:02 justin_smith: it seems like each branch could be replaced with the expanded version as the form returns - or does this mess up the order of evaluation or something?

19:06 coventry: Hmm, if that worked, things in the leaves would be evaluated many times, in that case, but it would be a lot simpler. And it should all be side-effect-free anyway...

19:06 Thanks, I'll think about it.

19:06 justin_smith: you could use memoization to avoid the leaf re-evaluation, no?

19:07 or would that break things by preventing intended side effects

19:09 coventry: The reason for this recursion is that a macro only gets expanded accurately in its evaluation context. So for each form, you have to make sure that the forms containing it are evaluated. E.g. (defmacro n [t] (println (macroexpand t) (-> 1 inc))) (let [-> (fn [& args] args)] (n (-> 1 inc)))

19:09 justin_smith: ahh right

19:10 coventry: riddley.walk fixes this by faking the local bindings. I was trying to find a way to do it which cooperates with the compiler instead.

19:19 justin_smith: regarding the nth conversation above, yeah, nth is actually much faster on vectors (though it may be a toss up for something like getting the third item)

19:43 d11wtq: As a TDD/BDD guy coming to clojure, I'm exploring my options for test frameworks. One thing that's important to me is the ability to nest tests, like in RSpec. Is midje basically the best thing out there in that regard? I've just read a blog about a project that moved from midje to clojure.test... are there any strong opinions around the two options out there?

19:48 Oh, clojure.test does nesting too. (testing ...) looks nicer than (deftest ...). The tests just read better and feel more natural to write.

19:48 yedi_: +1 to d11wtq's question -- oh paralysis of choice

19:52 coventry: d11wtq: You might look at the logs for this channel. That post was discussed here in the last week or so.

19:52 d11wtq: coventry: thanks. Is this channel on irclogger or something?

19:52 coventry: http://clojure-log.n01se.net/

19:53 d11wtq: coventry: thanks!

19:54 Looks like http://clojure-log.n01se.net/date/2013-11-25.html

19:56 Yeah, I agree with the "too much magic" thing. Given clojure.test offers the same nesting, I'll give it a shot.

20:01 technomancy: d11wtq: you can put calls to c.t./is in any old function

20:01 so the regular tools you use to abstract functions work fine on tests too

20:01 in fact, deftest just creates a function

20:02 d11wtq: Yeah. Simpler is better. Although deftest feels too xUnit-style to me, which I don't like so much.

20:04 technomancy: yeah, a better way to do it would be (defn ^:test mytest [] ...)

20:04 too late for that, but the difference is very minor

20:10 justin_smith: d11wtq: the way I wrote the caribou database backend tests was basically to write a function that runs a db through the hoops, and call it with each database in turn

20:10 that way I didn't need to duplicate code excessively, and I did not need to interleave the various backends

20:10 the function of course contained various calls to test/is

20:14 technomancy: the one problem with an c.t/is called from multiple places is the line number becomes less helpful

20:14 justin_smith: true

20:14 that's what the testing form is for

20:15 technomancy: I like to factor out a bunch of predicates and share logic there, keeping the is in the deftest

20:15 but c.t/testing helps too

20:15 justin_smith: my actual test is more like (deftest mysql-test (with-db mysql (testing "mysql and creation" (creation-test mysql)) ...))

20:16 then all the test/is calls are in creation-test

20:16 but I see the value of keeping is in the deftest too, but I opted not to

20:18 technomancy: I should hook up C-x ` into clojure.test; that would be bangin'

20:18 justin_smith: hmm, never mind. I misremember or it changed since then - I think patchwork refactored it

20:19 https://github.com/caribou/caribou-core/blob/master/test/caribou/test/model.clj#L907

20:25 emaphis: /banlist

20:28 general-general: I've got a question. How do I alter a clojure.java.io/writer function to accept a url, I'm finding it hard to find an example.. I think I'm supposed to put as-url in there somewhere... not sure where.

20:28 ?

20:28 I forgot the question mark.

20:29 justin_smith: call io/input-stream on the url

20:29 or are you trying to write to the url?

20:29 general-general: Yes, trying to write.

20:29 justin_smith: I think you'll do better to use clj-http.client for that kind of thing

20:30 general-general: Essentially trying to do something like post a "like" for a comment on a forum.

20:30 justin_smith: yeah, with clj-http.client you can just specify the data for the body as a map

20:30 general-general: Shame, I was hoping I could do it using just 'the core'.

20:30 justin_smith: and you don't even need to mess with streams

20:30 you could

20:30 it would just be more hassle than it is worth, in my experience

20:31 general-general: OK.

20:31 I wonder would the source of clj.http-client tell me.

20:31 justin_smith: unless you think using streams and sockets and io/copy is fun - in that case go for it, you are sure to learn a lot

20:31 but it is not likely to get you the easiest, the most correct, or even the most performant result

20:31 it could

20:32 general-general: Thanks Justin.

20:35 justin_smith: general-general: https://github.com/dakrone/clj-http/blob/master/src/clj_http/core.clj#L199 this looks like the meat of it in http.client

20:35 mostly using apache libs

20:35 for clojure code, that is epic in size

21:33 yedi_: ugh this fixed header is so fucking huge, why do ppl do this: http://www.nearform.com/nodecrunch/how-node-js-has-revolutionized-the-mailonline#.Upk4JWRDtvZ

21:41 yedi: 155k lines of java to 4k lines of clojure??? that has to be bullshit

21:43 dsrx: "lines of code" isn't the best metric of code complexity or even length

21:44 Raynes: yedi: Well, if it was crappy Java and good Clojure...

21:44 But I feel like they left something out.

21:44 Like the 100k lines of mustache templates that they included in that count or something :P

21:44 dsrx: also w/ judicious use of macros you can end up with insanely tight java->clojure replacement

21:44 probably

21:45 Raynes: yedi: More importantly, I bet they could replace those 4k lines of Clojure with 4 lines of J.

21:45 :P

21:46 bitemyapp: yedi: I don't think it's bullshit, I've seen some ridiculous Java codebases.

21:46 it's definitely an uncommon/extreme case, and there was probably a second system effect involved where they were able to cut away cruft, but it's still possible.

21:48 coventry: I think this micro-services architecture idea is interesting and slightly scary. (Dozens or hundreds of little servers, each just a few hundred LOC, all talking amongst themselves.) Anyone have experience with something like that?

21:49 It's mentioned in the article just before the "Journey to Node" section.

21:49 scottj: "155k lines of Java rewritten in 4k lines of Java" 10 day ago 0 points

21:52 coventry: Hmm "...about 4000 lines of Clojure (accompanied by a large number of Moustache templates shared by Node)." I wonder if that's where the java bloat was.

21:53 bitemyapp: coventry: I've worked on SOA and micro-SOA deployments.

21:53 coventry: they're as much about formalizing inter-dependence into contracts/APIs as anything else. I like them because they make your services language-independent, enabling teams to use the tools they actually like.

21:55 SOA gives the use of things like Clojure a huge leg-up because then your components are reusable APIs instead of java libraries that have to be language native across a variety of services.

21:55 can make scaling easier to pull off when there's an abstraction layer between provider and consumer too

21:56 coventry: bitemyapp: How many services? Were you releasing multiple versions of the same API simultaneously, as Fred George recommends? Were interactions between servers any harder to debug than systems with fewer, larger components?

21:57 bitemyapp: coventry: depends on which company, but in one case it was like 5-6 main services and a group of smaller ones. Multiple versions of the API simultaneously, yes.

21:57 yedi: Raynes: i guess the joke is that J does fucking _everything_ ?

21:57 Raynes: yedi: The joke is that J is an extremely compressed language.

21:57 bitemyapp: coventry: harder to debug depends on how you think about it. If you do it amateur-hour style and have to manually pull in logs from multiple services, that sucks, but it's supposed to incentivize you to setup centralized logging, search, and analytics (as a service)

21:57 Raynes: yedi: You can write bitemyapp's personality in two lines of j.

21:58 bitemyapp: coventry: I found that I preferred searching and grouping log messages in a centralized interface to grepping (or just plain trying to find) log files on naive deployments

21:58 coventry: bitemyapp: Cool. What tools did you use to aggregate the logs?

21:58 bitemyapp: coventry: elasticsearch and a custom dashboard.

21:59 coventry: servers creating log events emitted JSON that could be filtered by server name, service name, timestamps, etc.

21:59 they emitted JSON to haproxy fronting the ES nodes.

22:00 coventry: bitemyapp: Thanks.

22:01 bitemyapp: coventry: part of the impetus towards this SOA-esque setup was to move away from the really *really* bad default target for most companies where you have a bunch of backend and frontend services independently mutating a MySQL/PostgreSQL database.

22:01 yedi: ahh i love this channel

22:01 bitemyapp: coventry: it's easier to debug SOA log messages than it is to play "whodunnit" with a global mutable data store.

22:03 coventry: bitemyapp: How does SOA mitigate the problems of having a centralized DB?

22:04 bitemyapp: coventry: independent data stores, single responsibility infrastructure, easier to know why/how something happened or cahnged.

22:04 coventry: it's infrastructural decomplection.

22:05 I'm slowly getting my company to do the same thing with their various Python/MySQL/MongoDB/PostgreSQL things running around. Luckily they're a sharp bunch and knew to make things accessible via API rather than database mutation, so they're half-way there.

22:07 coventry: bitemyapp: Oh, "API rather than database mutation" makes it clear. Thanks.

22:07 bitemyapp: coventry: this is important because as you scale, you can start to enforce/provide guarantees at the API level, like, "this operation is idempotent...this operation is commutative" etc etc

22:07 these constraints/guarantees are necessary for sanity, hygiene, and scaling.

22:08 unless you *enjoy* being in a systems-level tarpit >:)

22:09 coventry: Yeah, sounds like a huge win.

22:09 bitemyapp: coventry: it can be, you still need to write good documentation so your coworkers don't get pissed.

22:11 coventry: bitemyapp: Right, well in the organizational structure George is talking about, I guess you make your service useable or it doesn't get used and you get voted off the island.

22:11 bitemyapp: coventry: yeah, which is appropriate.

22:11 coventry: that's another reason I like SOA, technologies/infrastructure move forward on a more evolutionary and somewhat less legacy-oriented basis.

22:12 francis_wolke: There is a paper (co?)authored by Oleg Kiselyov on creating a miniKanren logic programming system in haskell that didn't work out as well as the implementation in scheme. I'm not sure of the name or where look. His site didn't help me out at all. Could someone give me a hint here? Right now I'm looking at his papers one by one. :/

22:13 bitemyapp: francis_wolke: narrowing down Oleg papers is an NP hard problem.

22:13 Oleg is the bane of Comp sci graduate students everywhere. "Oleg already did it."

22:14 coventry: One link: http://scholar.google.com/scholar?q=author%3AOleg-Kiselyov+minikanren+haskell&btnG=&hl=en&as_sdt=0%2C33

22:17 gfredericks: hunter3

22:18 * gfredericks coughs quietly

22:19 bitemyapp: gfredericks: hunter2

22:21 gfredericks: oh right that was it

22:47 technomancy: oleg uses eshell

23:01 francis_wolke: technomancy: yay?

23:02 beppu: How do you guys debug your clojure code?

23:02 Take something like this for example: https://gist.github.com/beppu/7715205

23:08 `cbp: you can use something like http://clojurewiki.com/Tracing or printlns :)

23:08 with anonymous fns you can try giving them names as if you have an error in one of them it will tell you which one

23:11 beppu: `cbp During the ->>, how would I println an intermediate value?

23:11 (based on the gist I posted earlier)

23:12 `cbp: define a function that prints a value and then returns a value

23:12 then just plug it in

23:12 beppu: ok

23:12 xeqi: &(->> :x (#(doto % println)))

23:12 lazybot: ⇒ :x :x

23:12 `cbp: that returns the same value

23:13 *

23:13 clojurebot: * is just for when you are lazy and sloppy

23:13 `cbp: clojurebot: botsmack

23:13 clojurebot: clojurebot evades successfully!

23:13 `cbp: :(

23:13 beppu: doto is new to me

23:14 coventry: Hey, bitemyapp, thanks for the mention of troncle on the wiki. :-)

23:14 beppu: that's a cool idiom. thanks `cbp and xeqi .

23:14 bitemyapp: coventry: thanks for making useful things.

23:14 `cbp: its for java interop mostly thats a weird ass use of it

23:15 bitemyapp: coventry: you can return the favor by writing stuff on the wiki :)

23:16 coventry: I'll keep an eye out for places where I can contribute.

23:16 xeqi: beppu, `cbp : true, I think debug output like this is the only non interop object mutating code I use it for

23:16 bitemyapp: coventry: libraries needs letters below "D" ported over.

23:17 boring work but needs done.

23:17 akurilin: I can't wait for the new Alcest album.

23:18 Gonna buy it so I can use the CD in my car.

23:18 coventry: bitemyapp: yeah, that calls for a script.

23:18 bitemyapp: coventry: Ordinarily I agree but I'm curating stuff that should be elided or added in the course of the transfer.

23:21 I'm not going to stop anybody that adds stuff back in, but when they do, I'll probably comment on it.

23:21 which is something I've already done.

23:21 I'd rather trend in the direction of more information rather than less.

23:22 but the elisions are tended to spare me explaining that something is old or not very good.

23:22 not that that's necessarily why somebody's library isn't in there yet.

23:37 coventry: bitemyapp: It's just a dumb transformation, but it might save you a little work: https://www.refheap.com/21363

23:38 bitemyapp: coventry: thank you very much

23:39 coventry: It was easy: https://www.refheap.com/21364

23:46 bitemyapp: coventry: http://clojurewiki.com/Libraries ding a ling.

23:46 you used Python? you're a terrible person :P

23:47 coventry: BeautifulSoup is the Right Tool for that job. :-)

23:47 bitemyapp: coventry: true, just found it amusing :)

23:48 francis_wolke: dnolen: While working at the the cljs-repl the representation of the eval'd data structures gets printed - even when using `def'. When working with large amounts of data, this can cause slowdowns in the development experience (Emacs freezes). What is the intended end-game function of the cljs-repl? EG: is printing defs and the js representations of function defnitions desirable? What are the tradeoffs involved?

Logging service provided by n01se.net