2013-03-22
| 00:54 | clifton | hi, whats the favored pattern for reading/accessing environmental variables from config/(dev|production).clj |
| 00:54 | clifton | sneaking some clojure into our production stack :( |
| 00:54 | clifton | :) |
| 01:04 | hyPiRion | clifton: oh, I've heard people talking about environ for that |
| 01:04 | hyPiRion | https://github.com/weavejester/environ |
| 01:07 | clifton | thanks hypirion |
| 01:07 | hyPiRion | no problemo |
| 01:26 | tomoj | what's the other one? |
| 01:26 | tomoj | ah, carica |
| 02:44 | tomoj | why design IWatchable as it is instead of having add-watch return a remove-watch function? |
| 02:44 | tomoj | s/IWatchable/IRef/ for jvm |
| 02:46 | amalloy | tomoj: 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:47 | amalloy | eg, perhaps you have a bunch of files open, and a watcher for each, keyed by the filename |
| 02:47 | amalloy | when you close a file, you can remove its watch |
| 02:48 | tomoj | that does sound more fun |
| 02:49 | tomoj | but should we design our protocols to maximize fun? |
| 02:49 | amalloy | just imagine the fun of having to add *another* ref to manage the state of the watchers on your first ref |
| 02:49 | amalloy | i can hardly wait |
| 02:50 | tomoj | I see |
| 02:50 | tomoj | I was thinking since you can implement one in terms of the other, the protocol should specify the easiest one to implement |
| 02:50 | tomoj | but it's not symmetrical |
| 02:51 | tomoj | hmm |
| 02:53 | tomoj | it does seem strange to put the choice of having another ref right in the protocol |
| 02:55 | tomoj | I 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:57 | tomoj | oh, of course it makes sense |
| 02:57 | tomoj | atoms would be unusable otherwise |
| 03:00 | tomoj | ämalloy: thanks :) |
| 03:42 | ivan | I see https://github.com/strangeloop/clojurewest2013/tree/master/slides has something now |
| 05:22 | muhoo | huh, that's weird, an app just stopped working completely on lein 2.1.1 that worked fine on 2.0.0 |
| 05:23 | muhoo | lein cljsbuild hangs, lein trampoline repl hangs, just hangs. in production, of course. works fine on my dev system :-/ |
| 05:24 | muhoo | only difference i can see is producion is java 6, my machine is java 7. |
| 05:30 | ivan | muhoo: lein 2.1 changed the default :jvm-opts, could be something else though |
| 06:39 | necronian | How 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:45 | borkdude | necronian might be a firewall issue? |
| 06:46 | necronian | borkdude: That was my first thought, so I specifically set the machine to allow any incoming connection from anywhere and it didn't help |
| 06:47 | borkdude | necronian are you connecting to the right port number? |
| 06:47 | borkdude | necronian lein repl :connect <portnr> |
| 06:48 | necronian | It says nrepl server started on port 48333 and I try to connect with lein repl :connect adserver:48333 on the remote machine |
| 06:48 | borkdude | necronian no idea why it wouldn't work. try #leiningen also perhaps? |
| 06:49 | necronian | Ah, thanks good idea. I'm sure it's something stupid but I have no idea what. |
| 06:54 | ironm | necronian, did you check with "namp" listening ports on your server? Further you can trace with wireshark what is going on |
| 06:54 | ironm | "namp" |
| 06:54 | ironm | nmap |
| 06:54 | ironm | sorry |
| 06:55 | necronian | I can try to scan it with nmap, I've never used wireshark before |
| 06:58 | ironm | necronian, if you run linux it should be easy (to use wireshark) |
| 07:02 | pwned | it's even easier to run a tcpdump |
| 07:07 | necronian | ironm: 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:08 | ironm | necronian, have you tested locally on the server ? |
| 07:08 | ironm | in case you have an ssh access |
| 07:09 | necronian | ironm: Yes I can connect fine locally, just have an issue remotely. |
| 07:10 | ironm | it looks like a "firewall" issue |
| 07:14 | jcromartie | I want a lib that lets me go into a namespace and records def.* calls into a corresponding file |
| 07:14 | jcromartie | does that exist? |
| 07:14 | necronian | ironm: 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:15 | pepijndevos | Theory: There are more functional programmers than functional jobs. |
| 07:15 | jcromartie | so like, when I go into a namespace at the REPL, it replaces all of the def.* bindings with ones that rewrite the file |
| 07:16 | jcromartie | pepijndevos: corollary: functional programmers could fight to the death over functional jobs as a form of amusement |
| 07:17 | pepijndevos | jcromartie: amusement? |
| 07:17 | jcromartie | that is: be made to fight, for the amusement of others |
| 07:17 | jcromartie | e.g. gladiators |
| 07:17 | pepijndevos | ah |
| 07:19 | jcromartie | this is a start |
| 07:19 | jcromartie | (defmacro scribe! [code] (spit "scribe-session.clj" (str (prn-str code) "\n") :append true)) |
| 07:19 | jcromartie | at least I find it handy |
| 07:27 | necronian | ironm: 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:46 | eckroth | hi, 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:46 | eckroth | how can I fix this? |
| 07:48 | Bronsa | eckroth: have you tried (let [^type x nil] (Ctor. foo x)) ? |
| 07:49 | Bronsa | (I don't know if this will work, worth a try though) |
| 07:50 | eckroth | Bronsa: wow, nice job! I tried a similar thing that failed, because I didn't immediately call the Ctor |
| 07:50 | eckroth | Bronsa: thanks! |
| 07:51 | Bronsa | np |
| 07:56 | ironm | necronian, yes .. thank you. Such setting is often a source of "strange" issues |
| 08:01 | eckroth | In 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:03 | tomoj | cool |
| 08:06 | necronian | ironm: 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:06 | tomoj | I'm guessing :words-to-keep is the number of most frequent not-stoplisted words, and that is the dimension of the vectors? |
| 08:07 | tomoj | ..number of words to keep, obviously |
| 08:14 | ironm | necronian, 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:17 | necronian | ironm: I'll try filing an issue for the documentation on the leiningen repo tonight |
| 08:18 | eckroth | tomoj: yes, sorry, was away; words to keep is number of final words in vector |
| 08:19 | eckroth | tomoj: 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:19 | tomoj | thanks, I found the original javadoc |
| 08:19 | eckroth | ok |
| 08:19 | tomoj | I never tried weka because their docs scared me away, thanks for clj-ml, maybe I'll try it |
| 08:19 | eckroth | tomoj: for what it's worth, I plan to further improve this library so I can fully use it :) stay tuned |
| 08:19 | eckroth | tomoj: ha, yeah, and the weka interface is even worse |
| 08:20 | ironm | necronian, thanks a lot :) |
| 08:20 | eckroth | tomoj: 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:21 | tomoj | hmm |
| 08:21 | babilen | tomoj: clj-ml is still maintained? |
| 08:21 | tomoj | I think that was part of what scared me away |
| 08:21 | eckroth | babilen: I have a fork I'm improving, because I want to use it for a project |
| 08:23 | eckroth | babilen: 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:23 | babilen | eckroth: 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:23 | eckroth | babilen: thanks, stay tuned |
| 08:23 | eckroth | got to go |
| 08:24 | tomoj | the core.matrix protocols seem very large |
| 08:24 | babilen | eckroth: 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:24 | tomoj | do we really need all that? |
| 08:25 | tomoj | I'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:26 | babilen | tomoj: 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:27 | tomoj | speedups relative to previous versions of core.matrix? |
| 08:27 | tomoj | seems a bit presumptuous to put it in clojure.* :) |
| 08:27 | babilen | no, to something not using core.matrix -- but let me try to find it before I make things up on the spot :) |
| 08:28 | tomoj | I was thinking the interface seems oriented around strictness |
| 08:28 | babilen | http://clojurefun.wordpress.com/2013/03/07/achieving-awesome-numerical-performance-in-clojure/ |
| 08:29 | tomoj | but I guess there's no reason you couldn't make a crazy matrix type that doesn't perform operations strictly |
| 08:29 | babilen | But yeah .. that person is definitely convinced that it is great. |
| 08:30 | babilen | + https://gist.github.com/siscia/5172981 |
| 08:30 | tomoj | hmm |
| 08:30 | tomoj | I think we should be able to get much closer to vectorz |
| 08:30 | tomoj | "mutable operation" ?! |
| 08:33 | tomoj | I'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:34 | tomoj | s/how/decide how/ |
| 08:37 | tomoj | thinking primarily of jcublas |
| 08:37 | tomoj | won't core.matrix's protocols be sort of problematic in that environment? |
| 08:40 | babilen | tomoj: Maybe you want to raise that on their mailing list (numerical-clojure on google groups) - I can't really comment on that. |
| 08:55 | tomoj | it looks like whether you can, for example, mset! on the return value of new-vector depends on the implementation used? |
| 08:59 | tomoj | I guess that makes sense |
| 09:45 | jcromartie | how can I get it to stop throwing an exception when I try to print my defrecord in the REPL |
| 09:45 | jcromartie | i.e. this print-method BS |
| 09:45 | jcromartie | I've set up a print-method for the type itself |
| 09:46 | jcromartie | never mind… stateful multimethod mell |
| 09:46 | jcromartie | *hell |
| 09:56 | jcromartie | invitation to critique my first take on this event sourcing design: https://gist.github.com/jcromartie/5221441 |
| 09:57 | jcromartie | it 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:59 | jcromartie | and it doesn't let you write things that can't be read back… although in a rather brute force fashion for now |
| 09:59 | jcromartie | this is for small numbers of writes, large numbers of reads |
| 10:00 | borkdude | can the chunk size of lazy sequences be changed (for demo purposes)? |
| 10:02 | borkdude | can the chunk size of lazy sequences be changed (for demo purposes)? |
| 10:04 | pjstadig | borkdude: 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:04 | pjstadig | you might be able to unchunk it and rechunk it at the clojure level |
| 10:04 | borkdude | pjstadig I just want to show that side effects only occur once per produced item in some demo coe |
| 10:05 | pjstadig | so you want a chunk size of 1? |
| 10:05 | borkdude | pjstadig yes |
| 10:05 | pjstadig | you can create a lazy seq that is not chunked to demonstrate that using lazy-seq |
| 10:05 | pjstadig | or maybe use a list? |
| 10:05 | borkdude | pjstadig lists are not lazy |
| 10:06 | pjstadig | i think generally vectors are the thing that usually causes chunking |
| 10:06 | pjstadig | i mean map a side effecting functionacross a list |
| 10:06 | pjstadig | map will only chunk if the seq it is mapping is chunked |
| 10:07 | borkdude | pjstadig I could just simplify the output in the demo, this is about lazyseqs which are always chunked I think? |
| 10:07 | pjstadig | ,(first (map (partial println) [1 2 3 4 5])) |
| 10:07 | clojurebot | 1\n2\n3\n4\n5\n |
| 10:07 | pjstadig | ,(first (map (partial println) '(1 2 3 4 5))) |
| 10:07 | clojurebot | 1\n |
| 10:09 | borkdude | pjstadig ah ehm, ok yes :) |
| 10:09 | borkdude | pjstadig so it depends on the input whether map will chunk its ouput |
| 10:09 | pjstadig | yeah |
| 10:09 | pjstadig | ~source map |
| 10:09 | borkdude | pjstadig I had the example of map over (range) |
| 10:10 | pjstadig | yeah range is another one that creates a chunked seq |
| 10:10 | borkdude | every day I learn something new :) |
| 10:10 | pjstadig | ~source range |
| 10:11 | Ember- | hi, I have a slight problem with enlive |
| 10:11 | Ember- | set-attr seems to encode my string no matter what I do |
| 10:11 | Ember- | that's not what I want since I have get parameters in it |
| 10:11 | Ember- | and & is transformed into & |
| 10:12 | Ember- | I cannot find any options or anything to bypass this behavior |
| 10:12 | Ember- | enlive is great but it's documentation is *really* lacking |
| 10:20 | Ember- | so either everyone who would know answer to my question is sleeping or no one actually knows the answer |
| 10:20 | Ember- | damnit |
| 10:23 | devn | Hm, is org-babel now basically dead due to nrepl? |
| 10:23 | devn | org-babel-clojure* |
| 10:23 | TimMc | muhoo: Oh, the reflection stuff! I'd basically forgotten about that. |
| 10:24 | stuartsierra | devn: I use org-babel with nREPL. |
| 10:25 | TimMc | muhoo: Is it in a basically-usable state? If so, I should just push what's there and tweak it later. |
| 10:30 | devn | stuartsierra: you have your dotfiles out on github? |
| 10:30 | devn | stuartsierra: i found http://blog.jenkster.com/2013/02/org-babel-clojure-and-nrepl.html -- is that sufficient? |
| 10:30 | stuartsierra | devn: Yes: github.com/stuartsierra/dotfiles |
| 10:30 | Anderkent | Any help with debugging horrid compilation times? (3+ minutes to AOT compile a project) |
| 10:30 | devn | stuartsierra: cool, thanks. |
| 10:30 | stuartsierra | np |
| 10:47 | jcidaho | anyone using midje and getting junit output as to work with a CI server? |
| 10:48 | jcidaho | I've seen a google groups post a year old about it, and an issue on midje github been going a year or so |
| 11:05 | Anderkent | jcidaho: 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:05 | Anderkent | clojure.test.junit is pretty much useless |
| 11:31 | jtoy_ | is anyone here using this library? https://github.com/dakrone/cld |
| 11:32 | jtoy_ | if so, could someone test this line for me: (cld.core/detect "你好吗") when I run it freezes the repl |
| 11:33 | jtoy_ | which seems like a crapp bug |
| 11:35 | wastrel | 你好 |
| 11:35 | jtoy_ | ?? |
| 11:35 | lazybot | jtoy_: Definitely not. |
| 11:35 | jtoy_ | lazybot: it works for you? |
| 11:35 | wastrel | ?foo |
| 11:35 | wastrel | ??foo |
| 11:35 | wastrel | maybe it's a bot response |
| 11:35 | wastrel | is it abot? |
| 11:35 | jtoy_ | ic |
| 11:36 | wastrel | ?? |
| 11:36 | lazybot | wastrel: What are you, crazy? Of course not! |
| 11:36 | dakrone | jtoy_: yes, we use it |
| 11:36 | wastrel | heh |
| 11:36 | dakrone | jtoy_: it may be that your REPL is freezing, not actually cld, can you try it in a file? |
| 11:36 | jtoy_ | 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:36 | wastrel | i just saw 你好吗 and thought i was in #mandarin for a sec |
| 11:36 | jtoy_ | every time |
| 11:37 | dakrone | if I recall correctly, jline has issues with some UTF-8 stuff when used for the REPL |
| 11:37 | dakrone | but feel free to open an issue on cld |
| 11:37 | jtoy_ | dakrone: ok, ill assume its the repl then for now |
| 11:37 | jtoy_ | ill do some more testing first |
| 11:41 | jtoy_ | this is my first time usine language-detect, but on short sentences its got some funny results: (cld.core/detect "hello") |
| 11:41 | jtoy_ | ["nl" {"nl" "0.5714277977843022", "fi" "0.42856886520061827"}] |
| 11:42 | trptcolin | jtoy_ / 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:42 | jtoy_ | (cld.core/detect "bye") => ["no" {"no" "0.9999913661473905"}] |
| 11:42 | jtoy_ | trptcolin: im on lein1, not sure if its fixed in lein2 |
| 11:42 | dakrone | jtoy_: right, so cld uses statistical models for determining the languages, the shorter the text, the less likely it is to be correct |
| 11:43 | trptcolin | jtoy_: yup, that'll do it |
| 11:43 | dakrone | jtoy_: I know lein1 has that issue, I used to run into it all the time |
| 11:43 | dakrone | jtoy_: you'll need to pass more than a single word in to get a better answer |
| 11:47 | jcromartie | please critique my new lib: https://github.com/jcromartie/deck |
| 11:47 | jcromartie | I am new at this. so I don't have a clojar or anything |
| 11:52 | Raynes | jcromartie: Looks kinda like https://github.com/flatland/cassette. But there aren't any docs yet so sorry. I'll probably write some today. |
| 11:53 | jcromartie | aw snap |
| 11:53 | jcromartie | :) |
| 11:53 | jtoy_ | 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:53 | jcromartie | well great minds think alike huh |
| 11:53 | Raynes | It probably isn't quite the same though. |
| 11:53 | dakrone | jtoy_: if the string were entirely numbers I *think* it might cause that also |
| 11:54 | Raynes | jcromartie: 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:54 | jtoy_ | ah, yes |
| 11:54 | jcromartie | yeah this is not so slick |
| 11:55 | jcromartie | it's literally a single append-only log file |
| 11:55 | Raynes | jcromartie: deck is? |
| 11:55 | jcromartie | yeah |
| 11:55 | Raynes | So is cassette. :D |
| 11:55 | jcromartie | oh I see something about subdirs |
| 11:56 | jcromartie | but I get it |
| 11:56 | Raynes | Except it partitions log files after n bytes. |
| 11:56 | Raynes | (like kafka) |
| 11:56 | jcromartie | neat |
| 11:56 | Raynes | By partition I mean it just starts a new file once the old file runs out of the space pre-allocated. |
| 11:56 | jcromartie | maybe I can make mine not as dumb in the future :) |
| 11:57 | Raynes | Well, I wasn't saying yours is dumb or anything. I only gave it a cursory glance. |
| 11:57 | jcromartie | oh no, mine is dumb |
| 11:57 | jcromartie | but for now it's tested stable and fast enough for many n in terms of concurrent writes and numbers of writes |
| 11:57 | Raynes | lol |
| 11:57 | jcromartie | my use case is for fairly small datasets |
| 11:58 | bttf | what does 'foo actually return ? |
| 11:58 | Raynes | Our use case for cassette is "Let's save ALL the things!" so that we can play them back later if we want. |
| 11:58 | bttf | a symbol named foo ? |
| 11:58 | jcromartie | like an administrative type web app, where you're just configuring a few things |
| 11:58 | Raynes | bttf: Yes. |
| 11:58 | bttf | ij |
| 11:58 | bttf | ok* |
| 11:58 | Raynes | Darn keyboards. |
| 12:01 | mpenet | mapdb is also nice for simple persistance |
| 12:01 | mpenet | it's just maps (more or less) from clojure |
| 12:02 | jcromartie | I like that but I have problems keeping the data model consistent |
| 12:02 | jcromartie | the idea behind my scheme is to only store inputs |
| 12:02 | jcromartie | (hello OOTTP) |
| 12:03 | jcromartie | so I can change the way the inputs build up the in-memory "current" data model |
| 12:03 | devn | Does anyone know the rationale behind choosing SSE over BrowserChannel? |
| 12:03 | devn | (in Pedestal) |
| 12:17 | pbostrom | devn: I was wondering something similar, but s/BrowserChannel/Webockets/ |
| 12:18 | ppppaul | is it easy for me to integrate a pedestal service with angularjs? |
| 12:18 | technomancy | websockets are a lot harder to support in servers, proxies, routers, etc |
| 12:28 | pbostrom | technomancy: interesting, do you think that's a result of lack of adoption in the industry or technical limitations of websockets spec? |
| 12:30 | tbaldridge | devn: 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:30 | tbaldridge | Websockets also allow for duplex communication, something that hasn't been added to pedestal yet. |
| 12:31 | tbaldridge | That being said feel free to submit a patch :-) |
| 12:31 | technomancy | pbostrom: SSE is just strictly easier technically |
| 12:31 | technomancy | lots of HTTP infrastructure assumes half-duplex |
| 12:32 | technomancy | websockets gets more buzz and is more flexible, but most people who say they want it would be happy with SSE |
| 12:33 | devn | tbaldridge: Gotcha. :) |
| 12:34 | pbostrom | I also wonder if an SSE implementation can handle more clients than websockets |
| 12:35 | jtoy_ | can somone show me an exampe that uses map and inc together, Im trying to do (map #( stuff ) ["foo","bar"]) => ["1foo" "2bar" ] |
| 12:36 | tbaldridge | jtoy_: I often use this (map #(str %1 %2) (range) ["foo" "bar"]) |
| 12:37 | llasram | &(doc map-indexed) |
| 12:37 | lazybot | ⇒ "([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:37 | jtoy_ | tbaldridge: ah, range works too |
| 12:37 | tbaldridge | there's also maped index |
| 12:37 | tbaldridge | *mapped-index |
| 12:37 | jtoy_ | how does mapped-index implement it? with an atom? |
| 12:37 | tbaldridge | https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L5618 |
| 12:38 | tbaldridge | bleh |
| 12:38 | tbaldridge | that's the link: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L5618 |
| 12:38 | tbaldridge | it's not pretty, because it has to deal with chunked seqs |
| 12:39 | jcrossley3 | tbaldridge: why io.pedestal.service.log instead of clojure.tools.logging? |
| 12:40 | jtoy_ | i ddint know you could pass multiple collections like that to map, nice |
| 12:41 | devn | tbaldridge: I'm trying out the chat application and am getting some exceptions. Are there some known issues? |
| 12:42 | tbaldridge | devn: not to my knowledge, it's been about a week or so since I personally have run the app though. |
| 12:42 | tbaldridge | what's the error? |
| 12:42 | ppppaul | any benchmarks comparing pedestal to ring? |
| 12:42 | tbaldridge | ppppaul: pedestal uses ring....so.... |
| 12:42 | devn | tbaldridge: https://gist.github.com/devn/5222833 |
| 12:43 | ppppaul | oh |
| 12:44 | tbaldridge | ppppaul: 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:44 | ppppaul | hmmm |
| 12:44 | ppppaul | when was this done? |
| 12:45 | ppppaul | i'm always looking at the ring docs, haven't seen anything related to pedestal |
| 12:45 | tbaldridge | https://github.com/ring-clojure/ring/commit/a8d5aa69b1153af7491bbbf4b70042f7c8c407be |
| 12:45 | ppppaul | woah, that's a huge commit |
| 12:46 | tbaldridge | So 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:46 | ppppaul | pretty cool. |
| 12:47 | gfredericks | is "ring" supposed to refer to the interceptors style now then? |
| 12:47 | ppppaul | i'm going to read through the whole commit |
| 12:47 | devn | interceptors are bigger than basic ring handlers |
| 12:47 | tbaldridge | devn: I've contacted a co-worker about that issue. I'm not sure what the answer is, perhaps email the pedestal google group? |
| 12:47 | weavejester | gfredericks: No, the standard middleware was just split into two parts to aid async usage. |
| 12:48 | gfredericks | weavejester: are there two SPECs now? |
| 12:48 | weavejester | gfredericks: Essentially as well as wrap-foo, you also get foo-request and foo-response |
| 12:48 | devn | tbaldridge: it's not a big issue for me, but i figure i'd ask someone who might now |
| 12:48 | weavejester | gfredericks: No, the SPEC hasn't changed. |
| 12:48 | devn | know* |
| 12:48 | gfredericks | weavejester: and wrap-foo can be derived from the other two |
| 12:48 | tieTYT | i 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:49 | weavejester | gfredericks: Correct. Ring 1.2.0 exposes some new functions, but the existing middleware acts the same way. |
| 12:49 | tieTYT | i'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:49 | gfredericks | tieTYT: 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:49 | tieTYT | gfredericks: how do you do that? |
| 12:50 | gfredericks | tieTYT: if you have the thing at the repl you can just look at it |
| 12:50 | tieTYT | right, how? |
| 12:50 | tieTYT | i've got enlive output |
| 12:50 | weavejester | tieTYT: 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:50 | gfredericks | type the name for the thing and it'll get printed out? |
| 12:50 | tieTYT | and it's so freaking huge I can't really tell what it is by printing it out |
| 12:50 | gfredericks | ah |
| 12:50 | gfredericks | there's a type function |
| 12:51 | gfredericks | so you can (type my-thing) and (type (first my-thing)) to get some idea |
| 12:51 | tbaldridge | devn: I just heard back, it's a confirmed bug. |
| 12:51 | ppppaul | does the interceptor ring commit make clojure channels redundant? |
| 12:51 | tieTYT | gfredericks: ah ok great, thanks |
| 12:51 | tieTYT | weavejester: what's that library called? |
| 12:51 | weavejester | ppppaul: Clojure channels? |
| 12:51 | weavejester | tieTYT: https://github.com/clojure/core.typed |
| 12:51 | weavejester | tieTYT: It's rather new, however. |
| 12:52 | ppppaul | then channels library (starts with an A... it recently got removed from clojure werkz) |
| 12:52 | ppppaul | https://github.com/ztellman/aleph |
| 12:52 | tieTYT | weavejester: I see, thanks |
| 12:53 | weavejester | ppppaul: Personally, I prefer Alephs use of channels over interceptors. |
| 12:53 | weavejester | They're a better abstraction for websockets. |
| 12:53 | gfredericks | so the interceptors approach would primarily require new adaptors -- is that correct? |
| 12:53 | weavejester | gfredericks: 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:54 | ohpauleez | tieTYT: I haven't scrolled back up to see the full conversation, but you might look at using protocols too |
| 12:54 | ohpauleez | which dispatch on type |
| 12:54 | gfredericks | and that doesn't exist yet? |
| 12:54 | tieTYT | ohpauleez: well I want to reject a certain type of input instead of handle them both |
| 12:54 | weavejester | gfredericks: I assume it does, if Pedistal is being used |
| 12:55 | gfredericks | weavejester: okay, so it's integrated with pedistal |
| 12:55 | gfredericks | or built into rather |
| 12:56 | gfredericks | I'm just trying to get a sense for where the clojure webstack generally is headed |
| 12:56 | weavejester | gfredericks: Yes, I believe they have something which is loosely equivalent to an adapter, but supports interceptors |
| 12:56 | ppppaul | https://github.com/ring-clojure/ring/commit/a8d5aa69b1153af7491bbbf4b70042f7c8c407be i'm looking at this and i'm failing to see the introduction of interceptors |
| 12:56 | ppppaul | though, i am only half way through the commit |
| 12:58 | tbaldridge | ppppaul: 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:58 | weavejester | gfredericks: I should note that I'm a little skeptical of interceptors. :) |
| 12:58 | weavejester | And of HTTP async in general. |
| 12:58 | ppppaul | i see those changes |
| 12:58 | ppppaul | i didn't realize that was all that was needed to be done |
| 12:58 | weavejester | HTTP async seems to me to be essentially a hack to get around a lack of websockets |
| 12:59 | ppppaul | so, i guess interceptors make use of those functions separately, while regular ring middleware uses them in the same place/time/thread |
| 12:59 | weavejester | ppppaul: Right |
| 12:59 | powr-toc | weavejester: 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:59 | tbaldridge | The 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:59 | tbaldridge | ppppaul: bingo. |
| 13:00 | ppppaul | interesting |
| 13:00 | weavejester | tbaldridge: Do you think there will be any reason to support async HTTP when websocket support becomes universal? |
| 13:00 | tomoj | what is "async http"? |
| 13:01 | ppppaul | tbaldridge, you guys tested the use of interceptors via simulant? |
| 13:01 | weavejester | tomoj: Anything that involves deliberately delaying a HTTP response I guess. |
| 13:02 | devn | tbaldridge: another thing you might want to fix in the chat client: |
| 13:02 | devn | <IMG style="width:300px; height: 300px" SRC=# onmouseover="document.location='https://www.youtube.com/watch?v=dQw4w9WgXcQ&noredirect=1'"> |
| 13:02 | tbaldridge | weavejester: 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:02 | devn | ;) |
| 13:02 | tomoj | isn't async still sometimes valuable when you have many concurrent requests which don't hang open? |
| 13:02 | devn | i know it's just a sample, but i set one up and of course the first thing Brad does is try to inject |
| 13:03 | devn | s/one/an instance of the chat app/ |
| 13:03 | tbaldridge | (disclaimer) I work for relevance, but nothing I say here should be taken as the gospel |
| 13:03 | weavejester | tbaldridge: That's an interesting point. I guess you can improve performance of the web server by not blocking. |
| 13:04 | ppppaul | is pedestal.io running off of pedestal? |
| 13:04 | ppppaul | wondering... cus it's buggy as fuck |
| 13:04 | technomancy | async stack traces =( |
| 13:05 | devn | ppppaul: why do you say that? |
| 13:05 | ppppaul | but, it's not communicating with the back end, so i think there is some weirdness going on with the dom or JS |
| 13:05 | ppppaul | devn, i can't scroll properly on the site, and the buttons on the site break |
| 13:05 | technomancy | someone found a way to take clojure stack traces and make them worse |
| 13:05 | devn | technomancy: haha |
| 13:05 | technomancy | devn: they said it couldn't be done |
| 13:05 | devn | well, not funny actually |
| 13:05 | devn | sort of depressing |
| 13:06 | ppppaul | technomancy, need a smart logger |
| 13:06 | tdignan | ppppaul: well, what browser are you using |
| 13:06 | llasram | technomancy: I really thought the stackholm syndrome would have set in for you by now |
| 13:06 | tomoj | it would be nice if you could swap async for sync and get the exact same semantics |
| 13:06 | tbaldridge | technomancy: that was Guido's argument against tail calls in Python as well "horrible stack traces" |
| 13:06 | ppppaul | using Version 25.0.1364.160 Ubuntu 12.10 (25.0.1364.160-0ubuntu0.12.10.1) *chrome* |
| 13:06 | tomoj | maybe. is that impossible and/or point-defeating? |
| 13:06 | technomancy | llasram: nope; I'm just filled with guilt over ignoring clj-stacktrace |
| 13:07 | devn | ppppaul: I'm on Version 25.0.1364.172 |
| 13:07 | tomoj | if you could do that you could replay your bugs in a sync environment for easier debugging? |
| 13:07 | tdignan | ppppaul: do you have any chrome add ons? |
| 13:07 | devn | OSX -- and no issues |
| 13:07 | technomancy | tbaldridge: 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:07 | tdignan | I'm using chrome on linux mint, no issues. |
| 13:07 | technomancy | (but guido was just using that as an excuse) |
| 13:07 | tbaldridge | real men debug with println :-P |
| 13:08 | tbaldridge | (just kidding) |
| 13:08 | ppppaul | tdignan, the site works a little better in firefox |
| 13:08 | devn | speaking of debugging... ritz... |
| 13:08 | devn | what's up with ritz, yo? |
| 13:08 | tdignan | do you have javascript enabled and everything |
| 13:09 | devn | anyone in here use ritz? |
| 13:09 | ppppaul | i have extensions and JS enabled. i don't see anything coming up in the console. |
| 13:09 | ppppaul | i don't see any network requests |
| 13:10 | ppppaul | my extensions don't effect other sites |
| 13:10 | devn | ppppaul: if you have user scripts or other user installed extensions try disabling them and see what happens |
| 13:10 | ppppaul | cept for flashblock, which usually improves performance |
| 13:10 | devn | oh, the pedestal.io site is completely written in flash |
| 13:10 | devn | (jk) |
| 13:12 | tieTYT | is there any plans to make declare unnecessary in the language? |
| 13:12 | `fogus | tieTYT: I doubt it. |
| 13:13 | tieTYT | oh |
| 13:13 | llasram | tieTYT: Note that `declare` is something you find very rarely in most Clojure code |
| 13:13 | nDuff | Multi-pass compilation would be a pretty big change. |
| 13:13 | nDuff | ...would mean things wouldn't behave the same way in and out of the REPL. |
| 13:14 | llasram | Multi-form, really |
| 13:14 | tieTYT | llasram: is that because people have written their code to adjust to that? |
| 13:14 | technomancy | the talk on racket at clojurewest made me really appreciate that clojure got its compilation model right |
| 13:14 | nDuff | tieTYT: People usually write their code to declare things in dependency order, yes. |
| 13:14 | technomancy | so much nonsense you just don't have to think about =) |
| 13:14 | tieTYT | personally, I like to start at the high level and break it down |
| 13:14 | nDuff | tieTYT: If you don't do that, you can't run the same code in a REPL, and that's silly. |
| 13:14 | tbaldridge | (inc techomancy) |
| 13:14 | lazybot | ⇒ 1 |
| 13:14 | nDuff | (well, can't run it in a REPL starting from a blank namespace) |
| 13:15 | ppppaul | tbaldridge, can you help me understand how pedestal scales? |
| 13:15 | `fogus | tieTYT: Does "high-level" need to mean "top of file"? |
| 13:16 | tieTYT | no, 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:16 | tbaldridge | ppppaul: 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:16 | tieTYT | I 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 | `fogus | tieTYT: Me too. :-) |
| 13:17 | tieTYT | `fogus: so do you start at the bottom and add upwards? |
| 13:17 | tieTYT | add code upwards, I mean |
| 13:18 | `fogus | tieTYT: I don't know. It depends on the problem. I usually start with INDATA -> OUTDATA and work inward from there |
| 13:19 | tieTYT | i see |
| 13:20 | `fogus | I work in Emacs, so top or bottom doesn't matter. What matters is when I hit C-e |
| 13:20 | tieTYT | what does that do? |
| 13:20 | tieTYT | i've never used emacs |
| 13:20 | `fogus | eval form |
| 13:21 | `fogus | I meant C-xC-e :p |
| 13:22 | tieTYT | i think i'm missing a step. Are you rearranging the code after you do that? |
| 13:22 | tieTYT | after=before |
| 13:23 | `fogus | tieTYT: No. |
| 13:23 | tieTYT | then you're naturally writing your code in a way that avoids declare or you use declare? |
| 13:24 | `fogus | tieTYT: You're conflating where the text lies in the file with when it needs to be written |
| 13:24 | `fogus | I write the functions when I need them and lay them where the compiler likes them |
| 13:25 | tieTYT | ok |
| 13:25 | `fogus | Moving up or down is the same number of keystrokes... no productivity lost |
| 13:26 | tomoj | until next repl session :) |
| 13:27 | `fogus | tomoj: Isn't that a problem in every Lisp? |
| 13:28 | `fogus | Any time you run in a REPL you run the risk that what's in memory is not the same as in text. |
| 13:28 | `fogus | That was a problem that Smalltalk didn't have... ;-) |
| 13:29 | technomancy | we call that "getting slimed" |
| 13:29 | `fogus | technomancy: I like that |
| 13:41 | pjstadig | but we'll have to change it |
| 13:41 | pjstadig | to getting nrepl'ed? |
| 13:41 | pjstadig | doesn't have the same ring |
| 13:41 | technomancy | let it live on as a piece of history |
| 13:41 | pjstadig | hehe |
| 13:42 | pjstadig | like car and cdr |
| 13:42 | kanwei | anyone here using Pedestal? |
| 13:43 | tbaldridge | pjstadig: it's funny to here the miniKanren people "so if we simple cooder down the list..." |
| 13:43 | tbaldridge | wwaaatt? oh....cdr-down the list...I see.... |
| 13:43 | tbaldridge | <-- no scheme background |
| 13:45 | TimMc | cdadadddddaaaar |
| 13:45 | TimMc | better than juxt |
| 13:45 | pjstadig | tbaldridge: it's a lisp problem too |
| 13:46 | tbaldridge | skeuomorphs ftw |
| 13:47 | amalloy | TimMc: 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:50 | pjstadig | amalloy: don't worry...i got your back |
| 13:53 | antoineB | hello, i would like to change how a defrecord are printed to sreen, which prototype should i change? |
| 13:53 | gfredericks | is that possible? |
| 13:53 | technomancy | print-method |
| 13:54 | jcromartie | :) just did it this morning antoineB |
| 13:54 | davidchambers | I'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:54 | antoineB | is it a multi method? |
| 13:54 | jcromartie | just (defmethod print-method YourType [obj ^java.io.Writer writer] ...) |
| 13:54 | jcromartie | then (.write writer ...) |
| 13:54 | antoineB | ok thanks |
| 13:55 | tieTYT | if I have a situation where a multimethod might work, should I attempt to use a protocol instead? |
| 13:56 | technomancy | tieTYT: no |
| 13:56 | antoineB | i will suspect prototype are a little bit faster |
| 13:56 | tbaldridge | tieTYT: I suggest use protocols if you will always dispatch on the object type, or you need speed |
| 13:57 | tieTYT | can multimethods dispatch on the object value? |
| 13:57 | tbaldridge | yes |
| 13:57 | tieTYT | oh ok |
| 13:57 | tieTYT | i need to find some better tutorials on it |
| 13:57 | tbaldridge | multimethods take a dispatch function, the output of that function is what it dispatches on |
| 13:57 | tbaldridge | (defmulti foo (fn [x] (:bar x))) |
| 13:57 | technomancy | multimethods have a lot fewer confusing edge cases around reloading and AOT |
| 13:57 | technomancy | >_< |
| 13:58 | antoineB | tieTYT: multi dispatch on everything you want about the arguments you pass in |
| 13:58 | tbaldridge | technomancy: really? because if you reload you can't redef the dispatch fn of multimethods |
| 13:58 | tbaldridge | or has that changed? |
| 13:58 | technomancy | tbaldridge: right; there is one confusing edge case. which is a lot less than the number of confusing edge cases surrounding protocols. |
| 13:59 | technomancy | it's still stupid, but not as stupid. |
| 13:59 | technomancy | err--not as annoying |
| 13:59 | tbaldridge | what are the edge cases for protocols? I can't think of any I've hit. |
| 14:00 | technomancy | if you AOT code that uses a protocol and the protocol's .class files go away, it can't fall back to JIT |
| 14:00 | technomancy | if you reload a defrecord it breaks equality; you can have two visually indistinguishable objects that are not equal. |
| 14:00 | tbaldridge | ah, that's it then. I never AOT code, so that's why I haven't hit it |
| 14:00 | tbaldridge | interesting, I'll keep that in mind, thanks. |
| 14:00 | technomancy | there are more, but I've literally never used protocols; that's just what I've got by osmosis hanging out in IRC. |
| 14:01 | technomancy | I'd be tempted to fix the defmulti reloading bug if it weren't for jira |
| 14:02 | antoineB | did you ever need to reloading ? |
| 14:02 | `fogus | technomancy: If you fix it I'll deal with Jira. ;-) |
| 14:02 | Bronsa | I was just going to propose that too. |
| 14:03 | technomancy | `fogus: I'll add it to the seajure project list then =) |
| 14:03 | `fogus | But I'll happily defer to Bronsa. ;-) |
| 14:03 | `fogus | :p |
| 14:03 | `fogus | technomancy: Where is that list? |
| 14:04 | technomancy | `fogus: https://github.com/Seajure/seajure/wiki |
| 14:04 | technomancy | I really want to do print-method for namespaces |
| 14:05 | `fogus | Oh! I've never thought of that. That would be fun |
| 14:05 | cap10morgan | ah ha! lein new midje foo-bar is creating the namespace foo_bar.core instead of foo-bar.core. gonna pull request that. |
| 14:05 | technomancy | seems like a silly omission |
| 14:10 | ToBeReplaced | antoineB: i'm curious in the solution... was the answer just (defmethod print-method ClassName [r writer] (.write writer "my string function")) ? |
| 14:12 | antoineB | yes |
| 14:15 | antoineB | the question we can ask is why using a defmethod over a protocol for print-method? (i think it is a protocol for cljs) |
| 14:17 | technomancy | antoineB: print-method is IO-bound by definition; dispatch overhead is not an issue |
| 14:17 | technomancy | also protocols didn't exist back then, but whatever |
| 14:18 | sundbp | i'm trying to use gen-class with :impl-ns to have the implementation in another namespace and avoid AOT |
| 14:18 | antoineB | ok |
| 14:19 | sundbp | i'm strugglign and getting these kinds of errors: com.tulos.lo.examples.ExampleCljAddIn> (com.tulos.lo.examples.ExampleCljAddIn.) |
| 14:19 | sundbp | CompilerException java.lang.ClassFormatError: Duplicate method name&signature in class file com/tulos/lo/examples/Exam\ |
| 14:19 | sundbp | pleCljAddIn, compiling:(NO_SOURCE_PATH:1:24) |
| 14:20 | sundbp | that namespace has a :gen-class statement in the (ns ..) part. and uses :impl-ns 'tulos.addin |
| 14:21 | sundbp | in 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:21 | sundbp | does that sound like the right starting point? |
| 14:28 | jtoy_ | 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:29 | ToBeReplaced | what is map-index? |
| 14:30 | mpenet | it does happen in order, it would be a bit useless it that was not the case |
| 14:30 | jtoy_ | i see what happens, nm |
| 14:30 | jtoy_ | yes, exactly |
| 14:30 | AimHere | ToBeReplaced, there's a function map-index that assigns a numeric value as the first argument of the function you're mapping over |
| 14:31 | AimHere | map-indexed, rather. Presumably map-index is the index |
| 14:31 | AimHere | &(map-indexed (fn [idx _] idx) [:a :b :c :d]) |
| 14:31 | lazybot | ⇒ (0 1 2 3) |
| 14:32 | ppppaul | &(map-indexed (fn [& _] (reverse _) [:a :b :c :d]) |
| 14:32 | lazybot | java.lang.RuntimeException: EOF while reading, starting at line 1 |
| 14:33 | ppppaul | &(map-indexed (fn [& _] (reverse _)) [:a :b :c :d]) |
| 14:33 | lazybot | ⇒ ((:a 0) (:b 1) (:c 2) (:d 3)) |
| 14:37 | devn | Does Michael Klishin hang out in here ever? |
| 14:40 | amalloy | devn: you mean antares? yes |
| 14:43 | uvtc | How 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:44 | tbaldridge | uvtc: fastest way to process vectors is reducers |
| 14:44 | tbaldridge | uvtc: unless you use loops, using nth+map won't get you much |
| 14:44 | ToBeReplaced | ,(map-indexed #(vector %1 %2) [:a :b :c] |
| 14:44 | clojurebot | #<RuntimeException java.lang.RuntimeException: EOF while reading> |
| 14:44 | gfredericks | at worst (doseq [[i x] (map list (range) xs)] ...do stuff...)) |
| 14:44 | ToBeReplaced | ,(map-indexed #(vector %1 %2) [:a :b :c]) |
| 14:44 | clojurebot | ([0 :a] [1 :b] [2 :c]) |
| 14:45 | uvtc | ToBeReplaced: Ah, yes. I think that's what I want. Then I can put that in my `doseq [...]`. |
| 14:46 | uvtc | tbaldridge: thanks. Though, haven't studied reducers yet. Would use a loop, but I think what ToBeReplaced suggested is what I was looking for. |
| 14:46 | gfredericks | uvtc: ToBeReplaced or (map-indexed vector [:a :b :c]) is shorter |
| 14:46 | ToBeReplaced | gredericks is better... map list (range) xs |
| 14:46 | tbaldridge | uvtc: reducers also have the nice side-effect of being parallel (using multiple CPUs) |
| 14:46 | ToBeReplaced | ,(map-indexed vector [:a :b :c]) |
| 14:46 | clojurebot | ([0 :a] [1 :b] [2 :c]) |
| 14:47 | Raynes | cemerick: Asciidoc is excellent. |
| 14:47 | cemerick | Raynes: for sure |
| 14:47 | uvtc | gfredericks: thanks. |
| 14:47 | cemerick | or, it sucks, but it's maximally capable |
| 14:47 | gfredericks | uvtc: yerp |
| 14:49 | amalloy | gfredericks: i hear your swearjure talk was well received |
| 14:50 | borkdude | are there any talks online yet from clojurewest? |
| 14:50 | amalloy | borkdude: if the talks went online the next day, i bet attendance would drop quite a bit |
| 14:51 | uvtc | The PyCon ones went up *quick* (though not next-day). |
| 14:51 | technomancy | pycon has way more $$$ |
| 14:56 | gfredericks | amalloy: yeah it went better than I was expecting |
| 14:56 | gfredericks | thankfully rich gave me a great opening line |
| 14:56 | tbaldridge | gfredericks: that was an awesome talk |
| 14:57 | gfredericks | tbaldridge: thx |
| 14:57 | amalloy | gfredericks: not having heard this line, i'm now imagining rich introducing swearjure as "A #$*&ing joke of a language" |
| 14:58 | jtoy_ | 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:58 | gfredericks | amalloy: he spent half his keynote harping on self-imposed constraints |
| 14:58 | rabbit_airstrike | gfredericks: that was a hilarious talk. |
| 14:58 | gfredericks | jtoy_: sets don't have order |
| 14:58 | ToBeReplaced | if it's ordered, it's not a set... if you just want to strip duplicates, try distinct |
| 14:59 | amalloy | ToBeReplaced: not strictly true. if it's ordered it's not a hashset, but you can certainly design sets which are ordered |
| 14:59 | jtoy_ | hos is this able top keep an order: (def features (set (list (feature "gender" 0 :categorical) (feature "age" 1 :categorical)))) |
| 14:59 | rabbit_airstrike | sorted-set |
| 14:59 | amalloy | jtoy_: coincidental implementation details |
| 14:59 | jtoy_ | i tested it with many items, it always keeps the order of which the items were added |
| 15:00 | jtoy_ | i want to do the same thing as that but programitically generate the data |
| 15:00 | amalloy | hash sets are not ordered, and any sets which appear to be ordered are just luck |
| 15:00 | amalloy | (not actually luck, but you should pretend it's luck, since it's not any kind of guarantee) |
| 15:00 | ToBeReplaced | amalloy: what's an example for me to google? |
| 15:00 | jtoy_ | hmm, i wouldnt be surprised if the library has a bug |
| 15:01 | amalloy | &(apply sorted-set (range 40)) |
| 15:01 | lazybot | ⇒ #{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:01 | amalloy | $google flatland ordered set |
| 15:01 | lazybot | [flatland/ordered · GitHub] https://github.com/flatland/ordered |
| 15:01 | amalloy | are two reasonable ways to have sets which give ordering guarantees |
| 15:01 | jtoy_ | ok, ill just use sorted set |
| 15:01 | amalloy | jtoy_: we'll still be here, when you discover that's not what you want |
| 15:01 | jtoy_ | i think the library is implemented not very well, i need to give it data like that |
| 15:02 | jtoy_ | amalloy: haha, ok |
| 15:03 | ToBeReplaced | hm... i've never had a use before... when do you end up using something like that? |
| 15:03 | gfredericks | when writing legacy code |
| 15:04 | jtoy_ | amalloy: hmm, that makes it work, yeah! the required format doesnt make sense |
| 15:06 | jtoy_ | why would one use the flatland stuff vs the the core ones? for clojurescript? |
| 15:06 | gfredericks | I think flatland's are insertion-order |
| 15:06 | gfredericks | whereas clojure are value-order |
| 15:08 | gfredericks | &(apply sorted-set-by #(rem % 3) (range 40)) |
| 15:08 | lazybot | clojure.lang.ArityException: Wrong number of args (2) passed to: sandbox9396$eval46487$fn |
| 15:09 | jtoy_ | amalloy: yeah, you are right, that is not what I want |
| 15:09 | amalloy | (inc amalloy) :( |
| 15:10 | jtoy_ | i want the insertion-order sets, without adding more libraries :( |
| 15:10 | amalloy | gfredericks: sorted-set-by takes a comparator, unlike sort-by which takes a keyfn |
| 15:11 | gfredericks | yeah |
| 15:11 | gfredericks | I didn't care enough to redo it |
| 15:11 | amalloy | jtoy_: 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:13 | jtoy_ | 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:14 | thm_prover | I 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:14 | thm_prover | [especialy since the file names seems to be encoded in a way that encodes all information] |
| 15:18 | sundbp | using 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:19 | sundbp | i 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:23 | devn | what do people use for socket libraries? |
| 15:23 | zackzackzack | Is there a way to get more information about why a call is forcing the JVM to do reflection? |
| 15:23 | devn | I want to grab a websocket stream over 443 |
| 15:24 | zackzackzack | I'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:24 | amalloy | devn: aleph has a good websocket server, if you're comfortable with aleph and lamina |
| 15:24 | pbostrom | 2nd aleph |
| 15:25 | ppppaul | what is lamina for? |
| 15:25 | ppppaul | amalloy, |
| 15:25 | TimMc | technomancy: I installed Debian Squeeze. It's so beautiful I could cry... |
| 15:25 | TimMc | A thousand papercuts, suddenly removed. |
| 15:26 | gfredericks | beautiful compared to what? |
| 15:26 | TimMc | Latest Ubuntu. |
| 15:26 | pbostrom | ppppaul: lamina provides a "channels" abstraction around the websocket interface |
| 15:27 | amalloy | well, around a lot more than websockets |
| 15:27 | TimMc | gfredericks: beautiful == usable |
| 15:28 | ppppaul | oh. cool. |
| 15:32 | sundbp | worked it out. note to others: when using gen-class, don't explicitly list the interface methods you implement! |
| 15:33 | arrdem | TimMc: welcome to the Ubuntu expats club XP |
| 15:39 | devn | aww, wish ztellman was around |
| 15:40 | amalloy | devn: he's very responsive on the lamina/aleph/gloss MLs |
| 15:41 | devn | amalloy: cool, thanks -- looks like 0.5.0-SNAPSHOT (channel) is broken |
| 15:41 | devn | or the docs are out of date... |
| 15:42 | amalloy | i 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:42 | devn | hm, weird |
| 15:42 | amalloy | of course, X is broken is un-fixable |
| 15:42 | devn | amalloy: 0.5.0-SNAPSHOT? |
| 15:42 | devn | amalloy: i got a wrong number of arguments when I use (channel) |
| 15:43 | devn | amalloy: ArityException Wrong number of args (1) passed to: node$eval4985$queue clojure.lang.AFn.throwArity (AFn.java:437) |
| 15:43 | amalloy | lol. yep, looks like. i guess i just don't create empty channels myself |
| 15:44 | devn | amalloy: it fails with args as well i think |
| 15:44 | devn | like (channel 1 2 3) |
| 15:44 | amalloy | devn: bet you a dollar it's fixed within 10 minutes |
| 15:44 | devn | haha yeah, i bet you're right, i saw he committed like an hour ago |
| 15:50 | tbaldridge | technomancy: 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:56 | jtoy_ | amalloy: could you help me to fix this set issue? https://www.refheap.com/paste/12838 im really close |
| 15:57 | jtoy_ | its returned in a list? that is not a set? |
| 15:57 | ohpauleez | tbaldridge: 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:58 | tbaldridge | ohpauleez: 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:59 | tbaldridge | Or is that just crazy talk? Does the whole Java package system break down for native libs? |
| 15:59 | ztellman | devn: 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:59 | ohpauleez | tbaldridge: Nah, that's definitely reasonable. clojure-leap does this with Windows and OSX binaries. |
| 16:00 | ohpauleez | but the Java code does a conditionally lookup and load on launch |
| 16:00 | ohpauleez | and since they're all in the resource path, all works out ok |
| 16:00 | tbaldridge | ah, so do you simply include all libs in a single package? |
| 16:00 | ohpauleez | but I don't know if that's a good solution |
| 16:00 | ztellman | devn: a fix is pushed to clojars/github |
| 16:01 | ohpauleez | yeah |
| 16:01 | ohpauleez | you get the kitchen sink :) |
| 16:01 | ohpauleez | but you get portability |
| 16:01 | Raynes | amalloy: ^ Just a bit over 10 minutes. |
| 16:01 | tbaldridge | yeah. Well that could work. I'll look into it. Thanks. |
| 16:01 | ohpauleez | np |
| 16:02 | ztellman | Raynes: I was away from my computer when amalloy told me |
| 16:04 | Raynes | cemerick: 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:04 | cemerick | Raynes: what is that from? |
| 16:05 | Raynes | cemerick: 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:05 | Raynes | Incompatible versions of reply and nrepl, perhaps? |
| 16:06 | ohpauleez | Raynes: You've got to calibrate the qubits, before nREPL stabilizes. |
| 16:07 | Raynes | cemerick: I can require my namespaces and stuff, so it at least is kind of working. |
| 16:07 | Raynes | It's nrepl 0.2.2 and lein 2.1.1 |
| 16:07 | cemerick | Raynes: whew. Sounds like a reply bug. |
| 16:08 | Raynes | trptcolin: ^ |
| 16:08 | Raynes | bitchbitchwhine |
| 16:08 | Raynes | (it isn't so broken that it is unusable though, so what evs) |
| 16:08 | cemerick | Raynes: that doesn't happen with a regular `lein repl` with the same deps though? |
| 16:09 | Raynes | No. |
| 16:09 | Raynes | Well, I didn't actually try. |
| 16:09 | cemerick | right |
| 16:09 | cemerick | well, at least you said it with conviction |
| 16:09 | cemerick | the profile stuff around e.g. :connect is a bit wonky IIRC |
| 16:09 | Raynes | I'm a very insincere person. |
| 16:09 | Raynes | Yeah, lein repl works fine |
| 16:11 | cemerick | oh, you're starting the server manually, so the profile stuff isn't relevant |
| 16:14 | devn | ztellman: Thanks! (amalloy I owe you a dollar) |
| 16:14 | ztellman | devn: if you have any other questions, let me know |
| 16:14 | jtoy_ | amalloy: completely fixed it,thx forthe help |
| 16:14 | trptcolin | Raynes: 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:15 | Raynes | trptcolin: Completion works. |
| 16:15 | jtoy_ | does clojure have a respond to? |
| 16:15 | devn | ztellman: 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:15 | trptcolin | Raynes: ah, cool. i see, was grepping and mistook a local for a var |
| 16:15 | Raynes | devn: Stop stealing my bitcoins. |
| 16:16 | devn | hahaha |
| 16:16 | devn | This 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:16 | ztellman | (lamina.core/receive-all @(aleph.http/websocket-client {:url "http…"}) prn) |
| 16:16 | devn | Mission accomplished. |
| 16:16 | ztellman | or something like that |
| 16:17 | trptcolin | Raynes: GH ticket me? |
| 16:17 | ztellman | I'm not 100% sure the websocket client and https play nicely together |
| 16:17 | ztellman | but that's an easy fix, if you have an issue with that |
| 16:17 | Raynes | trptcolin: Sure. |
| 16:17 | trptcolin | cool, thanks - got some jline non-BMP character debugging i'm in the middle of |
| 16:17 | Raynes | trptcolin: Have no clue what the problem is so I'm just going to slap the keyboard for the title. |
| 16:18 | trptcolin | just stick the error msg in there, that's good enough |
| 16:25 | ztellman | devn: if you're having issues with the SSL certs, add ':ignore-ssl-certs? true' to the websocket-client option map |
| 16:27 | technomancy | TimMc: pure and uncut |
| 16:28 | ztellman | or just use the non-https endpoint, which I just noticed, and seems to work just fine |
| 16:28 | technomancy | tbaldridge: no docs unfortunately; all I can point to is the implementation. |
| 16:28 | technomancy | every 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:28 | Raynes | cemerick: 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:29 | cemerick | Raynes: depends on your env though, right? |
| 16:29 | technomancy | tbaldridge: 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:30 | technomancy | lein can DTRT but if you need it to run as an uberjar you've got to do all the heavy lifting yourself |
| 16:31 | Raynes | cemerick: Ask amalloy, he is the one who is all horrified of the world wide web. :p |
| 16:32 | technomancy | binding 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:32 | cemerick | Raynes: 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:32 | amalloy | i 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:32 | amalloy | though i would like it to change, i suppose |
| 16:32 | cemerick | it's a fair point |
| 16:34 | jtoy_ | 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:34 | amalloy | personally i'd rather leave the readme alone, and have the default bind address be localhost rather than 0.0.0.0 |
| 16:35 | technomancy | someone yelled at be for making swank bind to 0.0.0.0 by default |
| 16:35 | Raynes | Yeah, I brought it up because amalloy just yelled at me for binding to 0.0.0.0. |
| 16:35 | gfredericks | jtoy_: use (:refer-clojure :exclude [resolve]) in your ns declaration |
| 16:35 | squidz | does anybody know why compojure doesnt automatically load changes made to html/code |
| 16:36 | gfredericks | jtoy_: assuming of course you're bringing in the other one on purpose and want to use it and not the clojure one |
| 16:36 | technomancy | you 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:36 | Raynes | technomancy: nrepl isn't just for dev tools though. |
| 16:36 | Raynes | Users embed it in their applications. |
| 16:36 | Raynes | And they have to set the port and address in those cases. |
| 16:37 | amalloy | Raynes: you would only embed nrepl in an app as a dev tool |
| 16:37 | TimMc | localhost-by-default would be very reasonable |
| 16:37 | technomancy | Raynes: yep, and forcing them to pay attention or get owned is sad times |
| 16:37 | Raynes | amalloy: Whatever. |
| 16:37 | Raynes | I think my point was clear. |
| 16:37 | jtoy_ | gfredericks: thx, was just reading about that |
| 16:38 | squidz | i thought clojure was supposed to automatically load code while running |
| 16:39 | technomancy | squidz: that would make for some pretty rotten performance |
| 16:39 | squidz | but while in some kind of development mode? |
| 16:39 | technomancy | lein-ring does it in development mode, yeah |
| 16:40 | squidz | because if I have to start my ring server every time I want to see changes, it's not much better than java |
| 16:40 | technomancy | but it's much simpler just to connect a repl to it and reload that way |
| 16:40 | squidz | okay so maybe im not in development mode |
| 16:41 | squidz | so if I start my server in my terminal with lein ring server , how do I send my evaluations from emacs to it |
| 16:41 | squidz | I guess when I jack-in it starts a separate repl? |
| 16:41 | borkdude | squidz don't start it via lein ring, but via lein repl |
| 16:42 | technomancy | squidz: right; so you can just launch a web server via jetty from your repl |
| 16:42 | technomancy | https://github.com/technomancy/syme/blob/master/src/syme/web.clj#L161 |
| 16:42 | squidz | technomancy: from the repl i jacked-in to with emacs nrepl? |
| 16:42 | technomancy | aye |
| 16:42 | squidz | okay thanks this was bugging me |
| 16:42 | technomancy | you can launch a repl from lein ring too, but it's a bit more complicated |
| 16:43 | technomancy | indeed; running without a repl is like running blind |
| 16:43 | squidz | yeah I thought there has to be something im missing |
| 16:47 | drorbemet | Which is the current way of writing the out and printed output of a function evaluated in the repl to a file? |
| 16:47 | drorbemet | I read clojure.contrib.io doc and clojure.java.io doc ... which functions to use is still unclear to me .. |
| 16:48 | Raynes | cemerick: 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:48 | nDuff | drorbemet: rebind *out* to your file |
| 16:48 | Raynes | I'd happily provide either of these modifications, but I'm not sure I can bear the Jira patch nonsense for something this simple. |
| 16:49 | drorbemet | nDuff: that's to short for me at the moment, I don't even have a file handle, buffer or writer ... |
| 16:50 | drorbemet | nDuff: I deleted a file though with delete-file |
| 16:54 | edw | OK, 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:55 | technomancy | there is no easy, only familiar |
| 16:55 | tbaldridge | edw: I've had very bad experiences with LT. Perhaps that's simply because it's still "pre-alpha" though |
| 16:56 | aaelony | difficult equates to unfamiliar |
| 16:57 | nDuff | edw: There is no conventional REPL in LT, just the instarepl. Which is fine / all one needs, IME. |
| 16:58 | edw | So, 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:58 | arrdem | nDuff: define instarepl? |
| 16:59 | tbaldridge | like a repl but more instant |
| 16:59 | tbaldridge | :-P |
| 16:59 | nDuff | arrdem: Watch any Light Table demo video. Type code in editor -> evaluation result shown in editor alongside code, updated as you edit. |
| 17:00 | nDuff | arrdem: ...includes showing values of locals in other functions called during execution, etc etc. Generally pretty shiny. |
| 17:00 | edw | technomancy: Perhaps I have spent too many years (~25) in Emacs. |
| 17:00 | technomancy | edw: no such thing |
| 17:01 | edw | Yes, but I'm trying not to put my bigotry on display. |
| 17:01 | technomancy | "too many years to understand how normal people use computers" is possible though |
| 17:01 | borkdude | edw I hope I have mastered emacs in 25 years, but for now I will use it's basic features |
| 17:01 | borkdude | its |
| 17:02 | edw | But seriously, I am open-minded about LT: I wouldn't mind Squeak + CLJS + Emacs. But I'm utterly lost. |
| 17:03 | borkdude | didn't rich say something about emacs on clojurewest? saw smth on twitter |
| 17:04 | Raynes | Oh man, if Rich mentioned Emacs it'll validate the past 37 years of work on the editor! |
| 17:04 | edw | OK, I give up. Back to Emacs + nrepl + autocomplete. |
| 17:05 | ieure | borkdude, Rich said he uses Aquamacs, which, ewww. |
| 17:05 | technomancy | Raynes: he said if you spend more than 15m a day writing elisp you'll go blind |
| 17:05 | squidz | technomancy: wow thanks for the tip, I started my server from the repl in emacs and now everything works like magic :D |
| 17:05 | nDuff | edw: 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:05 | edw | technomancy: More than thirty minutes a day? Hairy palms. Forty-five? Neckbeard. |
| 17:06 | Raynes | Rich has never been particularly cutting edge on the environment front. |
| 17:06 | edw | So Rich has a 115 baud acoustic coupled modem connected to a daisywheel TTY? |
| 17:06 | arrdem | Raynes: we have The One True Editor.. what's to be cutting edge about? |
| 17:07 | yogthos | nDuff: I've been getting by with ccw myself :) |
| 17:07 | nDuff | Ewww. |
| 17:07 | yogthos | nDuff: it does all I need, got repl, paredit works acceptably |
| 17:08 | yogthos | nDuff: and I do need to work with java once in a while ;( |
| 17:08 | yogthos | nDuff: but purity aside, it's definitely usable for real work is my point |
| 17:09 | nDuff | yogthos: 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:09 | yogthos | nDuff: ah yeah that's fair :) |
| 17:09 | squidz | technomancy: do you know by chance if there is a way to reload when html is changed? |
| 17:09 | yogthos | nDuff: at this point I'm holding out for LT to actually mature |
| 17:10 | technomancy | squidz: depends on the templating lib |
| 17:10 | squidz | it is just plain html with enlive |
| 17:10 | technomancy | I think you just recompile the deftemplate, but I haven't used enlive in a while |
| 17:10 | squidz | so 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:10 | squidz | yeah thats right |
| 17:11 | squidz | but I guess im getting greedy and wanted to just see changes on html save |
| 17:11 | technomancy | squidz: you could do it in an emacs after-save-hook |
| 17:11 | technomancy | but emacs has no way of knowing which .html file corresponds with which .clj file |
| 17:11 | squidz | okay ill keep it simple and just evalueate the deftemplate |
| 17:12 | squidz | its already a lot better than java |
| 17:13 | squidz | i used hiccup first because it was easiest to grasp, then I switched to mustache, and now I landed at enlive |
| 17:13 | borkdude | so, what is the -canonical- templating library nowadays :P |
| 17:13 | technomancy | there's no one right answer |
| 17:14 | squidz | I 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:16 | borkdude | technomancy I thought there was some self declared canonical new web thing recently ;P |
| 17:17 | squidz | yeah I still have to look into pedestal |
| 17:17 | squidz | ive glanced over it, but haven't grokked it yet |
| 17:17 | technomancy | borkdude: last I checked Canonical is still using Python. =P |
| 17:18 | borkdude | lol |
| 17:18 | squidz | lol |
| 17:19 | technomancy | 2-lol combo; not bad but we can do better |
| 17:19 | borkdude | plol |
| 17:21 | tyler | whats like conj but puts on the end of list? |
| 17:21 | borkdude | tyler conj puts at the end if it gets a vector |
| 17:22 | borkdude | tyler conj is a polymorfic function |
| 17:22 | tyler | ah not sure what class its passing in, i assumed it was list but might be a vector |
| 17:22 | tyler | didn't write this code |
| 17:22 | dansalmo | would anyone here be interested in trying out a web based interpreter for lambda calculus that uses indices instead of traditional lambda notation? |
| 17:23 | dansalmo | It is not practical so much as educational. |
| 17:23 | tyler | are you saying education isn't practical? ;) |
| 17:23 | yogthos | squidz: I really like clabango myself :) https://github.com/danlarkin/clabango |
| 17:23 | borkdude | $findfn '(1 2 3) 4 '(1 2 3 4) |
| 17:23 | dansalmo | http://pure-fn.appspot.com/about |
| 17:23 | lazybot | [] |
| 17:23 | dansalmo | I guess you got me. :) |
| 17:24 | borkdude | $findfn 4 '(1 2 3) '(1 2 3 4) |
| 17:24 | lazybot | [] |
| 17:24 | borkdude | tyler I think you'd have to go with concat then |
| 17:24 | borkdude | ,(concat '(1 2 3) '(4)) |
| 17:24 | tyler | borkdude: thnx |
| 17:24 | SegFaultAX | technomancy: 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:24 | clojurebot | (1 2 3 4) |
| 17:25 | technomancy | SegFaultAX: heh; I copyedited that. copious lulz. |
| 17:25 | squidz | yogthos: 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:25 | SegFaultAX | technomancy: :D |
| 17:26 | SegFaultAX | For the record, Fullmetal Alchemist is amazing. |
| 17:26 | yogthos | squidz: I found it more flexible than clostache myself, it's based off django templates which are pretty nice |
| 17:26 | uvtc | tomato, tomahto, clamato, clabango |
| 17:26 | yogthos | :) |
| 17:26 | amalloy | dansalmo: you might enjoy http://www.ioccc.org/2012/tromp/hint.html if you're into indexed lambda calculus |
| 17:26 | yogthos | that's the nice thing about the stack being pluggable |
| 17:27 | squidz | I liked the idea of having normal html and being able to transform that xml to your hearts content. Seemed like an clean solution |
| 17:30 | dansalmo | amalloy, thanks. It looks interesting. Thanks for your help before, the web interpreter is was I was working on. |
| 17:31 | Raynes | SegFaultAX: This is true. |
| 17:31 | drorbemet | nDuff: got it, asked a bit to early .. |
| 17:32 | jtoy_ | is this considered the correct way to write a collection to a file? (with-open [wrtr (writer "fns.txt")] |
| 17:32 | jtoy_ | (map #(.write wrtr % ) fns)) |
| 17:33 | yogthos | nDuff: well that can happen, but in practice I haven't noticed it to be a problem |
| 17:33 | borkdude | jtoy_ it's pointless to use map for only side effects |
| 17:34 | jtoy_ | borkdude: it doesnt seem to work , what is the right way to do this then? |
| 17:34 | borkdude | jtoy_ also, what is fns? you probably need doseq |
| 17:34 | borkdude | jtoy_ give us the complete code via a refheap paste |
| 17:34 | jtoy_ | borkdude: fns is just my collection |
| 17:35 | jtoy_ | borkdude: https://www.refheap.com/paste/12839 |
| 17:37 | jtoy_ | I see : (with-open [wrtr (writer "fns.txt")] (doall (map #(.write wrtr (str % "\n") ) [1 2 3 4 5 6] )) ) |
| 17:37 | jtoy_ | im still considered a clojure newb, but so far everysingle time i work with read files, it seems like always doing doall |
| 17:38 | jtoy_ | or writing files, any file stuff |
| 17:39 | yogthos | you probably should be using doseq instead |
| 17:39 | yogthos | since you'd doing side effects |
| 17:39 | yogthos | (doseq [item [1 2 3 4 5 6]] (.write wrt item)) |
| 17:40 | borkdude | jtoy_ https://www.refheap.com/paste/12840 |
| 17:40 | borkdude | yogthos somehow I had to str i(tem) first |
| 17:40 | yogthos | yeah that makes sense |
| 17:41 | jtoy_ | so doseq is like for and doall is like map? is tht the correct way to think about this? |
| 17:41 | yogthos | the write method expects a string |
| 17:41 | yogthos | joys of dealing with java api |
| 17:41 | borkdude | jtoy_ map creates a lazy sequence of which the results are only produced on demand |
| 17:42 | borkdude | jtoy_ doall forces the production of all those elements |
| 17:42 | borkdude | jtoy_ but since you're only interested in the side effects and not in some resulting collecting, you should use doseq in this case |
| 17:42 | jtoy_ | borkdude: right, but is doseq to for like doall is to map? or is that analogy totally wrong? |
| 17:43 | borkdude | ,(doc doall) |
| 17:43 | yogthos | not quite |
| 17:43 | clojurebot | "([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:43 | pbostrom | personally, I wish there was a side-effect equivalent to 'map' |
| 17:43 | yogthos | conceptually doseq is specifically for side effects |
| 17:43 | borkdude | ,(doc doseq) |
| 17:43 | clojurebot | "([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:43 | technomancy | first person to say mapv gets a kick in the shins |
| 17:43 | yogthos | lol |
| 17:43 | technomancy | I'm watching you |
| 17:44 | jtoy_ | i see what doall does, but i dont really understand doseq even after reading that |
| 17:44 | borkdude | I don't get why (.write wrtr 1) doesn't return some error, it just silently fails? |
| 17:44 | jtoy_ | borkdude: without the str, it worked for me, it just outputted garbage |
| 17:45 | borkdude | ,(= nil (doseq [i (range 5)] (print i))) |
| 17:45 | clojurebot | 01234true |
| 17:45 | SegFaultAX | jtoy_: It's somewhat annoying to remember all the do* forms, but you'll get used to it. |
| 17:45 | yogthos | jtoy_: basically doseq will always return nil, and it doesn't retain the sequence in memory |
| 17:45 | borkdude | ,(= nil (doall (map print (range 5)))) |
| 17:45 | clojurebot | 01234false |
| 17:45 | amalloy | .write probably has an overload that accepts ints |
| 17:45 | yogthos | jtoy_: but you can do something with each element as you run through them |
| 17:46 | yogthos | jtoy_: presumably side effects like printing it out or writing to a file, etc |
| 17:46 | jtoy_ | yogthos: ah, i see |
| 17:47 | jtoy_ | 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:47 | borkdude | amalloy clojure uses longs right? |
| 17:47 | borkdude | amalloy ah, it can deal with ints, but those are interpreted as chars |
| 17:47 | borkdude | DOH |
| 17:48 | SegFaultAX | jtoy_: doall is for eagerly evaluating lazy things. That's probably not the right tool for what you're doing. |
| 17:48 | yogthos | jtoy_: if you're collecting then doall is fine |
| 17:48 | tieTYT | newbie here. So ~@ takes a & parameter and evaluates it as-is? |
| 17:48 | yogthos | jtoy_: the reason you need doall is because when you leave the (with-open ...) expression the file gets closed |
| 17:49 | yogthos | jtoy_: so you want to force evaluation before that happens |
| 17:49 | yogthos | tieTYT: in a macro ~@ will splice a sequence into the parent |
| 17:49 | tieTYT | what does that mean? |
| 17:49 | tieTYT | what's splice? |
| 17:49 | jtoy_ | SegFaultAX: I use it bc I use with-open |
| 17:49 | technomancy | try it and see |
| 17:50 | jtoy_ | does that mean maybe it makes sense to have a with-open-eager or something like that |
| 17:50 | yogthos | tieTYT: eg: (defmacro foo [items] `(println ~@items)) |
| 17:50 | technomancy | ,`(1 2 3 ~@[4 5 [6 7]]) |
| 17:50 | clojurebot | (1 2 3 4 5 ...) |
| 17:50 | technomancy | dang it clojurebot |
| 17:50 | technomancy | ,`(1 ~@[4 5 [6 7]]) |
| 17:50 | clojurebot | (1 4 5 [6 7]) |
| 17:50 | yogthos | what technomancy said :) |
| 17:51 | yogthos | whatever items were in the collection you used ~@ get appended into the outer expression |
| 17:52 | tieTYT | hm but you used ` there. I thought that forces evaluation |
| 17:52 | technomancy | ~@ only works inside ` |
| 17:52 | clojurebot | @ , {a b c] |
| 17:52 | tieTYT | how can you evaluate (1 2 3) |
| 17:52 | tieTYT | oh |
| 17:52 | hyPiRion | ,`[[~@[1 2 3]] [~@"wat the"] [~@{:a 1 :b 2}] [~@#{:also :sets}]] |
| 17:52 | clojurebot | [[1 2 3] [\w \a \t \space \t ...] [[:a 1] [:b 2]] [:also :sets]] |
| 17:52 | technomancy | also, quoting delays evaluation |
| 17:52 | yogthos | which can be very handy :) |
| 17:52 | tieTYT | i didn't see any quoting there |
| 17:52 | tieTYT | only unquoting |
| 17:53 | tieTYT | errr |
| 17:53 | hyPiRion | backquote -> ` |
| 17:53 | tieTYT | ohh |
| 17:53 | amalloy | clojurebot: 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:53 | clojurebot | In Ordnung |
| 17:53 | tieTYT | what's that vs '? |
| 17:53 | tieTYT | i got mixed up. I swapped ` with ~ in my head |
| 17:53 | hyPiRion | ,'[~@[:oh :no]] |
| 17:53 | clojurebot | [(clojure.core/unquote-splicing [:oh :no])] |
| 17:54 | SegFaultAX | I don't usually link to clojure.org, but: http://clojure.org/reader |
| 17:54 | jtoy_ | clojurebot: help |
| 17:54 | clojurebot | Nobody 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:54 | SegFaultAX | tieTYT: ^ |
| 17:54 | tieTYT | ok |
| 17:55 | yogthos | personally I'd recommend not focusing on macros too much when you're starting out :) |
| 17:56 | tieTYT | yogthos: i'm running into library code that uses them |
| 17:57 | yogthos | ah |
| 17:57 | tieTYT | are you just recommending I don't use them for now? |
| 17:58 | yogthos | yeah, it's rare that you actually need to use a macro legitimately |
| 17:59 | tieTYT | cool, I had that intuition :) |
| 17:59 | yogthos | :) |
| 17:59 | hyPiRion | Whenever I find a new language construct (such as macros) I tend to overuse them because I feel so powerful using it. |
| 17:59 | hyPiRion | Then I look at it 1 month later and cry because it's so horrible. |
| 17:59 | hyPiRion | (It's a good way of learning that specific construct though). |
| 17:59 | borkdude | hyPiRion haha, so true |
| 18:01 | SegFaultAX | But when you do need macros, they're amazing. |
| 18:01 | ivaraasen | hyPiRion: same thing in journalism. learned a new word or a new idiom, then used it in every single article |
| 18:01 | technomancy | drunk on the power of defmacro |
| 18:01 | technomancy | "you will cower before me, mortal!" |
| 18:02 | SegFaultAX | Obligatory: http://xkcd.com/224/ |
| 18:04 | borkdude | SegFaultAX I suspect he did it in perl8.org |
| 18:04 | hyPiRion | ivaraasen: 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:06 | ivaraasen | hyPiRion: in Trondheim this Easter BTW? |
| 18:07 | jtoy_ | is it perfectly fine to use with-open to open a file to write and read in 1 binding? |
| 18:07 | jtoy_ | i mean multiple open files |
| 18:07 | hyPiRion | ivaraasen: yeah, I'll be here for the whole Easter |
| 18:08 | borkdude | jtoy_ you need a binding for either a writer or reader |
| 18:08 | borkdude | jtoy_ and with-open supports multiple bindings afaik |
| 18:09 | ivaraasen | hyPiRion: same thing. feel free to call me up if you want to drink strong coffee and talk about swearjure |
| 18:09 | hyPiRion | ivaraasen: oh, sweet |
| 18:10 | hyPiRion | I should bring my spare Clojure stickers and buttons |
| 18:10 | ivaraasen | hyPiRion: damn, I need some Clojure stickers ... for my employees, of course. |
| 18:12 | hyPiRion | exactly |
| 18:13 | borkdude | any favorite plot libraries for quick function plotting and using ouputted pics in a .tex or .org document? gnuplot? |
| 18:13 | tieTYT | ooh #(...) looks useful |
| 18:14 | borkdude | tieTYT until you try to nest them :P |
| 18:14 | tieTYT | oh that could get ugly |
| 18:14 | tieTYT | so should I avoid them or just not nest them? |
| 18:14 | hyPiRion | not really, it's not allowed. |
| 18:15 | borkdude | tieTYT I tend to avoid them and use only (fn [x] ….), but this is just my personal preference |
| 18:15 | hyPiRion | use them where it makes stuff more readable |
| 18:15 | hyPiRion | e.g. #(Double/parseDouble %) |
| 18:16 | ivaraasen | hyPiRion: 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:16 | tieTYT | so that's an anonymous function that takes one argument and passes it to Double/parseDouble |
| 18:17 | hyPiRion | tieTYT: yep |
| 18:17 | tieTYT | ok |
| 18:17 | borkdude | ,(#(-> 1)) |
| 18:17 | clojurebot | 1 |
| 18:17 | hyPiRion | ivaraasen: 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:17 | hyPiRion | My shell script hacks can only do that much |
| 18:18 | ivaraasen | hyPiRion: err, yeah |
| 18:22 | hyPiRion | borkdude: 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:22 | borkdude | hyPiRion ivaraasen ok tnx, I'll stick with gnuplot |
| 18:23 | yacin | are there R bindings or interop for clojure? |
| 18:23 | yacin | i can't use anything for plotting except R/ggplot2 these days |
| 18:23 | tieTYT | ok I think i get ~@ now |
| 18:24 | tieTYT | it inlines the structure into the outter form |
| 18:24 | ivaraasen | borkdude: another option is just using org-plot on tables created from running print-table on your Clojure data structures |
| 18:24 | borkdude | ivaraasen I really need a function plot |
| 18:24 | borkdude | ivaraasen but it's good to know that exists |
| 18:24 | borkdude | it |
| 18:25 | ivaraasen | borkdude: yeah, I see where you're coming from. I tend to use Incanter for stuff like this mostly |
| 18:25 | ivaraasen | or Mathematica :P |
| 18:25 | llasram | yacin: There's http://www.rforge.net/rJava/ ; but I've only dealt w/ it via researcher code :-) |
| 18:25 | ravster | Where can I find an explanation of :available-media-types in liberator? |
| 18:25 | borkdude | I used Maple but it's long since I had a license |
| 18:26 | llasram | yacin: 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:26 | yacin | ah yeah, rjava. i've used that a bit |
| 18:26 | ravster | a "hello world" isn't even working without that, and I can't seem to find docs for as essential a function as that. |
| 18:26 | yacin | haha howdy llasram |
| 18:26 | llasram | yacin: Yep :-) |
| 18:26 | yacin | didn't check the nick right away :P |
| 18:27 | llasram | heh |
| 18:27 | ivaraasen | yacin: yeah, org-bable and print-table with some R in-between is pretty nice |
| 18:28 | ivaraasen | err, wrong nick again. |
| 18:28 | yacin | nice, i'll have to give it a whirl |
| 18:29 | ivaraasen | I'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:30 | hiredman | you know org-mode can export to pdf and html? |
| 18:31 | yacin | blah, i really need to get on the org-mode bus |
| 18:31 | hiredman | the pdf export is via latex I think |
| 18:31 | ivaraasen | hiredman: yeah, but we have some in-house quirks and use our own XML dialect that gets put into InDesign |
| 18:31 | hiredman | sounds gross :) |
| 18:31 | ivaraasen | it is |
| 18:32 | ivaraasen | most of the code is from the early 2000's |
| 18:32 | hiredman | I haven't used babel yet, but it is intriguing |
| 18:33 | ivaraasen | crashes all the time as well. usually half an hour before the paper has to reach the printing company |
| 18:34 | hyPiRion | haha |
| 18:35 | ivaraasen | which is like a $15k loss in revenue. pretty scary stuff |
| 18:47 | zakwilson | clj-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:49 | hiredman | zakwilson: if I recall the docs say something like single letter for numbers and multiple letters for longer forms for parsing |
| 18:49 | hiredman | oh |
| 18:49 | borkdude | goodnight |
| 18:49 | hiredman | I am thinking of simpledateformatter, dunno about clj-time |
| 18:52 | zakwilson | Actually, 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:02 | tyler | hugod: are you hugo duncan? |
| 19:06 | OneFourSeven | Can somebody explain to me how to use roles in cemerick friend? |
| 19:07 | OneFourSeven | I'm just not sure about the syntax behind the #{::user} and how I would store that stuff in a database |
| 19:08 | tyler | anyone know if you can simulate tty in clj-ssh? |
| 19:08 | hiredman | ,::user |
| 19:08 | clojurebot | :sandbox/user |
| 19:08 | hiredman | it is a set of namespace qualified keywords |
| 19:09 | hiredman | the reason he used namespace qualified keywords for roles is because you can put them in hierarchies |
| 19:10 | hiredman | hierarchies in clojure are a thing you should google about if you want to know about them |
| 19:12 | OneFourSeven | hiredman, what should I store in the db? A string with the role user? |
| 19:14 | Glenjamin | hi guys, is anyone aware of a lib for mocks/fakes/spies/stubs ? |
| 19:14 | technomancy | Glenjamin: clojure.core/with-redefs |
| 19:14 | Glenjamin | ideally i'd want to declare a stub, and then assert on how it was called afterwards |
| 19:15 | technomancy | ,(let [vals (atom [])] (with-redefs [mocked-fn (partial swap! vals)] (mocked-fn :expected) (= [:expected] @vals))) |
| 19:15 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve var: mocked-fn in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 19:15 | technomancy | oh yeah; can't do that in a sandbox |
| 19:15 | technomancy | whatever |
| 19:15 | technomancy | don't use a library just to redef a function in tests |
| 19:16 | Glenjamin | it's not the redef that i'm after, as you said - that's easy |
| 19:16 | Glenjamin | it's just wrapping up that atom + constantly combo |
| 19:17 | technomancy | well, 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:18 | Glenjamin | per-test :) |
| 19:18 | Glenjamin | but, yeah i take your point |
| 19:20 | Glenjamin | cluttering 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:20 | Glenjamin | since the form is general |
| 19:21 | technomancy | most nontrivial projects have a "test helper" kind of namespace |
| 19:21 | Glenjamin | exactly, thats the sort of thing we should be sharing |
| 19:22 | Glenjamin | anyway, i'll get some stuff working with that for now - cheers |
| 19:25 | chessguy | so i hear people talk about the reader in clojure. isn't it just the same as a parser in another language? |
| 19:26 | amalloy | chessguy: sorta. the main difference is it returns a data structure that's not complete rubbish |
| 19:28 | nDuff | chessguy: ...one of the big things about LISPs is isomorphism -- your parse tree and your code match. |
| 19:28 | chessguy | well, parsers return ASTs, right? |
| 19:28 | nDuff | chessguy: That makes macros far more powerful and usable than they are otherwise. |
| 19:29 | headshot | "homoiconicity" ? |
| 19:29 | drewc | reader is different from a parser ... first lex. then parse, then read and circle. |
| 19:29 | powr-toc | Can anyone tell me why this core.logic snippet is so slow? |
| 19:29 | powr-toc | http://pastebin.com/DrGkZyCW |
| 19:30 | powr-toc | distincto seems to perform quite badly |
| 19:30 | drewc | nDuff: like we used to have for paste.lisp.org before the spammers took care of it? |
| 19:31 | powr-toc | nDuff: Sorry, didn't see the ads... I have adblock |
| 19:31 | dnolen | powr-toc: if you dealing with integers you should probably use fd/distinct |
| 19:31 | chessguy | why not just use gists? |
| 19:31 | dnolen | powr-toc: I'm not sure how to make distincto efficient |
| 19:31 | hyPiRion | refheap :) |
| 19:31 | powr-toc | dnolen: I'm not dealing with ints... just in that example I wanted to generate some |
| 19:31 | powr-toc | values |
| 19:33 | powr-toc | dnolen: would I be better using integers and mapping them to my values somehow? |
| 19:33 | dnolen | powr-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:33 | dnolen | powr-toc: maybe |
| 19:34 | dnolen | powr-toc: also CLP(Set) might do what you want when we get there. |
| 19:34 | dnolen | powr-toc: if you look at the implementation of disincto you can see that it's pretty naive. |
| 19:35 | powr-toc | dnolen: Naive, you mean like I would write ;-) |
| 19:36 | powr-toc | dnolen: How else could it be written? |
| 19:37 | dnolen | powr-toc: it could probably be done almost exactly the same as fd/distinct |
| 19:39 | powr-toc | I don't really grok much of the fd stuff... it's mostly blackmagic to me |
| 19:40 | powr-toc | dnolen: where can I find out more about CLP(Set)? |
| 19:40 | dnolen | powr-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:41 | dnolen | powr-toc: https://github.com/clojure/core.logic/wiki/CLP%28Set%29, it's like CLP(FD) but trickier |
| 19:42 | powr-toc | dnolen: lol, and my head was already hurting! |
| 19:43 | dnolen | powr-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:44 | powr-toc | dnolen: I didn't seem to struggle quite as much with the small amount of prolog I've done... |
| 19:45 | dnolen | powr-toc: well I'm sure you used a fairly mature Prolog |
| 19:45 | dnolen | lots of optimizations in place |
| 19:45 | powr-toc | dnolen: yeah, SWI |
| 19:45 | dnolen | powr-toc: yeah I think they probably have a decent distinct constraint that does the right thing. |
| 19:46 | dnolen | powr-toc: writing a distinct like distincto in Prolog is sure to be bad too. |
| 19:47 | arohner | I have an app that works fine, until I AOT it. Now I get: https://gist.github.com/arohner/d1a2d9c0928b0ede769c |
| 19:47 | powr-toc | dnolen: from what I remember it was pretty decent |
| 19:48 | powr-toc | dnolen: but it seems core.logic is getting better and better all the time |
| 19:48 | hiredman | arohner: have you checked to see if that class exists in classes/ ? |
| 19:49 | arohner | hiredman: I don't think it does. That's part of log4j, so shouldn't I expect it *not* to be there? |
| 19:49 | arohner | sorry, nvm |
| 19:49 | dnolen | powr-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:50 | arohner | hiredman: I don't see it there, what should I look at? |
| 19:51 | arohner | https://groups.google.com/forum/?fromgroups=#!topic/datomic/6xWGFB-Dx68 |
| 19:51 | hiredman | arohner: do you have lein setup to delete non-project class files? |
| 19:51 | arohner | probably not. I'll look into that |
| 19:51 | hiredman | arohner: ugh, get a real build process |
| 19:52 | hiredman | and deploy a built artifact |
| 19:52 | arohner | huh? I triggered this trying to make 'lein uberjar' work |
| 19:52 | hiredman | don't `lein run` in a git checkout |
| 19:52 | hiredman | oh, the message there talks about "on various deployments" |
| 19:53 | arohner | that's not me posting :-) |
| 19:53 | powr-toc | dnolen: One thing I've not seen documented, is what the following does: (distribute q ::l/ff) |
| 19:53 | powr-toc | (as seen in sudokufd) |
| 19:54 | dnolen | powr-toc: actually I'm a looking a bit closer at your paste |
| 19:54 | dnolen | powr-toc: ::l/ff is a custom strategy for how to enumerate the domains |
| 19:55 | dnolen | powr-toc: there'll be more, very useful for optimization w/o really changing program |
| 19:55 | hiredman | arohner: does any clojure code not in your project end up as class files? |
| 19:55 | dnolen | powr-toc: oh, the issue here is not distincto :P |
| 19:56 | arohner | hiredman: yes, it looks like all 3rd party libs are in target/ |
| 19:56 | dnolen | powr-toc: it's how you're calling value* w/ everyg, you're generating a ton of possiblities whene you do that. |
| 19:56 | powr-toc | dnolen: I was wondering if that might be it... |
| 19:56 | powr-toc | dnolen: what's the best way to distribute that fact distinctly over the vector of lvars? |
| 19:58 | dnolen | powr-toc: if I'm not mistaken that's probably 15! or something? |
| 19:58 | powr-toc | dnolen: yeah... the performance sure seemed to suck like a factorial :-) |
| 19:59 | dnolen | powr-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:59 | hiredman | arohner: everything runs fine with `lein run`? |
| 19:59 | arohner | hiredman: yes |
| 19:59 | dnolen | powr-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:59 | arohner | hiredman: lein run works as long as target/ is empty |
| 20:00 | hiredman | arohner: how weird is your code base? are you doing conditional code loading or anything like that? |
| 20:00 | arohner | after `lein uberjar`, everything breaks with that exception until rm -rf target/ |
| 20:00 | arohner | I'll try undoing the transitive AOT manually, and see what happens |
| 20:01 | powr-toc | dnolen: 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:01 | dnolen | powr-toc: http://swannodette.github.com/2013/03/09/logic-programming-is-underrated/ |
| 20:01 | hiredman | arohner: I would try the reverse, force compilation of clojure.tools.logging upfront |
| 20:02 | powr-toc | dnolen: yes, that'd be the one :-) |
| 20:02 | arohner | hiredman: how would I do that? AOT tools.logging from it's source tree, and copy them in? |
| 20:02 | dnolen | powr-toc: yep, an fd encoding of your example takes <30ms, vs. 5000ms on my air |
| 20:02 | hiredman | like stick (compile 'clojure.tools.logging) before the (ns ...) of your main namespace |
| 20:03 | arohner | interesting :-) |
| 20:03 | powr-toc | dnolen: can you pastie? |
| 20:05 | dnolen | powr-toc: https://gist.github.com/swannodette/5225702 |
| 20:07 | dnolen | powr-toc: updated the gist just now |
| 20:09 | powr-toc | dnolen: wow... the jit eats it for breakfast too! Some of the benchmarks are coming in at under 5ms on my crappy laptop |
| 20:09 | dnolen | powr-toc: yep |
| 20:10 | powr-toc | impressive! |
| 20:10 | dnolen | powr-toc: like I said, slowly getting there |
| 20:10 | arohner | hiredman: progress! |
| 20:10 | arohner | I had to compile clojure.tools.logging, and tools.logging.impl |
| 20:10 | arohner | now I'm getting similar problems in other libs |
| 20:11 | arohner | thanks |
| 20:12 | hiredman | arohner: 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:13 | hiredman | move the order of require's and use's around |
| 20:14 | arohner | hiredman: I'm pretty sure I never use tools.logging without requiring it in that ns. How could my code cause the prob? |
| 20:17 | hiredman | arohner: I don't know, clojure.tools.logging actually does some pretty gross stuff under the hood to pick the logging library to use |
| 20:18 | hiredman | could 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:19 | Glenjamin | what is it with java logging? pretty much every other language/framework i've used just has the application bootstrap set up the logger |
| 20:19 | technomancy | Glenjamin: it is. the worst. |
| 20:20 | arohner | and I'd happily call (logger/init :log4j) or whatever |
| 20:25 | arohner | success! |
| 20:25 | arohner | startup time down from 1:30 to 0:21s |
| 20:26 | Glenjamin | 21s is good? |
| 20:26 | arohner | 4.5x improvement is good |
| 20:27 | Glenjamin | mm |
| 20:30 | arohner | Glenjamin: oh, that also includes DB & web server init |
| 20:30 | hiredman | arohner: did you just (compile ...) namespaces one by one until it worked? |
| 20:31 | arohner | hiredman: yes, I had to compile clojure.tools.logging, clojure.tools.loggin.impl, and explicitly require ring.adapter.jetty |
| 20:31 | clojurebot | clojure is like life: you make trade-offs |
| 20:31 | arohner | noir tries to load r.a.jetty at runtime |
| 20:31 | hiredman | interesting |
| 20:32 | hiredman | and loading jetty would bring in jetty's whatever logging |
| 20:32 | arohner | hrm, now immediately after lein uberjar, I get 'Error: Invalid or corrupt jarfile target/circle-0.1.0-SNAPSHOT-standalone.jar" |
| 20:32 | hiredman | now that you have an explicit load of jetty, I would try removing the explicit compiles |
| 20:32 | hiredman | arohner: always `lein clean` |
| 20:34 | arohner | hiredman: same result |
| 20:35 | hiredman | does the jar file unzip? |
| 20:37 | Glenjamin | can you move the noir require out of the ns declaration |
| 20:37 | arohner | hiredman: kind of: https://gist.github.com/arohner/02d57509bc1fe05c20ef |
| 20:37 | arohner | other than that, it completes fine |
| 20:38 | hiredman | yeah, unzip is most likely more lenient about files then java's jar file reading |
| 20:38 | hiredman | if lein is generating invalid jars that sounds like a lein problem :) |
| 20:38 | hiredman | what happens if you re-jar the contents? |
| 20:39 | arohner | using the jar tool manually? |
| 20:39 | hiredman | sure |
| 20:42 | arohner | oh wait, I haven't generated a java class |
| 20:42 | arohner | for my main ns |
| 20:42 | Glenjamin | is there a way to get a function to accept either [a b &c] or [a &c] ? |
| 20:42 | arohner | Glenjamin: manually parse the args. otherwise it's ambiguous |
| 20:43 | Glenjamin | cheers |
| 20:43 | Glenjamin | actually, i think my desired functions is ambiguous |
| 20:43 | Glenjamin | heh, rethink |
| 20:45 | arohner | what's the syntax to start clojure.main from a jar again? |
| 20:46 | tieTYT | in 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:46 | arohner | java -jar my-jar.jar clojure.main? |
| 20:46 | tieTYT | but then i lose all the requires I've built up |
| 20:47 | arohner | java -cp target/my-jar-standalone.jar clojure.main |
| 20:47 | Glenjamin | tieTYT: i think if you drop out and run lein deps, then require should work? |
| 20:48 | Glenjamin | ctrl+z / fg or separate shell |
| 20:48 | tieTYT | hm |
| 20:48 | tieTYT | ok i'll try that next time |
| 20:48 | arohner | tieTYT: there's also https://github.com/cemerick/pomegranate |
| 20:48 | arohner | though that doesn't reload project.clj for you |
| 20:49 | Glenjamin | i suspect i'm wrong, having read that |
| 20:50 | tieTYT | aroemers: thanks |
| 20:50 | tieTYT | arohner: i meant thanks |
| 20:51 | amalloy | Glenjamin: yeah, no way that works |
| 21:00 | tieTYT | this 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:02 | tieTYT | "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:02 | tieTYT | is that accurate? |
| 21:02 | tieTYT | i mean do you guys agree with that? |
| 21:10 | Raynes | Sure. |
| 21:10 | Raynes | I think that it is worded strangely. |
| 21:11 | Raynes | People 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:11 | drewc | I do not agree, but do not disagree, fwiw. |
| 21:13 | tieTYT | well 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:13 | tieTYT | so I was thinking a multimethod that dispatches on the domain of the url would be a good fit |
| 21:27 | lovemuffin | is 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:30 | mabes | lovemuffin: nailgun does that but it comes with its own set of problems... check out drip https://github.com/flatland/drip |
| 21:32 | lovemuffin | ah so its like jvm pools |
| 21:33 | lovemuffin | also for vim users, is the official unofficial vim plugin for clojure? https://github.com/vim-scripts/VimClojure |
| 21:45 | xeqi | lovemuffin: 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:46 | xeqi | not sure if vim-fireplace is the new standard yet |
| 21:51 | Glenjamin | "espionajure" good/bad name for a clojure stub/spy lib? |
| 21:51 | arohner | Glenjamin: https://github.com/circleci/bond |
| 21:51 | arohner | oh, that needs a readme |
| 21:51 | Glenjamin | bah, where were you two hours ago >.< |
| 21:52 | hyPiRion | Glenjamin: well, you have to set LEIN_IRONIC_JURE for that |
| 21:52 | Glenjamin | oo, metadata |
| 21:53 | Glenjamin | thats much smarter than dynamic binding a map of function => vector |
| 21:53 | lovemuffin | i've been reading programming clojure (pragprog) and eh its ok, does a lot of talking not enough doing |
| 21:53 | Glenjamin | this is what i had: https://gist.github.com/glenjamin/7edfefcbf1eaa02d6a58 |
| 21:54 | lovemuffin | so in a clojure project, the best debugger is the repl ? |
| 21:54 | jerryzhou | hi |
| 21:55 | Glenjamin | arohner: that's exactly what I was about to write, only done better :D |
| 21:55 | lovemuffin | or if it isn't what is the standard way to debug clojure? |
| 21:55 | arohner | Glenjamin: thanks. I'll write a readme then [ANN] it |
| 21:55 | Glenjamin | [ANN] ? |
| 21:55 | arohner | announce, on the google group |
| 21:56 | Glenjamin | oh right |
| 21:56 | arohner | message titles are typically prefixed with [ANN] |
| 21:56 | Glenjamin | i should subscribe to that |
| 21:56 | Glenjamin | oh, actually |
| 21:57 | Glenjamin | (with-stub [fn retval, fn2 retval2] body) would be cool |
| 21:57 | arohner | (with-redefs [f1 (constantly retval) f2 (constantly retval2)] body) |
| 21:58 | Glenjamin | yeah, but then i have to do with-redefs & with-spy :) |
| 22:00 | Glenjamin | i can knock up a patch for that if you'd accept it? |
| 22:00 | xeqi | lovemuffin: 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:00 | Glenjamin | i'd say sugar for constant retvals and fake implementations would be handy |
| 22:01 | xeqi | ... the repl is step one, when a real debugger is needed see ritz |
| 22:02 | lovemuffin | ok, so thats the standard way of doing it? most people don't depend on some IDE debugger |
| 22:02 | danielglauser | lovemuffin: most folks use emacs as their "IDE" |
| 22:03 | arohner | Glenjamin: how would you distinguish between (with-stub [f1 retval f2 retval]...) and (with-stub [f1 f2]) ? |
| 22:03 | Glenjamin | arohner: more macros :) |
| 22:04 | Glenjamin | or maybe (with-stub {f1 retval f2 retval} |
| 22:05 | Glenjamin | and then (with-fake {f1 #(…) f2 #(…)} ...) |
| 22:07 | arohner | hrm, vector vs. map isn't bad |
| 22:07 | arohner | I'm kind of proud of the fact that the entire lib is only 44 lines :-) |
| 22:08 | Glenjamin | yeah, i clearly need to work on my vector manipulation in macros :D |
| 22:09 | Glenjamin | anyway, uk time so i'm heading off |
| 22:09 | Glenjamin | i'll definitely be using bond though |
| 22:10 | Glenjamin | nice work on circle too, used it a couple of times and liked it :) |
| 22:10 | john2x | what's the difference between pedestal-app and pedestal-service? |
| 22:12 | powr-toc | john2x: apps are client-side (clojurescript) programs... service's are server side (clojure) programs |
| 22:13 | arohner | Glenjamin: thanks! |
| 22:14 | Glenjamin | only found out it was clojure fairly recently, just seemed like any other app from a consumer pov |
| 22:14 | john2x | powr-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:14 | Glenjamin | which i guess is a good thing? |
| 22:16 | powr-toc | john2x: yup |
| 22:17 | john2x | powr-toc: cool, thanks! |
| 22:42 | chessguy | 'evening, everyone |
| 22:44 | jerryzhou | hi |
| 22:45 | chessguy | anybody have a good recommendation for some good clojure code to read? i've got plenty of programming experience, including functional programming, and ruby |
| 22:49 | dcolish | clojurewerks does good stuff |
| 22:50 | ivan | chessguy: core.clj |
| 22:50 | ivan | actually, clojurescript core.cljs |
| 22:52 | chessguy | ivan\: you mean this? https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs |
| 22:53 | ivan | yes |
| 22:53 | chessguy | thanks |
| 22:55 | ivan | I also remember enjoying trying to understand the cljs emitter |
| 23:47 | muhoo | TimMc: yes, it's not only in a usable state, i'm using it constantly now |
| 23:58 | technomancy | I think I finished up syme: https://syme.herokuapp.com/ |