#clojure logs

2013-07-23

00:07clj_newb_2345I want to insert a "# " instead of every string.
00:07clj_newb_2345I am trying: init.init=> (clojure.string/replace "a\nb\nc\n" #"\\^" "# ") "a\nb\nc\n"
00:07clj_newb_2345this does not work (clearly)
00:07clj_newb_2345what am I doing wrong?
00:09brehautwhat do you think #"\\^" is supposed to match?
00:10brehautit looks like it should be matching two slashes before the start anchor, which is probably unlikely to match anything
00:10clj_newb_2345I'm an idiot
00:10clj_newb_2345I should use #"^"
00:10brehaut(^ doesnt by default match new lines)
00:11clj_newb_2345however, that matches _start of string_ rather than _start of line_
00:11clj_newb_2345then, if I use "\n", I match the start of all lines _except_ the first line
00:12brehaut,(clojure.string/replace "a\nb\nc\n" #"(?m)^" "# ")
00:12clojurebot"# a\n# b\n# c\n"
00:12brehautthe (?…) stuff at the start is a java regexp flag to enable multiline regexps
00:12brehaut(ie, so that it interprets new lines as new lines)
00:12brehautyou want to go look at the docs for java.something.Pattern
00:13brehaut,(class #"1")
00:13clojurebotjava.util.regex.Pattern
00:13brehautthat class
00:13clj_newb_2345wtf
00:13clj_newb_2345how did #"1"
00:13clj_newb_2345get clojurebot to say java.util.regex.Pattern ?
00:13brehauti thought it was pretty clear: i passed it to the class function
00:15clj_newb_2345,(class #"0")
00:15clojurebotjava.util.regex.Pattern
00:15clj_newb_2345,(class 10)
00:15clojurebotjava.lang.Long
00:15clj_newb_2345,(class "hello ")
00:15clojurebotjava.lang.String
00:15clj_newb_2345I get it now, you're asking Clojure: what is the Type of this object>
00:16brehautspecifically, asking for the class; jvm has primatives which dont (directly) have classes but still have types
00:16brehautthe call to class will box the primative, so its not strictly the same type as the value itself
00:34futilelook, you..
00:35brehautelipsis has three dots and they arent not perioids
00:35brehauterr are not
00:36Keith_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...
00:36Keith_...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)
00:38Keith_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.
00:40dnolenKeith_: and this is after requiring the lib w/o error and making sure the REPL is in the correct ns?
00:41brehautKeith_: did you install leiningen from the website, or via an OS package manager?
00:42Keith_I think I installed leiningen from the website...
00:42brehautgood. os packages seem to be about a thousand years old
00:43Keith_I am not sure I required the library this time, I have before... Let me try that now
00:44Keith_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...
00:45dnolenKeith_: IntelliJ is definitely one of the less popular Clojure envrionments - Eclipse your best bet for IDE
00:45Keith_OK thanks for that heads up :)
00:46Keith_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)
00:46brehautare you using reducers in a java 6 enviroment?
00:47RaynesI'm more interested in seeing the actual code he is executing.
00:47Keith_I updated to Java 7 because the library is using reducers
00:47Keith_OK ...1 min
00:48Keith_(ns uncomplicate.fluokitten.articles.getting-started-test
00:48Keith_ (:use [uncomplicate.fluokitten jvm core test])
00:48Keith_ (:use [midje.sweet :exclude [just]]))
00:48brehautrefheap.com
00:49noidiin 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
00:51noidiif 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
00:51Keith_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...
00:52Keith_java -version
00:52Keith_java version "1.6.0_45"
00:52Keith_Java(TM) SE Runtime Environment (build 1.6.0_45-b06-451-11M4406)
00:52Keith_Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01-451, mixed mode)
00:52Keith_kpm@imacs-MacBook-Pro~$
00:52brehautKeith_: 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)
00:53Keith_OK... Thanks
00:53dnolenKeith_: I would just install JDK 7 for OS X.
00:53Keith_Let me try the three steps above
00:54dnolenKeith_: you need to install forkjoin nothing will work otherwise for more recently version of Clojure - JDK 7 simplifies that
00:54Keith_BTW, it seems that I am required to load these commands from a file as opposed to typing directly in the REPL?
00:55Keith_Yes that is why I upgraded to 7, but I cannot see evidence of that
00:55dnolenKeith_: you need to set the JVM via System Java Preferences
00:55brehautmac os x might require you to specify which installed jvm should be used
00:55Keith_Oh boy
00:56Keith_OK... let me see... They have to fix these things...
00:56dnolenKeith_: open up System Preferences, goto Java, click Java menu, click View, select Java 7
00:56Keith_OK let me do that
00:57Keith_Seems that it says I am running 1.7 That's the only runtime available
00:59dnolenKeith_: hrm, you say this works at command line - maybe your Eclipse install is borked?
01:00smnirvenhey folks, anybody got some experience with clojure.java.io & clojure.data.csv that can help me out?
01:00noidimaybe you should try out your environment with a library that does not depend on reducers (and thus fork/join)?
01:00futileSo um, reduce doesn't work well when trying to seed it with -> or ->>
01:00Keith_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
01:01noidifutile, what do you mean?
01:01futilenoidi: (-> (new-cart) (reduce add-item! items)) ;; not what I wanted
01:02noidi,(->> [1 2 3] (map inc) (reduce +))
01:02clojurebot9
01:02futilenoidi: seed meaning, the default item
01:02futilenoidi: sig would be like (add-item! cart item)
01:03futileSometimes I want -n>
01:03futileWhich would let you pass positional index per row
01:04noidi,(-> 1 inc (as-> x (reduce + x [2 3])))
01:04clojurebot7
01:04dnolenKeith_: that seems very strange
01:04noidifutile, you can use as-> to bind the threaded value to a name
01:08futileLike: (-n> "N = %d" [0 .toUpperCase] [1 (.format my-locale 42)])
01:09futilenoidi: oh not bad, thanks
01:13futilenoidi: yeah that's pretty awesome, thanks
01:17noidifutile, np :)
01:19futileOh
01:21futileSo 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.
01:21futileBut what a dumb name :(
01:26r0bglees0nfutile: names are hard? =P
01:26futiler0bglees0n: oh
01:26r0bglees0ni released a project called barney before
01:26r0bglees0nand yeah it was named after the dinosaur
01:27r0bglees0neven worse? it was for IPC.
01:27r0bglees0n"sharing is caring".
01:27futileHA
01:27futiler0bglees0n: was it for Ruby?
01:27r0bglees0nit was
01:28r0bglees0nit was actually just a weird crazy DSL
01:29futiler0bglees0n: sounds like Ruby
01:29r0bglees0nyeah, but this was weird even for ruby
01:29futileOh man.
01:30futileYou may be my worst enemy.
01:30r0bglees0nhaha
01:30futile:)
01:30r0bglees0ndont hate me, it was an experiment :D
01:30futileOh did I tell you about that one lib I wrote?
01:30r0bglees0nwhich lib
01:31futilehttp://rubydoc.info/gems/omnomnom/0.0.1/frames
01:31r0bglees0ni can haz method missing?
01:31futileNope.
01:31futiledefine_method or something
01:32futile42 noms max
01:32futileSource is long lost (i.e. deleted for everyone's sake) so can't be too sure.
01:32futileI think one fork used method_missing
01:32r0bglees0ndefine_method is a nice performance tweak
01:32r0bglees0ni can see it being webscale
01:33futileOh man r0bglees0n.
01:33futileWe may have to battle.
01:33r0bglees0n:D
01:34rishdaoh, it exists? neat.
01:34futilewhatever.
01:38rishdaGotta solve the hard problems now.
01:39rishdaLike how to remove test duplication without making a mess, etc.
01:46rishdaYay, figured that one out.
03:33anildigitalHi Friends.. I want to start using emacs for playing with clojure .. can somebody suggest quick start how to setup emacs for clojure?
03:37turtilanildigital: 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*
03:38anildigitalturtil: 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
03:39anildigitalturtil: 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
03:39turtilanildigital: hmmmm, for me all i really needed was syntax highlighting, maybe im missing something important
03:39SegFaultAXturtil: LT is nowhere near production stable for most people used to more mature editors/IDEs
03:39anildigitalturtil: with Emacs.. you can eval your code at any time..
03:40turtilanildigital: i see, thats a feature i would have missed then
03:40anildigitalAnyone here can point to a post where I can start using Clojure with emacs
03:40turtilSegFaultAX: i certainly agree with you, but it is fun to play with (for me at least)
03:41anildigitalturtil: where do you work?
03:41anildigitalprobably can pm me :)
03:41SegFaultAXturtil: (not= fun-to-play-with ready-for-production-usage)
03:42turtilSegFaultAX: i take it you dont like lighttable :P
03:43anildigitalSegFaultAX: what editor do you use for Clojure?
03:44vijaykirananildigital: you might want to start with emacs-live setup - https://github.com/overtone/emacs-live
03:45anildigitalvijaykiran: okay thanks..
03:45anildigitalvijaykiran: I already have emacs installed.. and using it..
03:47vijaykirananildigital: ah - okay if you have customized it already, then installing clojure mode + nrepl should be enough to get started.
03:47anildigitalvijaykiran: nice
04:02ucbanildigital: you just need nrepl, clojure-mode and leiningen. The first two are available via packages (provided you're running a recent emacs)
04:03anildigitalucb: yep... now installed packages.. now installing leiningen version 2
04:04ucbanildigital: 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
04:04ucbanildigital: that should give you a repl
04:06anildigitalucb: yep... looks like these steps are not that difficult
04:07anildigitalucb: hope those are the steps.. and I don't have to do anything extra.. and I get all emacs godness for clojure
04:09ucbanildigital: I think that should get you going
04:19augustlgfredericks: did you figure out this one? https://gist.github.com/fredericksgary/6058783
04:38learner_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
04:38anildigitalucb: now when I do nrepl-jack-in, I see this error in *nrepl-error* buffer
04:38anildigitalclojure.lang.Compiler$CompilerException: java.lang.IllegalAccessError: doc does not exist (NO_SOURCE_FILE:0)
04:38anildigitalI opened project.clj and then did nrepl-jack-in
04:39ucbanildigital: I've never seen that before! Can you try $ lein repl in the project directory?
04:39anildigitalucb:
04:41ucbanildigital: ?
04:41ddellacostahow do exit a recur loop when I get an exception?
04:41anildigitalucb: okay.. I did lein repl.. it started fine
04:42anildigitalbut when I do that from nrepl-jack-in from clojure .. I see the error
04:42anildigitalucb: pasted error here http://pastebin.com/5iJm0zkS
04:42ucbddellacosta: shouldn't the exception break the loop for you?
04:43ddellacostaucb: not if I catch it.
04:43ucbddellacosta: then don't recur in your catch?
04:43ddellacostaucb: I'm recurring outside the catch.
04:45ucbanildigital: 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)
04:45anildigitalucb: any idea about the exception?
04:45ucbddellacosta: yeah, so, again, if you don't recur inside your catch clause that should be it? (perhaps I'm missing something)
04:45anildigitalucb: okay trying that
04:47ddellacostaucb: 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).
04:48ddellacostaanyways, 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.
04:48ucbddellacosta: 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.
04:48anildigitalucb: I get same exception in that way too
04:48anildigitaljava.lang.IllegalAccessError: doc does not exist (NO_SOURCE_FILE:0)
04:48ddellacostaucb: yeah, the problem is that if I catch at a higher level then I can't execute any logic on the exception. *sigh*
04:49ddellacostaagain, I think I'm thinking about it all the wrong way. this part of Java interop doesn't work so nicely w/Clojure, IMHO
04:51ddellacostaucb: but, thanks for helping, btw. :-) Just trying to explain the problem to you made me realize how much it smells.
04:51ucbddellacosta: heh, cool. Would be interested in finding out how you reworked it.
04:52ucbanildigital: strange. Perhaps something wrong with your nrepl.el?
04:52anildigitalucb: what is this doc it is trying to acces
04:52ucbanildigital: I haven't a clue I'm afraid :(
04:53ucbanildigital: it may be worth trying with emacs-live which is known to work
04:53ucbanildigital: just to rule things out
04:54ddellacostaucb: 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). ;-)
04:55ucbddellacosta: 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?
04:56ddellacostaucb: 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."
04:56anildigitalucb: 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
04:56anildigitalucb: if you could guess by that
04:57ucbanildigital: huh, interesting
04:57ddellacostaucb: ironically, it's tokenized at other stages in the system...
04:57ucbddellacosta: I reckon the code might end up looking simpler than you suspect. I normally dread dealing with indices, etc.
04:57ucbddellacosta: too many opportunities for off-by-N, overrunning, etc.
04:58ucbddellacosta: that should be a hint ;)
04:58vijaykirananildigital: doc might be the clojure.repl/doc function
04:59vijaykirananildigital: AFAIK nrepl-jack-in looks in the current dir/buffer. So the scratch won't start nrepl
04:59anildigitalah it may be because .. the project I generated was with lein 1.x and not 2.x
04:59ddellacostaucb: …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.
05:00ddellacostaYAGNY = YAGNI
05:01ucbddellacosta: 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 :)
05:01ucbalso, I've no idea what YAGNI stands for
05:01borkdudeYou ain't gonna need it
05:01ucbI see.
05:02ddellacostaucb: 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.
05:02ucbddellacosta: another thought: treat the string a seq of chars, drop a bunch, take some, reduce with str again. There's your window.
05:02anildigitalucb, vijaykiran success
05:02ucbanildigital: |o/
05:03ddellacostaucb: I have an even simpler solution, which I'll refheap and show you in a minute. :-)
05:03ddellacostaalthough I'm intrigued by the take/reduce thing
05:04ucbddellacosta: cool; let me see if I can do the drop/take thing
05:09ddellacostaucb: here is my solution: https://www.refheap.com/16845
05:09vijaykirananildigital: cool!
05:10ucbddellacosta: simple! :)
05:10ddellacostaucb: I have 40 chars hard-coded in, but that could be whatever I suppose.
05:10ddellacostaucb: yeah, works well enough. ;-)
05:10ucbddellacosta: sure; you can also add "..." to the beginning and end of the result.
05:10ddellacostaucb: 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.
05:11ddellacostaucb: thanks for talking through it with me, sincerely! It was helpful to get my brain going.
05:11ucbddellacosta: no worries; give me one sec. to finish polishing mine :)
05:11ddellacostaucb: yeah, I want to see what you came up with...
05:15ucbddellacosta: quick unpolished actually: https://www.refheap.com/16846
05:16ucbddellacosta: yours is simpler/nicer and probably faster
05:16ddellacostaucb: not by too much. neat!
05:17ddellacostaucb: yours is more flexible in that you can pass in the length. That's a cool solution, I like how you did it.
05:18ddellacostaucb: some of those functions I've never used either. Verra interesting.
05:18ucbyou 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)
05:19ddellacostamakes me laugh now to consider I was dealing with exceptions, when there are so many more much more elegant solutions.
05:19ucbalthough for your use case tokenising/joining on whitespace might be what you want
05:19ucbsometimes exceptions may be the right thing to do
05:19ddellacostaucb: 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.
05:20ddellacostayeah, 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.
05:21ddellacostathanks for taking the time to write something up. If it is okay with you, I will steal your nice little function...
05:23ucbddellacosta: please do; but work on it, as it stands it's ... well, mediocre?
05:23ddellacostaucb: 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.
05:24ucbddellacosta: s/can/should/ :)
05:24ddellacosta:-)
05:24ucbddellacosta: 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
05:24ucbwhich I reckon might be useful in other contexts as well
05:25ddellacostaucb: yeah, definitely.
05:26ddellacostaucb: 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.
05:26anildigitalucb: now I am trying to run default test in the app with C-c C-, . and I get http://monosnap.com/image/W6T3TGFD7wXAparTFdw8C3FkT
05:26anildigitalclass not found..
05:26anildigitalclojure.lang.Compiler$CompilerException: java.lang.ClassNotFoundException: clojure.test.mode, compiling
05:27ucbddellacosta: I have, but I'm not convinced it a great pattern because you're walking the seq back and forth
05:27ucbddellacosta: if you're only going one way, collecting results as you go along, then great
05:27ucbddellacosta: but not how I just did it (by counting, dropping as appropriate, etc.)
05:27ddellacostahuh
05:27ddellacostainteresting.
05:28ucbanildigital: I'm assuming you've compiled all namespaces?
05:28anildigitallooks like this one https://groups.google.com/forum/#!topic/clojure/mndiUiDU5bw
05:28ucbddellacosta: well, imagine you had a really long seq, and that you walked it a few times, counting, dropping, etc.
05:28ddellacostaucb: yeah, that could get slow quickly. I guess it all depends on what you're processing.
05:29ucbddellacosta: 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.
05:29ucbanildigital: yeah, I normally jack-in from a source file
05:30snake-johnAnybody 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?
05:31anildigitalucb: jack-in from source file solved the issue.. but isn't that weird?
05:32ucbanildigital: it is weird; yes. I guess my muscle memory has made it a non-issue for me?
05:32anildigitalucb: suppose you have 10 source file and you jack-in from one of those.. for others classes would get defined right?
05:33ucbanildigital: at least for me it does; I do compile things as I go along though
05:33anildigitalucb: is there single command to compile all the files in src
05:34ucbanildigital: good question. I don't know. There's the tools.namespace lib which does nice reloading things.
05:36ddellacostaucb: whoops, I had a bug in my solution, reworked: https://www.refheap.com/16845
05:36anildigitalucb: thanks .. now diving more
05:37ddellacostaanildigital: 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
05:38anildigitalddellacosta: thanks checking now
05:39anildigitalbtw what production apps and webapps do you people like which are benefitting from clojure?
05:39ucbddellacosta: nice
05:39ucbanildigital: that's a good post to read
05:40ddellacostaucb: yeah, that really helped me.
05:40ddellacostaanildigital: 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.
05:41ucbddellacosta: me too; I get reload fails rather frequently though. Haven't looked into why these happen
05:41anildigitalddellacosta: one I know is prismatic.. but don't know any other mainstream / popular company using clojure as such
05:41ddellacostaucb: 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
05:42ucbddellacosta: I see
05:43ddellacostaucb: 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
05:43ddellacostaucb, similarly: http://clojure.github.io/tools.namespace/#clojure.tools.namespace.repl/disable-reload!
05:43ucbddellacosta: nice; thanks!
05:44ddellacostaucb: np, hope it is helpful!
05:47anildigitalddellacosta: that was interesting post.. but I think for me long way to go to try that
05:49ddellacostaanildigital: 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.
05:49ddellacostaanildigital: can't hurt, you can just restart your repl if stuff gets borked, right? ;-)
05:49anildigitalhow do you call refresh?
05:50anildigitalddellacosta: yep
05:50ddellacosta(refresh) ;-)
05:51ddellacosta(…assuming you've got c.t.n.r use'd)
05:52anildigitalokay
06:17anildigitalddellacosta: I changed my repl namespace to the src file I was in with C-c M-n.
06:17anildigitalnow I want to change namespace back to default
06:17anildigitalhow to do that?
06:18ddellacostaanildigital: in-ns
06:18ddellacostaanildigital: sorry, don't know how in emacs, I don't use n-repl
06:18anildigitalddellacosta: yeah.. in nrepl
06:18Guest__anildigital by default namespace, you mean the user namespace?
06:19anildigitalGuest__: the one I get when I do nrepl-jack-in
06:19ddellacostaanildigital: but sounds like it should be easy if you are in that buffer, based on the docs here: https://github.com/kingtim/nrepl.el
06:19Guest__anildigital yes, that's the user namespace
06:19Guest__anildigital just type (ns user)
06:19augustlanildigital: the default namespace is jsut "user" I thnk
06:19augustlwhat Guest__ said
06:19anildigitalGuest__: with C-c M-n I changed it to the src file I was in
06:20anildigitalokay
06:20Guest__anildigital yeah, to switch namespaces in the repl just type (ns *namsepace*)
06:21anildigitalGuest__: http://monosnap.com/image/7uB9cFIWPmqVjbYer7eEH3eUE
06:21anildigitalGuest__: ah .. it was (ns user) not just ns user
06:22anildigitalso easy :D
06:22Guest__i have a function named (defn get-x-by-name [{:strs [query platform]}] ..) does that mean query and platform are optional arguments?
06:22noncomis 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 (->) ?
06:22anildigitalGuest__, augustl .. Clojure is so fun with Emacs
06:22Guest__anildigital anything in the repl is written as an s-exp so the parens are understood.
06:23anildigitalI can't imagine how the other people wo don't use Emacs .. use Clojure
06:24augustlnrepl is available in both Eclipse and IntelliJ afaik
06:24hyPiRionnoncom: is fn the same fn, or is it different fns?
06:25hyPiRion,(map #(* 2 %) (map #(/ % 3) (map #(+ 1 %) (range 1 10))))
06:25clojurebot(4/3 2 8/3 10/3 4 ...)
06:25hyPiRion,(map (comp #(* 2 %) #(/ % 3) #(+ 1 %)) (range 1 10))
06:25clojurebot(4/3 2 8/3 10/3 4 ...)
06:25anildigitalit does look awesome in emacs.. http://monosnap.com/image/5HUx7wvEnfNAiZ6E9W12CbVgG
06:25noncomhyPiRion: different, although, interesting, what if same
06:25noncomso, (comp) wox fine!
06:26anildigitalis there any way in nrepl .. to tell it to restart
06:26hyPiRionSay you want to repeatedly apply fn to an element, n times.
06:26hyPiRion,(nth (iterate inc 1) 10)
06:26clojurebot11
06:27Guest__,(+ 1 2)
06:27clojurebot3
06:27anildigital,(println 'awesome')
06:27clojurebotawesome'\n
06:27hyPiRion,(map (fn [val] (nth (iterate #(* 2 %) val) 6)) (range 0 10))
06:27clojurebot(0 64 128 192 256 ...)
06:29noncomaha...
06:31noncomhyPiRion: btw, I saw your swearjure experiment, interesting! I've been thinking over such lisp concept, although, not clojure-based..
06:32noncomhow is the experiment going now?
06:33hyPiRionnoncom: haha. Progress has stalled though, but I plan to create a Swearjure interpreter some day (if I get TimMc and gfredericks on it)
06:33noncomhyPiRion: did you hear about klisp?
06:33hyPiRionnoncom: no, what is that?
06:33noncomhttp://klisp.org/
06:34jzelinskiewhere can i get more info on "#=" I've seen it used in (read-string "#=(stuff)") to eval stuff?
06:34noncomit'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
06:35hyPiRionnoncom: huh, intersting. I'll add it on my list on "lisps I have to look at before implementing one myself"
06:35hyPiRion~#=
06:35clojurebothttps://twitter.com/richhickey/status/134645361796055040
06:35hyPiRionjzelinskie: ^
06:35noncomthough 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 :)
06:35jzelinskiei see
06:36hyPiRionjzelinskie: generally though, #=(f arg) is a reader function which will call f with arg at compile-time
06:37hyPiRionbefore macros are called
06:37jzelinskiegotcha
06:37noncomhyPiRion: so, are you going to take on swearjure seriously with the friends?
06:37hyPiRione.g. (defn #=(symbol "hello world") [a b] (+ a b)) is legal
06:38jzelinskieah! good example
06:38hyPiRionand you can call it with (#=(symbol "hello world") 1 2), although I wouldn't exactly recommend it :)
06:38jzelinskiehaha
06:38noncomi 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
06:39jzelinskiearen't they spelling ouroborus wrong? or is there an alternate spelling I'm not aware of
06:39hyPiRionnoncom: 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
06:39jzelinskieah, there is
06:39noncomjzelinskie: they're looks like japaneese, so no blame for spelling :)
06:39jzelinskieyou can actually use both according to wikipedia
06:40hyPiRionAlso, it's a great way to learn about Clojure internals, especially the reader
06:41noncomyeah, i'll be watching what's up!
06:42AnderkentAnyone remember off top of their head how to type tag a byte array?
06:43pjstadigAnderkent: ^bytes i think
06:43AnderkentTried that, but I get 'unable to resolve classname clojure.core$bytes
06:45Anderkentah, #^bytes seems to work tho
06:46noncomAnderkent: what # sign does?
06:46Anderkentno idea, but it stops it from failing to compile
06:46jzelinskiehaha
06:46noncom:)
06:47Anderkenti think all metadata used to be #^ ?
06:47noncomnot ^: ?
06:47noncomfor type-hints
06:47noncomidk
06:47Anderkent^:keyword is just for tagging with a keyword
06:47Anderkentthe : is part of the keyword not part of the ^, afaik
06:47noncomyeah
06:48pjstadigAnderkent: what version of Clojure are you using? ^bytes works for me with 1.5
06:48Anderkent1.5.1
06:49pjstadigAnderkent: https://gist.github.com/pjstadig/6061459
06:50Anderkenthm, that works for me too
06:50Anderkentok im confused now
06:52noncommaybe the exact usecase is important?
06:52Anderkentah! sorry, I was misreading the error message
06:52Anderkentpebkac :P
06:53Guest__if you want to tag something using ,(def ^{:doc "sample"} sample 1) helps
06:53Guest__Anderkent is that what you wanna do?
06:53Anderkenttype hint a function to return a byte array
06:54Guest__rem, Anderkent, what is it that you wanna do and what error does it show?
06:55Guest__*erm
06:55Anderkentsec
06:55Guest__if you want to include metadata then ^{} is what you must do. :)
06:56AnderkentYou don't need to use the full map metadata to type hint something, ^class-symbol is sufficient
06:57pjstadighttps://gist.github.com/pjstadig/6061490
06:57Anderkentwait the hint goes *after* the function symbol?
06:57Anderkentderp
06:58Anderkentright because it allows different arities to be hinted differently
06:58Anderkenthuh.
06:59Anderkentwell that was my problem, but the error message is very unhelpful :)
07:00pjstadigyeah for type hinting return values you "type hint" the args vector
07:00pjstadigtype hinting the function name would be metadata that ends up on the var
07:00pjstadiglike ^:dynamic or something
07:03Anderkentarent 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)
07:05pjstadigwell that's a good question
07:06pjstadiglooks like the :tag metadata is not getting to the var
07:06pjstadighttps://gist.github.com/pjstadig/6061528
07:07Anderkentyes, as you said it will be on the arglist :)
07:07pjstadigbut it does if you tag the var's name https://gist.github.com/pjstadig/6061532
07:08AnderkentSee comment :)
07:45silasdavisI'm trying to use marginalia to produce literate documentation for an API based on compojure
07:45silasdavisI'd really like it to pull and format my comments from within a defroutes form
07:46silasdavisso I can have the http method, route, and code all handled together
07:48silasdavisis there a way to make it do this?
08:51TheBusbyambrosebs: thanks for the interable-seq work around! Using it now
08:52ambrosebsTheBusby: hehe, nocheck let's you do practically whatever you want.
08:52ambrosebsTheBusby: not always a good thing...
08:54ambrosebsTheBusby: I'm writing a core.typed paper for Scheme Workshop so I might not be too active in the next week with the bugs.
08:54TheBusbyambrosebs: no worries, I'm occupied with other development as well, and really appreciate your e-mail responses!
08:55ambrosebs:)
08:55TheBusbyif 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. :(
08:56ambrosebsanother time :)
08:58ambrosebsTheBusby: which country are you in?
08:58TheBusbyambrosebs: 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
08:58ambrosebsWestern Australia
08:59TheBusbyI'd buy you a beer, but I think you're a tad too far away.
09:00ambrosebs:) a little north of me?
09:00ambrosebsahk :)
09:00ambrosebssame timezone right?
09:00TheBusby+8 UTC here
09:00ambrosebs+8
09:01ambrosebsI think we're 2 of a kind
09:01TheBusbywhoops, my mistake I'm +9, but close enough
09:02TheBusbymy 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.
09:02hyPiRionambrosebs: 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)
09:02ambrosebsTheBusby: cya!
09:03silasdaviswith compojure can I pull out a (GET "/foo" bar) form into a def like (def foo (GET "/foo" bar))
09:03ambrosebshyPiRion: I honestly haven't met a single person using clojure on my half of the country. Plenty on the east tho.
09:03silasdavisor does GET only work in the context of a defroutes / routes macro?
09:04hyPiRionambrosebs: aw, that's a shame. You'll have to convince people to start using it then.
09:05ambrosebshyPiRion: yea. at least my friends have heard of it now :)
09:07shoshinsilasdavis you can use it in the first form too i.e (def foo (GET "/foo" bar))
09:10shoshindefrosts just creates a Ring handler function from a series of routes.
09:10hyPiRionhrm, I wonder how I can pitch Clojure up here.
09:21gfredericksaugustl: yes
09:21gfredericksaugustl: https://groups.google.com/forum/#!topic/clojure/MzzeuAgMm5g
09:23augustlgfredericks: tnx
09:23augustldoh
09:24gfredericksyeah it was a mild facepalm
09:25augustlcan we blame the fact that inheritance is complex? Let's blame that.
09:26gfredericksI feel like the compiler could have thrown an error
09:26gfredericksin an ideal world
09:26gfredericksif you type-hint and nothing matches
09:29augustlwell, something might match run-time..
09:29gfrederickssure something could match the concrete type
09:30gfredericksbut if I'm explicitely hinting an interface that doesn't have the method I'm calling
09:30gfredericksI guess it's not obligated to compile to non-reflective code just because there's a type hint around... :/
09:30gfredericksa workaround I had before I figured out the issue was to pass a (reify Callable ...) instead of a fn :)
09:57stuartsierraI'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:03stuartsierra*today
10:05ddellacostaping callen
10:08dnolenstuartsierra: sweet
10:43ucbddellacosta: a rather contrived solution https://www.refheap.com/16856
10:44ddellacostaucb: holy crap
10:44ddellacostaucb: I'm right in the middle of something, so I can't dig into this at the moment, but wow
10:44ucbINORITE!
10:44ddellacostahaha
10:44ddellacostaYou must be itching to write some code, huh? ;-)
10:44ucbddellacosta: it doesn't really merits anybody's attention; I was just pointing you to it for the comedy effect
10:45ddellacostaucb: hahahaha
10:45ucbwell, I am writing code, just that your problem sounded like a nice code-kata
10:45ddellacostaucb: well, nonetheless, I'll check it out when I have some time. Yeah, it's definitely a nice little problem to play with.
10:45ucbcool!
10:54squidzstuartsierra: what will the new G.Closure lib/compiler give us?
10:55stuartsierrasquidz: The warm fuzzy glow of knowing our dependencies are up-to-date.
10:57squidzhehe okay I see
10:59stuartsierraProbably some bug fixes. Probably some new bugs, too.
11:01squidzstuartsierra: what are the major bugs right now that haven't been squashed?
11:01stuartsierrasquidz: In Google Closure? No idea.
11:02squidzno sorry I mean in clojurescript
11:03stuartsierrasquidz: Also, no idea. :) dnolen might know.
11:04squidzmeh, I won't bother him. If he happens to see it he can answer if he chooses. You guys are busy
11:06mdrogalisWhy on earth does this throw an exception? (sort '((:october) (:may)))
11:06mdrogalisPersistentList cannot be cast to java.lang.Comparable
11:07arrdemmdrogalis: you are seeking to order a list of lists, each of which contains one key.
11:07mdrogalisarrdem: Correct.
11:08mdrogalisI don't see why that can't be done.
11:08nDuffmdrogalis: Use vectors, not lists, for that.
11:08nDuffmdrogalis: Can't be done because, as the exception says, lists don't implement the Comparable interface.
11:08mdrogalisnDuff: Yes. I arrived at that solution. I think my question is "why don't lists implement Comparable?" :P
11:08arrdemnDuff: so if vector is Comparable, why isn't list?
11:09arrdemclearly we have an order relation on vectors :/
11:09nDuffmdrogalis: 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:10mdrogalisAhh, I can see performance being a reason given that it's related to compiling sexprs for Clojure programs
11:10gfrederickswhy would vector's comparable be any more performant than list's?
11:11justin_smithcache integrity?
11:11arrdemgfredericks: I guess list can be a cons, where vector is a hard array so... eh
11:11mdrogalisIndices?
11:11mdrogalisI'm relatively satisfied with that answer -- it seems likely.
11:11solussdsquidz: 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:12gfredericksarrdem: laziness is the only angle I can think of; because the algorithm would involve a linear walk regardless
11:12justin_smithaccidentally comparing two identical lazy infinites would be a bitch
11:12arrdem(inc justin_smith)
11:13lazybot⇒ 2
11:13arrdem,(type (range))
11:13clojurebotclojure.lang.LazySeq
11:13arrdem,(list? (range))
11:13clojurebotfalse
11:13squidzsolussd: 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:14arrdem(dec justin_smith)
11:14lazybotYou want me to leave karma the same? Fine, I will.
11:14arrdemwhen did that patch go throug?
11:14arrdemjustin_smith: enjoy your free karma :P
11:15solussdsquidz: eek! ok, thanks anyway
11:16squidzsolussd: if you find a solution let me know
11:21justin_smithis a circular list possible in clojure? I think immutability actually makes it impossible
11:22justin_smithotherwise, that would also be a reason not to make list comparable
11:22justin_smith(dec justin_smith)
11:22lazybotYou can't adjust your own karma.
11:23justin_smithwe had this code which created cached modified versions of files
11:23bbloom_i feel like you should be able to decrement your own karma
11:24bbloom_justin_smith: immutability means that pointers can only go to "older" values
11:24justin_smiththe file system operations ended up being a bunch of str and regex ops
11:24justin_smithbbloom_: yeah, makes sense
11:24solussdsquidz: it was caused by passing nil to dom/by-id
11:24bbloom_if you allow mutually recursive declarations, such as letfn, then you can get cycles, but internally mutation is necessary
11:24bbloom_haskell's laziness allows inherent circularity, but i think it's an anti-feature
11:25bbloom_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:25justin_smithso 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:25justin_smithis this quixotic? is there a reasonable way to go about it?
11:25bbloom_so then you might intrinsically understand the solution: do what file systems do internally! invent something like an inode identifier
11:26justin_smithmaybe I am being too oo here
11:26gfredericksjustin_smith: lazy seqs can let you do circular lists
11:27justin_smithwhat about a vector representing a path /etc/x11/xorg.conf -> ["etc" "X11" "xorg.conf"]
11:27arrdemgfredericks: lazy seqs let you repeat the elements of a finite list infinitely, the structure isn't circular itself
11:27justin_smithsince much of what I am doing in making the cached transformations is making sibling directories with children representing transforms of the file
11:27gfredericks,(let [a (promise) b (list* 1 2 3 (lazy-seq @a))] (deliver a b) (take 20 b))
11:27clojurebot(1 2 3 1 2 ...)
11:27justin_smith(neices)
11:27gfredericksarrdem: ^ looks circular to me
11:28gfredericksshould be able to do (nth _ 100000) on that without creating any new objects
11:29solussdsquidz: 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:29arrdemgfredericks: wow that's cute
11:29gfredericksarrdem: it uses quasi-mutability of course
11:29stuartsierragfredericks: I think 'circular' in this case means that some element in the list points to the head of the whole list.
11:29gfredericksstuartsierra: is that not what's going on in some sense?
11:30stuartsierragfredericks: I didn't look that close. ;)
11:30arrdemstuartsierra: I say this is cute because that's exactly how gfredericks's example works
11:30arrdemstuartsierra: b is defined to be 1, 2, 3, the lazy delevery of b
11:30stuartsierraYes that's circular.
11:31bbloom_i should note: mutability is required to achieve that :-P
11:31bbloom_the mutability of the promise, that is
11:31arrdembbloom_: how so? I don't know list*.
11:31justin_smithso that means you could end up comparing two lists that are infinite and identical
11:31squidzsolussd: 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:32bbloom_arrdem: it's just a fundamental truth about immutability and the progression of time
11:32justin_smithor is list* strictly different
11:32bbloom_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:32gfredericksjustin_smith: it coulda been a series of cons
11:32bbloom_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:32justin_smithso, in my naivity, I was technically correct?
11:33stuartsierra"I coulda been a cons-tender."
11:34squidzstuartsierra: ba dum tss
11:34gfredericks~rimshot
11:35clojurebotBadum, *tish*
11:37arrdemw00t, naive lisp code emitter in 335loc
11:37bjadoes anyone know of a project to add ritz support to vim-fireplace?
11:37judehi
11:37eggheadhey jude
11:38judefirst time using irc
11:38bjaI noticed vim-redl, but it seemed more limited than slimv. The downside to slimv seems to be that it's no longer maintained.
11:38eggheadyou chose a good channel for your first relay chat
11:38bjaerr, slimv is maintained, swank-clojure isn't maintained
11:38judeyeat~thanks
11:39judeyeah~thanks
11:45yedibest way to loop over a map? i know i can doseq
11:45yediis it also possible to map a fn across map pairs? without explicitly converting the map into a list of lists
11:45technomancyyedi: sure; map does that
11:45technomancy(calls seq on its arg)
11:46justin_smith(map (fn [[k v]] ...) mp)
11:47yedicool thanks
11:48justin_smith,(map (fn [[k v]] [k [v v]]) {:a 0 :b 1 :c 2})
11:48clojurebot([:a [0 0]] [:c [2 2]] [:b [1 1]])
11:48justin_smith,(into {} (map (fn [[k v]] [k [v v]]) {:a 0 :b 1 :c 2}))
11:48clojurebot{:a [0 0], :c [2 2], :b [1 1]}
11:48justin_smiththat is a pattern I use quite often
11:49justin_smithwell not making a vector of 2 copies of the value, but the fn [[k v]] / into {} part
11:51justin_smithregarding the abstraction over paths
11:51justin_smithhttp://www.haskell.org/ghc/docs/latest/html/libraries/filepath/System-FilePath-Posix.html something like this may be nice
11:57gfredericks,(let [kvpair (first {1 2})] (identical? kvpair (vec kvpair)))
11:57clojurebotfalse
11:58piranha,((juxt vec first) {1 2})
11:58clojurebot[[[1 2]] [1 2]]
11:59justin_smith,(vec [1 2])
11:59clojurebot[1 2]
12:00justin_smith,(identical? [1 2] [1 2])
12:00clojurebotfalse
12:00justin_smithI guess vec prevents data sharing
12:02llasramI think more ##(class (first {1 2}))
12:02lazybot⇒ clojure.lang.MapEntry
12:02justin_smithahh
12:02justin_smiththe printed representation just looks like a vector
12:02llasramI think more ##(let [v (vec (first {1 2}))] (identical? v (vec v)))
12:02lazybot⇒ false
12:02llasramEr
12:02llasramDidn't mean to say the "I think more" again
12:03llasramBut yeah, so `vec` returns an new vector, even if the original is a vector
12:03justin_smithbut see vec still prevents data sharing
12:03justin_smithyeah
12:03gfredericksvec probably blindly treats its arg as a seq
12:03justin_smithmakes sense
12:03gfredericksconvenient way to dup your vectors :P
12:04justin_smithI thought the reason I was using immutable datastructures was to not need to do things like defensive copying
12:05konrDo you guys recomend any particular core.logic tutorial?
12:06dnolenkonr: the one on the core.logic is OK, also TRS is not bad
12:06dnolenkonr: there's a miniKanren IRC & mailing list I recommend getting on those if you need more help
12:06dnolenkonr: TRS -> The Reasoned Schemer
12:06nDuffkonr: My only advice at this point is to skip anything that uses Thread/sleep. :)
12:06llasramjustin_smith: I'm going to say that this is less defensive copying and more a... missed optimization opportunity
12:07llasramThe code as-written just doesn't special-case starting with a PersistentVector, even though it easily could
12:07konrthanks :)
12:09muckerhey, 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:10dnolenjustin_smith: llasram: maybe I'm missing something but you cannot test for sharing with identical? anyway
12:10jvcbut i really like parens
12:10justin_smithmucker: yuck
12:10yediwhat am i doing wrong here? https://gist.github.com/yedi/28ed80a55b9fbfe85ed4
12:10justin_smithdnolen: more likely I was missing something
12:11justin_smithdnolen: 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:12jvchey guys, what's your favourite irc client?
12:12seangrovemucker: Strange you have end-let and end-def there
12:12justin_smithwhich in jvm speak is "are they the same object"
12:12jvcI*'
12:12seangroveIf you're doing white-space anyway, why not go for significant ws?
12:12jvcI'm new here
12:12dnolenjustin_smith: yes you cannot test for this property in a simple way - the sharing happens *inside*
12:12justin_smithdnolen: yeah, I was likely using sharing in a sloppier sense then you are using it
12:12muckerseangrove: I like allman style braces in other lang* :/ I even saw ruby code where the bloke went do .. end #method
12:13justin_smithyedi: #({...}) tries to call the map as a function, fails because it gets no args
12:14justin_smithuse fn instead of #() and you will be fine
12:14dnolenjustin_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:14yedijustin_smith: ah i see, thanks
12:14justin_smithdnolen: cool, thanks for the clarification
12:17jonasendnolen: any thoughts on https://groups.google.com/forum/#!topic/clojure-dev/vPv0cPZxTCE ?
12:17jonasenshould I open a ticket on JIRA?
12:17dnolenjonasen: no thoughts, reader changes generally have to go through rhickey
12:18devnhas anyone looked at pulsar/quasar?
12:18dnolenjonasen: oops
12:18jonasendnolen: ok, I'll wait then
12:18dnolenjonasen: sorry I didn't realize that makes it through the Clojure ready
12:18dnolenjonasen: the Clojure reader
12:18dnolenjonasen: yeah ticket + patch welcome
12:19jonasendnolen: ok, thanks!
12:30jvchey
12:36seangrovemucker: 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:38justin_smithit is inconsistent
12:39justin_smithif you have let and end-let why not * and end-*
12:39seangrovejustin_smith: I assumed it's a WIP
12:39seangroveThe source maps are finished - it's inconsistent. Why have column info for some symbols, and not all others?
12:39seangroveyuck
12:40seangroveShouldn't have released them at all
12:44dnolenseangrove: ?
12:45justin_smithwell 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:45sleetdropwhy (peek '(1 2 3)) need a ' while (peek [1 2 3]) doesn't
12:46bbloom_sleetdrop: the error message you get might be illuminating….
12:46dnolenseangrove: oh you all are talking about something else :)
12:46arrdemsleetdrop: because () is a list, which is read by default as a code form rather than a list
12:47bbloom_see what happens if you try '(peek ...)
12:47dnolensleetdrop: (1 2 3) is a function call where the function is 1
12:47dnolensleetdrop: adding a ' gives you a literal list
12:49Chousukesleetdrop: note that quoting a list also quotes the things inside it
12:49Chousukeso '(foo bar) doesn't give you a list of the values of foo and bar
12:50hyPiRionit gives you a list with the symbol foo and bar.
12:51Chousukesleetdrop: as to why [1 2 3] doesn't need a quote, it simply has to do with different evaluation semantics
12:52sleetdropThanks a lot everyone.
12:52Chousuke,(let [a 1 b 2] [(+ a b), '(+ a b), [+ a b], '[+ a b]]) shows the difference
12:52clojurebot[3 (+ a b) [#<core$_PLUS_ clojure.core$_PLUS_@1deafdc> 1 2] [+ a b]]
12:53Chousuke(that weird thing is just how clojure prints a function object)
12:56llasramIt's not that weird: ##(Object.)
12:56lazybot⇒ #<Object java.lang.Object@492903>
12:56technomancyit's hideous
12:56llasramWell...
12:57arrdem,(read-string "#<Object java.lang.Object@DEADBEEF>")
12:57clojurebot#<RuntimeException java.lang.RuntimeException: Unreadable form>
12:58llasramI 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:59amalloyllasram: sure it would be hard
12:59amalloyhow does a lambda with no def print? how does clojure know a particular function is a top-level def?
13:00llasram##(fn [])
13:00lazybot⇒ #<sandbox11362$eval14849$fn__14850 sandbox11362$eval14849$fn__14850@18cd072>
13:00amalloyi'm aware of how they currently print
13:00llasramSorry,
13:01amalloy(aside: ##(fn)) is actually valid, believe it or not
13:01llasram-> #<Fn sandbox11362.eval14849/fn__14850>
13:01lazybot⇒ #<sandbox11362$eval14860$fn__14861 sandbox11362$eval14860$fn__14861@df7935>
13:01llasramHaha
13:01llasramOoh, nice
13:01llasramYou learn something more compact every day!
13:01technomancyoh weird; I thought for sure (defn x []) expanded to an fn with an internal tame
13:01technomancyinternal name
13:01technomancybut no
13:01amalloy&#() ; we're aiming for compact?
13:01lazybot⇒ #<sandbox11362$eval14871$fn__14872 sandbox11362$eval14871$fn__14872@15e8f0d>
13:02llasramPerfect
13:03llasramAnyway, so anonymous still won't be great, but at least their printed form could immediately be recognizable to humans as such
13:03technomancyI wonder why defn doesn't go that route
13:03justin_smith,(fn example-anon [])
13:03clojurebot#<sandbox$eval29$example_anon__30 sandbox$eval29$example_anon__30@16b0e4e>
13:03technomancy(defn x []) -> (def x (fn x []))
13:04amalloytechnomancy: i remember wondering that too. one explanation is that it can generate a consistent classname
13:05amalloybut i think i investigated that possibility and discovered it's not relevant
13:06justin_smithin 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:06justin_smiththough I am not sure unit testing the macroexpansion of my macro was all that useful, in retrospect
13:07llasramCascalog does that to try to find Vars for function-objects. It fails a lot and makes me sad inside
13:07technomancyjustin_smith: unit testing macros is usually a sign that your macros are doing too much
13:07justin_smithtechnomancy: yup
13:07technomancyunless you're implementing pattern matching or something
13:07llasramBut I think just making `fn`s print nicer for humans is a much simpler goal
13:07justin_smithI was doing tdd as a development technique to help me construct my macro
13:08justin_smithand it was doing a kind of pattern matching for an extended syntax
13:08technomancyllasram: oy, yeah that sounds fraught with peril
13:08justin_smithone 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:08gfredericksclojure.walk would be much nicer if it preserved metadata :(
13:09technomancyI can empathize with the rationale but once you go down that road there's no end in sight
13:09amalloygfredericks: naw, you'd just use it for a while and then discover another one of its faults
13:09gfredericksamalloy: "much nicer" and "terrible" are logically compatible
13:09amalloyhaha
13:09llasramOOC, what other issues does it have?
13:09upwardindex,(if (Boolean. false) 1 2)
13:09clojurebot1
13:10upwardindex:(
13:10technomancyupwardindex: the existence of the Boolean constructor is a design bug
13:10technomancyin the JDK
13:10llasramDoes clojurebot have a pithy quote/link about that?
13:10llasram~false
13:10clojurebotfalse is the previous sentence
13:10llasramThanks, clojurebot
13:10gfrederickstechnomancy: do you think it would break anything worth not breaking if they removed it?
13:11amalloygfredericks: objectinputstream deserialization depends on it iirc
13:11amalloydisgusting as that seems
13:11technomancygfredericks: making it yell at you would be a great start
13:11llasramupwardindex: Anyway, you can use Boolean/FALSE instead. Boolean/FALSE, primitive boolean false, and nil are the only logical-false things in clojure
13:11amalloyor maybe not. maybe what it does is generate instances of Boolean without even going through the constructor
13:12technomancyLet's add a blacklist to clojure.core/compile.
13:12llasramOOoh
13:12amalloyhow orwellian, technomancy
13:12gfredericksmaybe he meant a warning blacklist
13:12technomancygfredericks: no, more like a TSA blacklist
13:12llasramI think he meant a reeducation-camp blacklist
13:13technomancywhere you can't see the list or get yourself off it
13:13amalloy/msg clojurebot (list technomancy)
13:13amalloynow you're on the list forever!
13:13gfrederickstechnomancy: can we create a secret court to approve the items on it?
13:13technomancyto make it more like the TSA it could ignore the package name and just work off the unqualified class name
13:14technomancygfredericks: what makes you think it doesn't already exist?
13:14justin_smithlol
13:14amalloytechnomancy: or ignore the unqualified name and just use the package, also like the TSA
13:15upwardindexllasram: found an answer on stack overflow that mentions i should be using Boolean/valueOf
13:16gfredericksis clojure.walk conceptually flawed? should I not even want something like it?
13:16technomancygfredericks: it is publicly disowned; does that count?
13:16gfredericksbut not replaced?
13:16gfredericksshould I make my own is what I'm really wondering
13:16technomancyno idea
13:17pjstadigis publicly disowned, but wasn't it used for core.async?
13:17gfrederickspjstadig: a secret court approved that
13:17pjstadiga parallel supreme court?
13:18pjstadigbut then it's not really supreme, because it's not at the top
13:18pjstadigit's like the lateral court
13:19pjstadigwhich sounds like a sportsball term
13:19justin_smithisomorphic court
13:22callenpjstadig: I love you.
13:22callenpjstadig: but migratus could be made more flesh-sack friendly.
13:22callenpjstadig: would some easy-mode leiningen commands be welcomed?
13:22arrdemcallen: pah easy mode
13:23technomancyyou have to unlock easy mode by flailing around in the repl and triggering three migration-related exceptions in under five minutes
13:24callentechnomancy: migratus requires making sacrifices to profane gods before you contrive a timestamp format that it actually likes.
13:24gfredericks"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:24justin_smithcallen: does it not suffice that it be numeric and monotonically increasing over time?
13:24technomancygfredericks: it could also mean the author just doesn't care
13:24danlarkinmig-rah-toos
13:24pjstadigcallen: i don't even know what easy-mode is, but sure
13:25callenpjstadig: well, a few problems.
13:25gfrederickstechnomancy: I care and wouldn't mind fixing it, but I have to know first if there's any reason not to try :)
13:25technomancycallen: 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:25gfrederickswell I don't _have_ to know
13:26callenpjstadig: 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:26callentechnomancy: thanks for the warning.
13:26technomancyI need to write a blagh on that subject
13:26amalloygfredericks: 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:27technomancyI'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:27pjstadigcallen: 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:27amalloyyou 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:28pjstadigi think your issues are valid, and would consider related PRs
13:28gfredericksamalloy: what about the tree-seq approach of forcing the user to decide how to deal with things?
13:28pjstadigcallen: there's already an issue for the batch exception, is there one for the timestamp thing? if not, please create one
13:29amalloygfredericks: 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:29callenpjstadig: there definitely is not a nice error for the timestamp thing.
13:29gfredericksamalloy: well it could certainly provide useful defaults
13:29amalloyie, 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:29callenpjstadig: generating a blank migration with the current timestamp just needs to be automated as well.
13:29gfrederickse.g., partial support for records
13:30gfredericksor full support that falls back on maps like dissoc
13:30bbloom_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:31bbloom_that was sorta the idea behind clojure.core/extend
13:31pjstadigcallen: I'm not as convinced on the generating a migration thing
13:31pjstadigi mean i know it would be nice to not have to manually create the files with the right name
13:31gfredericksbbloom_: I'm having trouble understanding what this has to do with clojure.walk
13:32pjstadigbut i'm not convinced that should be part of the leiningen plugin
13:32bbloom_gfredericks: you mentioned how tree-seq is parameterized
13:32callenpjstadig: people will have to write the generation script themselves otherwise.
13:32bbloom_gfredericks: which is also true of zippers
13:32callenpjstadig: I'd prefer to spare people the unnecessary effort.
13:33bbloom_gfredericks: in theory, you could create walk-vector, walk-map, walk-whatever
13:33bbloom_gfredericks: then you could say (def walk-standard (walk-compose walk-vector walk-map walk-whatever))
13:33pjstadigcallen: i understand, but on the other hand migratus is meant to be a library, not necessicarily a batteries-included migration framework
13:33bbloom_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:34bbloom_make sense now?
13:34callenpjstadig: it's a simple command to just touch a file with a specific timestamp format.
13:34gfredericksbbloom_: what would e.g. walk-vector do?
13:34gfrederickstrying to figure out how that relates to how walk-compose works
13:36bbloom_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:37bbloom_gfredericks: clojure.walk is essentially the "visiting all subterms" strategy. you can define a one-level descent on a per type basis
13:38bbloom_clojure.walk's prewalk and postwalk roughly translate to the bottomup and topdown strategies
13:39gfredericksbbloom_: I will have to read this
13:39gfredericksI'm looking at the clojure.walk source right now and can't figure out where the metadata gets lost
13:39gfredericksI think the map path uses empty and into
13:42bbloom_er i said that backwards. prewalk=topdown, postwalk=bottomup
13:42gfredericksyou know what maybe it actually doesn't
13:42gfredericksI might've been confusing myself
13:43gfredericksnevermind clojure.walk is teh best everybody use it for everything
13:43bbloom_heh
13:43technomancythere is a comment in leiningen's clojure.walk usage saying "clojure.walk discards metadata"
13:44technomancyI can't vouch for its accuracy
13:44cashonlyHas anyone used incanter for data visulization?
13:46gfrederickstechnomancy: yeah looks like it does for seqs
13:46gfredericksbut I'm not using a seq so doesn't matter everybody use clojure.walk
13:47technomancyPROBLEM SOLVED
13:47gfredericksalso it looks trivially changeable to fix that
13:47technomancywe're only using it in lein for defproject unquote, which is silly and should be replaced with read-eval
13:49arrdemwhere in the compile process does clojure do symbol qualification?
13:49bbloom_arrdem: in the reader, awkwardly enough
13:49arrdemurgh that's what I was afraid of.
13:49bbloom_it's easy to defeat
13:49arrdembut is it easy to replicate? :/
13:50bbloom_https://github.com/brandonbloom/backtick
13:50bbloom_man, i'm just self promoting left and right here guys
13:50bbloom_sorry about that :-P
13:50bbloom_you can quote, then call backtick/syntax-quote-fn later on that
13:50arrdembbloom_: your libs are good so I'm not complaining
13:51bbloom_arrdem: thanks. let me know if that solves your problem!
13:51arrdembbloom_: hum.. I'll need to ponder over lunch but I don't think it does.
13:52arrdemI'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:53bbloom_backtick intentionally replicates clojure's behavior…. in a more sane way
13:54bbloom_(syntax-quote (some stuff here)) should operate identically to `(some stuff here), but just at macro expand time instead of at read-time
13:54bbloom_and that's basically the same as (syntax-quote-fn '(some stuff here))
13:54bbloom_so you can (quote whatever) and (syntax-quote-fn whatever) much later
13:54bbloom_letting you decouple read time from the symbol resolution process
13:55arrdemright. 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:56bbloom_https://github.com/brandonbloom/backtick/blob/master/src/backtick.clj#L85-L101
13:56bbloom_you can define custom resolvers
13:57bbloom_(defn sometimes-resolve-symbol [x] (if blah x (resolve-symbol x)) (defquote my-resolving-quote sometimes-resolve-symbol)
13:57bbloom_i gotcha covers :-)
13:57stuartsierraClojureScript 0.0-1847 released.
13:57bbloom_covered*
13:58stuartsierraWith latest Google Closure library & compiler.
13:58bbloom_stuartsierra: cool!
13:58dnolenawesome
13:59seangrovewoow, thanks stuartsierra
14:06jonasenbbloom_: dnolen: The closure-lib warnings (cemericks CLJS-489) are gone with the new clojurescript release!
14:06bbloom_jonasen: w00t!
14:07bbloom_dnolen: i think it's time to pull the trigger on that patch :-P
14:07bbloom_trust in the cemerick, he will bring development nirvana to us all
14:07dnolenbbloom_: not going to happen until someone updates docs and fully preserves the hold behavior
14:08dnolenit just too much coordination w/ other tools otherwise
14:08cemerickjonasen: excellent, that's what we were hoping for :-)
14:08bbloom_doesn't cljs-build hard code to a particular cljs version?
14:08dnolenbbloom_: which is overrideable
14:08bbloom_surely they will break when they try to update. sounds like coordination to me :-P
14:08dnolenbbloom_: no
14:09bbloom_i'm just kidding
14:09stuartsierracljs-build has a default CLJS version but Leiningen :dependencies overrides it.
14:11cemerickdnolen: 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:13cemerickstuartsierra: thanks for the goog deps packaging :-)
14:13stuartsierracemerick: You're welcome. I've got some help from Sam Umbach at Relevance, who's trying to make it more automatic.
14:14konrDoes (keys foo) always return the same results, or the keys can be in a different order?
14:14atyzDoes ring have a way of determining the content-type if not explicitly set?
14:14dnolencemerick: I'd like to see the docs change as little as possible, and existing tools can just do what they were doing before.
14:15technomancykonr: guaranteed to be the same order for a given instance of a map
14:16jonasendnolen: what tools are you referring to? cljsbuild and ?
14:16konrtechnomancy: thanks!
14:16dnolenjonasen: node-repl
14:18cemerickdnolen: 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:18cemerickdnolen: node-repl has nothing to do with the browser repl...
14:19dnolencemerick: yes I just meant how REPLs hook in
14:20cemerickdnolen: 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:20dnolencemerick: yes but I don't see the point of the yak shaving around removing the simple server
14:21llasramtechnomancy: lagging due to lunch, but do you have a reference to the clojure.walk public-disowning?
14:21cemerickhah
14:23cemerickdnolen: 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:24dnolencemerick: I don't see what real challenges there are making the old default work while supporting the new fancy multiple browser REPL world.
14:27Foxboroncemerick: do you got any extensive documentation on how the NREPL server works? Trying to write a NREPL server for another language.
14:27cemerickFoxboron: the readme is pretty lengthy, and see the ops.md file in the repo.
14:28cemerickdnolen: 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:30dnolencemerick: 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:30squidzwhen 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:30dnolensquidz: go blocks return channels
14:31squidzoh right so it was just printing the channel
14:31squidzdnolen: thanks
14:32cemerickdnolen: Q: why? If a dynamic port is OK, then whatever tools actually depend on the browser repl will break anyway.
14:32dnolencemerick: why shouldn't a user be able specify a port?
14:34dnolencemerick: also why can't the first port default to 9000 and be some other value after that?
14:37cemerickdnolen: 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:38cemericktl;dr: why should you ever have to specify a port?
14:42dnolencemerick: 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:43dnolen"it doesn't seem the tools break in a significant way" is what I meant
14:47cemerickdnolen: 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:47dnolencemerick: so it doesn't auto resolve?
14:48cemerickdnolen: "auto resolve"?
14:48dnolencemerick: ok so no
14:49dnolencemerick: yeah I'm not excited about this - it probably should be broken out into a separate facility.
14:49cemerickdnolen: 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:50dnolencemerick: yes I understand what you're trying to do now
14:50dnolencemerick: it should be a separate browser REPL facility in addition to what we have now
14:51cemerickman, that's exactly what I was planning on doing ~6 months ago before trying to wedge a patch together
14:52dnolencemerick: when I say "separate" I don't necessarily mean outside CLJS
14:52dnolencemerick: but I think it should be made to work as w/o affecting what we have instead of walking over it.
14:53cemerickdnolen: Well, that's easy; it's just another repl env, and has nothing to do with the existing browser-repl.
14:54dnolencemerick: sounds like a plan then
14:55cemerickdnolen: 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:55cemerickI'll wrap it up into a project sometime next week, hopefully.
14:56dnolencemerick: I think that's fine as well.
14:56wei_is there a rails-like "time ago" library for diffing two timestamps? e.g. "10 days ago" "3 seconds ago"
14:56Raynestpope: Ping.
14:57dark_elementcemerick, Is multiple browser-repl server setup meant for cross browser dev?
14:58wei_i think clj-time will do
15:02cemerickdark_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:02cemerickso, all that's left to do is come up with a name besides "browser-repl" :-P
15:04dark_elementcemerick js-repl ?
15:04jodaroi vote for "sylvia"
15:04callenRaynes: nobody can help you now, bwahahaha
15:04cemerickdark_element: I hope I come up with something with a bit more panache. :-)
15:05squidzare yall figuring out a standard way to get a browser repl?
15:05dark_elementcemerick ohh it didn't occur to me it's for the project and not for renaming the browser-repl itself.
15:06Raynescallen: Wat?
15:07callenRaynes: you asked for tpope and i was feeling silly.
15:07cemerickdark_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:10lynaghkdakrone: ping
15:10dakronelynaghk: pong
15:10lynaghkdakrone: 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:11dakronelynaghk: certainly, what's up?
15:11callenlynaghk: HTTP proxy? use http-kit.
15:11dakroneI'm just about to release a new version that fixes an issue
15:11lynaghkdakrone: Right now clj-http will deflate the body but it leaves the content-encoding gzip header on
15:12lynaghkcallen: what are the relative merits of http-kit's client vs clj-http?
15:13dakronelynaghk: 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:13dakronelynaghk: however, if you are creating a proxy, it might be better to do {:decompress-body false} so it's passed through compressed
15:14callenlynaghk: http://http-kit.org/ async, highly concurrent, designed for this kind of problem.
15:15lynaghkdakrone: I need the proxy to do http-content rewrites (inject a script tag) so it'd need to be decompressed
15:16callenlynaghk: you want http-kit.
15:16lynaghkdakrone: 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:16callensigh. you can't amend mercurial commits that have joined the public change-set.
15:16dakronelynaghk: I understand, I will work on a fix for it, it should be a bug that it's not removed
15:17lynaghkdakrone: 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:18lynaghkcallen: 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:20technomancyimpossible. anything can be made better by adding async to it.
15:21technomancyhate clojure's stack traces? try an async approach; that will get rid of those pesky stack traces once and for all.
15:23duck1123I wish I could "like" irc messages
15:23trinaryjust post them to twitter
15:23technomancyyou can like them without the quotation marks; that's good enough for me.
15:24hyPiRionduck1123: you have inc for that, somewhat
15:24clj_newb_2345is there a way to use clojurescript without having to load all the google closure libraries?
15:24hyPiRionHmm, is inc case-sensitive?
15:24hyPiRion(inc HYPIRION)
15:24lazybot⇒ 15
15:24hyPiRionlol what
15:24clj_newb_2345(case: mobile tools, not wanting to deal with all the libraries that google closure loads)
15:25hyPiRionRaynes: ^
15:25gfrederickshyPiRion: you just found a self-incing hack!
15:25hyPiRionI shouldn't be able to inc myself
15:25hyPiRiongfredericks: wohoo
15:26hyPiRiongfredericks: maybe it accepts my inc because I screamed to it
15:26Raynes$karma Raybes
15:26lazybotRaybes has karma 0.
15:26Raynes$karma Raynes
15:26lazybotRaynes has karma 33.
15:26Raynes(dec RAYNES)
15:26gfredericks(inc raybes)
15:26lazybot⇒ 32
15:26lazybot⇒ 1
15:26ucb$karma ucb
15:26lazybotucb has karma 0.
15:26hyPiRion(INC RAYNES)
15:26RaynesIntresting.
15:26hyPiRionoh, that won't work.
15:26hyPiRion(inc RAYNES)
15:26lazybot⇒ 33
15:26technomancywhat about (identity RAYNES)
15:26RaynesI didn't realize strings were getting normalized.
15:26Raynestechnomancy: That's a good idea.
15:27hyPiRiontechnomancy: inc on that
15:27RayneshyPiRion: Go fix that and do what technomancy just said.
15:27hyPiRionRaynes: okay boss
15:27gfrederickstechnomancy: how can we make that side-effecting?
15:27hyPiRionJust don't bring your whip out again
15:27hyPiRiongfredericks: deref, inc! and dec! ?
15:27technomancygfredericks: if you figure that out you'd probably earn a few incs for sure
15:28technomancyanother feature request: dinc for double-incing
15:29gfredericksand ddinc for incing 12 times
15:29clj_newb_2345does clojurescript debugging have sourcemaps yet
15:29clj_newb_2345or is it still (1) look at jvascript (2) find corresponding clojurescript line
15:30clj_newb_2345ibdknox: ping
15:31hyPiRionoh wow
15:31hyPiRionThere's a (Thread/sleep 300000) in here.
15:31hyPiRionoh well.
15:31gfrederickshyPiRion: that's bad for perf
15:31gfredericksat least in theory
15:31gfredericksmake sure you do your own benchmarks
15:31technomancythe compiler should be able to optimize that away
15:32gfrederickstechnomancy: always test!
15:32hyPiRiongfredericks: not sure. (future (Thread/sleep 300000) (do-something)) should be bad, yeah
15:32RaynesLOL
15:32gfrederickshyPiRion: is this the lazybot inc-debouncer?
15:33Raynesamalloy: ^ What are you doing there?
15:33Rayneshttps://github.com/flatland/lazybot/blob/master/src/lazybot/plugins/karma.clj#L40
15:33hyPiRiongfredericks: yeah
15:33amalloyRaynes: that code isn't mine, man
15:34amalloyi'm just on the git-blame because i touched it last
15:34RaynesOh, I guess this is the thing that limits number of alters?
15:34RaynesOkay, that makes sense.
15:34RayneshyPiRion: This makes sense, what are you on about
15:34technomancyyeah what the heck; that should totally be a commute
15:34Raynestechnomancy: I'm pretty sure it shouldn't be a ref in the first place.
15:35squidz(inc SQUIDZ)
15:35lazybot⇒ 1
15:35amalloyRaynes: this is one of many ways in which a user could fork-bomb lazybot, btw
15:35RaynesI didn't write this code either. At least, not the original plugin.
15:35Raynesamalloy: Eh?
15:35RaynesWhat way?
15:35amalloyRaynes: every time i inc or dec someone, i consume a thread for five minutes
15:35amalloythen i switch nicks and do it again
15:35Raynessofixit
15:36Raynes:p
15:37amalloyactually i don't even have to switch nicks, since there's a separate limit per target
15:38hyPiRionoh humm
15:40RaynesI don't think I wrote this either fwiw.
15:40RaynesDidn't someone contribute the plugin at some point?
15:40RaynesI can't tell because you killed its history when we renamed.
15:40amalloyivey something, right?
15:40RaynesAnd I'm too lazy to git blame it locally.
15:40RaynesAh yes.
15:41gfredericksdang people are building languages with clojure as a platform now
15:41amalloyit's at the top of the dang file
15:41RaynesGood old Ivey. He is legend now, since he is gone.
15:42technomancyhe stopped his iveyfavs tweetor account =(
15:42technomancyhttps://mobile.twitter.com/iveyfavs
15:42technomancy^ gold mine
15:43technomancyI guess it was funnier before it was 90% NSA tweets
15:50bbloom_gfredericks: what about clojure as a platform?
15:52squidzwhat 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:53amalloyRaynes: try https://github.com/flatland/lazybot/compare/master%5E%5E...master
15:54amalloyi 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:57gfredericksbbloom_: gershwin is a language with "seamless clojure interop"
15:58gfredericksbut I assume you're familiar with it
15:58zoldarRaynes: 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:58RaynesI'm using actual vim right now.
15:58bbloom_gfredericks: nope, hadn't seen it
15:59zoldarah, ok then
15:59callenlynaghk: sounds like you've got it in hand then. :) godspeed.
15:59bbloom_gfredericks: "Gershwin is a stack-based, concatenative programming language with a Clojure runtime that targets the JVM."
15:59callenRaynes: you should use fake vim.
15:59bbloom_gfredericks: bwah? how did i miss this? that's all right up my alley :-P
16:00SegFaultAXbbloom_: Ping!
16:00bbloom_SegFaultAX: what' sup?
16:00gfredericksbbloom_: yeah I assumed you had half-invented it
16:00SegFaultAXbbloom_: IMGUI!?
16:00bbloom_SegFaultAX: IMGUI!!!!
16:01callenSegFaultAX: immediate mode is pleb mode.
16:01bbloom_callen: i disagree strongly
16:02dakronelynaghk: are you able to test out https://github.com/dakrone/clj-http/commit/ede1a89b7189e8a32a9b4ee4afda018cae4ffef1 before I cut a release with it in?
16:02bbloom_i think that intermediate mode naturally fits the notion of traversal
16:02bbloom_immediate* i mean
16:02bbloom_you don't need to be side effectual to utilize immediate mode
16:02callenbbloom_: modern graphics pipelines are built around retained mode. Even web content is headed in that direction.
16:02callenbbloom_: don't fight the future...prole.
16:03callenThe "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:04callenImmutability is immenseful useful, especially anywhere business logic predominates.
16:04scottjzoldar: #evil-mode maybe
16:04callenimmensely*
16:04callenbut for graphics? lol gtfo.
16:05bbloom_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:05bbloom_not for perf, although they get that too
16:07callenit'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:07bbloom_immediate vs retained is an invalid dichotomy
16:07bbloom_game developers thing in terms of immediate vs retained, but the real concern is internal vs external state
16:08bbloom_instagram's React is, effectively, an external-state & retained-mode system
16:08bbloom_however, game developers would probably think of it as immediate-mode
16:08callenbbloom_: also your experience was deeply biased by having been at Microsoft
16:08callenbbloom_: just because they failed at retained mode with D3D early on doesn't mean the rest of the industry did.
16:09callenretained-mode is the standard in OGL.
16:09bbloom_callen: LOL no it isn't
16:09bbloom_it hasn't been since a loooong time ago
16:09bbloom_when was the last time you used ogl?
16:09bbloom_display lists are gone
16:09bbloom_modern open gl mimics the hardware
16:10bbloom_which mimics the direct 3d api
16:11callenbbloom_: mostly 3.x, AFAIK OGL 4 got rid of immediate mode entirely and 3.x was the beginning of that shift.
16:12callenit was primarily old OGL 2 stuff that was immediate-mode.
16:13bbloom_callen: are you considering vertex buffers "retained"?
16:13bbloom_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:14bbloom_there is a terminology gap here
16:14bbloom_this is why i'm saying "retained" vs "immediate" is a broken thought process
16:14bbloom_immediate mode doesn't mean you don't retain anything
16:15bbloom_opengl literature SOMETIMES refers to vertex buffers etc as "retained"
16:15bbloom_which is only true so much as any cache implies retention
16:16bbloom_the bigger question is one of retaining drawing commands (like opengl's display lists) or scene graphics (like D3D retained mode)
16:16callenbbloom_: ...no.
16:16callenbbloom_: the shift in OpenGL has always been to continually push towards retained mode with manipulable primitives.
16:16callenWebGL is immediate mode
16:17bbloom_callen: i can find no evidence of your assertions regarding opengl 4
16:17callenbbloom_: this covers it nicely in high level goals and also specifics: http://www.opengl.org/registry/doc/glspec40.core.20100311.pdf
16:18callenin particular, the early "* view" sections.
16:19futileHow do you do a lot of little integration tests that require a database to set up?
16:19callenI didn't know Microsoft actually convinced their employees the rest of the industry was going to move back to using immediate-mode.
16:19futileIs there a Clojure lib for that?
16:19bbloom_callen: you have your terminology confused
16:19bbloom_callen: i just read the programmer & implementor sections. those are describing immediate mode
16:20dark_elementI 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:21bbloom_SegFaultAX: was there something productive you wanted to discuss?
16:21sandoverbbloom_, 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:21sandoverthose are banished now
16:22callenbbloom_: the entire OpenGL spec is about retained geometric primitives.
16:22sandoververtex buffers represent state
16:22callenbbloom_: 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:22sandoverso if you're doing 'modern' opengl, you'd probably have to characterize it as more 'stateful' than it used to be
16:23callenyou 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:23bbloom_modern opengl doesn't retain any drawing commands, only resources
16:23callenespecially from the point of view of the "boots on the ground" developer.
16:23bbloom_this is why i said "retained" vs "immediate" is a false dichotomy
16:23sandoverdisplay lists were essentially a record of a series of immediate mode calls, which could be played back over & over again
16:23sandoverthey were a transitional step to vertex buffers
16:24sandoverthe word 'retained' is the red herring.
16:24bbloom_sandover: that's what i'm saying
16:24callenbbloom_: and guess how VBO is used? for non-immediate-mode rendering...
16:24bbloom_callen: you call a draw function & give it a handle to the vertices....
16:24sandoveryes. but do we all agree that a VBO is a kind of state?
16:24callenyes.
16:25sandoverwith immediate mode drawing (basically turtle graphics) there is no need for that state
16:25callenall of the *retained* primitives that get statefully manipulated by the OpenGL API are state.
16:25bbloom_it's a question of WHAT gets retained
16:26sandoveryes. even under immediate mode graphics there is a gob of state that impinges on how the immediate mode calls would actually get rendered.
16:26bbloom_retaining vertex data is dramatically different than retaining command sequences
16:26callenbbloom_: as far as the industry is concerned, not really.
16:26sandoverit's still a ball of mud
16:26callenbbloom_: for their purposes, that's retained mode.
16:26bbloom_as i've argued several times, retained vs immediate are bad terminology
16:27callenbbloom_: you're the only confused one.
16:27bbloom_i'm not confused at all
16:29bbloom_http://en.wikipedia.org/wiki/Immediate_mode
16:29bbloom_http://en.wikipedia.org/wiki/Retained_mode
16:29bbloom_those definitions back up what i've been saying
16:29bbloom_"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:29jonasenI not able to run the clojurescript tests. Getting an exception when compiling test_runner.cljs
16:29callenretained-mode is far from expressly about drawing commands.
16:29bbloom_anyway, i'm done arguing b/c like i said. the terminology is somewhat fuzzy and non-helpful to differentiate
16:30jagajI'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:30bbloom_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:30bbloom_anyway, back to work
16:31callenthis may be a case of descriptivism vs. prescriptivism.
16:31jonasendnolen: bbloom_: have you tried running the tests with a fresh clojurescript clone. I'm probably doing something wrong here
16:31callenAll of the original immediate mode API was deprecated in OpenGL 4
16:42lynaghkdakrone: is there a snapshot release I can pull down to test?
16:42dakronelynaghk: too late! :) 0.7.6 is released
16:42lynaghkdakrone: I will test anyway. thanks for the speedy help!
16:42dakronelynaghk: no problem, let me know if you have any more issues
16:43lynaghkdakrone: I'm pretty sure I've owed you a beer before, so now it's two next time you're in PDX
16:43dakronehah, thanks :)
16:50lynaghkdakrone: should I be allowed to just pass in the ring request map to clj-http to proxy?
16:51lynaghkdakrone: 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:51dakronelynaghk: it's be safer to construct one
16:51dakroneerr, grammar
16:51dakroneit'd be safer to construct one
16:52dakroneso if possible, that'd be the way I'd do it
16:53lynaghkdakrone: so I'd need to manually construct a url from the ring request map's fields?
16:54jonasendnolen: 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:54yedii have a url like this `http://localhost:3000/search/?feature=ombre&amp;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:54dakronelynaghk: yea, if you want to manually create one
16:54dakronelynaghk: a similar project (proxy from ring to clj-http) is here: https://github.com/drewr/norville/blob/master/src/norville/middleware.clj#L13
16:56lynaghkdakrone: ah, cool. I'll check that out.
16:57yedihm, something else must be going wrong, since the ring docs explicitly say that behavior is supposed to return a list
16:58yedioh looks like params and query-params behave differently
16:59callenbbloom_: 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:59callenbbloom_: 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:59bbloom_callen: holy hell are you still on about this?
17:00callenbbloom_: I wanted to know.
17:00llasrams,know,be right at all costs,
17:00bbloom_(inc llasram)
17:00lazybot⇒ 9
17:01jzelinskiewhat is the defacto http library for clojure?
17:02llasramjzelinskie: https://github.com/dakrone/clj-http
17:02jzelinskiewhere is a good place I can learn about the popular libs?
17:02jzelinskiethird party libs that is
17:02callenbbloom_: 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:02jzelinskiethanks btw
17:03llasramIs http://www.clojure-toolbox.com/ still any good? Honestly, I think I learn mostly by watching here and the clojure-users list
17:03callenllasram: it's out of date but still useful.
17:03callenllasram: best to just ask in here if it's important.
17:03jzelinskieok thanks
17:03technomancyI like clojuresphere, but I wish it decayed the significance of outdated dependencies
17:03llasramOh, hey, clojure-toolbox has cassaforte on it, so can't be that out-of-date
17:04llasramand fluokitten for that matter
17:04llasramLooks up-to-date to me
17:04bbloom_callen: i'm going back to my policy of ignoring you and your pedantry
17:05callenllasram: yeah fluokitten is new. hrm. there are definitely some libraries that have fallen into disuse on that site though.
17:10callenllasram: case in point, the SQL section on clojure-toolbox is...painful.
17:19jzelinskieis slingshot popular? it looks pretty useful
17:20lynaghkdakrone: 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:20dakronelynaghk: is it up anywhere I could take a look at?
17:21lynaghkdakrone: https://gist.github.com/lynaghk/6066181
17:22lynaghkdakrone: bumping to the new version fixes the gzip issues though, thanks.
17:24dakronelynaghk: so you're removing the transfer-encoding headers manually there, but you want them to not be removed?
17:25nDuffjzelinskie: moderately.
17:25dakronelynaghk: not sure how it's misbehaving
17:25technomancyjzelinskie: slingshot was a lot more important before clojure got ex-info. now it's nice for fancier try/catch but not essential
17:26lynaghkdakrone: 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:27lynaghkdakrone: 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:29dakronelynaghk: if it's string-ish data, you could print it and see what it is
17:32jzelinskiei see technomancy -- i didn't know about ex-info thanks
17:35dakronelynaghk: alternatively, you could set {:debug true :debug-body true} and get some debug info printed out
17:35lynaghkdakrone: hmm, it's printing out fine, which makes me think jetty is messing up sending down the string somehow....ugh!
17:36jzelinskiewait clojure lets you define multiple definitions with different aritys in the same defn?
17:36jzelinskiei guess I never put that together
17:37dark_elementjzelinskie yup
17:37jzelinskiedo other lisps do it the same way?
17:39bbloom_jzelinskie: the syntax is slightly different in different lisps
17:39jzelinskiesince they dont have vectors etc... yeah i'd imagine
17:39bbloom_the semantics differ too, but in very subtle ways
17:39bbloom_for example, clojure's variadic functions interop cleanly with lazy sequences
17:42lynaghkdakrone: everything is working fine when curl uses the proxy, I'm going to assume this is a firefox problem =/ thanks for your help
17:42dakronelynaghk: no problem, glad it's working
17:45mikerodis it faster to conj to a PersistentVector$ChunkedSeq or a PersistentHashSet?
17:45mikerodfaster = more efficient
17:47hiredmana PersistentVector$ChunkedSeq is just a seq
17:47hiredmanconj on to a seq is adding a node to the front of a linked list
17:48hiredmansets require hashing and maybe equality checks, depending on the values
17:48justin_smithhiredman: so would that mean that hashes are faster for lookup, and seqs faster to build?
17:48hyPiRionhiredman: at least a hash lookup + pointer check, no?
17:49hiredmanif you have further questions, I suggest reading documentation and source
17:51bbloom_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:52mikerodhiredman: 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:03lynaghkdakrone: actually, have another question for you if you've got a sec
18:04lynaghkdakrone: 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:05OneFourSevenI'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:06konrOneFourSeven: I think there are some client-side routing libraries for CLJS on github
18:06konr
18:10bbloom_(doc when-first) ;; mind blown. had no idea that existed
18:10clojurebot"([bindings & body]); bindings => x xs Roughly the same as (when (seq xs) (let [x (first xs)] body)) but xs is evaluated only once"
18:11dark_elementI am trying to use requestAnimationFrame with core.async but end up blocking the whole page. https://www.refheap.com/16874
18:11amalloybbloom_: 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:12amalloyreally i'd like (when-let [[x & xs] (seq xs)] ...), except that that's not lazy enough
18:13bbloom_maybe call it when-seq & get it to do what you want?
18:13dakronelynaghk: I don't follow, why would it be a deflated stream rather than a gzip one?
18:13bbloom_(when-seq [[x & xs] s] …)
18:13trinaryok 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:13dakronelynaghk: it uses whichever is determined from the content-encoding header
18:14OneFourSeventrinary: are you using emacs?
18:14trinaryvim is my usual editor
18:15lynaghkdakrone: sorry, I meant that it should be the underlying stream
18:15OneFourSevenModern cljs is a fine guide to start with.
18:16lynaghkdakrone: the issue was that I was getting gzipinputstreams and then sending them down to the end client without uncompressing them.
18:16dakronelynaghk: if it doesn't decompress (or if it's turned off), it shouldn't be a GZIPInputStream, it should be a regular InputStream
18:16trinaryOneFourSeven: thanks, just want to make sure I'm not shooting myself in the foot right from the getgo.
18:18lynaghkdakrone: 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:19dakronelynaghk: {:decompress-body true} enables it, you'd need {:decompress-body false} to disable it
18:19dark_elementtrinary also check this if you are using nrepl https://github.com/cemerick/piggieback
18:20lynaghkdakrone: 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:20dakronelynaghk: right, it's decompressed as it's being read
18:21lynaghkdakrone: ahhhh. Okay. well then I'm back to square one =/
18:21dakronelynaghk: so you want to either turn off body decompression, or read the entire stream into memory and munge it there it sounds like
18:22dakronelynaghk: is the zipped stream causing issues somewhere?
18:22trinarydark_element: thx, will check it out
18:22lynaghkdakrone: 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:23dakronelynaghk: 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:24dakronelynaghk: can you turn off decompression and see if it persists?
18:26lynaghkdakrone: jetty doesn't seem to add a content-length header at all
18:26dakronelynaghk: what are the headers that jetty sends?
18:26lynaghkdakrone: so the issue could be that curl keeps trying and firefox gives up after the first chunk when there is no content length
18:27lynaghkdakrone: https://gist.github.com/lynaghk/ba0756eab5d19780d068
18:29dakronelynaghk: and the data from jetty is in correct chunked-encoding format?
18:29lynaghkdakrone: as far as I can tell---curl spits out the right result
18:29lynaghkdakrone: firefox, however, doesn't give the whole file
18:30dakronelynaghk: can you paste the headers from clj-http's {:debug true} output?
18:31lynaghkdakrone: gist updated.
18:32dakronelynaghk: any header difference when firefox is used instead of curl?
18:34lynaghkdakrone: gist updated.
18:36dakronelynaghk: 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:37dakroneto see whether it's header related
18:37lynaghkdakrone: yeah, I'll give that a shot. I have to run for now, though
18:37dakronelynaghk: good luck!
18:37lynaghkdakrone: this proxy bit was a "minor feature" that has sucked up more time than everything else on this project
18:37lynaghkdakrone: thanks! =P
18:37dakronelynaghk: hah, if it were public I would be able to help more
18:38lynaghkdakrone: yeah, I may split this thing out into a repo. I was wary about making it public because then it might get popular...
18:39lynaghkand then I would *definitely* start yak shaving.
18:44futileHow would you remove only one entry from a vector, based solely on value, without removing duplicates?
18:44futileSurely this is possible in about 10 boring lines of code. But is there a fun Clojure one-liner for it?
18:44bbloom_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:45futileOh.
18:45futileOr something.
18:45bbloom_you could create such a function in slightly more than a one liner :-P
18:46futileI'm thinking of something that mixes the first-filter pattern with split-by.
18:46futileI mean split-at.
18:47futileOnly thing I'm missing is how to get the index of the first instance of a value in a vector.
18:47noonianits simple as a recursive function
18:47futileNothing is simple as a recursive function and I no longer wish to be your friend.
18:48futile,(split-with #{3} [1 2 3 4 5])
18:48clojurebot[() (1 2 3 4 5)]
18:48hyPiRion,(apply concat ((juxt take-while (comp rest drop-while)) #(not= 4 %) [1 2 3 4 5 6 7 8 9]))
18:48clojurebot(1 2 3 5 6 ...)
18:48noonianlol
18:48futilehyPiRion: hmm, that's kind of like split-with/at..
18:48hyPiRionfutile: yup, with a rest mixed in.
18:49futileGreat to hear I wasn't that far off.
18:51futilehyPiRion: Alas I'm not smart enough to read that solution :(
18:52futileSo is it still fashionable to write your own Lisp interpreter these days?
18:52futileLast time I tried, I got stuck on the confusion about empty lists and nil.
18:52bbloom_futile: everybody should try it at least once
18:53bbloom_it's good for you!
18:53futileNo, I think it just makes people arrogant.
18:53hyPiRionfutile: it's exactly the same as split-with, just that (comp rest drop-while) removes the first element the drop-while usually returns
18:53futile"I've wrote a Lisp interpreter, see, I'm smarter than you now."
18:53hyPiRion(apply concat ...) is, well
18:54hyPiRion~flatten
18:54clojurebotflatten 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:54futileOh.
18:54hyPiRionthere should be a juxtcat
18:56futileSeems clearer to just use split-with, and concat (first %) with (rest (second %))
18:56noonianfutile: I'd do it like this: http://pastebin.com/hSkQknJD
18:57futilenoonian: YOU HAVE A VERY NICE HAT
18:57futileI'm trying to practice that rule of "if you don't have something nice to say, make something up".
18:57futile"and yell it if the thing you wanted to say was because you're angry"
18:58noonianfutile: sorry...
18:58futilenoonian: DONT APOLOGIZE, YOUR HAT IS VERY NICE AND FLUFFY
18:58futilenoonian: THATS A GOOD THING.
18:59futileLIKE THIS ONE http://bit.ly/13betrS
18:59seangroveCalm down futile
18:59futileGeez, a guy can't even compliment someone's hat these days.
19:00futile,(let [[a b] (split-with (partial not= 3) [1 2 3 4 5])] (concat a (rest b)))
19:00clojurebot(1 2 4 5)
19:00futile,(let [[a b] (split-with (partial not= 3) [5 4 3 2 1 2 3 4 5])] (concat a (rest b)))
19:00clojurebot(5 4 2 1 2 ...)
19:01futile,(pr-str (let [[a b] (split-with (partial not= 3) [5 4 3 2 1 2 3 4 5])] (concat a (rest b))))
19:01clojurebot"(5 4 2 1 2 ...)"
19:01futilefff
19:03futileThanks noonian for your help. It's much appreciated.
19:03futileYou too hyPiRion and bbloom_.
19:04nooniannp
19:05futilenoonian: 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:05noonianI agree, I prefer to use higher order functions usually
19:06noonianbut 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:06futilenoonian: ah I see.
19:07futilenoonian: well nevertheless, I appreciate that you took the time to even come up with a solution. Very kind of you.
19:07noonianfutile: no problem, I like writing recursive functions and as you pointed out you don't have to very often in Clojure :P
19:07futileWell gotta go now.
19:07futileBye and thanks all.
19:23lynaghkdakrone: you are not going to believe this nonsense: it was the user-agent string. adding that header lead to the truncated body.
19:23dakronelynaghk: wat
19:23lynaghkI KNOW.
19:24dakronethat's weird
19:24lynaghkdakrone: 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:24dakronelynaghk: sure, happy to help
19:32lynaghkdakrone: https://github.com/lynaghk/misc
19:32lynaghkdakrone: 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:33dakronelynaghk: sure, I'll check it out, thanks
20:04OneFourSevendnolen: How did you generate this heat map? https://twitter.com/swannodette/status/111860760765939713
20:06scottjOneFourSeven: http://www.patrick-wied.at/projects/heatmap-keyboard/
20:07OneFourSevenThanks. I was hoping it was a clojure library
20:18akurilinAny recommendations for tools for enabling autotesting with clojure.test? Anything fancy that might integrate with something like guard?
20:19akurilinlein-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:20lynaghkakurilin: midje has an autotest plugin
20:24akurilinlynaghk, 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:24lynaghkakurilin: dunno, I've never had to do it
20:24akurilindamn, midje has way more stars than speclj
20:26squidzlynaghk: how are you coding d3 stuff if you do it on your own time? Just using plain old javascript?
20:28lynaghksquidz: I haven't done plain js in quite a while. Both my professional and personal work in is Clojure/ClojureScript
20:28lynaghkthough I sometimes interop with JS
20:29OneFourSevenHow easy is it for you to find Clojure work lynaghk?
20:29lynaghkOneFourSeven: easy enough for me to keep paying rent = )
20:29squidzso what do you do when doing d3 stuff?
20:30squidzlynaghk: c2 or strokes?
20:30lynaghksquidz: I haven't done a lot of D3 stuff lately. C2 sometimes.
20:31squidzokay 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:32trinaryI do a lot of d3 stuff outside cljs and was wondering how viable c2 is, how well direct d3 interop etc work
20:34squidzthere'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:37akurilinIs 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:39noonianakurilin: 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:40justin_smithhow about (let [a (get-a) _ (some imperative step) b (something a) ...] z)
20:40johnmnevening
20:41justin_smith(that is, using _ as a dummy binding to throw imperative actions into a let form
20:41justin_smith)
20:41squidzwould there be any alternatives? sometimes it seems that no more can be pulled out of let forms
20:42akurilinYeah I'm definitely concerned I'm cheating by being imperative through the let form
20:43akurilinand I'm wondering if there's a clean and readable way of avoiding that.
20:44justin_smith(-> {} (assoc :a 0) (assoc :b :whatever) (doto imperative-whatever)) can probably do everything a let form can
20:44justin_smithbut may not be as readable or efficient
20:45justin_smithbut is more clearly a set of steps that build on one another
20:53rishdaIs it common to "mock out" the database during a test suite?
20:53rishdaOr do most people use the real database in test suites?
20:54gfredericksI use the real db rather often
20:54gfredericksbut mocking is easy
20:54rishdaIt is?
20:54gfredericksI also have a vcr lib that you can use to record db interaction for playback later, if you find that useful
20:54gfredericks,(doc with-redefs)
20:54clojurebot"([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:54rishdaok
20:56rishdaDoes it seem beneficial to use a simplified database API, and using an in-memory database in your tests?
21:14zikemanbCan anyone recommend a good clojure library for managing migrations against Postgres/MySQL?
21:15brehautzikemanb: ragtime has worked fine for my needs
21:15zikemanbthx, I'll give it a shot :)
21:39johnmn3I 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:39akurilinNote to self, just because Clojure allows keys to be Long, doesn't mean JSON won't lose that in translation :)
21:40ivanhttps://github.com/ptaoussanis/nippy why is encryption in a serialization library?
21:41brehautakurilin: lossing information should be your first assumption about json ;)
21:41johnmn3ivan: it's a network reader
21:41johnmn3ivan: or, a reader that can talk over the network.
21:41akurilinbrehaut, slowly learning, error by error :)
21:42akurilinbrehaut, any advice for how to safely coerce strings into numbers?
21:42ivanjohnmn3: I'm guessing encryption can still be composable in that case
21:42ivanafter all, TLS doesn't care what you transfer
21:43akurilinLong/parseLong seems to work
21:43johnmn3ivan: 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:44akurilinalthough I'm wondering if hardcoding the underlying numeric type to Long is somehow a faux pas.
21:44brehautakurilin: that would be reasonable. dont forget to catch exceptions
21:44akurilinI guess I'm not moving off the JVM anytime soon.
21:45brehautakurilin: JSON hand waves the representation, but in JS its an IEEE 64bit float ;)
21:46brehautakurilin: particular implementations of js will use some integer reperesentation when they can, but thats primarily an optimization
21:48brehautakurilin: if you are using non-string keys, i think associative lists are probably a better choice than objects in json too
21:49brehaut(associative list is a list of key value pairs)
21:50akurilinbrehaut, are the libraries for dealing with encoding/decoding associative lists both in clojure and js solid?
21:50brehautakurilin: no
21:50brehautakurilin: in clojure its simple: (into {} alist)
21:50gfredericksbrehaut: and also seq
21:50brehautin javascript you are as hosed as you are with basically every other datastructure situation
21:50gfredericks(dec javascript)
21:50lazybot⇒ -1
21:51akurilinbrehaut, 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:51brehautakurilin: your wire format should never be your internal representation for a plethora of reasons
21:51gfredericksfor(var pair in alist){ob[pair[0]]=ob[pair[1]]}
21:51gfredericksor something
21:51akurilinbrehaut, that's fair.
21:51gfredericksob[pair[0]]=pair[1] rather
21:52brehautgfredericks: lols nope; for in loops in JS are only for keys
21:52gfredericksbrehaut: yeah that's my "or something"
21:52brehautakurilin: it goes doubly when you are using a lowest common demoninator representation like JSON
21:53brehautakurilin: 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:53brehaut± stupid overloading array caveats
21:54brehautand of course, only numbers that are representable as ints are allowed as array indices
21:56nooniandoes 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:57akurilinbrehaut, 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:57brehautakurilin: have you considered edn?
21:57brehautor some other format?
21:59gfredericksis there a js<->edn lib in pure js yet?
22:00brehautperhaps mori?
22:00akurilinbrehaut, 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:00brehautdnolen: does mori expose the edn reader?
22:01akurilinDo yaml/toml also restrict keys to strings?
22:01brehautjust btw https://github.com/edn-format/edn/wiki/Implementations
22:02brehautakurilin: there is a recommended impo for objc there
22:02brehautand javascript
22:03akurilinbrehaut, hm interesting.
22:03akurilinbrehaut, ok will look into it further then, thank you :)
22:03brehautim not recommending EDN unreservedly; ive never used it myself; but it seems like JSON is really being stretched by your project
22:05isaacbwin a macro, can/how do I check if a value is a form?
22:05gfrederickswhat's not a form?
22:05brehaut,
22:05clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
22:05isaacbwhmm
22:06gfredericksbrehaut: that's also not a value :P
22:06isaacbwa "list that will be evaluated"?
22:06isaacbwI don't know the terminology
22:06gfredericksso lists in particular?
22:06gfrederickse.g., you don't consider [(+ 1 2) (inc 3)] to be a form?
22:06isaacbwlists that aren't prepended with a '
22:06brehautin a macro, a list that will be evaluated is any list you decide you want to be evaluated ;)
22:06isaacbwgfredericks: scratch the form bit
22:07gfredericksisaacbw: the single-quote doesn't exist from a macro's perspective
22:07gfredericks'a is just (quote a), which is a list
22:07gfredericksisaacbw: well without the form bit I don't think you asked anything else
22:08isaacbwalright, I think I got it
22:08`cbpHi how can I typehint formatter to remove the reflection warning? https://www.refheap.com/16878
22:09gfredericks`cbp: put ^DateTimeFormatter before formatter?
22:09`cbpdoesn't work :P
22:10`cbpoh i had to typehint d too my bad
23:02callenoh damn you to hell. "Can't type hint a primitive local"
23:04yediuh, are you not allowed to pass keywords as arguments anymore, when theres another variable being passed after it
23:04yediskateproj.es=> (add-chosen-to-choice ps ':color c)
23:04yediArityException Wrong number of args (1) passed to: es$add-chosen-to-choice$fn clojure.lang.AFn.throwArity (AFn.java:437)
23:05yedi(defn add-chosen-to-choice [params fname choice] ...)
23:15amalloyyedi: 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:17amalloyalso, don't name your namespace just "es". single-segment namespaces are the devil
23:25rishdaverily
23:27isaacbwhow could I be getting a Wrong number of args (-1) exception?
23:27yedithanks amalloy
23:27yediwhat do you mean by single segment namespaces
23:28amalloyisaacbw: (defmacro quote-all [& args] (cons `do (map #(quote) args))) (quote-all a b c) does that iirc
23:29amalloybasically if there's any arityexception during macroexpansion the compiler subtracts two, which is right most of the time but not always
23:33isaacbwah okay
23:33isaacbwthanks
23:58callenis StringBuilder the fastest way to build a string incrementally?
23:58brehautprobably; although str uses it automatically when it gets enough arguments
23:59callenbrehaut: considering options.