#clojure logs

2013-03-22

00:54cliftonhi, whats the favored pattern for reading/accessing environmental variables from config/(dev|production).clj
00:54cliftonsneaking some clojure into our production stack :(
00:54clifton:)
01:04hyPiRionclifton: oh, I've heard people talking about environ for that
01:04hyPiRionhttps://github.com/weavejester/environ
01:07cliftonthanks hypirion
01:07hyPiRionno problemo
01:26tomojwhat's the other one?
01:26tomojah, carica
02:44tomojwhy design IWatchable as it is instead of having add-watch return a remove-watch function?
02:44tomojs/IWatchable/IRef/ for jvm
02:46amalloytomoj: it wouldn't be a lot of fun if you had to keep track of the remove-watch function elsewhere. the way it is now, you can often remove a watcher without having to save the result of add-watch anywhere
02:47amalloyeg, perhaps you have a bunch of files open, and a watcher for each, keyed by the filename
02:47amalloywhen you close a file, you can remove its watch
02:48tomojthat does sound more fun
02:49tomojbut should we design our protocols to maximize fun?
02:49amalloyjust imagine the fun of having to add *another* ref to manage the state of the watchers on your first ref
02:49amalloyi can hardly wait
02:50tomojI see
02:50tomojI was thinking since you can implement one in terms of the other, the protocol should specify the easiest one to implement
02:50tomojbut it's not symmetrical
02:51tomojhmm
02:53tomojit does seem strange to put the choice of having another ref right in the protocol
02:55tomojI mean, I'd believe it makes the most sense for the refs in clojure and taking all the other factors I don't know about into account. but in general hiding *another* ref inside every ref seems strange
02:57tomojoh, of course it makes sense
02:57tomojatoms would be unusable otherwise
03:00tomojämalloy: thanks :)
03:42ivanI see https://github.com/strangeloop/clojurewest2013/tree/master/slides has something now
05:22muhoohuh, that's weird, an app just stopped working completely on lein 2.1.1 that worked fine on 2.0.0
05:23muhoolein cljsbuild hangs, lein trampoline repl hangs, just hangs. in production, of course. works fine on my dev system :-/
05:24muhooonly difference i can see is producion is java 6, my machine is java 7.
05:30ivanmuhoo: lein 2.1 changed the default :jvm-opts, could be something else though
06:39necronianHow do I set up nrepl to allow remote connections? If I do a lein repl and then try to connect to it from a remote machine I get ConnectException Connection refused: connect
06:45borkdudenecronian might be a firewall issue?
06:46necronianborkdude: That was my first thought, so I specifically set the machine to allow any incoming connection from anywhere and it didn't help
06:47borkdudenecronian are you connecting to the right port number?
06:47borkdudenecronian lein repl :connect <portnr>
06:48necronianIt says nrepl server started on port 48333 and I try to connect with lein repl :connect adserver:48333 on the remote machine
06:48borkdudenecronian no idea why it wouldn't work. try #leiningen also perhaps?
06:49necronianAh, thanks good idea. I'm sure it's something stupid but I have no idea what.
06:54ironmnecronian, did you check with "namp" listening ports on your server? Further you can trace with wireshark what is going on
06:54ironm"namp"
06:54ironmnmap
06:54ironmsorry
06:55necronianI can try to scan it with nmap, I've never used wireshark before
06:58ironmnecronian, if you run linux it should be easy (to use wireshark)
07:02pwnedit's even easier to run a tcpdump
07:07necronianironm: Well the port is clearly not open I have no idea why. It'll probably be easier for me to set up a ssh tunnel.
07:08ironmnecronian, have you tested locally on the server ?
07:08ironmin case you have an ssh access
07:09necronianironm: Yes I can connect fine locally, just have an issue remotely.
07:10ironmit looks like a "firewall" issue
07:14jcromartieI want a lib that lets me go into a namespace and records def.* calls into a corresponding file
07:14jcromartiedoes that exist?
07:14necronianironm: I know, but I can't see how, it's all on the same lan, iptables has no rules and I put ALL: ALL in host.allow
07:15pepijndevosTheory: There are more functional programmers than functional jobs.
07:15jcromartieso like, when I go into a namespace at the REPL, it replaces all of the def.* bindings with ones that rewrite the file
07:16jcromartiepepijndevos: corollary: functional programmers could fight to the death over functional jobs as a form of amusement
07:17pepijndevosjcromartie: amusement?
07:17jcromartiethat is: be made to fight, for the amusement of others
07:17jcromartiee.g. gladiators
07:17pepijndevosah
07:19jcromartiethis is a start
07:19jcromartie(defmacro scribe! [code] (spit "scribe-session.clj" (str (prn-str code) "\n") :append true))
07:19jcromartieat least I find it handy
07:27necronianironm: Thanks for the help, found the problem. Set the LEIN_REPL_HOST to the ip I wanted to bind to. Binds to localhost by default.
07:46eckrothhi, I'm trying to use a java constructor that is overloaded based on the 2nd param, but I need to pass nil to this second param; since nil apparently can't have a type, the wrong constructor is being called
07:46eckrothhow can I fix this?
07:48Bronsaeckroth: have you tried (let [^type x nil] (Ctor. foo x)) ?
07:49Bronsa(I don't know if this will work, worth a try though)
07:50eckrothBronsa: wow, nice job! I tried a similar thing that failed, because I didn't immediately call the Ctor
07:50eckrothBronsa: thanks!
07:51Bronsanp
07:56ironmnecronian, yes .. thank you. Such setting is often a source of "strange" issues
08:01eckrothIn case anyone is interested, I updated the machine learning library clj-ml (Weka wrapper for Clojure) to support string-to-word-vector filters (for text classification, etc.): https://clojars.org/cc.artifice/clj-ml
08:03tomojcool
08:06necronianironm: Yes, I don't think I can be held responsible for not finding it, I grepped the leiningen repo, there are 5 references to the variable none of them can be found by by reading the docs or through lein help.
08:06tomojI'm guessing :words-to-keep is the number of most frequent not-stoplisted words, and that is the dimension of the vectors?
08:07tomoj..number of words to keep, obviously
08:14ironmnecronian, could you document it somehow in the wiki (in case there is one) ? I guess a lot of newcomers will be very thankful for it (inluding me) ;)
08:17necronianironm: I'll try filing an issue for the documentation on the leiningen repo tonight
08:18eckrothtomoj: yes, sorry, was away; words to keep is number of final words in vector
08:19eckrothtomoj: I forget how weka does it but I presume it's the most frequent, or ones with highest tf-idf or whatever measure you choose
08:19tomojthanks, I found the original javadoc
08:19eckrothok
08:19tomojI never tried weka because their docs scared me away, thanks for clj-ml, maybe I'll try it
08:19eckrothtomoj: for what it's worth, I plan to further improve this library so I can fully use it :) stay tuned
08:19eckrothtomoj: ha, yeah, and the weka interface is even worse
08:20ironmnecronian, thanks a lot :)
08:20eckrothtomoj: I have a lecture about weka; you can check out this page for an example of using its interface: http://cse3521.artifice.cc/weka.html
08:21tomojhmm
08:21babilentomoj: clj-ml is still maintained?
08:21tomojI think that was part of what scared me away
08:21eckrothbabilen: I have a fork I'm improving, because I want to use it for a project
08:23eckrothbabilen: clj-ml may not fit the bill; I don't plan to reimplement any ML algs, but rather just utilize weka and whatever else
08:23babileneckroth: That is nice - I stumbled over clj-ml some time ago, but dismissed it because it did not look maintained at all. Great that you took over and might bring it back to life.
08:23eckrothbabilen: thanks, stay tuned
08:23eckrothgot to go
08:24tomojthe core.matrix protocols seem very large
08:24babileneckroth: Yeah, that's fine, I never meant that you should. It is just that I observe several things to take shape that would allow for the implementation of something that begins to feel like scipy/numpy/...
08:24tomojdo we really need all that?
08:25tomojI'd like for it to be the case that pretty much any matrix/vector operation can be implemented via application of a single simple protocol method :(
08:26babilentomoj: I haven't looked at it in some time, but the aim is to support a number of numeric libraries ... They also reported some impressive speed-ups recently. Let me find the mail.
08:27tomojspeedups relative to previous versions of core.matrix?
08:27tomojseems a bit presumptuous to put it in clojure.* :)
08:27babilenno, to something not using core.matrix -- but let me try to find it before I make things up on the spot :)
08:28tomojI was thinking the interface seems oriented around strictness
08:28babilenhttp://clojurefun.wordpress.com/2013/03/07/achieving-awesome-numerical-performance-in-clojure/
08:29tomojbut I guess there's no reason you couldn't make a crazy matrix type that doesn't perform operations strictly
08:29babilenBut yeah .. that person is definitely convinced that it is great.
08:30babilen+ https://gist.github.com/siscia/5172981
08:30tomojhmm
08:30tomojI think we should be able to get much closer to vectorz
08:30tomoj"mutable operation" ?!
08:33tomojI'd like to be able to compose a bunch of matrix operations in the style of clojure.core.reducers, and let the particular implementation how best to physically realize the entire composition
08:34tomojs/how/decide how/
08:37tomojthinking primarily of jcublas
08:37tomojwon't core.matrix's protocols be sort of problematic in that environment?
08:40babilentomoj: Maybe you want to raise that on their mailing list (numerical-clojure on google groups) - I can't really comment on that.
08:55tomojit looks like whether you can, for example, mset! on the return value of new-vector depends on the implementation used?
08:59tomojI guess that makes sense
09:45jcromartiehow can I get it to stop throwing an exception when I try to print my defrecord in the REPL
09:45jcromartiei.e. this print-method BS
09:45jcromartieI've set up a print-method for the type itself
09:46jcromartienever mind… stateful multimethod mell
09:46jcromartie*hell
09:56jcromartieinvitation to critique my first take on this event sourcing design: https://gist.github.com/jcromartie/5221441
09:57jcromartieit needs more examples, but the basic idea is that you use multimethods to define how events change your state, and then you can record and replay (in memory or when loading from disk) them on some initial state
09:59jcromartieand it doesn't let you write things that can't be read back… although in a rather brute force fashion for now
09:59jcromartiethis is for small numbers of writes, large numbers of reads
10:00borkdudecan the chunk size of lazy sequences be changed (for demo purposes)?
10:02borkdudecan the chunk size of lazy sequences be changed (for demo purposes)?
10:04pjstadigborkdude: as far as i understand the chunk size is a decision the data structure makes usually at the level of the java implementation, since it know the most efficient way to batch things
10:04pjstadigyou might be able to unchunk it and rechunk it at the clojure level
10:04borkdudepjstadig I just want to show that side effects only occur once per produced item in some demo coe
10:05pjstadigso you want a chunk size of 1?
10:05borkdudepjstadig yes
10:05pjstadigyou can create a lazy seq that is not chunked to demonstrate that using lazy-seq
10:05pjstadigor maybe use a list?
10:05borkdudepjstadig lists are not lazy
10:06pjstadigi think generally vectors are the thing that usually causes chunking
10:06pjstadigi mean map a side effecting functionacross a list
10:06pjstadigmap will only chunk if the seq it is mapping is chunked
10:07borkdudepjstadig I could just simplify the output in the demo, this is about lazyseqs which are always chunked I think?
10:07pjstadig,(first (map (partial println) [1 2 3 4 5]))
10:07clojurebot1\n2\n3\n4\n5\n
10:07pjstadig,(first (map (partial println) '(1 2 3 4 5)))
10:07clojurebot1\n
10:09borkdudepjstadig ah ehm, ok yes :)
10:09borkdudepjstadig so it depends on the input whether map will chunk its ouput
10:09pjstadigyeah
10:09pjstadig~source map
10:09borkdudepjstadig I had the example of map over (range)
10:10pjstadigyeah range is another one that creates a chunked seq
10:10borkdudeevery day I learn something new :)
10:10pjstadig~source range
10:11Ember-hi, I have a slight problem with enlive
10:11Ember-set-attr seems to encode my string no matter what I do
10:11Ember-that's not what I want since I have get parameters in it
10:11Ember-and & is transformed into &amp;
10:12Ember-I cannot find any options or anything to bypass this behavior
10:12Ember-enlive is great but it's documentation is *really* lacking
10:20Ember-so either everyone who would know answer to my question is sleeping or no one actually knows the answer
10:20Ember-damnit
10:23devnHm, is org-babel now basically dead due to nrepl?
10:23devnorg-babel-clojure*
10:23TimMcmuhoo: Oh, the reflection stuff! I'd basically forgotten about that.
10:24stuartsierradevn: I use org-babel with nREPL.
10:25TimMcmuhoo: Is it in a basically-usable state? If so, I should just push what's there and tweak it later.
10:30devnstuartsierra: you have your dotfiles out on github?
10:30devnstuartsierra: i found http://blog.jenkster.com/2013/02/org-babel-clojure-and-nrepl.html -- is that sufficient?
10:30stuartsierradevn: Yes: github.com/stuartsierra/dotfiles
10:30AnderkentAny help with debugging horrid compilation times? (3+ minutes to AOT compile a project)
10:30devnstuartsierra: cool, thanks.
10:30stuartsierranp
10:47jcidahoanyone using midje and getting junit output as to work with a CI server?
10:48jcidahoI've seen a google groups post a year old about it, and an issue on midje github been going a year or so
11:05Anderkentjcidaho: I was looking at junit output for clojure.test a while ago, but the writer was quite buggy. Pretty much gave up on that. Don't know about midje though, but they'd have to write it themselves
11:05Anderkentclojure.test.junit is pretty much useless
11:31jtoy_is anyone here using this library? https://github.com/dakrone/cld
11:32jtoy_if so, could someone test this line for me: (cld.core/detect "你好吗") when I run it freezes the repl
11:33jtoy_which seems like a crapp bug
11:35wastrel你好
11:35jtoy_??
11:35lazybotjtoy_: Definitely not.
11:35jtoy_lazybot: it works for you?
11:35wastrel?foo
11:35wastrel??foo
11:35wastrelmaybe it's a bot response
11:35wastrelis it abot?
11:35jtoy_ic
11:36wastrel??
11:36lazybotwastrel: What are you, crazy? Of course not!
11:36dakronejtoy_: yes, we use it
11:36wastrelheh
11:36dakronejtoy_: it may be that your REPL is freezing, not actually cld, can you try it in a file?
11:36jtoy_dakrone, yeah, I just ran the examples in your README, I tested it with any random chinese strings and it just freezes the repl
11:36wastreli just saw 你好吗 and thought i was in #mandarin for a sec
11:36jtoy_every time
11:37dakroneif I recall correctly, jline has issues with some UTF-8 stuff when used for the REPL
11:37dakronebut feel free to open an issue on cld
11:37jtoy_dakrone: ok, ill assume its the repl then for now
11:37jtoy_ill do some more testing first
11:41jtoy_this is my first time usine language-detect, but on short sentences its got some funny results: (cld.core/detect "hello")
11:41jtoy_["nl" {"nl" "0.5714277977843022", "fi" "0.42856886520061827"}]
11:42trptcolinjtoy_ / dakrone: right, non-BMP characters break jline, but those characters are looking fine to me in `lein repl`. so maybe they're in the BMP set?
11:42jtoy_(cld.core/detect "bye") => ["no" {"no" "0.9999913661473905"}]
11:42jtoy_trptcolin: im on lein1, not sure if its fixed in lein2
11:42dakronejtoy_: right, so cld uses statistical models for determining the languages, the shorter the text, the less likely it is to be correct
11:43trptcolinjtoy_: yup, that'll do it
11:43dakronejtoy_: I know lein1 has that issue, I used to run into it all the time
11:43dakronejtoy_: you'll need to pass more than a single word in to get a better answer
11:47jcromartieplease critique my new lib: https://github.com/jcromartie/deck
11:47jcromartieI am new at this. so I don't have a clojar or anything
11:52Raynesjcromartie: Looks kinda like https://github.com/flatland/cassette. But there aren't any docs yet so sorry. I'll probably write some today.
11:53jcromartieaw snap
11:53jcromartie:)
11:53jtoy_dakrone: do you know in what situation this error could occur: CompilerException java.lang.RuntimeException: com.cybozu.labs.langdetect.LangDetectException: no features in text, compiling I already remove all nil and empty strings
11:53jcromartiewell great minds think alike huh
11:53RaynesIt probably isn't quite the same though.
11:53dakronejtoy_: if the string were entirely numbers I *think* it might cause that also
11:54Raynesjcromartie: Cassette is essentially an implementation of Apache Kafka's file format in Clojure. It writes binary data to disk using gloss sequentially in a simple format and you can iterate through each entry and play it back. It's an append-only format.
11:54jtoy_ah, yes
11:54jcromartieyeah this is not so slick
11:55jcromartieit's literally a single append-only log file
11:55Raynesjcromartie: deck is?
11:55jcromartieyeah
11:55RaynesSo is cassette. :D
11:55jcromartieoh I see something about subdirs
11:56jcromartiebut I get it
11:56RaynesExcept it partitions log files after n bytes.
11:56Raynes(like kafka)
11:56jcromartieneat
11:56RaynesBy partition I mean it just starts a new file once the old file runs out of the space pre-allocated.
11:56jcromartiemaybe I can make mine not as dumb in the future :)
11:57RaynesWell, I wasn't saying yours is dumb or anything. I only gave it a cursory glance.
11:57jcromartieoh no, mine is dumb
11:57jcromartiebut for now it's tested stable and fast enough for many n in terms of concurrent writes and numbers of writes
11:57Rayneslol
11:57jcromartiemy use case is for fairly small datasets
11:58bttfwhat does 'foo actually return ?
11:58RaynesOur use case for cassette is "Let's save ALL the things!" so that we can play them back later if we want.
11:58bttfa symbol named foo ?
11:58jcromartielike an administrative type web app, where you're just configuring a few things
11:58Raynesbttf: Yes.
11:58bttfij
11:58bttfok*
11:58RaynesDarn keyboards.
12:01mpenetmapdb is also nice for simple persistance
12:01mpenetit's just maps (more or less) from clojure
12:02jcromartieI like that but I have problems keeping the data model consistent
12:02jcromartiethe idea behind my scheme is to only store inputs
12:02jcromartie(hello OOTTP)
12:03jcromartieso I can change the way the inputs build up the in-memory "current" data model
12:03devnDoes anyone know the rationale behind choosing SSE over BrowserChannel?
12:03devn(in Pedestal)
12:17pbostromdevn: I was wondering something similar, but s/BrowserChannel/Webockets/
12:18ppppaulis it easy for me to integrate a pedestal service with angularjs?
12:18technomancywebsockets are a lot harder to support in servers, proxies, routers, etc
12:28pbostromtechnomancy: interesting, do you think that's a result of lack of adoption in the industry or technical limitations of websockets spec?
12:30tbaldridgedevn: Mostly it was because it was low hanging fruit. Two co-workers and I implemented SSE in about 6 hours. Websockets would have taken longer.
12:30tbaldridgeWebsockets also allow for duplex communication, something that hasn't been added to pedestal yet.
12:31tbaldridgeThat being said feel free to submit a patch :-)
12:31technomancypbostrom: SSE is just strictly easier technically
12:31technomancylots of HTTP infrastructure assumes half-duplex
12:32technomancywebsockets gets more buzz and is more flexible, but most people who say they want it would be happy with SSE
12:33devntbaldridge: Gotcha. :)
12:34pbostromI also wonder if an SSE implementation can handle more clients than websockets
12:35jtoy_can somone show me an exampe that uses map and inc together, Im trying to do (map #( stuff ) ["foo","bar"]) => ["1foo" "2bar" ]
12:36tbaldridgejtoy_: I often use this (map #(str %1 %2) (range) ["foo" "bar"])
12:37llasram&(doc map-indexed)
12:37lazybot⇒ "([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."
12:37jtoy_tbaldridge: ah, range works too
12:37tbaldridgethere's also maped index
12:37tbaldridge*mapped-index
12:37jtoy_how does mapped-index implement it? with an atom?
12:37tbaldridgehttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L5618
12:38tbaldridgebleh
12:38tbaldridgethat's the link: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L5618
12:38tbaldridgeit's not pretty, because it has to deal with chunked seqs
12:39jcrossley3tbaldridge: why io.pedestal.service.log instead of clojure.tools.logging?
12:40jtoy_i ddint know you could pass multiple collections like that to map, nice
12:41devntbaldridge: I'm trying out the chat application and am getting some exceptions. Are there some known issues?
12:42tbaldridgedevn: not to my knowledge, it's been about a week or so since I personally have run the app though.
12:42tbaldridgewhat's the error?
12:42ppppaulany benchmarks comparing pedestal to ring?
12:42tbaldridgeppppaul: pedestal uses ring....so....
12:42devntbaldridge: https://gist.github.com/devn/5222833
12:43ppppauloh
12:44tbaldridgeppppaul: there were some design things that we decided to change in ring, those have then been back ported into mainline ring. So pedestal is now built right on top of ring
12:44ppppaulhmmm
12:44ppppaulwhen was this done?
12:45ppppauli'm always looking at the ring docs, haven't seen anything related to pedestal
12:45tbaldridgehttps://github.com/ring-clojure/ring/commit/a8d5aa69b1153af7491bbbf4b70042f7c8c407be
12:45ppppaulwoah, that's a huge commit
12:46tbaldridgeSo for our pedestal we needed support for stopping/resuming ring middleware. So the interceptors library was born, from there we refactored all the default middleware. So the fact that you never noticed was by design. We wanted to work with ring, but get the "extra features" that we needed.
12:46ppppaulpretty cool.
12:47gfredericksis "ring" supposed to refer to the interceptors style now then?
12:47ppppauli'm going to read through the whole commit
12:47devninterceptors are bigger than basic ring handlers
12:47tbaldridgedevn: I've contacted a co-worker about that issue. I'm not sure what the answer is, perhaps email the pedestal google group?
12:47weavejestergfredericks: No, the standard middleware was just split into two parts to aid async usage.
12:48gfredericksweavejester: are there two SPECs now?
12:48weavejestergfredericks: Essentially as well as wrap-foo, you also get foo-request and foo-response
12:48devntbaldridge: it's not a big issue for me, but i figure i'd ask someone who might now
12:48weavejestergfredericks: No, the SPEC hasn't changed.
12:48devnknow*
12:48gfredericksweavejester: and wrap-foo can be derived from the other two
12:48tieTYTi was developing yesterday and I have this issue where I have a function and I want to run map on it, but I'm not sure if I'm running on a collection or a collection of collections. I really want the former. How can I be sure I'm passing in the correct argument?
12:49weavejestergfredericks: Correct. Ring 1.2.0 exposes some new functions, but the existing middleware acts the same way.
12:49tieTYTi'm coming from haskell and this is very easy. You just write a type signature that takes a list instead of a list of lists
12:49gfrederickstieTYT: check what sort of argument it is? knowing what kind of thing a thing is is sort of separate from passing it to map
12:49tieTYTgfredericks: how do you do that?
12:50gfrederickstieTYT: if you have the thing at the repl you can just look at it
12:50tieTYTright, how?
12:50tieTYTi've got enlive output
12:50weavejestertieTYT: If you want to check, you can use a pre-condition, or if you're particularly bleeding-edge, there is a typed Clojure library.
12:50gfrederickstype the name for the thing and it'll get printed out?
12:50tieTYTand it's so freaking huge I can't really tell what it is by printing it out
12:50gfredericksah
12:50gfredericksthere's a type function
12:51gfredericksso you can (type my-thing) and (type (first my-thing)) to get some idea
12:51tbaldridgedevn: I just heard back, it's a confirmed bug.
12:51ppppauldoes the interceptor ring commit make clojure channels redundant?
12:51tieTYTgfredericks: ah ok great, thanks
12:51tieTYTweavejester: what's that library called?
12:51weavejesterppppaul: Clojure channels?
12:51weavejestertieTYT: https://github.com/clojure/core.typed
12:51weavejestertieTYT: It's rather new, however.
12:52ppppaulthen channels library (starts with an A... it recently got removed from clojure werkz)
12:52ppppaulhttps://github.com/ztellman/aleph
12:52tieTYTweavejester: I see, thanks
12:53weavejesterppppaul: Personally, I prefer Alephs use of channels over interceptors.
12:53weavejesterThey're a better abstraction for websockets.
12:53gfredericksso the interceptors approach would primarily require new adaptors -- is that correct?
12:53weavejestergfredericks: Well, they wouldn't be Ring adapters per se, but yes, it would require some integration with a HTTP server. It wouldn't happen automatically.
12:54ohpauleeztieTYT: I haven't scrolled back up to see the full conversation, but you might look at using protocols too
12:54ohpauleezwhich dispatch on type
12:54gfredericksand that doesn't exist yet?
12:54tieTYTohpauleez: well I want to reject a certain type of input instead of handle them both
12:54weavejestergfredericks: I assume it does, if Pedistal is being used
12:55gfredericksweavejester: okay, so it's integrated with pedistal
12:55gfredericksor built into rather
12:56gfredericksI'm just trying to get a sense for where the clojure webstack generally is headed
12:56weavejestergfredericks: Yes, I believe they have something which is loosely equivalent to an adapter, but supports interceptors
12:56ppppaulhttps://github.com/ring-clojure/ring/commit/a8d5aa69b1153af7491bbbf4b70042f7c8c407be i'm looking at this and i'm failing to see the introduction of interceptors
12:56ppppaulthough, i am only half way through the commit
12:58tbaldridgeppppaul: So here's the issue. In ring (before that commit) the request and response of parts of the middleware were combined into a single function. For async work they need to be separate.
12:58weavejestergfredericks: I should note that I'm a little skeptical of interceptors. :)
12:58weavejesterAnd of HTTP async in general.
12:58ppppauli see those changes
12:58ppppauli didn't realize that was all that was needed to be done
12:58weavejesterHTTP async seems to me to be essentially a hack to get around a lack of websockets
12:59ppppaulso, i guess interceptors make use of those functions separately, while regular ring middleware uses them in the same place/time/thread
12:59weavejesterppppaul: Right
12:59powr-tocweavejester: is there a video up of the pedestal talk at clojure/west yet? I'm yet to decide on interceptors, but they seem pretty complicated... and don't feel very functional
12:59tbaldridgeThe interceptor library (in pedestal) then uses these functions in a different way. Looks at a vector of fns and executes them in order, or pauses at certain point.
12:59tbaldridgeppppaul: bingo.
13:00ppppaulinteresting
13:00weavejestertbaldridge: Do you think there will be any reason to support async HTTP when websocket support becomes universal?
13:00tomojwhat is "async http"?
13:01ppppaultbaldridge, you guys tested the use of interceptors via simulant?
13:01weavejestertomoj: Anything that involves deliberately delaying a HTTP response I guess.
13:02devntbaldridge: another thing you might want to fix in the chat client:
13:02devn<IMG style="width:300px; height: 300px" SRC=# onmouseover="document.location='https://www.youtube.com/watch?v=dQw4w9WgXcQ&amp;noredirect=1'">
13:02tbaldridgeweavejester: I'm not sure. Personally I like async when I have to run of to a DB to do work, or perhaps make calls to other servers. I've done pure TCP work before, and it's a bit of a headache.
13:02devn;)
13:02tomojisn't async still sometimes valuable when you have many concurrent requests which don't hang open?
13:02devni know it's just a sample, but i set one up and of course the first thing Brad does is try to inject
13:03devns/one/an instance of the chat app/
13:03tbaldridge(disclaimer) I work for relevance, but nothing I say here should be taken as the gospel
13:03weavejestertbaldridge: That's an interesting point. I guess you can improve performance of the web server by not blocking.
13:04ppppaulis pedestal.io running off of pedestal?
13:04ppppaulwondering... cus it's buggy as fuck
13:04technomancyasync stack traces =(
13:05devnppppaul: why do you say that?
13:05ppppaulbut, it's not communicating with the back end, so i think there is some weirdness going on with the dom or JS
13:05ppppauldevn, i can't scroll properly on the site, and the buttons on the site break
13:05technomancysomeone found a way to take clojure stack traces and make them worse
13:05devntechnomancy: haha
13:05technomancydevn: they said it couldn't be done
13:05devnwell, not funny actually
13:05devnsort of depressing
13:06ppppaultechnomancy, need a smart logger
13:06tdignanppppaul: well, what browser are you using
13:06llasramtechnomancy: I really thought the stackholm syndrome would have set in for you by now
13:06tomojit would be nice if you could swap async for sync and get the exact same semantics
13:06tbaldridgetechnomancy: that was Guido's argument against tail calls in Python as well "horrible stack traces"
13:06ppppaulusing Version 25.0.1364.160 Ubuntu 12.10 (25.0.1364.160-0ubuntu0.12.10.1) *chrome*
13:06tomojmaybe. is that impossible and/or point-defeating?
13:06technomancyllasram: nope; I'm just filled with guilt over ignoring clj-stacktrace
13:07devnppppaul: I'm on Version 25.0.1364.172
13:07tomojif you could do that you could replay your bugs in a sync environment for easier debugging?
13:07tdignanppppaul: do you have any chrome add ons?
13:07devnOSX -- and no issues
13:07technomancytbaldridge: I'm not saying it's never worth the pain; just pointing out that you should make sure it's worth the trade-off because it's a big one.
13:07tdignanI'm using chrome on linux mint, no issues.
13:07technomancy(but guido was just using that as an excuse)
13:07tbaldridgereal men debug with println :-P
13:08tbaldridge(just kidding)
13:08ppppaultdignan, the site works a little better in firefox
13:08devnspeaking of debugging... ritz...
13:08devnwhat's up with ritz, yo?
13:08tdignando you have javascript enabled and everything
13:09devnanyone in here use ritz?
13:09ppppauli have extensions and JS enabled. i don't see anything coming up in the console.
13:09ppppauli don't see any network requests
13:10ppppaulmy extensions don't effect other sites
13:10devnppppaul: if you have user scripts or other user installed extensions try disabling them and see what happens
13:10ppppaulcept for flashblock, which usually improves performance
13:10devnoh, the pedestal.io site is completely written in flash
13:10devn(jk)
13:12tieTYTis there any plans to make declare unnecessary in the language?
13:12`fogustieTYT: I doubt it.
13:13tieTYToh
13:13llasramtieTYT: Note that `declare` is something you find very rarely in most Clojure code
13:13nDuffMulti-pass compilation would be a pretty big change.
13:13nDuff...would mean things wouldn't behave the same way in and out of the REPL.
13:14llasramMulti-form, really
13:14tieTYTllasram: is that because people have written their code to adjust to that?
13:14technomancythe talk on racket at clojurewest made me really appreciate that clojure got its compilation model right
13:14nDufftieTYT: People usually write their code to declare things in dependency order, yes.
13:14technomancyso much nonsense you just don't have to think about =)
13:14tieTYTpersonally, I like to start at the high level and break it down
13:14nDufftieTYT: If you don't do that, you can't run the same code in a REPL, and that's silly.
13:14tbaldridge(inc techomancy)
13:14lazybot⇒ 1
13:14nDuff(well, can't run it in a REPL starting from a blank namespace)
13:15ppppaultbaldridge, can you help me understand how pedestal scales?
13:15`fogustieTYT: Does "high-level" need to mean "top of file"?
13:16tieTYTno, it's just the way I write my code. I code outside in because if I code inside out, I often create code I realize I don't need to use
13:16tbaldridgeppppaul: I could try, but you'll probably get a better answer off the google group list. I have more experience with the Pedestal App code.
13:16tieTYTI don't think clojure gets in the way with that, I'm just used to languages that let me put the code in any order I want so I'll have to adjust
13:17`fogustieTYT: Me too. :-)
13:17tieTYT`fogus: so do you start at the bottom and add upwards?
13:17tieTYTadd code upwards, I mean
13:18`fogustieTYT: I don't know. It depends on the problem. I usually start with INDATA -> OUTDATA and work inward from there
13:19tieTYTi see
13:20`fogusI work in Emacs, so top or bottom doesn't matter. What matters is when I hit C-e
13:20tieTYTwhat does that do?
13:20tieTYTi've never used emacs
13:20`foguseval form
13:21`fogusI meant C-xC-e :p
13:22tieTYTi think i'm missing a step. Are you rearranging the code after you do that?
13:22tieTYTafter=before
13:23`fogustieTYT: No.
13:23tieTYTthen you're naturally writing your code in a way that avoids declare or you use declare?
13:24`fogustieTYT: You're conflating where the text lies in the file with when it needs to be written
13:24`fogusI write the functions when I need them and lay them where the compiler likes them
13:25tieTYTok
13:25`fogusMoving up or down is the same number of keystrokes... no productivity lost
13:26tomojuntil next repl session :)
13:27`fogustomoj: Isn't that a problem in every Lisp?
13:28`fogusAny time you run in a REPL you run the risk that what's in memory is not the same as in text.
13:28`fogusThat was a problem that Smalltalk didn't have... ;-)
13:29technomancywe call that "getting slimed"
13:29`fogustechnomancy: I like that
13:41pjstadigbut we'll have to change it
13:41pjstadigto getting nrepl'ed?
13:41pjstadigdoesn't have the same ring
13:41technomancylet it live on as a piece of history
13:41pjstadighehe
13:42pjstadiglike car and cdr
13:42kanweianyone here using Pedestal?
13:43tbaldridgepjstadig: it's funny to here the miniKanren people "so if we simple cooder down the list..."
13:43tbaldridgewwaaatt? oh....cdr-down the list...I see....
13:43tbaldridge<-- no scheme background
13:45TimMccdadadddddaaaar
13:45TimMcbetter than juxt
13:45pjstadigtbaldridge: it's a lisp problem too
13:46tbaldridgeskeuomorphs ftw
13:47amalloyTimMc: if i am ever trapped in a lisp factory, i will find a reason to write "help i'm trapped in a lisp factory", converted to ascii and encoded with a=0,d=1 into a giant cadr function and hope that someone finds my message in a bottle
13:50pjstadigamalloy: don't worry...i got your back
13:53antoineBhello, i would like to change how a defrecord are printed to sreen, which prototype should i change?
13:53gfredericksis that possible?
13:53technomancyprint-method
13:54jcromartie:) just did it this morning antoineB
13:54davidchambersI've spotted a typo at http://clojure.org/sequences, which doesn't appear to be part of the gh-pages branch of clojure/clojure. Is this wiki publicly writable?
13:54antoineBis it a multi method?
13:54jcromartiejust (defmethod print-method YourType [obj ^java.io.Writer writer] ...)
13:54jcromartiethen (.write writer ...)
13:54antoineBok thanks
13:55tieTYTif I have a situation where a multimethod might work, should I attempt to use a protocol instead?
13:56technomancytieTYT: no
13:56antoineBi will suspect prototype are a little bit faster
13:56tbaldridgetieTYT: I suggest use protocols if you will always dispatch on the object type, or you need speed
13:57tieTYTcan multimethods dispatch on the object value?
13:57tbaldridgeyes
13:57tieTYToh ok
13:57tieTYTi need to find some better tutorials on it
13:57tbaldridgemultimethods take a dispatch function, the output of that function is what it dispatches on
13:57tbaldridge(defmulti foo (fn [x] (:bar x)))
13:57technomancymultimethods have a lot fewer confusing edge cases around reloading and AOT
13:57technomancy>_<
13:58antoineBtieTYT: multi dispatch on everything you want about the arguments you pass in
13:58tbaldridgetechnomancy: really? because if you reload you can't redef the dispatch fn of multimethods
13:58tbaldridgeor has that changed?
13:58technomancytbaldridge: right; there is one confusing edge case. which is a lot less than the number of confusing edge cases surrounding protocols.
13:59technomancyit's still stupid, but not as stupid.
13:59technomancyerr--not as annoying
13:59tbaldridgewhat are the edge cases for protocols? I can't think of any I've hit.
14:00technomancyif you AOT code that uses a protocol and the protocol's .class files go away, it can't fall back to JIT
14:00technomancyif you reload a defrecord it breaks equality; you can have two visually indistinguishable objects that are not equal.
14:00tbaldridgeah, that's it then. I never AOT code, so that's why I haven't hit it
14:00tbaldridgeinteresting, I'll keep that in mind, thanks.
14:00technomancythere are more, but I've literally never used protocols; that's just what I've got by osmosis hanging out in IRC.
14:01technomancyI'd be tempted to fix the defmulti reloading bug if it weren't for jira
14:02antoineBdid you ever need to reloading ?
14:02`fogustechnomancy: If you fix it I'll deal with Jira. ;-)
14:02BronsaI was just going to propose that too.
14:03technomancy`fogus: I'll add it to the seajure project list then =)
14:03`fogusBut I'll happily defer to Bronsa. ;-)
14:03`fogus:p
14:03`fogustechnomancy: Where is that list?
14:04technomancy`fogus: https://github.com/Seajure/seajure/wiki
14:04technomancyI really want to do print-method for namespaces
14:05`fogusOh! I've never thought of that. That would be fun
14:05cap10morganah ha! lein new midje foo-bar is creating the namespace foo_bar.core instead of foo-bar.core. gonna pull request that.
14:05technomancyseems like a silly omission
14:10ToBeReplacedantoineB: i'm curious in the solution... was the answer just (defmethod print-method ClassName [r writer] (.write writer "my string function")) ?
14:12antoineByes
14:15antoineBthe question we can ask is why using a defmethod over a protocol for print-method? (i think it is a protocol for cljs)
14:17technomancyantoineB: print-method is IO-bound by definition; dispatch overhead is not an issue
14:17technomancyalso protocols didn't exist back then, but whatever
14:18sundbpi'm trying to use gen-class with :impl-ns to have the implementation in another namespace and avoid AOT
14:18antoineBok
14:19sundbpi'm strugglign and getting these kinds of errors: com.tulos.lo.examples.ExampleCljAddIn> (com.tulos.lo.examples.ExampleCljAddIn.)
14:19sundbpCompilerException java.lang.ClassFormatError: Duplicate method name&signature in class file com/tulos/lo/examples/Exam\
14:19sundbppleCljAddIn, compiling:(NO_SOURCE_PATH:1:24)
14:20sundbpthat namespace has a :gen-class statement in the (ns ..) part. and uses :impl-ns 'tulos.addin
14:21sundbpin tulos-addin are all the functions to implement the gen-class. in the gen-class namespace there's no content apart from the (ns ..) form
14:21sundbpdoes that sound like the right starting point?
14:28jtoy_does map-index not happen in order? it seems like after having 10 items, 10 appears first, is there a way to force the order?
14:29ToBeReplacedwhat is map-index?
14:30mpenetit does happen in order, it would be a bit useless it that was not the case
14:30jtoy_i see what happens, nm
14:30jtoy_yes, exactly
14:30AimHereToBeReplaced, there's a function map-index that assigns a numeric value as the first argument of the function you're mapping over
14:31AimHeremap-indexed, rather. Presumably map-index is the index
14:31AimHere&(map-indexed (fn [idx _] idx) [:a :b :c :d])
14:31lazybot⇒ (0 1 2 3)
14:32ppppaul&(map-indexed (fn [& _] (reverse _) [:a :b :c :d])
14:32lazybotjava.lang.RuntimeException: EOF while reading, starting at line 1
14:33ppppaul&(map-indexed (fn [& _] (reverse _)) [:a :b :c :d])
14:33lazybot⇒ ((:a 0) (:b 1) (:c 2) (:d 3))
14:37devnDoes Michael Klishin hang out in here ever?
14:40amalloydevn: you mean antares? yes
14:43uvtcHow can I iterate over a vector, not only getting its item but also its index? (I think I'm looking for the side-effectey version of map-indexed...) I think I Python it's called `enumerate`.
14:44tbaldridgeuvtc: fastest way to process vectors is reducers
14:44tbaldridgeuvtc: unless you use loops, using nth+map won't get you much
14:44ToBeReplaced,(map-indexed #(vector %1 %2) [:a :b :c]
14:44clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
14:44gfredericksat worst (doseq [[i x] (map list (range) xs)] ...do stuff...))
14:44ToBeReplaced ,(map-indexed #(vector %1 %2) [:a :b :c])
14:44clojurebot([0 :a] [1 :b] [2 :c])
14:45uvtcToBeReplaced: Ah, yes. I think that's what I want. Then I can put that in my `doseq [...]`.
14:46uvtctbaldridge: thanks. Though, haven't studied reducers yet. Would use a loop, but I think what ToBeReplaced suggested is what I was looking for.
14:46gfredericksuvtc: ToBeReplaced or (map-indexed vector [:a :b :c]) is shorter
14:46ToBeReplacedgredericks is better... map list (range) xs
14:46tbaldridgeuvtc: reducers also have the nice side-effect of being parallel (using multiple CPUs)
14:46ToBeReplaced,(map-indexed vector [:a :b :c])
14:46clojurebot([0 :a] [1 :b] [2 :c])
14:47Raynescemerick: Asciidoc is excellent.
14:47cemerickRaynes: for sure
14:47uvtcgfredericks: thanks.
14:47cemerickor, it sucks, but it's maximally capable
14:47gfredericksuvtc: yerp
14:49amalloygfredericks: i hear your swearjure talk was well received
14:50borkdudeare there any talks online yet from clojurewest?
14:50amalloyborkdude: if the talks went online the next day, i bet attendance would drop quite a bit
14:51uvtcThe PyCon ones went up *quick* (though not next-day).
14:51technomancypycon has way more $$$
14:56gfredericksamalloy: yeah it went better than I was expecting
14:56gfredericksthankfully rich gave me a great opening line
14:56tbaldridgegfredericks: that was an awesome talk
14:57gfrederickstbaldridge: thx
14:57amalloygfredericks: not having heard this line, i'm now imagining rich introducing swearjure as "A #$*&ing joke of a language"
14:58jtoy_if i have a lazyseq and turn it into a set, the order seems to get list, is there a way i can force the order?
14:58gfredericksamalloy: he spent half his keynote harping on self-imposed constraints
14:58rabbit_airstrikegfredericks: that was a hilarious talk.
14:58gfredericksjtoy_: sets don't have order
14:58ToBeReplacedif it's ordered, it's not a set... if you just want to strip duplicates, try distinct
14:59amalloyToBeReplaced: not strictly true. if it's ordered it's not a hashset, but you can certainly design sets which are ordered
14:59jtoy_hos is this able top keep an order: (def features (set (list (feature "gender" 0 :categorical) (feature "age" 1 :categorical))))
14:59rabbit_airstrikesorted-set
14:59amalloyjtoy_: coincidental implementation details
14:59jtoy_i tested it with many items, it always keeps the order of which the items were added
15:00jtoy_i want to do the same thing as that but programitically generate the data
15:00amalloyhash sets are not ordered, and any sets which appear to be ordered are just luck
15:00amalloy(not actually luck, but you should pretend it's luck, since it's not any kind of guarantee)
15:00ToBeReplacedamalloy: what's an example for me to google?
15:00jtoy_hmm, i wouldnt be surprised if the library has a bug
15:01amalloy&(apply sorted-set (range 40))
15:01lazybot⇒ #{0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39}
15:01amalloy$google flatland ordered set
15:01lazybot[flatland/ordered · GitHub] https://github.com/flatland/ordered
15:01amalloyare two reasonable ways to have sets which give ordering guarantees
15:01jtoy_ok, ill just use sorted set
15:01amalloyjtoy_: we'll still be here, when you discover that's not what you want
15:01jtoy_i think the library is implemented not very well, i need to give it data like that
15:02jtoy_amalloy: haha, ok
15:03ToBeReplacedhm... i've never had a use before... when do you end up using something like that?
15:03gfrederickswhen writing legacy code
15:04jtoy_amalloy: hmm, that makes it work, yeah! the required format doesnt make sense
15:06jtoy_why would one use the flatland stuff vs the the core ones? for clojurescript?
15:06gfredericksI think flatland's are insertion-order
15:06gfrederickswhereas clojure are value-order
15:08gfredericks&(apply sorted-set-by #(rem % 3) (range 40))
15:08lazybotclojure.lang.ArityException: Wrong number of args (2) passed to: sandbox9396$eval46487$fn
15:09jtoy_amalloy: yeah, you are right, that is not what I want
15:09amalloy(inc amalloy) :(
15:10jtoy_i want the insertion-order sets, without adding more libraries :(
15:10amalloygfredericks: sorted-set-by takes a comparator, unlike sort-by which takes a keyfn
15:11gfredericksyeah
15:11gfredericksI didn't care enough to redo it
15:11amalloyjtoy_: easy. remove the terrible library you're already using, if it really requires sets in a particular order (which, by the way, i very much doubt); that frees up room to add flatland/ordered
15:13jtoy_amalloy: this is code from the library and i did tryy with other 'orderings' but they dont work: (def features (set (list (feature "gender" 0 :categorical) (feature "age" 1 :categorical))))
15:14thm_proverI have a bunch of jars, like http://hpaste.org/84505 ... I want to use them all from Clojure. Is there a nice way to automate mvn-install them without having to manually mvn-install each one of them?
15:14thm_prover[especialy since the file names seems to be encoded in a way that encodes all information]
15:18sundbpusing gen-class this is the generated class when decompiling it - looks broken: http://i.imgur.com/df9RkuM.png http://i.imgur.com/vQYrBUl.png http://i.imgur.com/0xyMUfe.png
15:19sundbpi get the correct Var, but then another one referring some some odd functino. then a double definition of thewrapper, one for each Var. hence the error message..
15:23devnwhat do people use for socket libraries?
15:23zackzackzackIs there a way to get more information about why a call is forcing the JVM to do reflection?
15:23devnI want to grab a websocket stream over 443
15:24zackzackzackI've set *warn-on-reflection* to be true and tried everything I can think of to type hint in a macro correctly, but to no avail
15:24amalloydevn: aleph has a good websocket server, if you're comfortable with aleph and lamina
15:24pbostrom2nd aleph
15:25ppppaulwhat is lamina for?
15:25ppppaulamalloy,
15:25TimMctechnomancy: I installed Debian Squeeze. It's so beautiful I could cry...
15:25TimMcA thousand papercuts, suddenly removed.
15:26gfredericksbeautiful compared to what?
15:26TimMcLatest Ubuntu.
15:26pbostromppppaul: lamina provides a "channels" abstraction around the websocket interface
15:27amalloywell, around a lot more than websockets
15:27TimMcgfredericks: beautiful == usable
15:28ppppauloh. cool.
15:32sundbpworked it out. note to others: when using gen-class, don't explicitly list the interface methods you implement!
15:33arrdemTimMc: welcome to the Ubuntu expats club XP
15:39devnaww, wish ztellman was around
15:40amalloydevn: he's very responsive on the lamina/aleph/gloss MLs
15:41devnamalloy: cool, thanks -- looks like 0.5.0-SNAPSHOT (channel) is broken
15:41devnor the docs are out of date...
15:42amalloyi don't really believe that; i've been riding the latest snapshot for ages, and just updated and re-ran my app an hour ago
15:42devnhm, weird
15:42amalloyof course, X is broken is un-fixable
15:42devnamalloy: 0.5.0-SNAPSHOT?
15:42devnamalloy: i got a wrong number of arguments when I use (channel)
15:43devnamalloy: ArityException Wrong number of args (1) passed to: node$eval4985$queue clojure.lang.AFn.throwArity (AFn.java:437)
15:43amalloylol. yep, looks like. i guess i just don't create empty channels myself
15:44devnamalloy: it fails with args as well i think
15:44devnlike (channel 1 2 3)
15:44amalloydevn: bet you a dollar it's fixed within 10 minutes
15:44devnhaha yeah, i bet you're right, i saw he committed like an hour ago
15:50tbaldridgetechnomancy: can you point me to some resource that'll help with publishing .so/.dynlib files to clojars? There's native-deps, but that looks a little old.
15:56jtoy_amalloy: could you help me to fix this set issue? https://www.refheap.com/paste/12838 im really close
15:57jtoy_its returned in a list? that is not a set?
15:57ohpauleeztbaldridge: To my knowledge, there isn't a good solution. I package them in a separate dir and add them to my resources path. The JVM seems to pick them up there fine
15:58tbaldridgeohpauleez: yeah, in this case I'm trying to package specific .so for my lib. So users can simply add the clojars reference, and depending on the platform they get the right dlls.
15:59tbaldridgeOr is that just crazy talk? Does the whole Java package system break down for native libs?
15:59ztellmandevn: sorry about the issue with (channel), it was in the toString method, which is only used in the repl and didn't have an associated test
15:59ohpauleeztbaldridge: Nah, that's definitely reasonable. clojure-leap does this with Windows and OSX binaries.
16:00ohpauleezbut the Java code does a conditionally lookup and load on launch
16:00ohpauleezand since they're all in the resource path, all works out ok
16:00tbaldridgeah, so do you simply include all libs in a single package?
16:00ohpauleezbut I don't know if that's a good solution
16:00ztellmandevn: a fix is pushed to clojars/github
16:01ohpauleezyeah
16:01ohpauleezyou get the kitchen sink :)
16:01ohpauleezbut you get portability
16:01Raynesamalloy: ^ Just a bit over 10 minutes.
16:01tbaldridgeyeah. Well that could work. I'll look into it. Thanks.
16:01ohpauleeznp
16:02ztellmanRaynes: I was away from my computer when amalloy told me
16:04Raynescemerick: CompilerException java.lang.RuntimeException: Unable to resolve symbol: original-ns in this context, compiling:(NO_SOURCE_PATH:1:12355) WHAT DOES IT ALL MEAN
16:04cemerickRaynes: what is that from?
16:05Raynescemerick: This was the result of running (start-server :port port) in a project and then connecting with `lein :connect 4008`. It connected, spewed that exception, and now I'm in reply.eval-modes.nrepl=>
16:05RaynesIncompatible versions of reply and nrepl, perhaps?
16:06ohpauleezRaynes: You've got to calibrate the qubits, before nREPL stabilizes.
16:07Raynescemerick: I can require my namespaces and stuff, so it at least is kind of working.
16:07RaynesIt's nrepl 0.2.2 and lein 2.1.1
16:07cemerickRaynes: whew. Sounds like a reply bug.
16:08Raynestrptcolin: ^
16:08Raynesbitchbitchwhine
16:08Raynes(it isn't so broken that it is unusable though, so what evs)
16:08cemerickRaynes: that doesn't happen with a regular `lein repl` with the same deps though?
16:09RaynesNo.
16:09RaynesWell, I didn't actually try.
16:09cemerickright
16:09cemerickwell, at least you said it with conviction
16:09cemerickthe profile stuff around e.g. :connect is a bit wonky IIRC
16:09RaynesI'm a very insincere person.
16:09RaynesYeah, lein repl works fine
16:11cemerickoh, you're starting the server manually, so the profile stuff isn't relevant
16:14devnztellman: Thanks! (amalloy I owe you a dollar)
16:14ztellmandevn: if you have any other questions, let me know
16:14jtoy_amalloy: completely fixed it,thx forthe help
16:14trptcolinRaynes: yeah, this is basically a symptom of reply trying to do init code where it shouldn't. completion is probably going to be broken too.
16:15Raynestrptcolin: Completion works.
16:15jtoy_does clojure have a respond to?
16:15devnztellman: I'm trying to do something quick and dirty: I want to connect to a websocket server as outlined here: https://en.bitcoin.it/wiki/MtGox/API/Streaming
16:15trptcolinRaynes: ah, cool. i see, was grepping and mistook a local for a var
16:15Raynesdevn: Stop stealing my bitcoins.
16:16devnhahaha
16:16devnThis random dude is visiting our office today and he does automated trading stuff. They're trading at 70$ today. He was trying to debug some python script so I told him I'd rewrite what he has for a bitcoin.
16:16ztellman(lamina.core/receive-all @(aleph.http/websocket-client {:url "http…"}) prn)
16:16devnMission accomplished.
16:16ztellmanor something like that
16:17trptcolinRaynes: GH ticket me?
16:17ztellmanI'm not 100% sure the websocket client and https play nicely together
16:17ztellmanbut that's an easy fix, if you have an issue with that
16:17Raynestrptcolin: Sure.
16:17trptcolincool, thanks - got some jline non-BMP character debugging i'm in the middle of
16:17Raynestrptcolin: Have no clue what the problem is so I'm just going to slap the keyboard for the title.
16:18trptcolinjust stick the error msg in there, that's good enough
16:25ztellmandevn: if you're having issues with the SSL certs, add ':ignore-ssl-certs? true' to the websocket-client option map
16:27technomancyTimMc: pure and uncut
16:28ztellmanor just use the non-https endpoint, which I just noticed, and seems to work just fine
16:28technomancytbaldridge: no docs unfortunately; all I can point to is the implementation.
16:28technomancyevery time someone asks my reply is "it would be great if someone would contribute some docs" since I've never actually used native deps.
16:28Raynescemerick: The server example in the nrepl readme should apparently use :bind "localhost", because an nrepl server listening on anything other than localhost is 'bad practice'.
16:29cemerickRaynes: depends on your env though, right?
16:29technomancytbaldridge: all native bits in one jar is simplest; separate jars would reduce download time at the expense of more hassle for the user. recommend the former unless it's huge.
16:30technomancylein can DTRT but if you need it to run as an uberjar you've got to do all the heavy lifting yourself
16:31Raynescemerick: Ask amalloy, he is the one who is all horrified of the world wide web. :p
16:32technomancybinding to non-localhost is like using with-local-vars; if you're one of the few people qualified to do it, you'll know without needing docs.
16:32cemerickRaynes: oh, so this is unrelated to the stack you hit? Just so that people aren't accepting REPL connections on all network adapters, etc?
16:32amalloyi didn't recommend any change to cemerick's readme, Raynes. that was you. i can understand doing something insecure in a getting-started sort of page
16:32amalloythough i would like it to change, i suppose
16:32cemerickit's a fair point
16:34jtoy_how does one typically deal with this kind of issue: WARNING: resolve already refers to: #'clojure.core/resolve in namespace: interests.enrichments, being replaced by: #'clojurewerkz.urly.core/resolve
16:34amalloypersonally i'd rather leave the readme alone, and have the default bind address be localhost rather than 0.0.0.0
16:35technomancysomeone yelled at be for making swank bind to 0.0.0.0 by default
16:35RaynesYeah, I brought it up because amalloy just yelled at me for binding to 0.0.0.0.
16:35gfredericksjtoy_: use (:refer-clojure :exclude [resolve]) in your ns declaration
16:35squidzdoes anybody know why compojure doesnt automatically load changes made to html/code
16:36gfredericksjtoy_: assuming of course you're bringing in the other one on purpose and want to use it and not the clojure one
16:36technomancyyou could make the argument it should be up to the dev tool to specify localhost, but since the consequences of getting that wrong are fairly disastrous it's really not worth being pedantic
16:36Raynestechnomancy: nrepl isn't just for dev tools though.
16:36RaynesUsers embed it in their applications.
16:36RaynesAnd they have to set the port and address in those cases.
16:37amalloyRaynes: you would only embed nrepl in an app as a dev tool
16:37TimMclocalhost-by-default would be very reasonable
16:37technomancyRaynes: yep, and forcing them to pay attention or get owned is sad times
16:37Raynesamalloy: Whatever.
16:37RaynesI think my point was clear.
16:37jtoy_gfredericks: thx, was just reading about that
16:38squidzi thought clojure was supposed to automatically load code while running
16:39technomancysquidz: that would make for some pretty rotten performance
16:39squidzbut while in some kind of development mode?
16:39technomancylein-ring does it in development mode, yeah
16:40squidzbecause if I have to start my ring server every time I want to see changes, it's not much better than java
16:40technomancybut it's much simpler just to connect a repl to it and reload that way
16:40squidzokay so maybe im not in development mode
16:41squidzso if I start my server in my terminal with lein ring server , how do I send my evaluations from emacs to it
16:41squidzI guess when I jack-in it starts a separate repl?
16:41borkdudesquidz don't start it via lein ring, but via lein repl
16:42technomancysquidz: right; so you can just launch a web server via jetty from your repl
16:42technomancyhttps://github.com/technomancy/syme/blob/master/src/syme/web.clj#L161
16:42squidztechnomancy: from the repl i jacked-in to with emacs nrepl?
16:42technomancyaye
16:42squidzokay thanks this was bugging me
16:42technomancyyou can launch a repl from lein ring too, but it's a bit more complicated
16:43technomancyindeed; running without a repl is like running blind
16:43squidzyeah I thought there has to be something im missing
16:47drorbemetWhich is the current way of writing the out and printed output of a function evaluated in the repl to a file?
16:47drorbemetI read clojure.contrib.io doc and clojure.java.io doc ... which functions to use is still unclear to me ..
16:48Raynescemerick: So yeah, in summary, I think most people appear to be in favor of changing the default bind address to localhost, with the less nuclear option being to edit the README example to bind to localhost or at least mention that it isn't binding to localhost by default.
16:48nDuffdrorbemet: rebind *out* to your file
16:48RaynesI'd happily provide either of these modifications, but I'm not sure I can bear the Jira patch nonsense for something this simple.
16:49drorbemetnDuff: that's to short for me at the moment, I don't even have a file handle, buffer or writer ...
16:50drorbemetnDuff: I deleted a file though with delete-file
16:54edwOK, I'm playing with the new LightTable and…how exactly do you get a Clojure REPL in a project? Am I crazy in saying that nrepl in Emacs is like a million times easier to grok?
16:55technomancythere is no easy, only familiar
16:55tbaldridgeedw: I've had very bad experiences with LT. Perhaps that's simply because it's still "pre-alpha" though
16:56aaelonydifficult equates to unfamiliar
16:57nDuffedw: There is no conventional REPL in LT, just the instarepl. Which is fine / all one needs, IME.
16:58edwSo, if I have a project, how do I get LT to start a JVM in the project's directory, with the appropriate deps on the classpath?
16:58arrdemnDuff: define instarepl?
16:59tbaldridgelike a repl but more instant
16:59tbaldridge:-P
16:59nDuffarrdem: Watch any Light Table demo video. Type code in editor -> evaluation result shown in editor alongside code, updated as you edit.
17:00nDuffarrdem: ...includes showing values of locals in other functions called during execution, etc etc. Generally pretty shiny.
17:00edwtechnomancy: Perhaps I have spent too many years (~25) in Emacs.
17:00technomancyedw: no such thing
17:01edwYes, but I'm trying not to put my bigotry on display.
17:01technomancy"too many years to understand how normal people use computers" is possible though
17:01borkdudeedw I hope I have mastered emacs in 25 years, but for now I will use it's basic features
17:01borkdudeits
17:02edwBut seriously, I am open-minded about LT: I wouldn't mind Squeak + CLJS + Emacs. But I'm utterly lost.
17:03borkdudedidn't rich say something about emacs on clojurewest? saw smth on twitter
17:04RaynesOh man, if Rich mentioned Emacs it'll validate the past 37 years of work on the editor!
17:04edwOK, I give up. Back to Emacs + nrepl + autocomplete.
17:05ieureborkdude, Rich said he uses Aquamacs, which, ewww.
17:05technomancyRaynes: he said if you spend more than 15m a day writing elisp you'll go blind
17:05squidztechnomancy: wow thanks for the tip, I started my server from the repl in emacs and now everything works like magic :D
17:05nDuffedw: personally, btw, I find that LT is great for quick experimentation -- say, inspecting the behavior of code people are asking about here in IRC -- but for real work, there's no replacement for emacs yet.
17:05edwtechnomancy: More than thirty minutes a day? Hairy palms. Forty-five? Neckbeard.
17:06RaynesRich has never been particularly cutting edge on the environment front.
17:06edwSo Rich has a 115 baud acoustic coupled modem connected to a daisywheel TTY?
17:06arrdemRaynes: we have The One True Editor.. what's to be cutting edge about?
17:07yogthosnDuff: I've been getting by with ccw myself :)
17:07nDuffEwww.
17:07yogthosnDuff: it does all I need, got repl, paredit works acceptably
17:08yogthosnDuff: and I do need to work with java once in a while ;(
17:08yogthosnDuff: but purity aside, it's definitely usable for real work is my point
17:09nDuffyogthos: I fire up IDLE for working with Java, but find CCW's paredit incompatible enough with my finger memory (need slurp and barf, damnit) that it's totally worth running multiple environments.
17:09yogthosnDuff: ah yeah that's fair :)
17:09squidztechnomancy: do you know by chance if there is a way to reload when html is changed?
17:09yogthosnDuff: at this point I'm holding out for LT to actually mature
17:10technomancysquidz: depends on the templating lib
17:10squidzit is just plain html with enlive
17:10technomancyI think you just recompile the deftemplate, but I haven't used enlive in a while
17:10squidzso if I eval the enlive it loads but I wanted to know if there was a way to just edit the html then save
17:10squidzyeah thats right
17:11squidzbut I guess im getting greedy and wanted to just see changes on html save
17:11technomancysquidz: you could do it in an emacs after-save-hook
17:11technomancybut emacs has no way of knowing which .html file corresponds with which .clj file
17:11squidzokay ill keep it simple and just evalueate the deftemplate
17:12squidzits already a lot better than java
17:13squidzi used hiccup first because it was easiest to grasp, then I switched to mustache, and now I landed at enlive
17:13borkdudeso, what is the -canonical- templating library nowadays :P
17:13technomancythere's no one right answer
17:14squidzI decided to switch from mustache to enlive because mustache just wasnt flexible enough, and clojurescript has a library enfocus which is almost the same as enlive with goodies
17:16borkdudetechnomancy I thought there was some self declared canonical new web thing recently ;P
17:17squidzyeah I still have to look into pedestal
17:17squidzive glanced over it, but haven't grokked it yet
17:17technomancyborkdude: last I checked Canonical is still using Python. =P
17:18borkdudelol
17:18squidzlol
17:19technomancy2-lol combo; not bad but we can do better
17:19borkdudeplol
17:21tylerwhats like conj but puts on the end of list?
17:21borkdudetyler conj puts at the end if it gets a vector
17:22borkdudetyler conj is a polymorfic function
17:22tylerah not sure what class its passing in, i assumed it was list but might be a vector
17:22tylerdidn't write this code
17:22dansalmowould anyone here be interested in trying out a web based interpreter for lambda calculus that uses indices instead of traditional lambda notation?
17:23dansalmoIt is not practical so much as educational.
17:23tylerare you saying education isn't practical? ;)
17:23yogthossquidz: I really like clabango myself :) https://github.com/danlarkin/clabango
17:23borkdude$findfn '(1 2 3) 4 '(1 2 3 4)
17:23dansalmohttp://pure-fn.appspot.com/about
17:23lazybot[]
17:23dansalmoI guess you got me. :)
17:24borkdude$findfn 4 '(1 2 3) '(1 2 3 4)
17:24lazybot[]
17:24borkdudetyler I think you'd have to go with concat then
17:24borkdude,(concat '(1 2 3) '(4))
17:24tylerborkdude: thnx
17:24SegFaultAXtechnomancy: If you haven't seen it yet, I think you might enjoy the first part of this post: http://www.flyingmachinestudios.com/programming/how-clojure-babies-are-made-lein-run/
17:24clojurebot(1 2 3 4)
17:25technomancySegFaultAX: heh; I copyedited that. copious lulz.
17:25squidzyogthos: yeah i took a look at clabango, but it seemed pretty similar to clostache, and after my experience with clostace, I wanted something more different
17:25SegFaultAXtechnomancy: :D
17:26SegFaultAXFor the record, Fullmetal Alchemist is amazing.
17:26yogthossquidz: I found it more flexible than clostache myself, it's based off django templates which are pretty nice
17:26uvtctomato, tomahto, clamato, clabango
17:26yogthos:)
17:26amalloydansalmo: you might enjoy http://www.ioccc.org/2012/tromp/hint.html if you're into indexed lambda calculus
17:26yogthosthat's the nice thing about the stack being pluggable
17:27squidzI liked the idea of having normal html and being able to transform that xml to your hearts content. Seemed like an clean solution
17:30dansalmoamalloy, thanks. It looks interesting. Thanks for your help before, the web interpreter is was I was working on.
17:31RaynesSegFaultAX: This is true.
17:31drorbemetnDuff: got it, asked a bit to early ..
17:32jtoy_is this considered the correct way to write a collection to a file? (with-open [wrtr (writer "fns.txt")]
17:32jtoy_(map #(.write wrtr % ) fns))
17:33yogthosnDuff: well that can happen, but in practice I haven't noticed it to be a problem
17:33borkdudejtoy_ it's pointless to use map for only side effects
17:34jtoy_borkdude: it doesnt seem to work , what is the right way to do this then?
17:34borkdudejtoy_ also, what is fns? you probably need doseq
17:34borkdudejtoy_ give us the complete code via a refheap paste
17:34jtoy_borkdude: fns is just my collection
17:35jtoy_borkdude: https://www.refheap.com/paste/12839
17:37jtoy_I see : (with-open [wrtr (writer "fns.txt")] (doall (map #(.write wrtr (str % "\n") ) [1 2 3 4 5 6] )) )
17:37jtoy_im still considered a clojure newb, but so far everysingle time i work with read files, it seems like always doing doall
17:38jtoy_or writing files, any file stuff
17:39yogthosyou probably should be using doseq instead
17:39yogthossince you'd doing side effects
17:39yogthos(doseq [item [1 2 3 4 5 6]] (.write wrt item))
17:40borkdudejtoy_ https://www.refheap.com/paste/12840
17:40borkdudeyogthos somehow I had to str i(tem) first
17:40yogthosyeah that makes sense
17:41jtoy_so doseq is like for and doall is like map? is tht the correct way to think about this?
17:41yogthosthe write method expects a string
17:41yogthosjoys of dealing with java api
17:41borkdudejtoy_ map creates a lazy sequence of which the results are only produced on demand
17:42borkdudejtoy_ doall forces the production of all those elements
17:42borkdudejtoy_ but since you're only interested in the side effects and not in some resulting collecting, you should use doseq in this case
17:42jtoy_borkdude: right, but is doseq to for like doall is to map? or is that analogy totally wrong?
17:43borkdude,(doc doall)
17:43yogthosnot quite
17:43clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time."
17:43pbostrompersonally, I wish there was a side-effect equivalent to 'map'
17:43yogthosconceptually doseq is specifically for side effects
17:43borkdude,(doc doseq)
17:43clojurebot"([seq-exprs & body]); Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by \"for\". Does not retain the head of the sequence. Returns nil."
17:43technomancyfirst person to say mapv gets a kick in the shins
17:43yogthoslol
17:43technomancyI'm watching you
17:44jtoy_i see what doall does, but i dont really understand doseq even after reading that
17:44borkdudeI don't get why (.write wrtr 1) doesn't return some error, it just silently fails?
17:44jtoy_borkdude: without the str, it worked for me, it just outputted garbage
17:45borkdude,(= nil (doseq [i (range 5)] (print i)))
17:45clojurebot01234true
17:45SegFaultAXjtoy_: It's somewhat annoying to remember all the do* forms, but you'll get used to it.
17:45yogthosjtoy_: basically doseq will always return nil, and it doesn't retain the sequence in memory
17:45borkdude,(= nil (doall (map print (range 5))))
17:45clojurebot01234false
17:45amalloy.write probably has an overload that accepts ints
17:45yogthosjtoy_: but you can do something with each element as you run through them
17:46yogthosjtoy_: presumably side effects like printing it out or writing to a file, etc
17:46jtoy_yogthos: ah, i see
17:47jtoy_yogthos: so in my case i often read in files, and i want to just collect a part of each line, i use doall and that works now, is that considered the best way to do it?
17:47borkdudeamalloy clojure uses longs right?
17:47borkdudeamalloy ah, it can deal with ints, but those are interpreted as chars
17:47borkdudeDOH
17:48SegFaultAXjtoy_: doall is for eagerly evaluating lazy things. That's probably not the right tool for what you're doing.
17:48yogthosjtoy_: if you're collecting then doall is fine
17:48tieTYTnewbie here. So ~@ takes a & parameter and evaluates it as-is?
17:48yogthosjtoy_: the reason you need doall is because when you leave the (with-open ...) expression the file gets closed
17:49yogthosjtoy_: so you want to force evaluation before that happens
17:49yogthostieTYT: in a macro ~@ will splice a sequence into the parent
17:49tieTYTwhat does that mean?
17:49tieTYTwhat's splice?
17:49jtoy_SegFaultAX: I use it bc I use with-open
17:49technomancytry it and see
17:50jtoy_does that mean maybe it makes sense to have a with-open-eager or something like that
17:50yogthostieTYT: eg: (defmacro foo [items] `(println ~@items))
17:50technomancy,`(1 2 3 ~@[4 5 [6 7]])
17:50clojurebot(1 2 3 4 5 ...)
17:50technomancydang it clojurebot
17:50technomancy,`(1 ~@[4 5 [6 7]])
17:50clojurebot(1 4 5 [6 7])
17:50yogthoswhat technomancy said :)
17:51yogthoswhatever items were in the collection you used ~@ get appended into the outer expression
17:52tieTYThm but you used ` there. I thought that forces evaluation
17:52technomancy~@ only works inside `
17:52clojurebot@ , {a b c]
17:52tieTYThow can you evaluate (1 2 3)
17:52tieTYToh
17:52hyPiRion,`[[~@[1 2 3]] [~@"wat the"] [~@{:a 1 :b 2}] [~@#{:also :sets}]]
17:52clojurebot[[1 2 3] [\w \a \t \space \t ...] [[:a 1] [:b 2]] [:also :sets]]
17:52technomancyalso, quoting delays evaluation
17:52yogthoswhich can be very handy :)
17:52tieTYTi didn't see any quoting there
17:52tieTYTonly unquoting
17:53tieTYTerrr
17:53hyPiRionbackquote -> `
17:53tieTYTohh
17:53amalloyclojurebot: tias is <reply> Try it and see! You'll get results faster than asking someone in #clojure to evaluate it for you, and you'll get that warm, fuzzy feeling of self-reliance.
17:53clojurebotIn Ordnung
17:53tieTYTwhat's that vs '?
17:53tieTYTi got mixed up. I swapped ` with ~ in my head
17:53hyPiRion,'[~@[:oh :no]]
17:53clojurebot[(clojure.core/unquote-splicing [:oh :no])]
17:54SegFaultAXI don't usually link to clojure.org, but: http://clojure.org/reader
17:54jtoy_clojurebot: help
17:54clojurebotNobody can help with "X doesn't work". Please provide context: what you did, what you hoped would happen, and what happened instead. A stack trace is especially helpful, if applicable.
17:54SegFaultAXtieTYT: ^
17:54tieTYTok
17:55yogthospersonally I'd recommend not focusing on macros too much when you're starting out :)
17:56tieTYTyogthos: i'm running into library code that uses them
17:57yogthosah
17:57tieTYTare you just recommending I don't use them for now?
17:58yogthosyeah, it's rare that you actually need to use a macro legitimately
17:59tieTYTcool, I had that intuition :)
17:59yogthos:)
17:59hyPiRionWhenever I find a new language construct (such as macros) I tend to overuse them because I feel so powerful using it.
17:59hyPiRionThen I look at it 1 month later and cry because it's so horrible.
17:59hyPiRion(It's a good way of learning that specific construct though).
17:59borkdudehyPiRion haha, so true
18:01SegFaultAXBut when you do need macros, they're amazing.
18:01ivaraasenhyPiRion: same thing in journalism. learned a new word or a new idiom, then used it in every single article
18:01technomancydrunk on the power of defmacro
18:01technomancy"you will cower before me, mortal!"
18:02SegFaultAXObligatory: http://xkcd.com/224/
18:04borkdudeSegFaultAX I suspect he did it in perl8.org
18:04hyPiRionivaraasen: oh yeah, it's a bit painful there too. Or in reports for that matter. When I found a nice way to cite things, they were suddenly everywhere.
18:06ivaraasenhyPiRion: in Trondheim this Easter BTW?
18:07jtoy_is it perfectly fine to use with-open to open a file to write and read in 1 binding?
18:07jtoy_i mean multiple open files
18:07hyPiRionivaraasen: yeah, I'll be here for the whole Easter
18:08borkdudejtoy_ you need a binding for either a writer or reader
18:08borkdudejtoy_ and with-open supports multiple bindings afaik
18:09ivaraasenhyPiRion: same thing. feel free to call me up if you want to drink strong coffee and talk about swearjure
18:09hyPiRionivaraasen: oh, sweet
18:10hyPiRionI should bring my spare Clojure stickers and buttons
18:10ivaraasenhyPiRion: damn, I need some Clojure stickers ... for my employees, of course.
18:12hyPiRionexactly
18:13borkdudeany favorite plot libraries for quick function plotting and using ouputted pics in a .tex or .org document? gnuplot?
18:13tieTYTooh #(...) looks useful
18:14borkdudetieTYT until you try to nest them :P
18:14tieTYToh that could get ugly
18:14tieTYTso should I avoid them or just not nest them?
18:14hyPiRionnot really, it's not allowed.
18:15borkdudetieTYT I tend to avoid them and use only (fn [x] ….), but this is just my personal preference
18:15hyPiRionuse them where it makes stuff more readable
18:15hyPiRione.g. #(Double/parseDouble %)
18:16ivaraasenhyPiRion: I tend to use GNUPlot. somebody needs to make an open source version of the service mentioned in the a grammar of statistical graphics talk
18:16tieTYTso that's an anonymous function that takes one argument and passes it to Double/parseDouble
18:17hyPiRiontieTYT: yep
18:17tieTYTok
18:17borkdude,(#(-> 1))
18:17clojurebot1
18:17hyPiRionivaraasen: I think you meant to send that one to borkdude? Regardless, I agree. GNUPlot is nice, but I would like an api for it in Clojure
18:17hyPiRionMy shell script hacks can only do that much
18:18ivaraasenhyPiRion: err, yeah
18:22hyPiRionborkdude: gnuplot with epslatex is my favourite for plotting, but it's not quick if you're not familiar with it. I know Incanter has some way of spitting out PDFs though.
18:22borkdudehyPiRion ivaraasen ok tnx, I'll stick with gnuplot
18:23yacinare there R bindings or interop for clojure?
18:23yacini can't use anything for plotting except R/ggplot2 these days
18:23tieTYTok I think i get ~@ now
18:24tieTYTit inlines the structure into the outter form
18:24ivaraasenborkdude: another option is just using org-plot on tables created from running print-table on your Clojure data structures
18:24borkdudeivaraasen I really need a function plot
18:24borkdudeivaraasen but it's good to know that exists
18:24borkdudeit
18:25ivaraasenborkdude: yeah, I see where you're coming from. I tend to use Incanter for stuff like this mostly
18:25ivaraasenor Mathematica :P
18:25llasramyacin: There's http://www.rforge.net/rJava/ ; but I've only dealt w/ it via researcher code :-)
18:25ravsterWhere can I find an explanation of :available-media-types in liberator?
18:25borkdudeI used Maple but it's long since I had a license
18:26llasramyacin: Lately I've been using org-babel to glue together doing data-processing in Clojure then stats and plotting in R. It works not half-badly
18:26yacinah yeah, rjava. i've used that a bit
18:26ravstera "hello world" isn't even working without that, and I can't seem to find docs for as essential a function as that.
18:26yacinhaha howdy llasram
18:26llasramyacin: Yep :-)
18:26yacindidn't check the nick right away :P
18:27llasramheh
18:27ivaraasenyacin: yeah, org-bable and print-table with some R in-between is pretty nice
18:28ivaraasenerr, wrong nick again.
18:28yacinnice, i'll have to give it a whirl
18:29ivaraasenI'm considering writing some output stuff so I can write my articles in org-mode and export them as XML to InDesign, ready formatted. reproducible journalism is an interesting concept.
18:30hiredmanyou know org-mode can export to pdf and html?
18:31yacinblah, i really need to get on the org-mode bus
18:31hiredmanthe pdf export is via latex I think
18:31ivaraasenhiredman: yeah, but we have some in-house quirks and use our own XML dialect that gets put into InDesign
18:31hiredmansounds gross :)
18:31ivaraasenit is
18:32ivaraasenmost of the code is from the early 2000's
18:32hiredmanI haven't used babel yet, but it is intriguing
18:33ivaraasencrashes all the time as well. usually half an hour before the paper has to reach the printing company
18:34hyPiRionhaha
18:35ivaraasenwhich is like a $15k loss in revenue. pretty scary stuff
18:47zakwilsonclj-time is saying this string is invalid for this formatter, but it looks ok to me according to the jodatime docs: (parse (formatter "d M y") "22 March 2013"). It works with a numeric month though.
18:49hiredmanzakwilson: if I recall the docs say something like single letter for numbers and multiple letters for longer forms for parsing
18:49hiredmanoh
18:49borkdudegoodnight
18:49hiredmanI am thinking of simpledateformatter, dunno about clj-time
18:52zakwilsonActually, hiredman, that does seem to be it; MMM parses "March". That is one possible interpretation of the docs, which say "Month: 3 or over, use text, otherwise use number.", but since they give "July; Jul; 07" as examples, I assumed it meant that 3 or more characters in the string being parsed would be treated as a textual representation of the month, not three or more Ms in the pattern.
19:02tylerhugod: are you hugo duncan?
19:06OneFourSevenCan somebody explain to me how to use roles in cemerick friend?
19:07OneFourSevenI'm just not sure about the syntax behind the #{::user} and how I would store that stuff in a database
19:08tyleranyone know if you can simulate tty in clj-ssh?
19:08hiredman,::user
19:08clojurebot:sandbox/user
19:08hiredmanit is a set of namespace qualified keywords
19:09hiredmanthe reason he used namespace qualified keywords for roles is because you can put them in hierarchies
19:10hiredmanhierarchies in clojure are a thing you should google about if you want to know about them
19:12OneFourSevenhiredman, what should I store in the db? A string with the role user?
19:14Glenjaminhi guys, is anyone aware of a lib for mocks/fakes/spies/stubs ?
19:14technomancyGlenjamin: clojure.core/with-redefs
19:14Glenjaminideally i'd want to declare a stub, and then assert on how it was called afterwards
19:15technomancy,(let [vals (atom [])] (with-redefs [mocked-fn (partial swap! vals)] (mocked-fn :expected) (= [:expected] @vals)))
19:15clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve var: mocked-fn in this context, compiling:(NO_SOURCE_PATH:0:0)>
19:15technomancyoh yeah; can't do that in a sandbox
19:15technomancywhatever
19:15technomancydon't use a library just to redef a function in tests
19:16Glenjaminit's not the redef that i'm after, as you said - that's easy
19:16Glenjaminit's just wrapping up that atom + constantly combo
19:17technomancywell, you can add one line to project.clj and one line to your ns form to refer it, or you can just add two lines for the above snippet =)
19:18Glenjaminper-test :)
19:18Glenjaminbut, yeah i take your point
19:20Glenjamincluttering up test cases with that every time would distract from the actual meat of the test, so i'd end up pulling it out into a macro, which at that point makes sense to spin off as a separate project
19:20Glenjaminsince the form is general
19:21technomancymost nontrivial projects have a "test helper" kind of namespace
19:21Glenjaminexactly, thats the sort of thing we should be sharing
19:22Glenjaminanyway, i'll get some stuff working with that for now - cheers
19:25chessguyso i hear people talk about the reader in clojure. isn't it just the same as a parser in another language?
19:26amalloychessguy: sorta. the main difference is it returns a data structure that's not complete rubbish
19:28nDuffchessguy: ...one of the big things about LISPs is isomorphism -- your parse tree and your code match.
19:28chessguywell, parsers return ASTs, right?
19:28nDuffchessguy: That makes macros far more powerful and usable than they are otherwise.
19:29headshot"homoiconicity" ?
19:29drewcreader is different from a parser ... first lex. then parse, then read and circle.
19:29powr-tocCan anyone tell me why this core.logic snippet is so slow?
19:29powr-tochttp://pastebin.com/DrGkZyCW
19:30powr-tocdistincto seems to perform quite badly
19:30drewcnDuff: like we used to have for paste.lisp.org before the spammers took care of it?
19:31powr-tocnDuff: Sorry, didn't see the ads... I have adblock
19:31dnolenpowr-toc: if you dealing with integers you should probably use fd/distinct
19:31chessguywhy not just use gists?
19:31dnolenpowr-toc: I'm not sure how to make distincto efficient
19:31hyPiRionrefheap :)
19:31powr-tocdnolen: I'm not dealing with ints... just in that example I wanted to generate some
19:31powr-tocvalues
19:33powr-tocdnolen: would I be better using integers and mapping them to my values somehow?
19:33dnolenpowr-toc: there's probably a way to to do an efficient distincto constraint when you don't have complex terms ... would take a patch of course.
19:33dnolenpowr-toc: maybe
19:34dnolenpowr-toc: also CLP(Set) might do what you want when we get there.
19:34dnolenpowr-toc: if you look at the implementation of disincto you can see that it's pretty naive.
19:35powr-tocdnolen: Naive, you mean like I would write ;-)
19:36powr-tocdnolen: How else could it be written?
19:37dnolenpowr-toc: it could probably be done almost exactly the same as fd/distinct
19:39powr-tocI don't really grok much of the fd stuff... it's mostly blackmagic to me
19:40powr-tocdnolen: where can I find out more about CLP(Set)?
19:40dnolenpowr-toc: hehe, it not as complicated as it seems though there's a lot of details that you need to be aware of to write a constraint - hopefully that will improve with time.
19:41dnolenpowr-toc: https://github.com/clojure/core.logic/wiki/CLP%28Set%29, it's like CLP(FD) but trickier
19:42powr-tocdnolen: lol, and my head was already hurting!
19:43dnolenpowr-toc: one day these silly details will be hidden from the user and you can just use the damn thing. kind of how people just use persistent data structures in Clojure - obviously we're not there yet.
19:44powr-tocdnolen: I didn't seem to struggle quite as much with the small amount of prolog I've done...
19:45dnolenpowr-toc: well I'm sure you used a fairly mature Prolog
19:45dnolenlots of optimizations in place
19:45powr-tocdnolen: yeah, SWI
19:45dnolenpowr-toc: yeah I think they probably have a decent distinct constraint that does the right thing.
19:46dnolenpowr-toc: writing a distinct like distincto in Prolog is sure to be bad too.
19:47arohnerI have an app that works fine, until I AOT it. Now I get: https://gist.github.com/arohner/d1a2d9c0928b0ede769c
19:47powr-tocdnolen: from what I remember it was pretty decent
19:48powr-tocdnolen: but it seems core.logic is getting better and better all the time
19:48hiredmanarohner: have you checked to see if that class exists in classes/ ?
19:49arohnerhiredman: I don't think it does. That's part of log4j, so shouldn't I expect it *not* to be there?
19:49arohnersorry, nvm
19:49dnolenpowr-toc: slowly but surely. I would look into this, but I'm trying to improve the CLP(FD) stuff at the moment, adding minimize, maximize, etc
19:50arohnerhiredman: I don't see it there, what should I look at?
19:51arohnerhttps://groups.google.com/forum/?fromgroups=#!topic/datomic/6xWGFB-Dx68
19:51hiredmanarohner: do you have lein setup to delete non-project class files?
19:51arohnerprobably not. I'll look into that
19:51hiredmanarohner: ugh, get a real build process
19:52hiredmanand deploy a built artifact
19:52arohnerhuh? I triggered this trying to make 'lein uberjar' work
19:52hiredmandon't `lein run` in a git checkout
19:52hiredmanoh, the message there talks about "on various deployments"
19:53arohnerthat's not me posting :-)
19:53powr-tocdnolen: One thing I've not seen documented, is what the following does: (distribute q ::l/ff)
19:53powr-toc(as seen in sudokufd)
19:54dnolenpowr-toc: actually I'm a looking a bit closer at your paste
19:54dnolenpowr-toc: ::l/ff is a custom strategy for how to enumerate the domains
19:55dnolenpowr-toc: there'll be more, very useful for optimization w/o really changing program
19:55hiredmanarohner: does any clojure code not in your project end up as class files?
19:55dnolenpowr-toc: oh, the issue here is not distincto :P
19:56arohnerhiredman: yes, it looks like all 3rd party libs are in target/
19:56dnolenpowr-toc: it's how you're calling value* w/ everyg, you're generating a ton of possiblities whene you do that.
19:56powr-tocdnolen: I was wondering if that might be it...
19:56powr-tocdnolen: what's the best way to distribute that fact distinctly over the vector of lvars?
19:58dnolenpowr-toc: if I'm not mistaken that's probably 15! or something?
19:58powr-tocdnolen: yeah... the performance sure seemed to suck like a factorial :-)
19:59dnolenpowr-toc: yeah, you're probably better off encoding the problem in CLP(FD) if you can and writing helpers to move between the representations
19:59hiredmanarohner: everything runs fine with `lein run`?
19:59arohnerhiredman: yes
19:59dnolenpowr-toc: it's annoying, and I've had to do this - it's likely we'll fast track at least a version of CLP(Set) that works when everything is ground as this is very common.
19:59arohnerhiredman: lein run works as long as target/ is empty
20:00hiredmanarohner: how weird is your code base? are you doing conditional code loading or anything like that?
20:00arohnerafter `lein uberjar`, everything breaks with that exception until rm -rf target/
20:00arohnerI'll try undoing the transitive AOT manually, and see what happens
20:01powr-tocdnolen: Am I right in thinking that I saw an example recently where someone (you?) bodged in some CLP(Set) stuff, did what you describe?
20:01dnolenpowr-toc: http://swannodette.github.com/2013/03/09/logic-programming-is-underrated/
20:01hiredmanarohner: I would try the reverse, force compilation of clojure.tools.logging upfront
20:02powr-tocdnolen: yes, that'd be the one :-)
20:02arohnerhiredman: how would I do that? AOT tools.logging from it's source tree, and copy them in?
20:02dnolenpowr-toc: yep, an fd encoding of your example takes <30ms, vs. 5000ms on my air
20:02hiredmanlike stick (compile 'clojure.tools.logging) before the (ns ...) of your main namespace
20:03arohnerinteresting :-)
20:03powr-tocdnolen: can you pastie?
20:05dnolenpowr-toc: https://gist.github.com/swannodette/5225702
20:07dnolenpowr-toc: updated the gist just now
20:09powr-tocdnolen: wow... the jit eats it for breakfast too! Some of the benchmarks are coming in at under 5ms on my crappy laptop
20:09dnolenpowr-toc: yep
20:10powr-tocimpressive!
20:10dnolenpowr-toc: like I said, slowly getting there
20:10arohnerhiredman: progress!
20:10arohnerI had to compile clojure.tools.logging, and tools.logging.impl
20:10arohnernow I'm getting similar problems in other libs
20:11arohnerthanks
20:12hiredmanarohner: so it may just be an ordering thing, if you move ordering around so libs compile in a specific order it might work out
20:13hiredmanmove the order of require's and use's around
20:14arohnerhiredman: I'm pretty sure I never use tools.logging without requiring it in that ns. How could my code cause the prob?
20:17hiredmanarohner: I don't know, clojure.tools.logging actually does some pretty gross stuff under the hood to pick the logging library to use
20:18hiredmancould be something like something depends on logging, so logging is loaded, logging looks that the available classes and compiles itself to use backend X, but then some other code loads latter that invalidates that so logging dies or something
20:19Glenjaminwhat is it with java logging? pretty much every other language/framework i've used just has the application bootstrap set up the logger
20:19technomancyGlenjamin: it is. the worst.
20:20arohnerand I'd happily call (logger/init :log4j) or whatever
20:25arohnersuccess!
20:25arohnerstartup time down from 1:30 to 0:21s
20:26Glenjamin21s is good?
20:26arohner4.5x improvement is good
20:27Glenjaminmm
20:30arohnerGlenjamin: oh, that also includes DB & web server init
20:30hiredmanarohner: did you just (compile ...) namespaces one by one until it worked?
20:31arohnerhiredman: yes, I had to compile clojure.tools.logging, clojure.tools.loggin.impl, and explicitly require ring.adapter.jetty
20:31clojurebotclojure is like life: you make trade-offs
20:31arohnernoir tries to load r.a.jetty at runtime
20:31hiredmaninteresting
20:32hiredmanand loading jetty would bring in jetty's whatever logging
20:32arohnerhrm, now immediately after lein uberjar, I get 'Error: Invalid or corrupt jarfile target/circle-0.1.0-SNAPSHOT-standalone.jar"
20:32hiredmannow that you have an explicit load of jetty, I would try removing the explicit compiles
20:32hiredmanarohner: always `lein clean`
20:34arohnerhiredman: same result
20:35hiredmandoes the jar file unzip?
20:37Glenjamincan you move the noir require out of the ns declaration
20:37arohnerhiredman: kind of: https://gist.github.com/arohner/02d57509bc1fe05c20ef
20:37arohnerother than that, it completes fine
20:38hiredmanyeah, unzip is most likely more lenient about files then java's jar file reading
20:38hiredmanif lein is generating invalid jars that sounds like a lein problem :)
20:38hiredmanwhat happens if you re-jar the contents?
20:39arohnerusing the jar tool manually?
20:39hiredmansure
20:42arohneroh wait, I haven't generated a java class
20:42arohnerfor my main ns
20:42Glenjaminis there a way to get a function to accept either [a b &c] or [a &c] ?
20:42arohnerGlenjamin: manually parse the args. otherwise it's ambiguous
20:43Glenjamincheers
20:43Glenjaminactually, i think my desired functions is ambiguous
20:43Glenjaminheh, rethink
20:45arohnerwhat's the syntax to start clojure.main from a jar again?
20:46tieTYTin lein is there a way to reload the repl so that it downloads new dependencies you've added to the project.clj? I always ctrl+c and reenter
20:46arohnerjava -jar my-jar.jar clojure.main?
20:46tieTYTbut then i lose all the requires I've built up
20:47arohnerjava -cp target/my-jar-standalone.jar clojure.main
20:47GlenjamintieTYT: i think if you drop out and run lein deps, then require should work?
20:48Glenjaminctrl+z / fg or separate shell
20:48tieTYThm
20:48tieTYTok i'll try that next time
20:48arohnertieTYT: there's also https://github.com/cemerick/pomegranate
20:48arohnerthough that doesn't reload project.clj for you
20:49Glenjamini suspect i'm wrong, having read that
20:50tieTYTaroemers: thanks
20:50tieTYTarohner: i meant thanks
20:51amalloyGlenjamin: yeah, no way that works
21:00tieTYTthis article should be at the top of google when you search for a multimethod tutorial: http://www.fatvat.co.uk/2009/01/multi-methods-in-clojure.html
21:02tieTYT"Reading Programming Clojure shows that multi-methods are very rarely used in most of the current Clojure code (only about 1 occurrence per thousand lines of code). There's some guidelines in the book about choosing whether to use multi-methods, but it's summed up best with "try writing the function in both styles, and pick the one that seems more reliable"."
21:02tieTYTis that accurate?
21:02tieTYTi mean do you guys agree with that?
21:10RaynesSure.
21:10RaynesI think that it is worded strangely.
21:11RaynesPeople don't sit around going "HMMMM, I don't know if I should use a multimethod or not…". A multimethod is either a good solution or it isn't. It solves a specific purpose, and if it isn't used very often it is merely because that purpose doesn't come up all that often.
21:11drewcI do not agree, but do not disagree, fwiw.
21:13tieTYTwell my situation is I'm writing a program that's kind of like a web spider. It's going to traverse different sites but I'm going to program in the logic of how to traverse each site given a starting url. So the logic will differ depending on if you go to a.com/... vs b.com/...
21:13tieTYTso I was thinking a multimethod that dispatches on the domain of the url would be a good fit
21:27lovemuffinis there a way to keep the jvm 'warm' ? for instance running `lein new` to see the help then running `lein new app project` slow
21:30mabeslovemuffin: nailgun does that but it comes with its own set of problems... check out drip https://github.com/flatland/drip
21:32lovemuffinah so its like jvm pools
21:33lovemuffinalso for vim users, is the official unofficial vim plugin for clojure? https://github.com/vim-scripts/VimClojure
21:45xeqilovemuffin: the common way is to use https://github.com/sattvik/lein-tarsier, though I know there is alot of work being done on https://github.com/tpope/vim-fireplace
21:46xeqinot sure if vim-fireplace is the new standard yet
21:51Glenjamin"espionajure" good/bad name for a clojure stub/spy lib?
21:51arohnerGlenjamin: https://github.com/circleci/bond
21:51arohneroh, that needs a readme
21:51Glenjaminbah, where were you two hours ago >.<
21:52hyPiRionGlenjamin: well, you have to set LEIN_IRONIC_JURE for that
21:52Glenjaminoo, metadata
21:53Glenjaminthats much smarter than dynamic binding a map of function => vector
21:53lovemuffini've been reading programming clojure (pragprog) and eh its ok, does a lot of talking not enough doing
21:53Glenjaminthis is what i had: https://gist.github.com/glenjamin/7edfefcbf1eaa02d6a58
21:54lovemuffinso in a clojure project, the best debugger is the repl ?
21:54jerryzhouhi
21:55Glenjaminarohner: that's exactly what I was about to write, only done better :D
21:55lovemuffinor if it isn't what is the standard way to debug clojure?
21:55arohnerGlenjamin: thanks. I'll write a readme then [ANN] it
21:55Glenjamin[ANN] ?
21:55arohnerannounce, on the google group
21:56Glenjaminoh right
21:56arohnermessage titles are typically prefixed with [ANN]
21:56Glenjamini should subscribe to that
21:56Glenjaminoh, actually
21:57Glenjamin(with-stub [fn retval, fn2 retval2] body) would be cool
21:57arohner(with-redefs [f1 (constantly retval) f2 (constantly retval2)] body)
21:58Glenjaminyeah, but then i have to do with-redefs & with-spy :)
22:00Glenjamini can knock up a patch for that if you'd accept it?
22:00xeqilovemuffin: if you can use the repl, hugod has done a lot of work on ritz to make a real debugger https://github.com/pallet/ritz
22:00Glenjamini'd say sugar for constant retvals and fake implementations would be handy
22:01xeqi... the repl is step one, when a real debugger is needed see ritz
22:02lovemuffinok, so thats the standard way of doing it? most people don't depend on some IDE debugger
22:02danielglauserlovemuffin: most folks use emacs as their "IDE"
22:03arohnerGlenjamin: how would you distinguish between (with-stub [f1 retval f2 retval]...) and (with-stub [f1 f2]) ?
22:03Glenjaminarohner: more macros :)
22:04Glenjaminor maybe (with-stub {f1 retval f2 retval}
22:05Glenjaminand then (with-fake {f1 #(…) f2 #(…)} ...)
22:07arohnerhrm, vector vs. map isn't bad
22:07arohnerI'm kind of proud of the fact that the entire lib is only 44 lines :-)
22:08Glenjaminyeah, i clearly need to work on my vector manipulation in macros :D
22:09Glenjaminanyway, uk time so i'm heading off
22:09Glenjamini'll definitely be using bond though
22:10Glenjaminnice work on circle too, used it a couple of times and liked it :)
22:10john2xwhat's the difference between pedestal-app and pedestal-service?
22:12powr-tocjohn2x: apps are client-side (clojurescript) programs... service's are server side (clojure) programs
22:13arohnerGlenjamin: thanks!
22:14Glenjaminonly found out it was clojure fairly recently, just seemed like any other app from a consumer pov
22:14john2xpowr-toc, oh ok. so if I don't want to work in clojurescript (yet), I can just create a service and build the client whichever way?
22:14Glenjaminwhich i guess is a good thing?
22:16powr-tocjohn2x: yup
22:17john2xpowr-toc: cool, thanks!
22:42chessguy'evening, everyone
22:44jerryzhouhi
22:45chessguyanybody have a good recommendation for some good clojure code to read? i've got plenty of programming experience, including functional programming, and ruby
22:49dcolishclojurewerks does good stuff
22:50ivanchessguy: core.clj
22:50ivanactually, clojurescript core.cljs
22:52chessguyivan\: you mean this? https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs
22:53ivanyes
22:53chessguythanks
22:55ivanI also remember enjoying trying to understand the cljs emitter
23:47muhooTimMc: yes, it's not only in a usable state, i'm using it constantly now
23:58technomancyI think I finished up syme: https://syme.herokuapp.com/