#clojure log - Jul 23 2013

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

0:07 clj_newb_2345: I want to insert a "# " instead of every string.

0:07 I am trying: init.init=> (clojure.string/replace "a\nb\nc\n" #"\\^" "# ") "a\nb\nc\n"

0:07 this does not work (clearly)

0:07 what am I doing wrong?

0:09 brehaut: what do you think #"\\^" is supposed to match?

0:10 it looks like it should be matching two slashes before the start anchor, which is probably unlikely to match anything

0:10 clj_newb_2345: I'm an idiot

0:10 I should use #"^"

0:10 brehaut: (^ doesnt by default match new lines)

0:11 clj_newb_2345: however, that matches _start of string_ rather than _start of line_

0:11 then, if I use "\n", I match the start of all lines _except_ the first line

0:12 brehaut: ,(clojure.string/replace "a\nb\nc\n" #"(?m)^" "# ")

0:12 clojurebot: "# a\n# b\n# c\n"

0:12 brehaut: the (?…) stuff at the start is a java regexp flag to enable multiline regexps

0:12 (ie, so that it interprets new lines as new lines)

0:12 you want to go look at the docs for java.something.Pattern

0:13 ,(class #"1")

0:13 clojurebot: java.util.regex.Pattern

0:13 brehaut: that class

0:13 clj_newb_2345: wtf

0:13 how did #"1"

0:13 get clojurebot to say java.util.regex.Pattern ?

0:13 brehaut: i thought it was pretty clear: i passed it to the class function

0:15 clj_newb_2345: ,(class #"0")

0:15 clojurebot: java.util.regex.Pattern

0:15 clj_newb_2345: ,(class 10)

0:15 clojurebot: java.lang.Long

0:15 clj_newb_2345: ,(class "hello ")

0:15 clojurebot: java.lang.String

0:15 clj_newb_2345: I get it now, you're asking Clojure: what is the Type of this object>

0:16 brehaut: specifically, asking for the class; jvm has primatives which dont (directly) have classes but still have types

0:16 the call to class will box the primative, so its not strictly the same type as the value itself

0:34 futile: look, you..

0:35 brehaut: elipsis has three dots and they arent not perioids

0:35 err are not

0:36 Keith_: I am running into some severe difficulty setting up a working clojure environment. I have tried IntelliJ Idea 12, Eclipse Indigo and even LightTable. Everything works fine with the core installation... Yes, they all allow you to evaluate (+ 2 3) but once I try to set up dependencies to introduce new libraries, frustration sets. Most recently in Eclipse, I was able to update the leiningen...

0:36 ...dependencies to include the library (I couldn't reliably accomplish this in IntelliJ). Every time I attempt to access a function from the library I receive the following message : CompilerException java.lang.RuntimeException: Unable to resolve symbol: fmap in this context, compiling:(NO_SOURCE_PATH:1:1)

0:38 Does anyone have any ideas on how to overcome these difficulties? I have spent weeks trying to obtain a stable environment so that I could set about exploring and learning the language.

0:40 dnolen: Keith_: and this is after requiring the lib w/o error and making sure the REPL is in the correct ns?

0:41 brehaut: Keith_: did you install leiningen from the website, or via an OS package manager?

0:42 Keith_: I think I installed leiningen from the website...

0:42 brehaut: good. os packages seem to be about a thousand years old

0:43 Keith_: I am not sure I required the library this time, I have before... Let me try that now

0:44 I had been focusing on IntelliJ, = because I like their environment but I have had little luck. I just moved back to Eclipse tonight just to try something different...

0:45 dnolen: Keith_: IntelliJ is definitely one of the less popular Clojure envrionments - Eclipse your best bet for IDE

0:45 Keith_: OK thanks for that heads up :)

0:46 SO I tried to execute the namespace command and :use the libraries and I received CompilerException java.lang.ClassNotFoundException: jsr166y.ForkJoinPool, compiling:(clojure/core/reducers.clj:56:21)

0:46 brehaut: are you using reducers in a java 6 enviroment?

0:47 Raynes: I'm more interested in seeing the actual code he is executing.

0:47 Keith_: I updated to Java 7 because the library is using reducers

0:47 OK ...1 min

0:48 (ns uncomplicate.fluokitten.articles.getting-started-test

0:48 (:use [uncomplicate.fluokitten jvm core test])

0:48 (:use [midje.sweet :exclude [just]]))

0:48 brehaut: refheap.com

0:49 noidi: in Eclipse & Counterclockwise, you have to (1) require the library in your namespace file's ns form, e.g. (ns my.ns (:require [hiccup.core :refer :all])), (2) (re-)load the file in your REPL environmenty (I think the default shortcut is Ctrl+Alt+S), (3) switch the REPL to the namespace with Ctrl+Alt+N

0:51 if you skip (2) or (3), either the library doesn't get loaded, or you'll be in a namespace that can't see the library's namespaces

0:51 Keith_: OK... I will try that... I also checked my java version and I am not seeing the 7. I am pretty sure I ran the test app which said I was using java 7...

0:52 java -version

0:52 java version "1.6.0_45"

0:52 Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-11M4406)

0:52 Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01-451, mixed mode)

0:52 kpm@imacs-MacBook-Pro~$

0:52 brehaut: Keith_: i believe its possible to use reducers from java 6 if you install the appropriate library (that is described in the reducers docs or blog post or something)

0:53 Keith_: OK... Thanks

0:53 dnolen: Keith_: I would just install JDK 7 for OS X.

0:53 Keith_: Let me try the three steps above

0:54 dnolen: Keith_: you need to install forkjoin nothing will work otherwise for more recently version of Clojure - JDK 7 simplifies that

0:54 Keith_: BTW, it seems that I am required to load these commands from a file as opposed to typing directly in the REPL?

0:55 Yes that is why I upgraded to 7, but I cannot see evidence of that

0:55 dnolen: Keith_: you need to set the JVM via System Java Preferences

0:55 brehaut: mac os x might require you to specify which installed jvm should be used

0:55 Keith_: Oh boy

0:56 OK... let me see... They have to fix these things...

0:56 dnolen: Keith_: open up System Preferences, goto Java, click Java menu, click View, select Java 7

0:56 Keith_: OK let me do that

0:57 Seems that it says I am running 1.7 That's the only runtime available

0:59 dnolen: Keith_: hrm, you say this works at command line - maybe your Eclipse install is borked?

1:00 smnirven: hey folks, anybody got some experience with clojure.java.io & clojure.data.csv that can help me out?

1:00 noidi: maybe you should try out your environment with a library that does not depend on reducers (and thus fork/join)?

1:00 futile: So um, reduce doesn't work well when trying to seed it with -> or ->>

1:00 Keith_: No... At the command line it says I am running 1.6.0_45-b06-451-11M4406, but System Preferences is saying 1.7.0 build 25

1:01 noidi: futile, what do you mean?

1:01 futile: noidi: (-> (new-cart) (reduce add-item! items)) ;; not what I wanted

1:02 noidi: ,(->> [1 2 3] (map inc) (reduce +))

1:02 clojurebot: 9

1:02 futile: noidi: seed meaning, the default item

1:02 noidi: sig would be like (add-item! cart item)

1:03 Sometimes I want -n>

1:03 Which would let you pass positional index per row

1:04 noidi: ,(-> 1 inc (as-> x (reduce + x [2 3])))

1:04 clojurebot: 7

1:04 dnolen: Keith_: that seems very strange

1:04 noidi: futile, you can use as-> to bind the threaded value to a name

1:08 futile: Like: (-n> "N = %d" [0 .toUpperCase] [1 (.format my-locale 42)])

1:09 noidi: oh not bad, thanks

1:13 noidi: yeah that's pretty awesome, thanks

1:17 noidi: futile, np :)

1:19 futile: Oh

1:21 So test2 is ideally the no-magic way to test. And what's the opposite of magic, but science! And what's science's way of testing? Experiment! That should maybe be the new name of test2.

1:21 But what a dumb name :(

1:26 r0bglees0n: futile: names are hard? =P

1:26 futile: r0bglees0n: oh

1:26 r0bglees0n: i released a project called barney before

1:26 and yeah it was named after the dinosaur

1:27 even worse? it was for IPC.

1:27 "sharing is caring".

1:27 futile: HA

1:27 r0bglees0n: was it for Ruby?

1:27 r0bglees0n: it was

1:28 it was actually just a weird crazy DSL

1:29 futile: r0bglees0n: sounds like Ruby

1:29 r0bglees0n: yeah, but this was weird even for ruby

1:29 futile: Oh man.

1:30 You may be my worst enemy.

1:30 r0bglees0n: haha

1:30 futile: :)

1:30 r0bglees0n: dont hate me, it was an experiment :D

1:30 * futile high fives r0bglees0n

1:30 futile: Oh did I tell you about that one lib I wrote?

1:30 r0bglees0n: which lib

1:31 futile: http://rubydoc.info/gems/omnomnom/0.0.1/frames

1:31 r0bglees0n: i can haz method missing?

1:31 futile: Nope.

1:31 define_method or something

1:32 42 noms max

1:32 Source is long lost (i.e. deleted for everyone's sake) so can't be too sure.

1:32 I think one fork used method_missing

1:32 r0bglees0n: define_method is a nice performance tweak

1:32 i can see it being webscale

1:33 futile: Oh man r0bglees0n.

1:33 We may have to battle.

1:33 r0bglees0n: :D

1:34 rishda: oh, it exists? neat.

1:34 futile: whatever.

1:38 rishda: Gotta solve the hard problems now.

1:39 Like how to remove test duplication without making a mess, etc.

1:46 Yay, figured that one out.

3:33 anildigital: Hi Friends.. I want to start using emacs for playing with clojure .. can somebody suggest quick start how to setup emacs for clojure?

3:37 turtil: anildigital: i cant, but lighttable is really good? i hear a lot of people suggest emacs is good for Clojure development, but i would like to know why people say that, prior to Lighttable i used Sublime Text and Vim, and both of those natively supported everything i needed *shrug*

3:38 anildigital: turtil: I attended seveval sessions by ppl who do clojure development.. they used Emacs.. there were lots of advantages because of Emacs... as clojure syntax is similar to lisp

3:39 turtil: I have been using emacs for quite a long time now.. I think.. it would take less time for me to dive into clojure.. once I know what emacs scripts/plugins support clojure well

3:39 turtil: anildigital: hmmmm, for me all i really needed was syntax highlighting, maybe im missing something important

3:39 SegFaultAX: turtil: LT is nowhere near production stable for most people used to more mature editors/IDEs

3:39 anildigital: turtil: with Emacs.. you can eval your code at any time..

3:40 turtil: anildigital: i see, thats a feature i would have missed then

3:40 anildigital: Anyone here can point to a post where I can start using Clojure with emacs

3:40 turtil: SegFaultAX: i certainly agree with you, but it is fun to play with (for me at least)

3:41 * turtil doesnt get to use clojure at his job, so clojure remains a hobby lang :(

3:41 * anildigital looks like this one http://clojure-doc.org/articles/tutorials/emacs.html

3:41 anildigital: turtil: where do you work?

3:41 probably can pm me :)

3:41 SegFaultAX: turtil: (not= fun-to-play-with ready-for-production-usage)

3:42 turtil: SegFaultAX: i take it you dont like lighttable :P

3:43 anildigital: SegFaultAX: what editor do you use for Clojure?

3:44 vijaykiran: anildigital: you might want to start with emacs-live setup - https://github.com/overtone/emacs-live

3:45 anildigital: vijaykiran: okay thanks..

3:45 vijaykiran: I already have emacs installed.. and using it..

3:47 vijaykiran: anildigital: ah - okay if you have customized it already, then installing clojure mode + nrepl should be enough to get started.

3:47 anildigital: vijaykiran: nice

4:02 ucb: anildigital: you just need nrepl, clojure-mode and leiningen. The first two are available via packages (provided you're running a recent emacs)

4:03 anildigital: ucb: yep... now installed packages.. now installing leiningen version 2

4:04 ucb: anildigital: once you've done that, create a new clojure project (just $ lein new foobar), open the project.clj file and in that buffer: M-x nrepl-jack-in

4:04 anildigital: that should give you a repl

4:06 anildigital: ucb: yep... looks like these steps are not that difficult

4:07 ucb: hope those are the steps.. and I don't have to do anything extra.. and I get all emacs godness for clojure

4:09 ucb: anildigital: I think that should get you going

4:19 augustl: gfredericks: did you figure out this one? https://gist.github.com/fredericksgary/6058783

4:38 learner_: keith_: If you are using Intellij Idea. You can do this from your lein project. 1. lein pom (which generates pom file) 2. mvn idea:clean idea:idea -DdownloadSources=true (you need to have maven installed & path is configured for this) 3. Install La clojure plugin. Hope this helps

4:38 anildigital: ucb: now when I do nrepl-jack-in, I see this error in *nrepl-error* buffer

4:38 clojure.lang.Compiler$CompilerException: java.lang.IllegalAccessError: doc does not exist (NO_SOURCE_FILE:0)

4:38 I opened project.clj and then did nrepl-jack-in

4:39 ucb: anildigital: I've never seen that before! Can you try $ lein repl in the project directory?

4:39 anildigital: ucb:

4:41 ucb: anildigital: ?

4:41 ddellacosta: how do exit a recur loop when I get an exception?

4:41 anildigital: ucb: okay.. I did lein repl.. it started fine

4:42 but when I do that from nrepl-jack-in from clojure .. I see the error

4:42 ucb: pasted error here http://pastebin.com/5iJm0zkS

4:42 ucb: ddellacosta: shouldn't the exception break the loop for you?

4:43 ddellacosta: ucb: not if I catch it.

4:43 ucb: ddellacosta: then don't recur in your catch?

4:43 ddellacosta: ucb: I'm recurring outside the catch.

4:45 ucb: anildigital: try $ lein repl and then M-x nrepl in emacs. When it asks you about the host, just use the default (localhost) and then put the right port in (you should see a message like "nREPL server started on port 50346" when you $ lein repl)

4:45 anildigital: ucb: any idea about the exception?

4:45 ucb: ddellacosta: yeah, so, again, if you don't recur inside your catch clause that should be it? (perhaps I'm missing something)

4:45 anildigital: ucb: okay trying that

4:47 ddellacosta: ucb: 1) I recur outside the catch clause. If I don't I wouldn't be able to recur until I caught an exception. 2) I'm catching the exception, because if I didn't, the whole thing breaks (not catching the exception), and the exception is telling me at what point I want to stop doing what I'm doing (in the recur loop).

4:48 anyways, the whole thing smells so I'll try to rework it. I don't think there's a good solution to this without significant magic, and I suspect there is a smarter/easier way to do it.

4:48 ucb: ddellacosta: I see. You're using exceptions for early stopping I reckon? Perhaps catch at a higher level then? Dunno, hard to say without understanding your intentions and seeing some code.

4:48 anildigital: ucb: I get same exception in that way too

4:48 java.lang.IllegalAccessError: doc does not exist (NO_SOURCE_FILE:0)

4:48 ddellacosta: ucb: yeah, the problem is that if I catch at a higher level then I can't execute any logic on the exception. *sigh*

4:49 again, I think I'm thinking about it all the wrong way. this part of Java interop doesn't work so nicely w/Clojure, IMHO

4:51 ucb: but, thanks for helping, btw. :-) Just trying to explain the problem to you made me realize how much it smells.

4:51 ucb: ddellacosta: heh, cool. Would be interested in finding out how you reworked it.

4:52 anildigital: strange. Perhaps something wrong with your nrepl.el?

4:52 anildigital: ucb: what is this doc it is trying to acces

4:52 ucb: anildigital: I haven't a clue I'm afraid :(

4:53 anildigital: it may be worth trying with emacs-live which is known to work

4:53 anildigital: just to rule things out

4:54 ddellacosta: ucb: what I'm doing is using subs to get a chunk of text n chars before and n chars after a given word (sub-string). So I was getting exceptions when I overran those bounds. My first solution was to try to iteratively loop through…hence the exception stupidity. While explaining it to you, I realized that it would be MUCH simpler and shorter to just test the length of the string and adjust my subs indexes based on that (duh). ;-)

4:55 ucb: ddellacosta: are you trying to get a window around a token? Why not tokenise the entire sentence first and then treat it as a seq of tokens?

4:56 ddellacosta: ucb: it's not worth it to add that kind of complexity to the system. It's really just a dead simple way to get a chunk of summary text around a specific substring (which I already have the index values for). It's "good enough."

4:56 anildigital: ucb: also.. when I am in scratch and I do nrepl-jack-in .. I don't get that error.. it comes only when.. I have project.clj open in buffer and I do nrepl-jack-in

4:56 ucb: if you could guess by that

4:57 ucb: anildigital: huh, interesting

4:57 ddellacosta: ucb: ironically, it's tokenized at other stages in the system...

4:57 ucb: ddellacosta: I reckon the code might end up looking simpler than you suspect. I normally dread dealing with indices, etc.

4:57 ddellacosta: too many opportunities for off-by-N, overrunning, etc.

4:58 ddellacosta: that should be a hint ;)

4:58 vijaykiran: anildigital: doc might be the clojure.repl/doc function

4:59 anildigital: AFAIK nrepl-jack-in looks in the current dir/buffer. So the scratch won't start nrepl

4:59 anildigital: ah it may be because .. the project I generated was with lein 1.x and not 2.x

4:59 ddellacosta: ucb: …I dunno, you may be right, but it's *really* not worth it in terms of work when I can simply do this to get a stupid chunk of text for the view. YAGNY and all that. And the point in the system where it is tokenized is pretty far in the back-end, so it's not worth doing it there (i.e. pulling out a summary based on tokens vs. string indexes and storing it for use on the front-end) either.


5:01 ucb: ddellacosta: your call; I'm just suggesting that because that's how *I'd* do it. Now that you mention that the rest of the system operates like that, I'd reinforce the suggestion because no surprises and all that :)

5:01 also, I've no idea what YAGNI stands for

5:01 borkdude: You ain't gonna need it

5:01 ucb: I see.

5:02 ddellacosta: ucb: I mean, it's one function vs. an entire sub-system for tokenization, all just to display a small summary of search results found on the front-end.

5:02 ucb: ddellacosta: another thought: treat the string a seq of chars, drop a bunch, take some, reduce with str again. There's your window.

5:02 anildigital: ucb, vijaykiran success

5:02 ucb: anildigital: |o/

5:03 ddellacosta: ucb: I have an even simpler solution, which I'll refheap and show you in a minute. :-)

5:03 although I'm intrigued by the take/reduce thing

5:04 ucb: ddellacosta: cool; let me see if I can do the drop/take thing

5:09 ddellacosta: ucb: here is my solution: https://www.refheap.com/16845

5:09 vijaykiran: anildigital: cool!

5:10 ucb: ddellacosta: simple! :)

5:10 ddellacosta: ucb: I have 40 chars hard-coded in, but that could be whatever I suppose.

5:10 ucb: yeah, works well enough. ;-)

5:10 ucb: ddellacosta: sure; you can also add "..." to the beginning and end of the result.

5:10 ddellacosta: ucb: ah, yeah, I'm doing some prettifying like that in another place--chopping off everything up to the first space, and adding the "…" like you suggest.

5:11 ucb: thanks for talking through it with me, sincerely! It was helpful to get my brain going.

5:11 ucb: ddellacosta: no worries; give me one sec. to finish polishing mine :)

5:11 ddellacosta: ucb: yeah, I want to see what you came up with...

5:15 ucb: ddellacosta: quick unpolished actually: https://www.refheap.com/16846

5:16 ddellacosta: yours is simpler/nicer and probably faster

5:16 ddellacosta: ucb: not by too much. neat!

5:17 ucb: yours is more flexible in that you can pass in the length. That's a cool solution, I like how you did it.

5:18 ucb: some of those functions I've never used either. Verra interesting.

5:18 ucb: you should probably abstract it so that it takes a seq of tokens already (avoid string/split) and a way of reconstructing sentences too (avoid string/join)

5:19 ddellacosta: makes me laugh now to consider I was dealing with exceptions, when there are so many more much more elegant solutions.

5:19 ucb: although for your use case tokenising/joining on whitespace might be what you want

5:19 sometimes exceptions may be the right thing to do

5:19 ddellacosta: ucb: yeah, I think your approach is better for incorporating into a more comprehensive lib, where I've got the tokens available already…I'll have to think about it.

5:20 yeah, sometimes they are, but when I get stuck on a problem I can't solve by wrangling exceptions, I've realized it's usually a clue I'm doing it the wrong way.

5:20 * ucb nods

5:21 ddellacosta: thanks for taking the time to write something up. If it is okay with you, I will steal your nice little function...

5:23 ucb: ddellacosta: please do; but work on it, as it stands it's ... well, mediocre?

5:23 ddellacosta: ucb: haha…I think it's pretty nice for a quick one-off. It's more that I think it can be abstracted to something more widely applicable.

5:24 ucb: ddellacosta: s/can/should/ :)

5:24 ddellacosta: :-)

5:24 ucb: ddellacosta: in all effectiveness, if you abstract it correctly, it should be able to get you a window of things around a thing in a seq

5:24 which I reckon might be useful in other contexts as well

5:25 ddellacosta: ucb: yeah, definitely.

5:26 ucb: have you used that take/drop kind of pattern before? I haven't seen that before, but it seems like a good one to know/apply generally.

5:26 anildigital: ucb: now I am trying to run default test in the app with C-c C-, . and I get http://monosnap.com/image/W6T3TGFD7wXAparTFdw8C3FkT

5:26 class not found..

5:26 clojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: clojure.test.mode, compiling

5:27 ucb: ddellacosta: I have, but I'm not convinced it a great pattern because you're walking the seq back and forth

5:27 ddellacosta: if you're only going one way, collecting results as you go along, then great

5:27 ddellacosta: but not how I just did it (by counting, dropping as appropriate, etc.)

5:27 ddellacosta: huh

5:27 interesting.

5:28 ucb: anildigital: I'm assuming you've compiled all namespaces?

5:28 anildigital: looks like this one https://groups.google.com/forum/#!topic/clojure/mndiUiDU5bw

5:28 ucb: ddellacosta: well, imagine you had a really long seq, and that you walked it a few times, counting, dropping, etc.

5:28 ddellacosta: ucb: yeah, that could get slow quickly. I guess it all depends on what you're processing.

5:29 ucb: ddellacosta: regardless I reckon. Again, I think the /right/ (for some definition of right) approach is to walk the seq collecting what you want as you go along.

5:29 anildigital: yeah, I normally jack-in from a source file

5:30 snake-john: Anybody understands the go macro in core.async? I am trying to understand the "concept" "state machine" and "parking". does this mean that the go macro builds up a "state machine" data structure where all channel reads/writes expressions become machines states and all vars get saved in a map so that if a channel read needs to block the whole state can be parked and later retrieved?

5:31 anildigital: ucb: jack-in from source file solved the issue.. but isn't that weird?

5:32 ucb: anildigital: it is weird; yes. I guess my muscle memory has made it a non-issue for me?

5:32 anildigital: ucb: suppose you have 10 source file and you jack-in from one of those.. for others classes would get defined right?

5:33 ucb: anildigital: at least for me it does; I do compile things as I go along though

5:33 anildigital: ucb: is there single command to compile all the files in src

5:34 ucb: anildigital: good question. I don't know. There's the tools.namespace lib which does nice reloading things.

5:36 ddellacosta: ucb: whoops, I had a bug in my solution, reworked: https://www.refheap.com/16845

5:36 anildigital: ucb: thanks .. now diving more

5:37 ddellacosta: anildigital: I've been using refresh from clojure.tools.namespace.repl lately, it is really handy for reload-ing your namespaces, but you have to be cautious about how you code. Read Stuart Sierra's blog post on it for details: http://thinkrelevance.com/blog/2013/06/04/clojure-workflow-reloaded

5:38 anildigital: ddellacosta: thanks checking now

5:39 btw what production apps and webapps do you people like which are benefitting from clojure?

5:39 ucb: ddellacosta: nice

5:39 anildigital: that's a good post to read

5:40 ddellacosta: ucb: yeah, that really helped me.

5:40 anildigital: I don't know how to answer your question--there's not a lot of apps I *use* which are based on Clojure, honestly, although I know there are companies out there using it, a good number these days.

5:41 ucb: ddellacosta: me too; I get reload fails rather frequently though. Haven't looked into why these happen

5:41 anildigital: ddellacosta: one I know is prismatic.. but don't know any other mainstream / popular company using clojure as such

5:41 ddellacosta: ucb: re: c.t.n.r, it's definitely tricky--I've had some issues too, and some of it was helped by excluding stuff, and some was due to bad coding on my part

5:42 ucb: ddellacosta: I see

5:43 ddellacosta: ucb: this *may* help you, but of course depends on how you have stuff structured: http://clojure.github.io/tools.namespace/#clojure.tools.namespace.repl/set-refresh-dirs

5:43 ucb, similarly: http://clojure.github.io/tools.namespace/#clojure.tools.namespace.repl/disable-reload!

5:43 ucb: ddellacosta: nice; thanks!

5:44 ddellacosta: ucb: np, hope it is helpful!

5:47 anildigital: ddellacosta: that was interesting post.. but I think for me long way to go to try that

5:49 ddellacosta: anildigital: I would be so sure--I was surprised actually in that I was able to find it useful right away, because I simply required clojure.tools.namespace.repl and started calling refresh, and it worked for me right off the bat (for a good number of my projects). So you may want to give it a shot and just see if it helps or not.

5:49 anildigital: can't hurt, you can just restart your repl if stuff gets borked, right? ;-)

5:49 anildigital: how do you call refresh?

5:50 ddellacosta: yep

5:50 ddellacosta: (refresh) ;-)

5:51 (…assuming you've got c.t.n.r use'd)

5:52 anildigital: okay

6:17 ddellacosta: I changed my repl namespace to the src file I was in with C-c M-n.

6:17 now I want to change namespace back to default

6:17 how to do that?

6:18 ddellacosta: anildigital: in-ns

6:18 anildigital: sorry, don't know how in emacs, I don't use n-repl

6:18 anildigital: ddellacosta: yeah.. in nrepl

6:18 Guest__: anildigital by default namespace, you mean the user namespace?

6:19 anildigital: Guest__: the one I get when I do nrepl-jack-in

6:19 ddellacosta: anildigital: but sounds like it should be easy if you are in that buffer, based on the docs here: https://github.com/kingtim/nrepl.el

6:19 Guest__: anildigital yes, that's the user namespace

6:19 anildigital just type (ns user)

6:19 augustl: anildigital: the default namespace is jsut "user" I thnk

6:19 what Guest__ said

6:19 anildigital: Guest__: with C-c M-n I changed it to the src file I was in

6:20 okay

6:20 Guest__: anildigital yeah, to switch namespaces in the repl just type (ns *namsepace*)

6:21 anildigital: Guest__: http://monosnap.com/image/7uB9cFIWPmqVjbYer7eEH3eUE

6:21 Guest__: ah .. it was (ns user) not just ns user

6:22 so easy :D

6:22 Guest__: i have a function named (defn get-x-by-name [{:strs [query platform]}] ..) does that mean query and platform are optional arguments?

6:22 noncom: is there any idiomatic way to pass a sequence through a sequence of (map) applications? like (map fn (map fn (map fn seq))) except for using (->) ?

6:22 anildigital: Guest__, augustl .. Clojure is so fun with Emacs

6:22 Guest__: anildigital anything in the repl is written as an s-exp so the parens are understood.

6:23 anildigital: I can't imagine how the other people wo don't use Emacs .. use Clojure

6:24 augustl: nrepl is available in both Eclipse and IntelliJ afaik

6:24 hyPiRion: noncom: is fn the same fn, or is it different fns?

6:25 ,(map #(* 2 %) (map #(/ % 3) (map #(+ 1 %) (range 1 10))))

6:25 clojurebot: (4/3 2 8/3 10/3 4 ...)

6:25 hyPiRion: ,(map (comp #(* 2 %) #(/ % 3) #(+ 1 %)) (range 1 10))

6:25 clojurebot: (4/3 2 8/3 10/3 4 ...)

6:25 anildigital: it does look awesome in emacs.. http://monosnap.com/image/5HUx7wvEnfNAiZ6E9W12CbVgG

6:25 noncom: hyPiRion: different, although, interesting, what if same

6:25 so, (comp) wox fine!

6:26 anildigital: is there any way in nrepl .. to tell it to restart

6:26 hyPiRion: Say you want to repeatedly apply fn to an element, n times.

6:26 ,(nth (iterate inc 1) 10)

6:26 clojurebot: 11

6:27 Guest__: ,(+ 1 2)

6:27 clojurebot: 3

6:27 anildigital: ,(println 'awesome')

6:27 clojurebot: awesome'\n

6:27 hyPiRion: ,(map (fn [val] (nth (iterate #(* 2 %) val) 6)) (range 0 10))

6:27 clojurebot: (0 64 128 192 256 ...)

6:29 noncom: aha...

6:31 hyPiRion: btw, I saw your swearjure experiment, interesting! I've been thinking over such lisp concept, although, not clojure-based..

6:32 how is the experiment going now?

6:33 hyPiRion: noncom: haha. Progress has stalled though, but I plan to create a Swearjure interpreter some day (if I get TimMc and gfredericks on it)

6:33 noncom: hyPiRion: did you hear about klisp?

6:33 hyPiRion: noncom: no, what is that?

6:33 noncom: http://klisp.org/

6:34 jzelinskie: where can i get more info on "#=" I've seen it used in (read-string "#=(stuff)") to eval stuff?

6:34 noncom: it's just some time ago i was thinking on making something like a cross between the concept of swearjure and concept of klisp.. just for experiment

6:35 hyPiRion: noncom: huh, intersting. I'll add it on my list on "lisps I have to look at before implementing one myself"

6:35 ~#=

6:35 clojurebot: https://twitter.com/richhickey/status/134645361796055040

6:35 hyPiRion: jzelinskie: ^

6:35 noncom: though i'm not as good at lisping as it is required to be.. what i wanted to say is that it's cool that someone else thinks of these things too, like you, TimMc and gfredericks :)

6:35 jzelinskie: i see

6:36 hyPiRion: jzelinskie: generally though, #=(f arg) is a reader function which will call f with arg at compile-time

6:37 before macros are called

6:37 jzelinskie: gotcha

6:37 noncom: hyPiRion: so, are you going to take on swearjure seriously with the friends?

6:37 hyPiRion: e.g. (defn #=(symbol "hello world") [a b] (+ a b)) is legal

6:38 jzelinskie: ah! good example

6:38 hyPiRion: and you can call it with (#=(symbol "hello world") 1 2), although I wouldn't exactly recommend it :)

6:38 jzelinskie: haha

6:38 noncom: i believe this kind of search is very important to discover fundamentals of things, like, take a look at this: https://github.com/mame/quine-relay

6:39 jzelinskie: aren't they spelling ouroborus wrong? or is there an alternate spelling I'm not aware of

6:39 hyPiRion: noncom: Well, seriously and seriously. I would like to develop something in Swearjure before I start on larger programming language projects, just to get some experience on it

6:39 jzelinskie: ah, there is

6:39 noncom: jzelinskie: they're looks like japaneese, so no blame for spelling :)

6:39 jzelinskie: you can actually use both according to wikipedia

6:40 hyPiRion: Also, it's a great way to learn about Clojure internals, especially the reader

6:41 noncom: yeah, i'll be watching what's up!

6:42 * hyPiRion heads out for lunch

6:42 Anderkent: Anyone remember off top of their head how to type tag a byte array?

6:43 pjstadig: Anderkent: ^bytes i think

6:43 Anderkent: Tried that, but I get 'unable to resolve classname clojure.core$bytes

6:45 ah, #^bytes seems to work tho

6:46 noncom: Anderkent: what # sign does?

6:46 Anderkent: no idea, but it stops it from failing to compile

6:46 jzelinskie: haha

6:46 noncom: :)

6:47 Anderkent: i think all metadata used to be #^ ?

6:47 noncom: not ^: ?

6:47 for type-hints

6:47 idk

6:47 Anderkent: ^:keyword is just for tagging with a keyword

6:47 the : is part of the keyword not part of the ^, afaik

6:47 noncom: yeah

6:48 pjstadig: Anderkent: what version of Clojure are you using? ^bytes works for me with 1.5

6:48 Anderkent: 1.5.1

6:49 pjstadig: Anderkent: https://gist.github.com/pjstadig/6061459

6:50 Anderkent: hm, that works for me too

6:50 ok im confused now

6:52 noncom: maybe the exact usecase is important?

6:52 Anderkent: ah! sorry, I was misreading the error message

6:52 pebkac :P

6:53 Guest__: if you want to tag something using ,(def ^{:doc "sample"} sample 1) helps

6:53 Anderkent is that what you wanna do?

6:53 Anderkent: type hint a function to return a byte array

6:54 Guest__: rem, Anderkent, what is it that you wanna do and what error does it show?

6:55 *erm

6:55 Anderkent: sec

6:55 Guest__: if you want to include metadata then ^{} is what you must do. :)

6:56 Anderkent: You don't need to use the full map metadata to type hint something, ^class-symbol is sufficient

6:57 pjstadig: https://gist.github.com/pjstadig/6061490

6:57 Anderkent: wait the hint goes *after* the function symbol?

6:57 derp

6:58 right because it allows different arities to be hinted differently

6:58 huh.

6:59 well that was my problem, but the error message is very unhelpful :)

7:00 pjstadig: yeah for type hinting return values you "type hint" the args vector

7:00 type hinting the function name would be metadata that ends up on the var

7:00 like ^:dynamic or something

7:03 Anderkent: arent type hints just the :tag metadata on the var? or is it the other way around (i.e. type hint is processed by compiler first, then added to the var as conveniance)

7:05 pjstadig: well that's a good question

7:06 looks like the :tag metadata is not getting to the var

7:06 https://gist.github.com/pjstadig/6061528

7:07 Anderkent: yes, as you said it will be on the arglist :)

7:07 pjstadig: but it does if you tag the var's name https://gist.github.com/pjstadig/6061532

7:08 Anderkent: See comment :)

7:45 silasdavis: I'm trying to use marginalia to produce literate documentation for an API based on compojure

7:45 I'd really like it to pull and format my comments from within a defroutes form

7:46 so I can have the http method, route, and code all handled together

7:48 is there a way to make it do this?

8:51 TheBusby: ambrosebs: thanks for the interable-seq work around! Using it now

8:52 ambrosebs: TheBusby: hehe, nocheck let's you do practically whatever you want.

8:52 TheBusby: not always a good thing...

8:54 TheBusby: I'm writing a core.typed paper for Scheme Workshop so I might not be too active in the next week with the bugs.

8:54 TheBusby: ambrosebs: no worries, I'm occupied with other development as well, and really appreciate your e-mail responses!

8:55 ambrosebs: :)

8:55 TheBusby: if I wasn't so busy, I'd see if I could help out with a patch or two. No such luck at this point in time though. :(

8:56 ambrosebs: another time :)

8:58 TheBusby: which country are you in?

8:58 TheBusby: ambrosebs: I have to ask, but where are you located? I hardly ever run across people in the Clojure community who aren't EU or US TZ

8:58 ambrosebs: Western Australia

8:59 TheBusby: I'd buy you a beer, but I think you're a tad too far away.

9:00 * TheBusby is based in Tokyo

9:00 ambrosebs: :) a little north of me?

9:00 ahk :)

9:00 same timezone right?

9:00 TheBusby: +8 UTC here

9:00 ambrosebs: +8

9:01 I think we're 2 of a kind

9:01 TheBusby: whoops, my mistake I'm +9, but close enough

9:02 my apologies but I have to disappear for the evening. Thank you again for all your help, and I'll be updated the example file throughout this week.

9:02 hyPiRion: ambrosebs: So I assume there are very few Clojure developers in Australia? I would've guessed there were more than just you though (I know you're exaggerating, but well)

9:02 ambrosebs: TheBusby: cya!

9:03 silasdavis: with compojure can I pull out a (GET "/foo" bar) form into a def like (def foo (GET "/foo" bar))

9:03 ambrosebs: hyPiRion: I honestly haven't met a single person using clojure on my half of the country. Plenty on the east tho.

9:03 silasdavis: or does GET only work in the context of a defroutes / routes macro?

9:04 hyPiRion: ambrosebs: aw, that's a shame. You'll have to convince people to start using it then.

9:05 ambrosebs: hyPiRion: yea. at least my friends have heard of it now :)

9:07 shoshin: silasdavis you can use it in the first form too i.e (def foo (GET "/foo" bar))

9:10 defrosts just creates a Ring handler function from a series of routes.

9:10 hyPiRion: hrm, I wonder how I can pitch Clojure up here.

9:21 gfredericks: augustl: yes

9:21 augustl: https://groups.google.com/forum/#!topic/clojure/MzzeuAgMm5g

9:23 augustl: gfredericks: tnx

9:23 doh

9:24 gfredericks: yeah it was a mild facepalm

9:25 augustl: can we blame the fact that inheritance is complex? Let's blame that.

9:26 gfredericks: I feel like the compiler could have thrown an error

9:26 in an ideal world

9:26 if you type-hint and nothing matches

9:29 augustl: well, something might match run-time..

9:29 gfredericks: sure something could match the concrete type

9:30 but if I'm explicitely hinting an interface that doesn't have the method I'm calling

9:30 I guess it's not obligated to compile to non-reflective code just because there's a type hint around... :/

9:30 a workaround I had before I figured out the issue was to pass a (reify Callable ...) instead of a fn :)

9:57 stuartsierra: I've gotten no reports of problems with ClojureScript using new G.Closure lib & compiler, so I'm going to go ahead and release it toady.

10:03 *today

10:05 ddellacosta: ping callen

10:08 dnolen: stuartsierra: sweet

10:43 ucb: ddellacosta: a rather contrived solution https://www.refheap.com/16856

10:44 ddellacosta: ucb: holy crap

10:44 ucb: I'm right in the middle of something, so I can't dig into this at the moment, but wow

10:44 ucb: INORITE!

10:44 ddellacosta: haha

10:44 You must be itching to write some code, huh? ;-)

10:44 ucb: ddellacosta: it doesn't really merits anybody's attention; I was just pointing you to it for the comedy effect

10:45 ddellacosta: ucb: hahahaha

10:45 ucb: well, I am writing code, just that your problem sounded like a nice code-kata

10:45 ddellacosta: ucb: well, nonetheless, I'll check it out when I have some time. Yeah, it's definitely a nice little problem to play with.

10:45 * ucb nods

10:45 ucb: cool!

10:54 squidz: stuartsierra: what will the new G.Closure lib/compiler give us?

10:55 stuartsierra: squidz: The warm fuzzy glow of knowing our dependencies are up-to-date.

10:57 squidz: hehe okay I see

10:59 stuartsierra: Probably some bug fixes. Probably some new bugs, too.

11:01 squidz: stuartsierra: what are the major bugs right now that haven't been squashed?

11:01 stuartsierra: squidz: In Google Closure? No idea.

11:02 squidz: no sorry I mean in clojurescript

11:03 stuartsierra: squidz: Also, no idea. :) dnolen might know.

11:04 squidz: meh, I won't bother him. If he happens to see it he can answer if he chooses. You guys are busy

11:06 mdrogalis: Why on earth does this throw an exception? (sort '((:october) (:may)))

11:06 PersistentList cannot be cast to java.lang.Comparable

11:07 arrdem: mdrogalis: you are seeking to order a list of lists, each of which contains one key.

11:07 mdrogalis: arrdem: Correct.

11:08 I don't see why that can't be done.

11:08 nDuff: mdrogalis: Use vectors, not lists, for that.

11:08 mdrogalis: Can't be done because, as the exception says, lists don't implement the Comparable interface.

11:08 mdrogalis: nDuff: Yes. I arrived at that solution. I think my question is "why don't lists implement Comparable?" :P

11:08 arrdem: nDuff: so if vector is Comparable, why isn't list?

11:09 clearly we have an order relation on vectors :/

11:09 nDuff: mdrogalis: Clojure frequently declines to implement things at all if they can't be implemented in a performant manner. I don't know the answer -- would have to dig into the implementation or ask Rich -- but this kind of difference is usually an intentional thing.

11:10 mdrogalis: Ahh, I can see performance being a reason given that it's related to compiling sexprs for Clojure programs

11:10 gfredericks: why would vector's comparable be any more performant than list's?

11:10 * nDuff shrugs and points back at the explicit-speculation disclaimer.

11:11 justin_smith: cache integrity?

11:11 arrdem: gfredericks: I guess list can be a cons, where vector is a hard array so... eh

11:11 mdrogalis: Indices?

11:11 I'm relatively satisfied with that answer -- it seems likely.

11:11 solussd: squidz: on the 14th you encountered a pedestal error "doesn't support name". Did you ever figure out what was causing that in your render-config and how to fix it? I'm running into that now.

11:12 gfredericks: arrdem: laziness is the only angle I can think of; because the algorithm would involve a linear walk regardless

11:12 justin_smith: accidentally comparing two identical lazy infinites would be a bitch

11:12 arrdem: (inc justin_smith)

11:13 lazybot: ⇒ 2

11:13 arrdem: ,(type (range))

11:13 clojurebot: clojure.lang.LazySeq

11:13 arrdem: ,(list? (range))

11:13 clojurebot: false

11:13 squidz: solussd: oh god, I don't think I ever found an answer. I switched to making a clojruescript app with angularjs but that error frustrated me so much that I gave up trying I think. If I remember correctly it was something about using more than one parameter in the render-config right

11:14 arrdem: (dec justin_smith)

11:14 lazybot: You want me to leave karma the same? Fine, I will.

11:14 arrdem: when did that patch go throug?

11:14 justin_smith: enjoy your free karma :P

11:15 solussd: squidz: eek! ok, thanks anyway

11:16 squidz: solussd: if you find a solution let me know

11:21 justin_smith: is a circular list possible in clojure? I think immutability actually makes it impossible

11:22 otherwise, that would also be a reason not to make list comparable

11:22 (dec justin_smith)

11:22 lazybot: You can't adjust your own karma.

11:23 justin_smith: we had this code which created cached modified versions of files

11:23 bbloom_: i feel like you should be able to decrement your own karma

11:24 justin_smith: immutability means that pointers can only go to "older" values

11:24 justin_smith: the file system operations ended up being a bunch of str and regex ops

11:24 bbloom_: yeah, makes sense

11:24 solussd: squidz: it was caused by passing nil to dom/by-id

11:24 bbloom_: if you allow mutually recursive declarations, such as letfn, then you can get cycles, but internally mutation is necessary

11:24 haskell's laziness allows inherent circularity, but i think it's an anti-feature

11:25 b/c once you introduce a cycle, you can't get structural sharing for changes to any individual node in the cycle & still preserve immutability

11:25 justin_smith: so I am working on an abstraction over file paths that will make code over filesystems look less like string manipulation code (so things will be readable when I come back to them)

11:25 is this quixotic? is there a reasonable way to go about it?

11:25 bbloom_: so then you might intrinsically understand the solution: do what file systems do internally! invent something like an inode identifier

11:26 justin_smith: maybe I am being too oo here

11:26 gfredericks: justin_smith: lazy seqs can let you do circular lists

11:27 justin_smith: what about a vector representing a path /etc/x11/xorg.conf -> ["etc" "X11" "xorg.conf"]

11:27 arrdem: gfredericks: lazy seqs let you repeat the elements of a finite list infinitely, the structure isn't circular itself

11:27 justin_smith: since much of what I am doing in making the cached transformations is making sibling directories with children representing transforms of the file

11:27 gfredericks: ,(let [a (promise) b (list* 1 2 3 (lazy-seq @a))] (deliver a b) (take 20 b))

11:27 clojurebot: (1 2 3 1 2 ...)

11:27 justin_smith: (neices)

11:27 gfredericks: arrdem: ^ looks circular to me

11:28 * arrdem ponders for 3 mana

11:28 gfredericks: should be able to do (nth _ 100000) on that without creating any new objects

11:29 solussd: squidz: in my case, the parent id returned by render/get-parent-id was nil because my template wasn't _within the application.html, which has the "root" id

11:29 arrdem: gfredericks: wow that's cute

11:29 gfredericks: arrdem: it uses quasi-mutability of course

11:29 stuartsierra: gfredericks: I think 'circular' in this case means that some element in the list points to the head of the whole list.

11:29 gfredericks: stuartsierra: is that not what's going on in some sense?

11:30 stuartsierra: gfredericks: I didn't look that close. ;)

11:30 arrdem: stuartsierra: I say this is cute because that's exactly how gfredericks's example works

11:30 stuartsierra: b is defined to be 1, 2, 3, the lazy delevery of b

11:30 stuartsierra: Yes that's circular.

11:31 bbloom_: i should note: mutability is required to achieve that :-P

11:31 the mutability of the promise, that is

11:31 arrdem: bbloom_: how so? I don't know list*.

11:31 justin_smith: so that means you could end up comparing two lists that are infinite and identical

11:31 squidz: solussd: hmm I see. I might have to give pedestal another go. Not sure if that was my problem because I can't really remember but it is certainly an interesting library

11:32 bbloom_: arrdem: it's just a fundamental truth about immutability and the progression of time

11:32 justin_smith: or is list* strictly different

11:32 bbloom_: if you make two things, once has to be inherently created after the other. and so the former can't have a pointer to the later

11:32 gfredericks: justin_smith: it coulda been a series of cons

11:32 bbloom_: the only way you can cheat that is if you know the memory address of the latter apriori, like if it was a stack allocation of a known size

11:32 justin_smith: so, in my naivity, I was technically correct?

11:33 stuartsierra: "I coulda been a cons-tender."

11:34 squidz: stuartsierra: ba dum tss

11:34 gfredericks: ~rimshot

11:35 clojurebot: Badum, *tish*

11:37 arrdem: w00t, naive lisp code emitter in 335loc

11:37 bja: does anyone know of a project to add ritz support to vim-fireplace?

11:37 jude: hi

11:37 egghead: hey jude

11:38 jude: first time using irc

11:38 bja: I noticed vim-redl, but it seemed more limited than slimv. The downside to slimv seems to be that it's no longer maintained.

11:38 egghead: you chose a good channel for your first relay chat

11:38 bja: err, slimv is maintained, swank-clojure isn't maintained

11:38 jude: yeat~thanks

11:39 yeah~thanks

11:45 yedi: best way to loop over a map? i know i can doseq

11:45 is it also possible to map a fn across map pairs? without explicitly converting the map into a list of lists

11:45 technomancy: yedi: sure; map does that

11:45 (calls seq on its arg)

11:46 justin_smith: (map (fn [[k v]] ...) mp)

11:47 yedi: cool thanks

11:48 justin_smith: ,(map (fn [[k v]] [k [v v]]) {:a 0 :b 1 :c 2})

11:48 clojurebot: ([:a [0 0]] [:c [2 2]] [:b [1 1]])

11:48 justin_smith: ,(into {} (map (fn [[k v]] [k [v v]]) {:a 0 :b 1 :c 2}))

11:48 clojurebot: {:a [0 0], :c [2 2], :b [1 1]}

11:48 justin_smith: that is a pattern I use quite often

11:49 well not making a vector of 2 copies of the value, but the fn [[k v]] / into {} part

11:51 regarding the abstraction over paths

11:51 http://www.haskell.org/ghc/docs/latest/html/libraries/filepath/System-FilePath-Posix.html something like this may be nice

11:57 gfredericks: ,(let [kvpair (first {1 2})] (identical? kvpair (vec kvpair)))

11:57 clojurebot: false

11:58 piranha: ,((juxt vec first) {1 2})

11:58 clojurebot: [[[1 2]] [1 2]]

11:59 justin_smith: ,(vec [1 2])

11:59 clojurebot: [1 2]

12:00 justin_smith: ,(identical? [1 2] [1 2])

12:00 clojurebot: false

12:00 justin_smith: I guess vec prevents data sharing

12:02 llasram: I think more ##(class (first {1 2}))

12:02 lazybot: ⇒ clojure.lang.MapEntry

12:02 justin_smith: ahh

12:02 the printed representation just looks like a vector

12:02 llasram: I think more ##(let [v (vec (first {1 2}))] (identical? v (vec v)))

12:02 lazybot: ⇒ false

12:02 llasram: Er

12:02 Didn't mean to say the "I think more" again

12:03 But yeah, so `vec` returns an new vector, even if the original is a vector

12:03 justin_smith: but see vec still prevents data sharing

12:03 yeah

12:03 gfredericks: vec probably blindly treats its arg as a seq

12:03 justin_smith: makes sense

12:03 gfredericks: convenient way to dup your vectors :P

12:04 justin_smith: I thought the reason I was using immutable datastructures was to not need to do things like defensive copying

12:05 konr: Do you guys recomend any particular core.logic tutorial?

12:06 dnolen: konr: the one on the core.logic is OK, also TRS is not bad

12:06 konr: there's a miniKanren IRC & mailing list I recommend getting on those if you need more help

12:06 konr: TRS -> The Reasoned Schemer

12:06 nDuff: konr: My only advice at this point is to skip anything that uses Thread/sleep. :)

12:06 llasram: justin_smith: I'm going to say that this is less defensive copying and more a... missed optimization opportunity

12:07 The code as-written just doesn't special-case starting with a PersistentVector, even though it easily could

12:07 konr: thanks :)

12:09 mucker: hey, guys .. I just want to share this here, I got the idea from some elisp code I read once https://github.com/themucker/pvizer

12:10 dnolen: justin_smith: llasram: maybe I'm missing something but you cannot test for sharing with identical? anyway

12:10 jvc: but i really like parens

12:10 justin_smith: mucker: yuck

12:10 yedi: what am i doing wrong here? https://gist.github.com/yedi/28ed80a55b9fbfe85ed4

12:10 justin_smith: dnolen: more likely I was missing something

12:11 dnolen: maybe I was using the word "sharing" wrong or too loosly, I meant in the sense of "do these things point to the same storage"

12:12 jvc: hey guys, what's your favourite irc client?

12:12 seangrove: mucker: Strange you have end-let and end-def there

12:12 justin_smith: which in jvm speak is "are they the same object"

12:12 jvc: I*'

12:12 seangrove: If you're doing white-space anyway, why not go for significant ws?

12:12 jvc: I'm new here

12:12 dnolen: justin_smith: yes you cannot test for this property in a simple way - the sharing happens *inside*

12:12 justin_smith: dnolen: yeah, I was likely using sharing in a sloppier sense then you are using it

12:12 mucker: seangrove: I like allman style braces in other lang* :/ I even saw ruby code where the bloke went do .. end #method

12:13 * mucker just a dumb hack anyway

12:13 justin_smith: yedi: #({...}) tries to call the map as a function, fails because it gets no args

12:14 use fn instead of #() and you will be fine

12:14 dnolen: justin_smith: yeah, the sharing I'm talking about is the only one Clojure pursues - you might see two instances of [1 2] be identical? in some cases but this a compiler optimization

12:14 yedi: justin_smith: ah i see, thanks

12:14 justin_smith: dnolen: cool, thanks for the clarification

12:17 jonasen: dnolen: any thoughts on https://groups.google.com/forum/#!topic/clojure-dev/vPv0cPZxTCE ?

12:17 should I open a ticket on JIRA?

12:17 dnolen: jonasen: no thoughts, reader changes generally have to go through rhickey

12:18 devn: has anyone looked at pulsar/quasar?

12:18 dnolen: jonasen: oops

12:18 jonasen: dnolen: ok, I'll wait then

12:18 dnolen: jonasen: sorry I didn't realize that makes it through the Clojure ready

12:18 jonasen: the Clojure reader

12:18 jonasen: yeah ticket + patch welcome

12:19 jonasen: dnolen: ok, thanks!

12:30 jvc: hey

12:36 seangrove: mucker: Pretty cool. I'm fine with parens, and a lot of people are tired of seeing alternative syntaxes to lisps, but I like the experimentation

12:38 justin_smith: it is inconsistent

12:39 if you have let and end-let why not * and end-*

12:39 seangrove: justin_smith: I assumed it's a WIP

12:39 The source maps are finished - it's inconsistent. Why have column info for some symbols, and not all others?

12:39 yuck

12:40 Shouldn't have released them at all

12:44 dnolen: seangrove: ?

12:45 justin_smith: well the alternative to inconsenstent in this case is rediculous - either you pick a few forms that get the form end-form treatment, or the whole thing becomes kind of silly https://www.refheap.com/16864 paste of a random function from my code translated to that style

12:45 sleetdrop: why (peek '(1 2 3)) need a ' while (peek [1 2 3]) doesn't

12:46 bbloom_: sleetdrop: the error message you get might be illuminating….

12:46 dnolen: seangrove: oh you all are talking about something else :)

12:46 arrdem: sleetdrop: because () is a list, which is read by default as a code form rather than a list

12:47 bbloom_: see what happens if you try '(peek ...)

12:47 dnolen: sleetdrop: (1 2 3) is a function call where the function is 1

12:47 sleetdrop: adding a ' gives you a literal list

12:49 Chousuke: sleetdrop: note that quoting a list also quotes the things inside it

12:49 so '(foo bar) doesn't give you a list of the values of foo and bar

12:50 hyPiRion: it gives you a list with the symbol foo and bar.

12:51 Chousuke: sleetdrop: as to why [1 2 3] doesn't need a quote, it simply has to do with different evaluation semantics

12:52 sleetdrop: Thanks a lot everyone.

12:52 Chousuke: ,(let [a 1 b 2] [(+ a b), '(+ a b), [+ a b], '[+ a b]]) shows the difference

12:52 clojurebot: [3 (+ a b) [#<core$_PLUS_ clojure.core$_PLUS_@1deafdc> 1 2] [+ a b]]

12:53 Chousuke: (that weird thing is just how clojure prints a function object)

12:56 llasram: It's not that weird: ##(Object.)

12:56 lazybot: ⇒ #<Object java.lang.Object@492903>

12:56 technomancy: it's hideous

12:56 llasram: Well...

12:57 arrdem: ,(read-string "#<Object java.lang.Object@DEADBEEF>")

12:57 clojurebot: #<RuntimeException java.lang.RuntimeException: Unreadable form>

12:58 llasram: I guess it wouldn't be too difficult to make functions print at least as something like #<Fn clojure.core/+>. Still not `read`able, but at least more human-legible

12:59 amalloy: llasram: sure it would be hard

12:59 how does a lambda with no def print? how does clojure know a particular function is a top-level def?

13:00 llasram: ##(fn [])

13:00 lazybot: ⇒ #<sandbox11362$eval14849$fn__14850 sandbox11362$eval14849$fn__14850@18cd072>

13:00 amalloy: i'm aware of how they currently print

13:00 llasram: Sorry,

13:01 amalloy: (aside: ##(fn)) is actually valid, believe it or not

13:01 llasram: -> #<Fn sandbox11362.eval14849/fn__14850>

13:01 lazybot: ⇒ #<sandbox11362$eval14860$fn__14861 sandbox11362$eval14860$fn__14861@df7935>

13:01 llasram: Haha

13:01 Ooh, nice

13:01 You learn something more compact every day!

13:01 technomancy: oh weird; I thought for sure (defn x []) expanded to an fn with an internal tame

13:01 internal name

13:01 but no

13:01 amalloy: &#() ; we're aiming for compact?

13:01 lazybot: ⇒ #<sandbox11362$eval14871$fn__14872 sandbox11362$eval14871$fn__14872@15e8f0d>

13:02 llasram: Perfect

13:03 Anyway, so anonymous still won't be great, but at least their printed form could immediately be recognizable to humans as such

13:03 technomancy: I wonder why defn doesn't go that route

13:03 justin_smith: ,(fn example-anon [])

13:03 clojurebot: #<sandbox$eval29$example_anon__30 sandbox$eval29$example_anon__30@16b0e4e>

13:03 technomancy: (defn x []) -> (def x (fn x []))

13:04 amalloy: technomancy: i remember wondering that too. one explanation is that it can generate a consistent classname

13:05 but i think i investigated that possibility and discovered it's not relevant

13:06 justin_smith: in unit-testing some defmacro construction, I used a regex on the string form of the function representation to get the readable / predictable part out

13:06 though I am not sure unit testing the macroexpansion of my macro was all that useful, in retrospect

13:07 llasram: Cascalog does that to try to find Vars for function-objects. It fails a lot and makes me sad inside

13:07 technomancy: justin_smith: unit testing macros is usually a sign that your macros are doing too much

13:07 justin_smith: technomancy: yup

13:07 technomancy: unless you're implementing pattern matching or something

13:07 llasram: But I think just making `fn`s print nicer for humans is a much simpler goal

13:07 justin_smith: I was doing tdd as a development technique to help me construct my macro

13:08 and it was doing a kind of pattern matching for an extended syntax

13:08 technomancy: llasram: oy, yeah that sounds fraught with peril

13:08 justin_smith: one which I decided in retrospect had the problem many dsls end with - kinda neat, but in the long term a loss because it is no longer a lisp

13:08 gfredericks: clojure.walk would be much nicer if it preserved metadata :(

13:09 technomancy: I can empathize with the rationale but once you go down that road there's no end in sight

13:09 amalloy: gfredericks: naw, you'd just use it for a while and then discover another one of its faults

13:09 gfredericks: amalloy: "much nicer" and "terrible" are logically compatible

13:09 amalloy: haha

13:09 llasram: OOC, what other issues does it have?

13:09 upwardindex: ,(if (Boolean. false) 1 2)

13:09 clojurebot: 1

13:10 upwardindex: :(

13:10 technomancy: upwardindex: the existence of the Boolean constructor is a design bug

13:10 in the JDK

13:10 llasram: Does clojurebot have a pithy quote/link about that?

13:10 ~false

13:10 clojurebot: false is the previous sentence

13:10 llasram: Thanks, clojurebot

13:10 gfredericks: technomancy: do you think it would break anything worth not breaking if they removed it?

13:11 amalloy: gfredericks: objectinputstream deserialization depends on it iirc

13:11 disgusting as that seems

13:11 technomancy: gfredericks: making it yell at you would be a great start

13:11 llasram: upwardindex: Anyway, you can use Boolean/FALSE instead. Boolean/FALSE, primitive boolean false, and nil are the only logical-false things in clojure

13:11 amalloy: or maybe not. maybe what it does is generate instances of Boolean without even going through the constructor

13:12 technomancy: Let's add a blacklist to clojure.core/compile.

13:12 llasram: OOoh

13:12 amalloy: how orwellian, technomancy

13:12 gfredericks: maybe he meant a warning blacklist

13:12 technomancy: gfredericks: no, more like a TSA blacklist

13:12 llasram: I think he meant a reeducation-camp blacklist

13:13 technomancy: where you can't see the list or get yourself off it

13:13 amalloy: /msg clojurebot (list technomancy)

13:13 now you're on the list forever!

13:13 gfredericks: technomancy: can we create a secret court to approve the items on it?

13:13 technomancy: to make it more like the TSA it could ignore the package name and just work off the unqualified class name

13:14 gfredericks: what makes you think it doesn't already exist?

13:14 justin_smith: lol

13:14 amalloy: technomancy: or ignore the unqualified name and just use the package, also like the TSA

13:15 upwardindex: llasram: found an answer on stack overflow that mentions i should be using Boolean/valueOf

13:16 gfredericks: is clojure.walk conceptually flawed? should I not even want something like it?

13:16 technomancy: gfredericks: it is publicly disowned; does that count?

13:16 gfredericks: but not replaced?

13:16 should I make my own is what I'm really wondering

13:16 technomancy: no idea

13:17 pjstadig: is publicly disowned, but wasn't it used for core.async?

13:17 gfredericks: pjstadig: a secret court approved that

13:17 pjstadig: a parallel supreme court?

13:17 * gfredericks wonders what a perpendicular supreme court would do

13:18 pjstadig: but then it's not really supreme, because it's not at the top

13:18 it's like the lateral court

13:19 which sounds like a sportsball term

13:19 justin_smith: isomorphic court

13:22 callen: pjstadig: I love you.

13:22 pjstadig: but migratus could be made more flesh-sack friendly.

13:22 pjstadig: would some easy-mode leiningen commands be welcomed?

13:22 arrdem: callen: pah easy mode

13:23 technomancy: you have to unlock easy mode by flailing around in the repl and triggering three migration-related exceptions in under five minutes

13:24 callen: technomancy: migratus requires making sacrifices to profane gods before you contrive a timestamp format that it actually likes.

13:24 gfredericks: "disowned" either implies that it can't be fixed at all or it can't be fixed backwards-compatibly; I would think something like tree-seq's arg signature could work?

13:24 justin_smith: callen: does it not suffice that it be numeric and monotonically increasing over time?

13:24 technomancy: gfredericks: it could also mean the author just doesn't care

13:24 danlarkin: mig-rah-toos

13:24 pjstadig: callen: i don't even know what easy-mode is, but sure

13:25 callen: pjstadig: well, a few problems.

13:25 gfredericks: technomancy: I care and wouldn't mind fixing it, but I have to know first if there's any reason not to try :)

13:25 technomancy: callen: just don't write lein tasks that are thin wrappers over code that runs in-project and doesn't need access to the project map

13:25 gfredericks: well I don't _have_ to know

13:26 callen: pjstadig: one is that the errors are opaque, the statement separator thing could more obvious and have a better error message. the timestamp format needs to be automated in the job-thingie and have a better associated error message, etc.

13:26 technomancy: thanks for the warning.

13:26 technomancy: I need to write a blagh on that subject

13:26 amalloy: gfredericks: i don't think it can be fixed at all. there are too many kinds of collections that you simply can't rebuild with (into (empty x) (map inner x)), and anything more specialized is a closed system that won't work on every new type

13:27 technomancy: I've been keeping it on my queue for when I don't have anything interesting to write about, but other things keep coming up

13:27 pjstadig: callen: i've been sitting on the batch error thing because i don't want to get into the job of molesting exceptions, especially if it needs to be done in a database independent way

13:27 amalloy: you can make something that works for PersistentVector, PersistentList, and PersistentHashMap, the concrete classes, but if you try to work with interfaces or records you immediately run into trouble

13:28 pjstadig: i think your issues are valid, and would consider related PRs

13:28 gfredericks: amalloy: what about the tree-seq approach of forcing the user to decide how to deal with things?

13:28 pjstadig: callen: there's already an issue for the batch exception, is there one for the timestamp thing? if not, please create one

13:29 amalloy: gfredericks: i think if you take that approach your 'walk function will require just as much work as rewriting it from scratch as a self-recursive function, but i'm not sure

13:29 callen: pjstadig: there definitely is not a nice error for the timestamp thing.

13:29 gfredericks: amalloy: well it could certainly provide useful defaults

13:29 amalloy: ie, if you had walk, and i wanted to do a tree transformation of some kind, it would be as easy for me to not use walk as to use it

13:29 callen: pjstadig: generating a blank migration with the current timestamp just needs to be automated as well.

13:29 gfredericks: e.g., partial support for records

13:30 or full support that falls back on maps like dissoc

13:30 bbloom_: amalloy: gfredericks: that's why you often see an extra level of indirection in naming. ie people do something like (defn foo-sequential […) then implement IFooable on sequential things by calling it. you can actually build up little collections of things and compose them

13:31 that was sorta the idea behind clojure.core/extend

13:31 pjstadig: callen: I'm not as convinced on the generating a migration thing

13:31 i mean i know it would be nice to not have to manually create the files with the right name

13:31 gfredericks: bbloom_: I'm having trouble understanding what this has to do with clojure.walk

13:32 pjstadig: but i'm not convinced that should be part of the leiningen plugin

13:32 bbloom_: gfredericks: you mentioned how tree-seq is parameterized

13:32 callen: pjstadig: people will have to write the generation script themselves otherwise.

13:32 bbloom_: gfredericks: which is also true of zippers

13:32 callen: pjstadig: I'd prefer to spare people the unnecessary effort.

13:33 bbloom_: gfredericks: in theory, you could create walk-vector, walk-map, walk-whatever

13:33 gfredericks: then you could say (def walk-standard (walk-compose walk-vector walk-map walk-whatever))

13:33 pjstadig: callen: i understand, but on the other hand migratus is meant to be a library, not necessicarily a batteries-included migration framework

13:33 bbloom_: gfredericks: and if you wanted to later add your own type, you could do (def walk-mystuff (walk-compose walk-my-thing walk-standard))

13:34 make sense now?

13:34 callen: pjstadig: it's a simple command to just touch a file with a specific timestamp format.

13:34 gfredericks: bbloom_: what would e.g. walk-vector do?

13:34 trying to figure out how that relates to how walk-compose works

13:36 bbloom_: gfredericks: entertainingly, this is deeply related to the strategoxt thing i was just discussing on twitter: http://hydra.nixos.org/build/5372152/download/1/manual/chunk-chapter/stratego-traversal-strategies.html

13:37 gfredericks: clojure.walk is essentially the "visiting all subterms" strategy. you can define a one-level descent on a per type basis

13:38 clojure.walk's prewalk and postwalk roughly translate to the bottomup and topdown strategies

13:39 gfredericks: bbloom_: I will have to read this

13:39 I'm looking at the clojure.walk source right now and can't figure out where the metadata gets lost

13:39 I think the map path uses empty and into

13:42 bbloom_: er i said that backwards. prewalk=topdown, postwalk=bottomup

13:42 gfredericks: you know what maybe it actually doesn't

13:42 I might've been confusing myself

13:43 nevermind clojure.walk is teh best everybody use it for everything

13:43 bbloom_: heh

13:43 technomancy: there is a comment in leiningen's clojure.walk usage saying "clojure.walk discards metadata"

13:44 I can't vouch for its accuracy

13:44 cashonly: Has anyone used incanter for data visulization?

13:46 gfredericks: technomancy: yeah looks like it does for seqs

13:46 but I'm not using a seq so doesn't matter everybody use clojure.walk

13:47 technomancy: PROBLEM SOLVED

13:47 gfredericks: also it looks trivially changeable to fix that

13:47 technomancy: we're only using it in lein for defproject unquote, which is silly and should be replaced with read-eval

13:49 arrdem: where in the compile process does clojure do symbol qualification?

13:49 bbloom_: arrdem: in the reader, awkwardly enough

13:49 arrdem: urgh that's what I was afraid of.

13:49 bbloom_: it's easy to defeat

13:49 arrdem: but is it easy to replicate? :/

13:50 bbloom_: https://github.com/brandonbloom/backtick

13:50 man, i'm just self promoting left and right here guys

13:50 sorry about that :-P

13:50 you can quote, then call backtick/syntax-quote-fn later on that

13:50 arrdem: bbloom_: your libs are good so I'm not complaining

13:51 bbloom_: arrdem: thanks. let me know if that solves your problem!

13:51 arrdem: bbloom_: hum.. I'll need to ponder over lunch but I don't think it does.

13:52 I'm working on a toy clojure -> asm compiler :P so mine is the challenge of replicating clojure's behavior not forcing it to do more sane things

13:53 bbloom_: backtick intentionally replicates clojure's behavior…. in a more sane way

13:54 (syntax-quote (some stuff here)) should operate identically to `(some stuff here), but just at macro expand time instead of at read-time

13:54 and that's basically the same as (syntax-quote-fn '(some stuff here))

13:54 so you can (quote whatever) and (syntax-quote-fn whatever) much later

13:54 letting you decouple read time from the symbol resolution process

13:55 arrdem: right. and what I need to do is cook up an ast walk or macro which conditionally prefixes symbols the same way rhickey's Clojure does.

13:56 bbloom_: https://github.com/brandonbloom/backtick/blob/master/src/backtick.clj#L85-L101

13:56 you can define custom resolvers

13:57 (defn sometimes-resolve-symbol [x] (if blah x (resolve-symbol x)) (defquote my-resolving-quote sometimes-resolve-symbol)

13:57 i gotcha covers :-)

13:57 stuartsierra: ClojureScript 0.0-1847 released.

13:57 bbloom_: covered*

13:58 stuartsierra: With latest Google Closure library & compiler.

13:58 bbloom_: stuartsierra: cool!

13:58 dnolen: awesome

13:59 seangrove: woow, thanks stuartsierra

14:01 * bbloom_ runs script/bootstrap before he forgets

14:06 jonasen: bbloom_: dnolen: The closure-lib warnings (cemericks CLJS-489) are gone with the new clojurescript release!

14:06 bbloom_: jonasen: w00t!

14:07 dnolen: i think it's time to pull the trigger on that patch :-P

14:07 trust in the cemerick, he will bring development nirvana to us all

14:07 dnolen: bbloom_: not going to happen until someone updates docs and fully preserves the hold behavior

14:08 it just too much coordination w/ other tools otherwise

14:08 cemerick: jonasen: excellent, that's what we were hoping for :-)

14:08 bbloom_: doesn't cljs-build hard code to a particular cljs version?

14:08 dnolen: bbloom_: which is overrideable

14:08 bbloom_: surely they will break when they try to update. sounds like coordination to me :-P

14:08 dnolen: bbloom_: no

14:09 bbloom_: i'm just kidding

14:09 stuartsierra: cljs-build has a default CLJS version but Leiningen :dependencies overrides it.

14:11 cemerick: dnolen: the old behaviour can't be preserved. It's _possible_ something similar can be provided, but it'll never be as magic as what's there now.

14:13 stuartsierra: thanks for the goog deps packaging :-)

14:13 stuartsierra: cemerick: You're welcome. I've got some help from Sam Umbach at Relevance, who's trying to make it more automatic.

14:14 konr: Does (keys foo) always return the same results, or the keys can be in a different order?

14:14 atyz: Does ring have a way of determining the content-type if not explicitly set?

14:14 dnolen: cemerick: I'd like to see the docs change as little as possible, and existing tools can just do what they were doing before.

14:15 technomancy: konr: guaranteed to be the same order for a given instance of a map

14:16 jonasen: dnolen: what tools are you referring to? cljsbuild and ?

14:16 konr: technomancy: thanks!

14:16 dnolen: jonasen: node-repl

14:18 cemerick: dnolen: insofar as existing tools are expecting that there's a single server running on port 9000...that's just not something we should *want* to retain.

14:18 dnolen: node-repl has nothing to do with the browser repl...

14:19 dnolen: cemerick: yes I just meant how REPLs hook in

14:20 cemerick: dnolen: Confused. The patch on 489 doesn't change anything about REPL envs and such. node-repl 'hooks in' just like the new browser-repl does and how the rhino env does.

14:20 dnolen: cemerick: yes but I don't see the point of the yak shaving around removing the simple server

14:21 llasram: technomancy: lagging due to lunch, but do you have a reference to the clojure.walk public-disowning?

14:21 cemerick: hah

14:23 dnolen: it's not yak-shaving; pulling out the home-grown HTTP server was necessary to make it possible to have multiple browser-repls going simultaneously. That objective is largely at odds with any assumption that there's a single server that you can statically refer to in the "simple" case where it serves up your entire app.

14:24 dnolen: cemerick: I don't see what real challenges there are making the old default work while supporting the new fancy multiple browser REPL world.

14:27 Foxboron: cemerick: do you got any extensive documentation on how the NREPL server works? Trying to write a NREPL server for another language.

14:27 cemerick: Foxboron: the readme is pretty lengthy, and see the ops.md file in the repo.

14:28 dnolen: Not challenges, as long as 100% compat with the old way isn't required. Like I said, it's possible some ground can be made up to make the new act like the old in many ways, but some things (like the port 9000 expectation) just won't.

14:30 dnolen: cemerick: yes and that's what I would like to see before pushing that patch forward - I'm not so concerned about the port bit.

14:30 squidz: when I try to get my value from a channel via (js/console.log (go (<! c))) why does it only work if I move the console.log call inside the go form?

14:30 dnolen: squidz: go blocks return channels

14:31 squidz: oh right so it was just printing the channel

14:31 dnolen: thanks

14:32 cemerick: dnolen: Q: why? If a dynamic port is OK, then whatever tools actually depend on the browser repl will break anyway.

14:32 dnolen: cemerick: why shouldn't a user be able specify a port?

14:34 cemerick: also why can't the first port default to 9000 and be some other value after that?

14:37 cemerick: dnolen: starting at 9000 and going up means that people and tools will assume 9000, then will either (a) connect, (b) fail to connect, or (c) connect to the wrong browser-repl server. In either (b) or (c), they'd have to go look and see what the port number was anyway. Defaulting a port number just complicates the workflow and/or sets a trap.

14:38 tl;dr: why should you ever have to specify a port?

14:42 dnolen: cemerick: ok, I do so what you mean - to be honest I haven't had time to look at the largish patch. But it doesn't seem to me that the tools do not break in a significant way? They call browser REPL, it starts up the web server on a dynamic port, and on the client side how does that port get resolved?

14:43 "it doesn't seem the tools break in a significant way" is what I meant

14:47 cemerick: dnolen: each browser-repl env record carries slots with the URL that you'd use with `connect` or copy/paste into a browser. You can get that into your client-side however you like; the typical case is probably via whatever templating you're using already.

14:47 dnolen: cemerick: so it doesn't auto resolve?

14:48 cemerick: dnolen: "auto resolve"?

14:48 dnolen: cemerick: ok so no

14:49 cemerick: yeah I'm not excited about this - it probably should be broken out into a separate facility.

14:49 cemerick: dnolen: if you mean "automatically find the right browser-repl server", then no, that's not supported. Not sure how it could be, given you could be running N browser-repl servers.

14:50 dnolen: cemerick: yes I understand what you're trying to do now

14:50 cemerick: it should be a separate browser REPL facility in addition to what we have now

14:50 * cemerick facepalms

14:51 cemerick: man, that's exactly what I was planning on doing ~6 months ago before trying to wedge a patch together

14:52 dnolen: cemerick: when I say "separate" I don't necessarily mean outside CLJS

14:52 cemerick: but I think it should be made to work as w/o affecting what we have instead of walking over it.

14:53 cemerick: dnolen: Well, that's easy; it's just another repl env, and has nothing to do with the existing browser-repl.

14:54 dnolen: cemerick: sounds like a plan then

14:55 cemerick: dnolen: separate lib tho; if it's not going to be the default, then there's little reason for it to be part of cljs proper, at least to start.

14:55 I'll wrap it up into a project sometime next week, hopefully.

14:56 dnolen: cemerick: I think that's fine as well.

14:56 wei_: is there a rails-like "time ago" library for diffing two timestamps? e.g. "10 days ago" "3 seconds ago"

14:56 Raynes: tpope: Ping.

14:57 dark_element: cemerick, Is multiple browser-repl server setup meant for cross browser dev?

14:58 wei_: i think clj-time will do

15:02 cemerick: dark_element: Multiple browsers, having multiple headless cljs REPLs for whatever reasons, etc. All the same rationales for why you might want to have more than one Clojure REPL.

15:02 so, all that's left to do is come up with a name besides "browser-repl" :-P

15:04 dark_element: cemerick js-repl ?

15:04 jodaro: i vote for "sylvia"

15:04 callen: Raynes: nobody can help you now, bwahahaha

15:04 cemerick: dark_element: I hope I come up with something with a bit more panache. :-)

15:05 squidz: are yall figuring out a standard way to get a browser repl?

15:05 dark_element: cemerick ohh it didn't occur to me it's for the project and not for renaming the browser-repl itself.

15:06 Raynes: callen: Wat?

15:07 callen: Raynes: you asked for tpope and i was feeling silly.

15:07 cemerick: dark_element: nope, browser-repl remains as-is. I was planning on releasing the revamp separately at the beginning, so all is as it should be, I guess.

15:10 lynaghk: dakrone: ping

15:10 dakrone: lynaghk: pong

15:10 lynaghk: dakrone: I was using clj-http to implement an HTTP proxy, and I think I ran into a bug. I wanted to ask you about it casually before opening up an issue on github

15:11 dakrone: lynaghk: certainly, what's up?

15:11 callen: lynaghk: HTTP proxy? use http-kit.

15:11 dakrone: I'm just about to release a new version that fixes an issue

15:11 lynaghk: dakrone: Right now clj-http will deflate the body but it leaves the content-encoding gzip header on

15:12 callen: what are the relative merits of http-kit's client vs clj-http?

15:13 dakrone: lynaghk: I believe it's left on to signify that it was at once point compressed, I see your point though that it might need to be removed

15:13 lynaghk: however, if you are creating a proxy, it might be better to do {:decompress-body false} so it's passed through compressed

15:14 callen: lynaghk: http://http-kit.org/ async, highly concurrent, designed for this kind of problem.

15:15 lynaghk: dakrone: I need the proxy to do http-content rewrites (inject a script tag) so it'd need to be decompressed

15:16 callen: lynaghk: you want http-kit.

15:16 lynaghk: dakrone: I was just surprised about the behavior, since the api takes ring request maps and I got the impression you should just be able to pipe things through and have it work decently.

15:16 callen: sigh. you can't amend mercurial commits that have joined the public change-set.

15:16 dakrone: lynaghk: I understand, I will work on a fix for it, it should be a bug that it's not removed

15:17 lynaghk: dakrone: okay, cool; as I said, I didn't want to just open up an issue because it was just a surprise to me, so I didn't know if it was a bug in the codez or in my understanding =P

15:18 callen: I'm aware of http-kit, just not of any reason to use it over clj-http. "async, highly concurrent" isn't compelling for my particular use case.

15:20 technomancy: impossible. anything can be made better by adding async to it.

15:21 hate clojure's stack traces? try an async approach; that will get rid of those pesky stack traces once and for all.

15:23 duck1123: I wish I could "like" irc messages

15:23 trinary: just post them to twitter

15:23 technomancy: you can like them without the quotation marks; that's good enough for me.

15:24 hyPiRion: duck1123: you have inc for that, somewhat

15:24 clj_newb_2345: is there a way to use clojurescript without having to load all the google closure libraries?

15:24 hyPiRion: Hmm, is inc case-sensitive?

15:24 (inc HYPIRION)

15:24 lazybot: ⇒ 15

15:24 hyPiRion: lol what

15:24 clj_newb_2345: (case: mobile tools, not wanting to deal with all the libraries that google closure loads)

15:25 hyPiRion: Raynes: ^

15:25 gfredericks: hyPiRion: you just found a self-incing hack!

15:25 hyPiRion: I shouldn't be able to inc myself

15:25 gfredericks: wohoo

15:26 gfredericks: maybe it accepts my inc because I screamed to it

15:26 Raynes: $karma Raybes

15:26 lazybot: Raybes has karma 0.

15:26 Raynes: $karma Raynes

15:26 lazybot: Raynes has karma 33.

15:26 Raynes: (dec RAYNES)

15:26 gfredericks: (inc raybes)

15:26 lazybot: ⇒ 32

15:26 ⇒ 1

15:26 ucb: $karma ucb

15:26 lazybot: ucb has karma 0.

15:26 hyPiRion: (INC RAYNES)

15:26 Raynes: Intresting.

15:26 hyPiRion: oh, that won't work.

15:26 (inc RAYNES)

15:26 lazybot: ⇒ 33

15:26 technomancy: what about (identity RAYNES)

15:26 Raynes: I didn't realize strings were getting normalized.

15:26 technomancy: That's a good idea.

15:27 hyPiRion: technomancy: inc on that

15:27 Raynes: hyPiRion: Go fix that and do what technomancy just said.

15:27 hyPiRion: Raynes: okay boss

15:27 gfredericks: technomancy: how can we make that side-effecting?

15:27 hyPiRion: Just don't bring your whip out again

15:27 gfredericks: deref, inc! and dec! ?

15:27 technomancy: gfredericks: if you figure that out you'd probably earn a few incs for sure

15:28 another feature request: dinc for double-incing

15:29 gfredericks: and ddinc for incing 12 times

15:29 clj_newb_2345: does clojurescript debugging have sourcemaps yet

15:29 or is it still (1) look at jvascript (2) find corresponding clojurescript line

15:30 ibdknox: ping

15:31 hyPiRion: oh wow

15:31 There's a (Thread/sleep 300000) in here.

15:31 oh well.

15:31 gfredericks: hyPiRion: that's bad for perf

15:31 at least in theory

15:31 make sure you do your own benchmarks

15:31 technomancy: the compiler should be able to optimize that away

15:32 gfredericks: technomancy: always test!

15:32 hyPiRion: gfredericks: not sure. (future (Thread/sleep 300000) (do-something)) should be bad, yeah

15:32 Raynes: LOL

15:32 gfredericks: hyPiRion: is this the lazybot inc-debouncer?

15:33 Raynes: amalloy: ^ What are you doing there?

15:33 https://github.com/flatland/lazybot/blob/master/src/lazybot/plugins/karma.clj#L40

15:33 hyPiRion: gfredericks: yeah

15:33 amalloy: Raynes: that code isn't mine, man

15:34 i'm just on the git-blame because i touched it last

15:34 Raynes: Oh, I guess this is the thing that limits number of alters?

15:34 Okay, that makes sense.

15:34 hyPiRion: This makes sense, what are you on about

15:34 technomancy: yeah what the heck; that should totally be a commute

15:34 Raynes: technomancy: I'm pretty sure it shouldn't be a ref in the first place.

15:35 squidz: (inc SQUIDZ)

15:35 lazybot: ⇒ 1

15:35 amalloy: Raynes: this is one of many ways in which a user could fork-bomb lazybot, btw

15:35 Raynes: I didn't write this code either. At least, not the original plugin.

15:35 amalloy: Eh?

15:35 What way?

15:35 amalloy: Raynes: every time i inc or dec someone, i consume a thread for five minutes

15:35 then i switch nicks and do it again

15:35 Raynes: sofixit

15:36 :p

15:37 amalloy: actually i don't even have to switch nicks, since there's a separate limit per target

15:38 hyPiRion: oh humm

15:40 Raynes: I don't think I wrote this either fwiw.

15:40 Didn't someone contribute the plugin at some point?

15:40 I can't tell because you killed its history when we renamed.

15:40 amalloy: ivey something, right?

15:40 Raynes: And I'm too lazy to git blame it locally.

15:40 Ah yes.

15:41 gfredericks: dang people are building languages with clojure as a platform now

15:41 amalloy: it's at the top of the dang file

15:41 Raynes: Good old Ivey. He is legend now, since he is gone.

15:42 technomancy: he stopped his iveyfavs tweetor account =(

15:42 https://mobile.twitter.com/iveyfavs

15:42 ^ gold mine

15:43 I guess it was funnier before it was 90% NSA tweets

15:50 bbloom_: gfredericks: what about clojure as a platform?

15:52 squidz: what are some ways I can combine clojurescript and javascript. For example if I want to write code in javascript for a specific library but somehow separate out the logic into clojurescript. Is good ways of doing this?

15:53 amalloy: Raynes: try https://github.com/flatland/lazybot/compare/master%5E%5E...master

15:54 i guess that probably leaves open a way around the "five-minute limit" thing, but honestly i'm not sure that's a useful feature

15:57 gfredericks: bbloom_: gershwin is a language with "seamless clojure interop"

15:58 but I assume you're familiar with it

15:58 zoldar: Raynes: are you using evil-mode along with undo-tree? I get a warning after issuing any command after requiring undo-tree: "Symbol's function definition is void: ad-Orig-deactivate-mark". Did you hit any similar issue while setting it up?

15:58 Raynes: I'm using actual vim right now.

15:58 bbloom_: gfredericks: nope, hadn't seen it

15:59 zoldar: ah, ok then

15:59 callen: lynaghk: sounds like you've got it in hand then. :) godspeed.

15:59 bbloom_: gfredericks: "Gershwin is a stack-based, concatenative programming language with a Clojure runtime that targets the JVM."

15:59 callen: Raynes: you should use fake vim.

15:59 bbloom_: gfredericks: bwah? how did i miss this? that's all right up my alley :-P

16:00 SegFaultAX: bbloom_: Ping!

16:00 bbloom_: SegFaultAX: what' sup?

16:00 gfredericks: bbloom_: yeah I assumed you had half-invented it

16:00 SegFaultAX: bbloom_: IMGUI!?

16:00 bbloom_: SegFaultAX: IMGUI!!!!

16:01 callen: SegFaultAX: immediate mode is pleb mode.

16:01 bbloom_: callen: i disagree strongly

16:02 dakrone: lynaghk: are you able to test out https://github.com/dakrone/clj-http/commit/ede1a89b7189e8a32a9b4ee4afda018cae4ffef1 before I cut a release with it in?

16:02 bbloom_: i think that intermediate mode naturally fits the notion of traversal

16:02 immediate* i mean

16:02 you don't need to be side effectual to utilize immediate mode

16:02 callen: bbloom_: modern graphics pipelines are built around retained mode. Even web content is headed in that direction.

16:02 bbloom_: don't fight the future...prole.

16:03 The "broken paradigm" of statefulness has been running the world round for decades. You need a more compelling narrative than "everything that seems to be working fine is broken, we know better!"

16:04 Immutability is immenseful useful, especially anywhere business logic predominates.

16:04 scottj: zoldar: #evil-mode maybe

16:04 callen: immensely*

16:04 but for graphics? lol gtfo.

16:05 bbloom_: callen: i used to work in the game industry. i'm telling you: modern games strongly avoid retained scene graphs & much prefer custom in memory database traversals

16:05 not for perf, although they get that too

16:07 callen: it's being deeply disingenuous to say that because not all of the pipeline is modeled in terms of retained mode, that none of it is or should be retained mode.

16:07 bbloom_: immediate vs retained is an invalid dichotomy

16:07 game developers thing in terms of immediate vs retained, but the real concern is internal vs external state

16:08 instagram's React is, effectively, an external-state & retained-mode system

16:08 however, game developers would probably think of it as immediate-mode

16:08 callen: bbloom_: also your experience was deeply biased by having been at Microsoft

16:08 bbloom_: just because they failed at retained mode with D3D early on doesn't mean the rest of the industry did.

16:09 retained-mode is the standard in OGL.

16:09 bbloom_: callen: LOL no it isn't

16:09 it hasn't been since a loooong time ago

16:09 when was the last time you used ogl?

16:09 display lists are gone

16:09 modern open gl mimics the hardware

16:10 which mimics the direct 3d api

16:11 callen: bbloom_: mostly 3.x, AFAIK OGL 4 got rid of immediate mode entirely and 3.x was the beginning of that shift.

16:12 it was primarily old OGL 2 stuff that was immediate-mode.

16:13 bbloom_: callen: are you considering vertex buffers "retained"?

16:13 b/c as far as i can tell, precisely the opposite of what you're saying happened: OGL 4 does not support *any* retained mode primitives

16:14 there is a terminology gap here

16:14 this is why i'm saying "retained" vs "immediate" is a broken thought process

16:14 immediate mode doesn't mean you don't retain anything

16:15 opengl literature SOMETIMES refers to vertex buffers etc as "retained"

16:15 which is only true so much as any cache implies retention

16:16 the bigger question is one of retaining drawing commands (like opengl's display lists) or scene graphics (like D3D retained mode)

16:16 callen: bbloom_: ...no.

16:16 bbloom_: the shift in OpenGL has always been to continually push towards retained mode with manipulable primitives.

16:16 WebGL is immediate mode

16:17 bbloom_: callen: i can find no evidence of your assertions regarding opengl 4

16:17 callen: bbloom_: this covers it nicely in high level goals and also specifics: http://www.opengl.org/registry/doc/glspec40.core.20100311.pdf

16:18 in particular, the early "* view" sections.

16:19 futile: How do you do a lot of little integration tests that require a database to set up?

16:19 callen: I didn't know Microsoft actually convinced their employees the rest of the industry was going to move back to using immediate-mode.

16:19 futile: Is there a Clojure lib for that?

16:19 bbloom_: callen: you have your terminology confused

16:19 callen: i just read the programmer & implementor sections. those are describing immediate mode

16:20 dark_element: I am trying to use webgl shaders with clojurescript the problem is interop between shaders and js in itself is wonky. I am not sure how to interop between webgl shader and clojurescript

16:21 bbloom_: SegFaultAX: was there something productive you wanted to discuss?

16:21 sandover: bbloom_, callen: terminology is definitely at issue here. "immediate mode" is usually used (is it not?) to describe a more or less stateless, one-shot, call such as glVertex3d()

16:21 those are banished now

16:22 callen: bbloom_: the entire OpenGL spec is about retained geometric primitives.

16:22 sandover: vertex buffers represent state

16:22 callen: bbloom_: it is nothing but retained mode now, the entire immediate mode API to OpenGL from the 2.x era is effectively gone and deprecated.

16:22 sandover: so if you're doing 'modern' opengl, you'd probably have to characterize it as more 'stateful' than it used to be

16:23 callen: you could fairly describe it as an *impure* implementation of retained mode, but it's still more in that continuum than anything approximating an immediate mode rendering pipeline BY FAR

16:23 bbloom_: modern opengl doesn't retain any drawing commands, only resources

16:23 callen: especially from the point of view of the "boots on the ground" developer.

16:23 bbloom_: this is why i said "retained" vs "immediate" is a false dichotomy

16:23 sandover: display lists were essentially a record of a series of immediate mode calls, which could be played back over & over again

16:23 they were a transitional step to vertex buffers

16:24 the word 'retained' is the red herring.

16:24 bbloom_: sandover: that's what i'm saying

16:24 callen: bbloom_: and guess how VBO is used? for non-immediate-mode rendering...

16:24 bbloom_: callen: you call a draw function & give it a handle to the vertices....

16:24 sandover: yes. but do we all agree that a VBO is a kind of state?

16:24 callen: yes.

16:25 sandover: with immediate mode drawing (basically turtle graphics) there is no need for that state

16:25 callen: all of the *retained* primitives that get statefully manipulated by the OpenGL API are state.

16:25 bbloom_: it's a question of WHAT gets retained

16:26 sandover: yes. even under immediate mode graphics there is a gob of state that impinges on how the immediate mode calls would actually get rendered.

16:26 bbloom_: retaining vertex data is dramatically different than retaining command sequences

16:26 callen: bbloom_: as far as the industry is concerned, not really.

16:26 sandover: it's still a ball of mud

16:26 callen: bbloom_: for their purposes, that's retained mode.

16:26 bbloom_: as i've argued several times, retained vs immediate are bad terminology

16:27 callen: bbloom_: you're the only confused one.

16:27 bbloom_: i'm not confused at all

16:29 http://en.wikipedia.org/wiki/Immediate_mode

16:29 http://en.wikipedia.org/wiki/Retained_mode

16:29 those definitions back up what i've been saying

16:29 "Although drawing commands have to be re-issued for each new frame, modern systems using this method are generally able to avoid the unnecessary duplication of more memory-intensive display data by referring to that unchanging data (e.g. textures and vertex buffers) in the drawing commands."

16:29 jonasen: I not able to run the clojurescript tests. Getting an exception when compiling test_runner.cljs

16:29 callen: retained-mode is far from expressly about drawing commands.

16:29 bbloom_: anyway, i'm done arguing b/c like i said. the terminology is somewhat fuzzy and non-helpful to differentiate

16:30 jagaj: I've been out of the clojure loop for around a year now, has there been any recent developments in the non-emacs ide world?

16:30 bbloom_: lol the wikipedia article on retained mode even says: "For example, OpenGL has immediate mode functions that can use previously defined server side objects (textures, vertex and index buffers, shaders, etc.) without resending unchanged data."

16:30 anyway, back to work

16:31 callen: this may be a case of descriptivism vs. prescriptivism.

16:31 jonasen: dnolen: bbloom_: have you tried running the tests with a fresh clojurescript clone. I'm probably doing something wrong here

16:31 callen: All of the original immediate mode API was deprecated in OpenGL 4

16:42 lynaghk: dakrone: is there a snapshot release I can pull down to test?

16:42 dakrone: lynaghk: too late! :) 0.7.6 is released

16:42 lynaghk: dakrone: I will test anyway. thanks for the speedy help!

16:42 dakrone: lynaghk: no problem, let me know if you have any more issues

16:43 lynaghk: dakrone: I'm pretty sure I've owed you a beer before, so now it's two next time you're in PDX

16:43 dakrone: hah, thanks :)

16:50 lynaghk: dakrone: should I be allowed to just pass in the ring request map to clj-http to proxy?

16:51 dakrone: or would it be better if I explicitly tried to construct a URL out of the ring request's keys (uri, request-method, &c.)

16:51 dakrone: lynaghk: it's be safer to construct one

16:51 err, grammar

16:51 it'd be safer to construct one

16:52 so if possible, that'd be the way I'd do it

16:53 lynaghk: dakrone: so I'd need to manually construct a url from the ring request map's fields?

16:54 jonasen: dnolen: It seems like the analyzer crashes when trying to read ::other/foo here: https://github.com/clojure/clojurescript/blob/master/test/cljs/cljs/keyword_test.cljs#L6

16:54 yedi: i have a url like this `http://localhost:3000/search/?feature=ombre&feature=new` -- in compojure, (:params request) only returns {:feature "new"}, how can i get it to return a mapping of param names to list of values? (instead of only one arbitrary value)

16:54 dakrone: lynaghk: yea, if you want to manually create one

16:54 lynaghk: a similar project (proxy from ring to clj-http) is here: https://github.com/drewr/norville/blob/master/src/norville/middleware.clj#L13

16:56 lynaghk: dakrone: ah, cool. I'll check that out.

16:57 yedi: hm, something else must be going wrong, since the ring docs explicitly say that behavior is supposed to return a list

16:58 oh looks like params and query-params behave differently

16:59 callen: bbloom_: 3.x told people to stop using glBegin/glEnd immediate mode stuff. and 4.x says an implementation does not even have to include it unless they advertise legacy support.

16:59 bbloom_: directly from a programmer at NVidia. mobile game dev concurred with the general shift to the hybrid retained mode from immediate mode in OpenGL.

16:59 bbloom_: callen: holy hell are you still on about this?

17:00 callen: bbloom_: I wanted to know.

17:00 llasram: s,know,be right at all costs,

17:00 bbloom_: (inc llasram)

17:00 lazybot: ⇒ 9

17:01 jzelinskie: what is the defacto http library for clojure?

17:02 llasram: jzelinskie: https://github.com/dakrone/clj-http

17:02 jzelinskie: where is a good place I can learn about the popular libs?

17:02 third party libs that is

17:02 callen: bbloom_: the commands that manipulate the data structures are themselves "immediate" in nature but given the specificity per primitive of those commands, the deep statefulness of the data structures, shaders, etc and the stateful, retained nature of those primitives it's a mostly retained mode design.

17:02 jzelinskie: thanks btw

17:03 llasram: Is http://www.clojure-toolbox.com/ still any good? Honestly, I think I learn mostly by watching here and the clojure-users list

17:03 callen: llasram: it's out of date but still useful.

17:03 llasram: best to just ask in here if it's important.

17:03 jzelinskie: ok thanks

17:03 technomancy: I like clojuresphere, but I wish it decayed the significance of outdated dependencies

17:03 llasram: Oh, hey, clojure-toolbox has cassaforte on it, so can't be that out-of-date

17:04 and fluokitten for that matter

17:04 Looks up-to-date to me

17:04 bbloom_: callen: i'm going back to my policy of ignoring you and your pedantry

17:05 callen: llasram: yeah fluokitten is new. hrm. there are definitely some libraries that have fallen into disuse on that site though.

17:10 llasram: case in point, the SQL section on clojure-toolbox is...painful.

17:19 jzelinskie: is slingshot popular? it looks pretty useful

17:20 lynaghk: dakrone: I'm using the :stream option of clj-http and passing the body directly to embedded jetty, but it looks like requests with transfer-encoding: chunked are getting cut off

17:20 dakrone: lynaghk: is it up anywhere I could take a look at?

17:21 lynaghk: dakrone: https://gist.github.com/lynaghk/6066181

17:22 dakrone: bumping to the new version fixes the gzip issues though, thanks.

17:24 dakrone: lynaghk: so you're removing the transfer-encoding headers manually there, but you want them to not be removed?

17:25 nDuff: jzelinskie: moderately.

17:25 dakrone: lynaghk: not sure how it's misbehaving

17:25 technomancy: jzelinskie: slingshot was a lot more important before clojure got ex-info. now it's nice for fancier try/catch but not essential

17:26 lynaghk: dakrone: I need to remove the transfer-encoding headers since I'm proxying them. Presumably clj-http has given me a body stream that when slurped is the entire body

17:27 dakrone: I think the issue is that the body I get out of clj-http is not the full body; when I pass it off to jetty the client gets truncated results.

17:29 dakrone: lynaghk: if it's string-ish data, you could print it and see what it is

17:32 jzelinskie: i see technomancy -- i didn't know about ex-info thanks

17:35 dakrone: lynaghk: alternatively, you could set {:debug true :debug-body true} and get some debug info printed out

17:35 lynaghk: dakrone: hmm, it's printing out fine, which makes me think jetty is messing up sending down the string somehow....ugh!

17:36 jzelinskie: wait clojure lets you define multiple definitions with different aritys in the same defn?

17:36 i guess I never put that together

17:37 dark_element: jzelinskie yup

17:37 jzelinskie: do other lisps do it the same way?

17:39 bbloom_: jzelinskie: the syntax is slightly different in different lisps

17:39 jzelinskie: since they dont have vectors etc... yeah i'd imagine

17:39 bbloom_: the semantics differ too, but in very subtle ways

17:39 for example, clojure's variadic functions interop cleanly with lazy sequences

17:42 lynaghk: dakrone: everything is working fine when curl uses the proxy, I'm going to assume this is a firefox problem =/ thanks for your help

17:42 dakrone: lynaghk: no problem, glad it's working

17:45 mikerod: is it faster to conj to a PersistentVector$ChunkedSeq or a PersistentHashSet?

17:45 faster = more efficient

17:47 hiredman: a PersistentVector$ChunkedSeq is just a seq

17:47 conj on to a seq is adding a node to the front of a linked list

17:48 sets require hashing and maybe equality checks, depending on the values

17:48 justin_smith: hiredman: so would that mean that hashes are faster for lookup, and seqs faster to build?

17:48 hyPiRion: hiredman: at least a hash lookup + pointer check, no?

17:49 hiredman: if you have further questions, I suggest reading documentation and source

17:51 bbloom_: justin_smith: it's a little more complex than that. for example, small maps are represented internally by arrays with linear scans instead of hashing! see PersistentArrayMap vs PersistentHashMap vs PersistentTreeMap

17:52 mikerod: hiredman: thanks, that make sense. I wasn't sure that the PersistentVector$ChunkedSeq is the same as seq when using conj. Source would probably be helpful there.

18:03 lynaghk: dakrone: actually, have another question for you if you've got a sec

18:04 dakrone: if clj-http's gzip is supposed to be transparent, when you use the :as :stream request option, shouldn't the body be a deflated stream, not a gzip stream?

18:05 OneFourSeven: I'm trying to figure out how to do routing in a one page client side app in Clojurescript. Trying to get something similar to backbone or angularjs's routing. Any ideas?

18:06 konr: OneFourSeven: I think there are some client-side routing libraries for CLJS on github


18:10 bbloom_: (doc when-first) ;; mind blown. had no idea that existed

18:10 clojurebot: "([bindings & body]); bindings => x xs Roughly the same as (when (seq xs) (let [x (first xs)] body)) but xs is evaluated only once"

18:11 dark_element: I am trying to use requestAnimationFrame with core.async but end up blocking the whole page. https://www.refheap.com/16874

18:11 amalloy: bbloom_: it's okay, and i use it occasionally, but usually i also want to bind (seq xs) to something, so that it doesn't have to be re-seq'd when i call (rest xs)

18:12 really i'd like (when-let [[x & xs] (seq xs)] ...), except that that's not lazy enough

18:13 bbloom_: maybe call it when-seq & get it to do what you want?

18:13 dakrone: lynaghk: I don't follow, why would it be a deflated stream rather than a gzip one?

18:13 bbloom_: (when-seq [[x & xs] s] …)

18:13 trinary: ok just getting started with clojurescript, is https://github.com/magomimmo/modern-cljs a reasonable way to get things going, browser repl, all that stuff?

18:13 dakrone: lynaghk: it uses whichever is determined from the content-encoding header

18:14 OneFourSeven: trinary: are you using emacs?

18:14 trinary: vim is my usual editor

18:15 lynaghk: dakrone: sorry, I meant that it should be the underlying stream

18:15 OneFourSeven: Modern cljs is a fine guide to start with.

18:16 lynaghk: dakrone: the issue was that I was getting gzipinputstreams and then sending them down to the end client without uncompressing them.

18:16 dakrone: lynaghk: if it doesn't decompress (or if it's turned off), it shouldn't be a GZIPInputStream, it should be a regular InputStream

18:16 trinary: OneFourSeven: thanks, just want to make sure I'm not shooting myself in the foot right from the getgo.

18:18 lynaghk: dakrone: yeah, that's the issue. Even if you explicitly say :decompress-body true, if you have :as :stream then the body is a GzipInputStream

18:19 dakrone: lynaghk: {:decompress-body true} enables it, you'd need {:decompress-body false} to disable it

18:19 dark_element: trinary also check this if you are using nrepl https://github.com/cemerick/piggieback

18:20 lynaghk: dakrone: right. What I'm saying is that even if you have {:decompress-body true}, if you also have {:as :stream} then the body isn't actually decompressed---you get a GZIPInputStream

18:20 dakrone: lynaghk: right, it's decompressed as it's being read

18:21 lynaghk: dakrone: ahhhh. Okay. well then I'm back to square one =/

18:21 dakrone: lynaghk: so you want to either turn off body decompression, or read the entire stream into memory and munge it there it sounds like

18:22 lynaghk: is the zipped stream causing issues somewhere?

18:22 trinary: dark_element: thx, will check it out

18:22 lynaghk: dakrone: yeah. there are several things getting mixed up in here. I've tried reading the entire stream into memory and munging it, which works fine for small things, but for big things that I just want to pass through (i.e., I don't slurp them in) they get truncated

18:23 dakrone: lynaghk: it might be that Jetty tries to grab the length of the stream, which is actually a gzipped stream, so the length is incorrect when re-hydrated, and thus gets truncated

18:24 lynaghk: can you turn off decompression and see if it persists?

18:26 lynaghk: dakrone: jetty doesn't seem to add a content-length header at all

18:26 dakrone: lynaghk: what are the headers that jetty sends?

18:26 lynaghk: dakrone: so the issue could be that curl keeps trying and firefox gives up after the first chunk when there is no content length

18:27 dakrone: https://gist.github.com/lynaghk/ba0756eab5d19780d068

18:29 dakrone: lynaghk: and the data from jetty is in correct chunked-encoding format?

18:29 lynaghk: dakrone: as far as I can tell---curl spits out the right result

18:29 dakrone: firefox, however, doesn't give the whole file

18:30 dakrone: lynaghk: can you paste the headers from clj-http's {:debug true} output?

18:31 lynaghk: dakrone: gist updated.

18:32 dakrone: lynaghk: any header difference when firefox is used instead of curl?

18:34 lynaghk: dakrone: gist updated.

18:36 dakrone: lynaghk: if you don't mind the tedium of typing, you could try doing the request with curl, but manually specifying the exact firefox headers

18:37 to see whether it's header related

18:37 lynaghk: dakrone: yeah, I'll give that a shot. I have to run for now, though

18:37 dakrone: lynaghk: good luck!

18:37 lynaghk: dakrone: this proxy bit was a "minor feature" that has sucked up more time than everything else on this project

18:37 dakrone: thanks! =P

18:37 dakrone: lynaghk: hah, if it were public I would be able to help more

18:38 lynaghk: dakrone: yeah, I may split this thing out into a repo. I was wary about making it public because then it might get popular...

18:39 and then I would *definitely* start yak shaving.

18:44 futile: How would you remove only one entry from a vector, based solely on value, without removing duplicates?

18:44 Surely this is possible in about 10 boring lines of code. But is there a fun Clojure one-liner for it?

18:44 bbloom_: futile: clojure intentionally lacks a function for removing an interior item from a vector b/c it would have to be a linear algorithm

18:45 futile: Oh.

18:45 Or something.

18:45 bbloom_: you could create such a function in slightly more than a one liner :-P

18:46 futile: I'm thinking of something that mixes the first-filter pattern with split-by.

18:46 I mean split-at.

18:47 Only thing I'm missing is how to get the index of the first instance of a value in a vector.

18:47 noonian: its simple as a recursive function

18:47 futile: Nothing is simple as a recursive function and I no longer wish to be your friend.

18:48 ,(split-with #{3} [1 2 3 4 5])

18:48 clojurebot: [() (1 2 3 4 5)]

18:48 hyPiRion: ,(apply concat ((juxt take-while (comp rest drop-while)) #(not= 4 %) [1 2 3 4 5 6 7 8 9]))

18:48 clojurebot: (1 2 3 5 6 ...)

18:48 noonian: lol

18:48 futile: hyPiRion: hmm, that's kind of like split-with/at..

18:48 hyPiRion: futile: yup, with a rest mixed in.

18:49 futile: Great to hear I wasn't that far off.

18:51 hyPiRion: Alas I'm not smart enough to read that solution :(

18:52 So is it still fashionable to write your own Lisp interpreter these days?

18:52 Last time I tried, I got stuck on the confusion about empty lists and nil.

18:52 bbloom_: futile: everybody should try it at least once

18:53 it's good for you!

18:53 futile: No, I think it just makes people arrogant.

18:53 hyPiRion: futile: it's exactly the same as split-with, just that (comp rest drop-while) removes the first element the drop-while usually returns

18:53 futile: "I've wrote a Lisp interpreter, see, I'm smarter than you now."

18:53 hyPiRion: (apply concat ...) is, well

18:54 ~flatten

18:54 clojurebot: flatten is rarely the right answer. Suppose you need to use a list as your "base type", for example. Usually you only want to flatten a single level, and in that case you're better off with concat. Or, better still, use mapcat to produce a sequence that's shaped right to begin with.

18:54 futile: Oh.

18:54 hyPiRion: there should be a juxtcat

18:56 futile: Seems clearer to just use split-with, and concat (first %) with (rest (second %))

18:56 noonian: futile: I'd do it like this: http://pastebin.com/hSkQknJD

18:57 futile: noonian: YOU HAVE A VERY NICE HAT

18:57 I'm trying to practice that rule of "if you don't have something nice to say, make something up".

18:57 "and yell it if the thing you wanted to say was because you're angry"

18:58 noonian: futile: sorry...


18:58 noonian: THATS A GOOD THING.

18:59 LIKE THIS ONE http://bit.ly/13betrS

18:59 seangrove: Calm down futile

18:59 futile: Geez, a guy can't even compliment someone's hat these days.

19:00 ,(let [[a b] (split-with (partial not= 3) [1 2 3 4 5])] (concat a (rest b)))

19:00 clojurebot: (1 2 4 5)

19:00 futile: ,(let [[a b] (split-with (partial not= 3) [5 4 3 2 1 2 3 4 5])] (concat a (rest b)))

19:00 clojurebot: (5 4 2 1 2 ...)

19:01 futile: ,(pr-str (let [[a b] (split-with (partial not= 3) [5 4 3 2 1 2 3 4 5])] (concat a (rest b))))

19:01 clojurebot: "(5 4 2 1 2 ...)"

19:01 futile: fff

19:03 Thanks noonian for your help. It's much appreciated.

19:03 You too hyPiRion and bbloom_.

19:04 noonian: np

19:05 futile: noonian: I've been noticing that Clojure's lazy sequences usually solve the same problem recursion does, just in a less confusing way. That's why I prefer lazy sequences over recursion in Clojure.

19:05 noonian: I agree, I prefer to use higher order functions usually

19:06 but I couldn't think of a non-hacky way to do it with reduce or something and make sure that only the first one was removed

19:06 futile: noonian: ah I see.

19:07 noonian: well nevertheless, I appreciate that you took the time to even come up with a solution. Very kind of you.

19:07 noonian: futile: no problem, I like writing recursive functions and as you pointed out you don't have to very often in Clojure :P

19:07 futile: Well gotta go now.

19:07 Bye and thanks all.

19:23 lynaghk: dakrone: you are not going to believe this nonsense: it was the user-agent string. adding that header lead to the truncated body.

19:23 dakrone: lynaghk: wat

19:23 lynaghk: I KNOW.

19:24 dakrone: that's weird

19:24 lynaghk: dakrone: there are still some other issues, I'm going to open source this bad boy in a misc repo so that you can kick it around if you're interested.

19:24 dakrone: lynaghk: sure, happy to help

19:32 lynaghk: dakrone: https://github.com/lynaghk/misc

19:32 dakrone: I've added you as a collab, so feel free to push or tweak whatever you want to. If we actually end up with a usable proxy rewriter we can graduate it to its own repository.

19:33 dakrone: lynaghk: sure, I'll check it out, thanks

20:04 OneFourSeven: dnolen: How did you generate this heat map? https://twitter.com/swannodette/status/111860760765939713

20:06 scottj: OneFourSeven: http://www.patrick-wied.at/projects/heatmap-keyboard/

20:07 OneFourSeven: Thanks. I was hoping it was a clojure library

20:18 akurilin: Any recommendations for tools for enabling autotesting with clojure.test? Anything fancy that might integrate with something like guard?

20:19 lein-autotest and lein-retest look scary because they haven't had commits to them in 2 years. I can't tell if they're perfect, or if they're deprecated :)

20:20 lynaghk: akurilin: midje has an autotest plugin

20:24 akurilin: lynaghk, oh that's neat. Is it easy to slowly transition new tests to it, and have midje run in parallel to clojure.test while not fully converted?

20:24 lynaghk: akurilin: dunno, I've never had to do it

20:24 akurilin: damn, midje has way more stars than speclj

20:26 squidz: lynaghk: how are you coding d3 stuff if you do it on your own time? Just using plain old javascript?

20:28 lynaghk: squidz: I haven't done plain js in quite a while. Both my professional and personal work in is Clojure/ClojureScript

20:28 though I sometimes interop with JS

20:29 OneFourSeven: How easy is it for you to find Clojure work lynaghk?

20:29 lynaghk: OneFourSeven: easy enough for me to keep paying rent = )

20:29 squidz: so what do you do when doing d3 stuff?

20:30 lynaghk: c2 or strokes?

20:30 lynaghk: squidz: I haven't done a lot of D3 stuff lately. C2 sometimes.

20:31 squidz: okay just wondering because I have to do d3 stuff and I want to use clojurescript but am worried if it will take too much time I dont have

20:32 trinary: I do a lot of d3 stuff outside cljs and was wondering how viable c2 is, how well direct d3 interop etc work

20:34 squidz: there's a new library called strokes which looks really cool but Ive ran into a bug I can't figure out. Haven't tried c2 yet

20:37 akurilin: Is it pretty common to have a big blob of logic in one's let form, where each next binding depends on the previous, or is that an indication that I'm not being particularly idiomatic?

20:39 noonian: akurilin: I think its fine, I do that sometimes depending on the nature of the function and if I think it makes it more readable.

20:40 justin_smith: how about (let [a (get-a) _ (some imperative step) b (something a) ...] z)

20:40 johnmn: evening

20:41 justin_smith: (that is, using _ as a dummy binding to throw imperative actions into a let form

20:41 )

20:41 squidz: would there be any alternatives? sometimes it seems that no more can be pulled out of let forms

20:42 akurilin: Yeah I'm definitely concerned I'm cheating by being imperative through the let form

20:43 and I'm wondering if there's a clean and readable way of avoiding that.

20:44 justin_smith: (-> {} (assoc :a 0) (assoc :b :whatever) (doto imperative-whatever)) can probably do everything a let form can

20:44 but may not be as readable or efficient

20:45 but is more clearly a set of steps that build on one another

20:53 rishda: Is it common to "mock out" the database during a test suite?

20:53 Or do most people use the real database in test suites?

20:54 gfredericks: I use the real db rather often

20:54 but mocking is easy

20:54 rishda: It is?

20:54 gfredericks: I also have a vcr lib that you can use to record db interaction for playback later, if you find that useful

20:54 ,(doc with-redefs)

20:54 clojurebot: "([bindings & body]); binding => var-symbol temp-value-expr Temporarily redefines Vars while executing the body. The temp-value-exprs will be evaluated and each resulting value will replace in parallel the root value of its Var. After the body is executed, the root values of all the Vars will be set back to their old values. These temporary changes will be visible in all threads. Useful for mockin...

20:54 rishda: ok

20:56 Does it seem beneficial to use a simplified database API, and using an in-memory database in your tests?

21:14 zikemanb: Can anyone recommend a good clojure library for managing migrations against Postgres/MySQL?

21:15 brehaut: zikemanb: ragtime has worked fine for my needs

21:15 zikemanb: thx, I'll give it a shot :)

21:39 johnmn3: I have a client that needs a tool built. This is going to be my first paid programming gig. I've already built a prototype and they want the full app built. I need a paid mentor that I can go to for questions now and then. Please PM me if you are interested.

21:39 akurilin: Note to self, just because Clojure allows keys to be Long, doesn't mean JSON won't lose that in translation :)

21:40 ivan: https://github.com/ptaoussanis/nippy why is encryption in a serialization library?

21:41 brehaut: akurilin: lossing information should be your first assumption about json ;)

21:41 johnmn3: ivan: it's a network reader

21:41 ivan: or, a reader that can talk over the network.

21:41 akurilin: brehaut, slowly learning, error by error :)

21:42 brehaut, any advice for how to safely coerce strings into numbers?

21:42 ivan: johnmn3: I'm guessing encryption can still be composable in that case

21:42 after all, TLS doesn't care what you transfer

21:43 akurilin: Long/parseLong seems to work

21:43 johnmn3: ivan: yea, if you're pushing your repl over ssh, then its not a problem.. I suppose you could reach a repl on your webapp on EC2 without ssh with nippy

21:44 akurilin: although I'm wondering if hardcoding the underlying numeric type to Long is somehow a faux pas.

21:44 brehaut: akurilin: that would be reasonable. dont forget to catch exceptions

21:44 akurilin: I guess I'm not moving off the JVM anytime soon.

21:45 brehaut: akurilin: JSON hand waves the representation, but in JS its an IEEE 64bit float ;)

21:46 akurilin: particular implementations of js will use some integer reperesentation when they can, but thats primarily an optimization

21:48 akurilin: if you are using non-string keys, i think associative lists are probably a better choice than objects in json too

21:49 (associative list is a list of key value pairs)

21:50 akurilin: brehaut, are the libraries for dealing with encoding/decoding associative lists both in clojure and js solid?

21:50 brehaut: akurilin: no

21:50 akurilin: in clojure its simple: (into {} alist)

21:50 gfredericks: brehaut: and also seq

21:50 brehaut: in javascript you are as hosed as you are with basically every other datastructure situation

21:50 gfredericks: (dec javascript)

21:50 lazybot: ⇒ -1

21:51 akurilin: brehaut, my issue is that I have to ferry stuff around to javascript and objectivec so json does the translation as best as it can.

21:51 brehaut: akurilin: your wire format should never be your internal representation for a plethora of reasons

21:51 gfredericks: for(var pair in alist){ob[pair[0]]=ob[pair[1]]}

21:51 or something

21:51 akurilin: brehaut, that's fair.

21:51 gfredericks: ob[pair[0]]=pair[1] rather

21:52 brehaut: gfredericks: lols nope; for in loops in JS are only for keys

21:52 gfredericks: brehaut: yeah that's my "or something"

21:52 brehaut: akurilin: it goes doubly when you are using a lowest common demoninator representation like JSON

21:53 akurilin: in javascript if you have string keys or numeric keys, you can unpack an alist into objects or arrays as needed; javascripts arrays are sparse, so var l = []; l[1000] = 42; is a valid associative structure

21:53 ± stupid overloading array caveats

21:54 and of course, only numbers that are representable as ints are allowed as array indices

21:56 noonian: does anyone know if its possible to use lein-exec-p scripts by having a project's uberjar on the classpath but no project source?

21:57 akurilin: brehaut, I'll definitely consider that, I feel like continuously adding logic to deal with keys that got converted to str will be too much pain to tolerate on the long term

21:57 brehaut: akurilin: have you considered edn?

21:57 or some other format?

21:59 gfredericks: is there a js<->edn lib in pure js yet?

22:00 brehaut: perhaps mori?

22:00 akurilin: brehaut, I haven't looked too deep into it, mostly because I don't imagine there's a solid Objective-C library for it yet.

22:00 brehaut: dnolen: does mori expose the edn reader?

22:01 akurilin: Do yaml/toml also restrict keys to strings?

22:01 brehaut: just btw https://github.com/edn-format/edn/wiki/Implementations

22:02 akurilin: there is a recommended impo for objc there

22:02 and javascript

22:03 akurilin: brehaut, hm interesting.

22:03 brehaut, ok will look into it further then, thank you :)

22:03 brehaut: im not recommending EDN unreservedly; ive never used it myself; but it seems like JSON is really being stretched by your project

22:05 isaacbw: in a macro, can/how do I check if a value is a form?

22:05 gfredericks: what's not a form?

22:05 brehaut: ,

22:05 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

22:05 isaacbw: hmm

22:06 gfredericks: brehaut: that's also not a value :P

22:06 isaacbw: a "list that will be evaluated"?

22:06 I don't know the terminology

22:06 gfredericks: so lists in particular?

22:06 e.g., you don't consider [(+ 1 2) (inc 3)] to be a form?

22:06 isaacbw: lists that aren't prepended with a '

22:06 brehaut: in a macro, a list that will be evaluated is any list you decide you want to be evaluated ;)

22:06 isaacbw: gfredericks: scratch the form bit

22:07 gfredericks: isaacbw: the single-quote doesn't exist from a macro's perspective

22:07 'a is just (quote a), which is a list

22:07 isaacbw: well without the form bit I don't think you asked anything else

22:08 isaacbw: alright, I think I got it

22:08 `cbp: Hi how can I typehint formatter to remove the reflection warning? https://www.refheap.com/16878

22:09 gfredericks: `cbp: put ^DateTimeFormatter before formatter?

22:09 `cbp: doesn't work :P

22:10 oh i had to typehint d too my bad

23:02 callen: oh damn you to hell. "Can't type hint a primitive local"

23:04 yedi: uh, are you not allowed to pass keywords as arguments anymore, when theres another variable being passed after it

23:04 skateproj.es=> (add-chosen-to-choice ps ':color c)

23:04 ArityException Wrong number of args (1) passed to: es$add-chosen-to-choice$fn clojure.lang.AFn.throwArity (AFn.java:437)

23:05 (defn add-chosen-to-choice [params fname choice] ...)

23:15 amalloy: yedi: add-chosen-to-choice has a lambda in it that you're calling with the wrong number of args. has nothing to do with args to add-chosen-to-choice itself

23:17 also, don't name your namespace just "es". single-segment namespaces are the devil

23:25 rishda: verily

23:27 isaacbw: how could I be getting a Wrong number of args (-1) exception?

23:27 yedi: thanks amalloy

23:27 what do you mean by single segment namespaces

23:28 amalloy: isaacbw: (defmacro quote-all [& args] (cons `do (map #(quote) args))) (quote-all a b c) does that iirc

23:29 basically if there's any arityexception during macroexpansion the compiler subtracts two, which is right most of the time but not always

23:33 isaacbw: ah okay

23:33 thanks

23:58 callen: is StringBuilder the fastest way to build a string incrementally?

23:58 brehaut: probably; although str uses it automatically when it gets enough arguments

23:59 callen: brehaut: considering options.

Logging service provided by n01se.net