2013-04-11
| 00:00 | wliao | dr_choc: yeah, I feel the same way. But everything works again after refreshing the page. |
| 00:00 | dr_choc | Reliably? |
| 00:00 | dr_choc | It's like a 1/10 right now :/ |
| 00:01 | wliao | dr_choc: It almost always works. |
| 00:01 | dr_choc | wlia: okay, I must be doing something wrong. Are you using the lein-cljsbuild plugin? |
| 00:02 | wliao | dr_choc: You tried cljs-bootstrap? |
| 00:03 | wliao | It's a bit out-dated, but still works. |
| 00:04 | dr_choc | wliao: No, but I don't think the code is the problem. I just tried with firefox and it seems a lot more reliable in making the repl connection |
| 00:05 | wliao | dr_choc: rhino is the most reliable.:) |
| 00:05 | dr_choc | Updating chormium, lets see if that changes anything |
| 00:06 | dr_choc | wliao: I'm making a game, so it's amazingly helpful to be able to swap out parts on the fly. I can't get the same feedback with rhino |
| 00:08 | dr_choc | Updated chrome seems to work, it might as well have been simply restarting chrome since it's been open for >1week |
| 00:08 | dr_choc | Thanks wliao |
| 00:09 | wliao | dr_choc: np |
| 00:35 | dabd | I am trying to write a seq to a file but instead it writes clojure.lang.LazySeq@dc5003c2. How can I force it to evaluate the seq? |
| 00:37 | wliao | ,(doall (repeat 20 0)) |
| 00:37 | clojurebot | (0 0 0 0 0 ...) |
| 00:42 | wliao | &(print "a") |
| 00:42 | lazybot | ⇒ anil |
| 00:45 | dabd | I tried the following but it still prints clojure.Lang.LazySeq... https://gist.github.com/dabd/5360795 |
| 00:50 | dabd | I think I found the problem. The spit function doesn't work with sequences |
| 00:50 | dabd | so I need to convert the sequence to a string first. |
| 00:51 | dr_choc | you can convert it to vec to |
| 00:51 | dr_choc | just put a (vec (doall ... |
| 00:52 | dr_choc | At that point you don't need doall since you are passing it into vec which forces the fns to evaluate |
| 00:53 | dr_choc | However doseq might be more beneficial: http://clojuredocs.org/clojure_core/clojure.core/doseq |
| 00:53 | dabd | but doseq returns nil |
| 00:54 | nonuby | when using wrap-reload I suspect this is recursive since i.e. if i specify acme.core in reloadables if I touch acme.views.homepage that would reload? |
| 00:55 | dr_choc | dabd: I guess it isn't useful for your case. Whenever I see (doall (map... I automatically think of doseq instead |
| 00:56 | dr_choc | wait clojurebot evals clojure? that's awesome! |
| 00:57 | brehaut | it evals some clojure |
| 00:57 | brehaut | ,(future "lols, no") |
| 00:57 | clojurebot | #<SecurityException java.lang.SecurityException: no threads please> |
| 00:57 | dr_choc | (take 10 (iterate inc 0)) |
| 00:58 | dr_choc | ,(take 10 (iterate inc 0)) |
| 00:58 | clojurebot | (0 1 2 3 4 ...) |
| 00:58 | brehaut | lazybot also evals code #(range) |
| 00:58 | brehaut | hmm ##(range) |
| 00:58 | lazybot | java.lang.OutOfMemoryError: Java heap space |
| 00:58 | brehaut | magic |
| 00:58 | brehaut | &(range) |
| 00:58 | lazybot | java.lang.OutOfMemoryError: Java heap space |
| 00:58 | dr_choc | ,(pmap dec (take 10 (iterate inc 0))) |
| 00:58 | clojurebot | #<SecurityException java.lang.SecurityException: no threads please> |
| 00:59 | dr_choc | What's ampersand do? |
| 00:59 | brehaut | lazybot eval |
| 00:59 | Raynes | &(+ 3 3) |
| 00:59 | lazybot | ⇒ 6 |
| 00:59 | dr_choc | What's the difference? |
| 01:00 | dr_choc | clojurebot isn't lazy? |
| 01:00 | brehaut | the difference is the difference between hiredman and raynes |
| 01:01 | brehaut | the stuff that isnt eval is different, and the sandboxing and evaluation restrictions differ too |
| 01:01 | Raynes | They're completely different bots. |
| 01:01 | Raynes | But both do evaluation. |
| 01:01 | Raynes | It's that simple. <3 |
| 01:01 | dr_choc | okay |
| 01:14 | Rich_Morin | I'd like to use re-seq on some input that contains newlines. What's the magic for doing this? |
| 01:15 | brehaut | Rich_Morin: http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html check out special constructs |
| 01:15 | brehaut | Rich_Morin: i think you want m |
| 01:16 | brehaut | that is, if you want to use ^ and $ |
| 01:16 | Rich_Morin | Any idea where the construct goes in the RE? |
| 01:17 | brehaut | if you dont use the anchors you canjust match \n |
| 01:17 | brehaut | yeah, chuck it at the front |
| 01:17 | brehaut | #"(?m)…" |
| 01:17 | Rich_Morin | tnx; I'll try it |
| 01:17 | amalloy | that or (?s) |
| 01:20 | n_b | Will update-in not work on transient colls? |
| 01:20 | n_b | i.e, must I use bang fns on things I've marked transient? |
| 01:21 | amalloy | n_b: of course. (conj foo bar) guarantees that foo and bar both remain unchanged; it couldn't promise that if the args were transient |
| 01:22 | n_b | Perfectly sensible. Thanks amalloy - just wanted to confirm my understanding was correct |
| 01:24 | wliao | does lazybot, I pm him, <lazybot> You're going to need to tell me what you want help with. |
| 01:25 | wliao | does lazybot have some help doc, I pm him, <lazybot> You're going to need to tell me what you want help with. |
| 01:39 | ivan | wliao: https://github.com/flatland/lazybot/tree/develop/src/lazybot |
| 01:40 | wliao | ivan: Cool. tks |
| 01:48 | jack_rabbit | I'm having trouble building a gui for my program. I've looked at seesaw and java swing, but being as I've not built guis in java before, it's a bit confusing to me, even with the docs. Can you guys make a suggestion for anything that might help me out? |
| 01:49 | tieTYT | jack_rabbit: can you be more specific? |
| 01:49 | tieTYT | have you looked at their examples? |
| 01:50 | tieTYT | question for the rest of you: I assume that a typical workflow is to explore some code in the repl. Once you figure out what you're trying to do, you now want to persist that code in your clj file. How do you get the repl history (of forms that compiled)? |
| 01:50 | jack_rabbit | tieTYT, I have, but when I try to implement my own, I can't seem to get it to work. Can you point me to a tutorial or something? I've googled a bit, but I'm wondering what some of you use when you build GUIs. |
| 01:51 | callen | tieTYT: I write code in my editor and evaluate it in the repl with ^-e |
| 01:51 | callen | so, when it eventually works, it's just there. |
| 01:51 | tieTYT | callen: I assume that's an emacs command? I'm working in CCW |
| 01:51 | tieTYT | although, I think CCW is supposed to have a way to do that |
| 01:52 | callen | well do that instead. |
| 01:52 | tieTYT | ah I can do that |
| 01:52 | tieTYT | callen: ok that seems like a cool workflow. But don't you often have to use fake input to test your functions? |
| 01:53 | tieTYT | do you just write that in your file too and delete it when you know your production code works? |
| 01:53 | tieTYT | eg: a function takes a real url as input. You don't want to type that in every time |
| 01:55 | callen | tieTYT: I'll def test data or just write actual test-cases. |
| 01:55 | callen | tieTYT: this methodology falls apart in web dev. |
| 01:55 | tieTYT | def the test data in your file or in the repl? |
| 01:56 | callen | either/or |
| 01:56 | tieTYT | hm ok |
| 01:57 | tieTYT | well that sounds like an interesting workflow |
| 01:57 | tieTYT | i'll try that on the next thing I build |
| 01:57 | n_b | Dumb Question time: Writing my first macro and getting an interesting result: https://www.refheap.com/paste/13512 |
| 01:57 | n_b | I assume I'm unquoting in the wrong place or something? |
| 01:58 | jack_rabbit | n_b, what do you want the result to be? |
| 01:59 | n_b | I want it to print "Timing: #{form}" followed by the time it took |
| 01:59 | n_b | as returned by the time macro |
| 01:59 | jack_rabbit | n_b, The "Timing" statements are running at macro expand time, before the code it expands to runs. |
| 02:01 | n_b | ahh. I see how time is doing it, I think |
| 02:01 | jack_rabbit | n_b, you need to quote the entire (do |
| 02:02 | tieTYT | I heard that @ is a macro |
| 02:02 | tieTYT | how do you macroexpand it? (macroexpand-1 @) doesn't compile |
| 02:02 | jack_rabbit | I think it is macro syntax for (deref) |
| 02:02 | jack_rabbit | Try to actually deref something. |
| 02:03 | tieTYT | hrm, I guess that something has to exist |
| 02:03 | jack_rabbit | Right. @ on its own isn't a valid macro call. |
| 02:04 | tieTYT | hrm... (macroexpand @a) => [] |
| 02:04 | tieTYT | that's the result, how do I see the process? |
| 02:05 | jack_rabbit | tieTYT, You forgot to quote it. |
| 02:05 | tieTYT | i dont' know what that means, what should I have typed? |
| 02:05 | tieTYT | oh nm |
| 02:05 | tieTYT | i get it |
| 02:05 | jack_rabbit | (macroexpand '@a) |
| 02:05 | tieTYT | (macroexpand '@a) |
| 02:06 | tieTYT | is there a way to see how the macro is written? The real thing I'm curious about is if I can make my own macros that work by prefixing a symbol to a symbol |
| 02:06 | jack_rabbit | ,(let [x (atom 1)] (macroexpand '@x)) |
| 02:06 | clojurebot | (clojure.core/deref x) |
| 02:06 | jack_rabbit | tieTYT, You could try the source function. |
| 02:07 | tieTYT | that's a good idea |
| 02:07 | tieTYT | how would I write that? |
| 02:08 | jack_rabbit | (you need to 'use' clojure.repl, then call (source deref) |
| 02:08 | tieTYT | but I want to see how @ is defined, not deref |
| 02:08 | jack_rabbit | tieTYT, Oh. |
| 02:09 | tieTYT | but i don't really care, I want to know if I can write a macro like @ |
| 02:09 | tieTYT | syntax wise, not functionality wise |
| 02:09 | jack_rabbit | tieTYT, Yeah, i'm not sure how they implement those special symbols. |
| 02:09 | tieTYT | ok |
| 02:09 | tieTYT | well anyway re: seesaw, that's a tough one |
| 02:10 | tieTYT | I know how to write swing code so I get what's going on under the hood |
| 02:11 | jack_rabbit | Maybe I'll just use an interface builder and include the class file in my clojure project. |
| 02:11 | tieTYT | i think netbeans has the best one |
| 02:11 | tieTYT | i had bad experiences with intellijs |
| 02:12 | jack_rabbit | Cool. I'll try that out. |
| 02:12 | alandipert | tieTYT: you can't write your own 'reader macros', which is what @ is |
| 02:12 | tieTYT | alandipert: good to know |
| 02:12 | alandipert | tieTYT: unofficially though, you can: http://briancarper.net/blog/449/ |
| 02:13 | tieTYT | ok thanks |
| 02:18 | tieTYT | jack_rabbit: one problem with a builder is the code it generates isn't very readable so it'll be hard to learn from. That may not be a factor for you though |
| 02:19 | jack_rabbit | tieTYT, Yeah, I don't really care about the GUI code. It's fairly uninteresting to me. If I find myself building a lot of GUIs, I'll take the time to learn it. |
| 02:21 | tieTYT | fair enough |
| 02:21 | jack_rabbit | Thanks for the heads up, though. |
| 02:21 | tieTYT | no |
| 02:21 | tieTYT | np |
| 02:33 | sztamas_ | Hi, I'm trying to learn Clojure/Lisp. I have a mainly OO background, so it is a bit of a challenge as you can imagine :) |
| 02:34 | sztamas_ | would anyone be kind enough to have a quick look at https://github.com/sztamas/guess-my-number/blob/master/src/guess_my_number/core.clj and tell me how it looks like |
| 02:34 | sztamas_ | ? |
| 02:35 | sztamas_ | it isn't much code, I promise :) |
| 02:39 | wink | sztamas_: line 46 works like that? |
| 02:40 | wink | I'm hardly an expert myself though :) |
| 02:40 | vladimus | can you make minecraft mods in clojure? |
| 02:40 | wink | vladimus: I faintly remember reading something like that, and why wouldn't you. it's a JAR with jvm bytecode |
| 02:41 | vladimus | wink: Thanks. It just seems like an interesting idea. |
| 02:42 | sztamas_ | wink: commands is a set |
| 02:43 | sztamas_ | which is a function |
| 02:43 | sztamas_ | I think it does |
| 02:43 | n_b | jack_rabbit: Thanks for the pointer; my macro now works properly, is hygenic, etc... |
| 02:43 | jack_rabbit | n_b, Cool. Glad to hear it. |
| 02:44 | jack_rabbit | sztamas_, So does it work? |
| 02:44 | sztamas_ | you meant the whole app or line 46 |
| 02:44 | sztamas_ | ? |
| 02:44 | sztamas_ | both seem to work fine |
| 02:45 | wink | sztamas_: I'd used (some |
| 02:46 | wink | sztamas_: so I probably learnt more than you by trying to give feedback ;) |
| 02:47 | sztamas_ | I am happy with that. No problems :) |
| 02:47 | sztamas_ | so it doesn't look like much like an OO programmer trying to write Clojure code? |
| 02:48 | wink | sztamas_: not fully awake enough to find a better solution, but the use atoms is a bit uncommon I think |
| 02:48 | wink | it's not exactly what I'd call "avoiding global state" |
| 02:48 | sztamas_ | yes, I know |
| 02:49 | sztamas_ | smells a bit |
| 02:49 | wink | you could probably construct some recursive stuff to keep track |
| 02:49 | jack_rabbit | sztamas_, I've not seen code like that on line 73 before. I'm sure there's an easier way to do that. |
| 02:49 | jack_rabbit | Or at least less verbose. |
| 02:49 | wink | oh, right. |
| 02:50 | jack_rabbit | I don't think ns-resolve is even necessary. |
| 02:50 | sztamas_ | wink: that was like that in the original source though. The use of global state ... |
| 02:51 | wink | sztamas_: yeah well, I'm not a purist on pureness myself (pun not intended) - but I think it's valid criticism, but not a must |
| 02:51 | wink | #haskell might throw stones at you sthough ;) |
| 02:52 | jack_rabbit | It's a fairly "stateful" problem. |
| 02:52 | jack_rabbit | global atoms might not be the best, but since it's obviously not part of a larger application, I'd think it's fine. |
| 02:52 | sztamas_ | jack_rabbit: I wasn't using ns-resolve initially, but the app is called from the user namespace |
| 02:52 | jack_rabbit | sztamas_, ahh. |
| 02:53 | jack_rabbit | sztamas_, a macro might be better form. |
| 02:53 | wink | sztamas_: you can use :main NS in project.clj iirc to switch to your ns on "lein repl" |
| 02:53 | sztamas_ | I agree it is probably not idiomatic because I came up with it myself :) |
| 02:53 | wink | as long as it works ;) |
| 02:53 | jack_rabbit | I sometimes use closures to capture state within a small subset of the functions within a project. |
| 02:54 | vladimus | ugh |
| 02:54 | wink | I'd love to have some sort of idiomatic guidelines document |
| 02:54 | jack_rabbit | Yeah, I'm still trying to get into a "functional" mindset. |
| 02:54 | wink | like.. do I use (:foo {}) or (get {} :foo) |
| 02:55 | jack_rabbit | I've been reading Volkmann's tutorial, and it addresses some of those things. |
| 02:56 | metellus | wink: https://github.com/bbatsov/clojure-style-guide this has been linked in here before and as far as I know it's correct |
| 02:56 | wink | metellus: yay, thanks,. will have a look |
| 02:58 | wink | kibit also has some rules, that might count as style, lile (inc x) instead of + x 1 |
| 02:58 | jack_rabbit | Huh. |
| 02:58 | jack_rabbit | I don't really like that suggestion. |
| 02:59 | sztamas_ | wink: does that :main only switch the REPLs namespace? |
| 02:59 | sztamas_ | wink: what happens when I create a jar and run the app? |
| 02:59 | sztamas_ | wink: I mean with java -jar ... |
| 02:59 | wink | sztamas_: hmm, no clue, really :) |
| 03:00 | wink | sztamas_: I think it still applies, in one of my libs I have :main NAME.core |
| 03:01 | wink | and I'm using it as a jar, no problems so far |
| 03:01 | sztamas_ | wink: I have it set |
| 03:01 | sztamas_ | wink: it was part of the "app" template I guess |
| 03:02 | wink | probably, yeah. |
| 03:02 | wink | but I'm fighting namespaces myself quite often, you'd need to ask someonme else :) |
| 03:04 | sztamas_ | when you do lein run the *ns* is set to user |
| 03:13 | jack_rabbit | sztamas_, I thought the namespace was whatever you set in :main. |
| 03:14 | rads | I have some simple clojurescript code that adds event listeners to a couple dom elements: |
| 03:14 | rads | https://gist.github.com/rads/4b568fb452fd66bc199f |
| 03:14 | n_b | is there a way to just discard results of a for? Like (into nil)? |
| 03:14 | rads | I wanted to use dynamic binding to cache the DOM elements, but I realize now the dynamic vars won't be bound when the event listeners actually fire |
| 03:14 | jack_rabbit | n_b, just don't use them? |
| 03:14 | rads | what is the simplest way around this? pass in a map of the cached dom elements to each event listener? |
| 03:15 | jack_rabbit | n_b, for returns a lazy sequence, so as long as you don't evaluate the elements... |
| 03:23 | n_b | jack_rabbit: right; but unless I change that doall on line 22 into something like (into [] |
| 03:23 | n_b | I get this error: https://www.refheap.com/paste/13513 |
| 03:24 | wink | metellus: wow, it's even better at second look than at the first. thanks a lot, exactly what I needed |
| 03:24 | metellus | glad I could help |
| 03:24 | sztamas_ | jack_rabbit: I've just created a new test app with lein and added a (println *ns*) to main. It displays #<Namespace user> |
| 03:27 | jack_rabbit | n_b, your problem is the nil at the end of the for. |
| 03:29 | n_b | Oh, sorry. I pasted in from the wrong undo tree. It does work fine if I leave out the nil (and I realise it's at odds with tthe docstring as well); that was thrown in to stop the repl exploding when trying to print a 1E6 item large col |
| 03:33 | n_b | And it should work if you do something like (time-many nil 1), but it explodes. It seems like it's trying to call nil as a function for some reason? |
| 03:37 | jack_rabbit | n_b, try this: http://paste.lisp.org/display/136665 |
| 03:38 | jack_rabbit | The macro expanded to a list of functions to evaluate without a do around them. |
| 03:38 | n_b | that does it |
| 03:38 | n_b | ah, so you expand the result of the for into the quoted list |
| 03:39 | n_b | and then as it's wrapped inside a do it returns the last val. |
| 03:39 | n_b | Thanks for holding my hand through that, I (think) I have a much firmer grasp on what's going on now |
| 03:40 | n_b | Will play with it some more tomorrow morning. |
| 03:40 | jack_rabbit | n_b, sorry. This: http://paste.lisp.org/display/136665#1 |
| 03:40 | jack_rabbit | n_b, cool, man. |
| 03:41 | jack_rabbit | Oh, wait. They both work. |
| 03:41 | jack_rabbit | n_b, I didn't know if there was a reason you used doall. |
| 03:42 | n_b | jack_rabbit: nope, just troubleshooting by way of guesswork |
| 03:53 | mullr | Is there a trick to getting your jvm-opts to work with nrepl-ritz? |
| 04:34 | mullr | (the answer appears to be that jvm-opts doesn't pass through in nrepl-ritz 0.7.0, but it's fixed for the next release) |
| 05:01 | jack_rabbit | So if I java a java file containing a package and class, how do I include that in my leiningen project? |
| 05:08 | rodnaph | jack_rabbit: https://github.com/rodnaph/gmailer/blob/master/project.clj#L7 |
| 05:09 | jack_rabbit | sweet. Thanks. I'll have a try with that. |
| 05:11 | jack_rabbit | Okay. How do I import the class into a .clj, then? I'm getting ClassNotFoundException. |
| 05:13 | jack_rabbit | Weird. The class wasn't in a package, so I put it in one, and then used the package-qualified name, and it seems to be loading. |
| 06:32 | bio-imaging | is there a version of letfn that allows functions to call each other tail recursively? |
| 06:37 | dnolen | bio-imaging: nope |
| 06:41 | noidi | bio-imaging, the JVM does not support TCO, so you have to use trampolines for mutual recursion |
| 06:42 | noidi | http://jakemccrary.com/blog/2010/12/06/trampolining-through-mutual-recursion/ |
| 06:42 | bio-imaging | yea i know but for a fixed set of functions you could generate a bunch of gotos |
| 06:42 | noidi | oh, that's true |
| 06:42 | bio-imaging | trampolines are quite slow :) |
| 08:00 | wei_ | why doesn't this form: (->> [1] #(conj % 2)) give me the expected [1 2] ? |
| 08:01 | bio-imaging | because ->> is a macro, it doesn't take a function as its second argument |
| 08:02 | bio-imaging | (->> 1 (conj [1])) |
| 08:03 | bio-imaging | (->> x (a b c)) gets translated to (a x b c) |
| 08:03 | rodnaph | (->> x (a b c)) => (a b c x) ? |
| 08:04 | bio-imaging | right |
| 08:05 | wei_ | so there's no easy way to reverse the order of parameters in a form? e.g. (->> (map :a [{:a 1} {:a 2}]) (filter #(= 1 %)) #(conj 2 %)) |
| 08:06 | bio-imaging | i'm not sure what you want to accomplish |
| 08:06 | bio-imaging | can you write it without ->> first? |
| 08:08 | wei_ | sure |
| 08:08 | bio-imaging | you could do (#(conj 2 %)) i guess |
| 08:09 | bio-imaging | but conj actually takes the opposite order |
| 08:09 | wei_ | oh right, I meant #(conj % 2) |
| 08:09 | bio-imaging | (->> (map :a [{:a 1} {:a 2}]) (filter #(= 1 %)) (#(conj % 2))) |
| 08:09 | bio-imaging | try that |
| 08:10 | wei_ | that doesn't seem to compile:ClassCastException java.lang.Long cannot be cast to clojure.lang.IPersistentCollection |
| 08:10 | bio-imaging | that's strange |
| 08:10 | wei_ | my rewrite is (conj (->> (map :a [{:a 1} {:a 2}]) (filter #(= 1 %))) 2) |
| 08:10 | bio-imaging | it works for me |
| 08:10 | wei_ | but that's not as nice, especially if there's more functions after the conj |
| 08:11 | bio-imaging | probably you have the arguments for conj in the wrong order? |
| 08:11 | wei_ | oh, that does work for me! thanks. |
| 08:11 | bio-imaging | :) |
| 08:12 | wei_ | I might have redefined accidentally. worked after restarting the repl |
| 08:12 | wei_ | learned a new trick :) |
| 08:12 | bio-imaging | probably your rewrite is cleaner though |
| 08:13 | wei_ | but there are more functions afterward, like (->> .. shuffle (take 3)) |
| 08:13 | bio-imaging | ah, yes |
| 08:35 | rodnaph | does anyone know if leiningen RPMs are available for CentOS6 anywhere? |
| 08:38 | wink | no clue, you could try #leiningen though |
| 08:38 | wink | the question is if you really need it as an rpm? |
| 08:39 | joegallo | the answer is you don't, you really really don't |
| 08:43 | rodnaph | wink: i'll try thanks. joegallo - actually the answer is "you do when your automation team will only use stuff that's packaged as an RPM" :P |
| 08:44 | wink | rodnaph: then use fpm and package those 2 files :P |
| 08:44 | rodnaph | fpm? *new thing* will google. |
| 08:44 | wink | jordansissel/fpm |
| 08:45 | wink | or something on github |
| 08:45 | borh | rodnaph: there is a slighly outdated leiningen rpm in the puppetlabs_dependencies repo (0.2preview10.el6) |
| 08:45 | rodnaph | wink: ah yeah i've seen that. i'm still going to need leiningen to build my war though, right? |
| 08:46 | wink | rodnaph: no, I meant.. package the lein shell script and lein jar and you got a RPM |
| 08:46 | wink | fpm has the nice thing that you don't need a specfile or something |
| 08:47 | wink | it's literally a oneline for leiningen |
| 08:51 | rodnaph | wink: ah right ok - i'll try that if all else fails then. cheers |
| 10:46 | gfredericks | so if I have a deployment box that does not have a readline executable, is my best bet for getting a usable repl packaging jline with my project? |
| 10:48 | hyPiRion | gfredericks: hm, wouldn't it be possible to jack-in to an nREPL session at that server? |
| 10:48 | hyPiRion | /s/jack-in/connect/ |
| 10:50 | gfredericks | oh from a local machine with better stuff? |
| 10:50 | gfredericks | this would require bundling nrepl instead of jline? |
| 10:52 | hyPiRion | yeah |
| 10:53 | danneu | i come from a heroku-everything world and bought a linode box to cut my teeth. what's the straightforward way to deploy? lein uberjar and then have a git hook that rsyncs it to the server? |
| 10:54 | hyPiRion | gfredericks: nrepl is a server-like thing, and lein repl sets up an REPL-y (+ jline) interface which then connects to an nREPL server |
| 10:55 | danneu | (i meant conventional, not straightforward) |
| 11:00 | danneu | also i wrote a simple middleware that mimics rails output https://gist.github.com/danneu/9cbed0c0743fe8011014 |
| 11:02 | ppppaul | what is the reader macro '@' symbol? |
| 11:03 | yogthos | ppppaul: it's shorthand for deref |
| 11:03 | ppppaul | thank you |
| 11:09 | gfredericks | ppppaul: easy way to examine reader macros: |
| 11:09 | gfredericks | ,'@foo |
| 11:09 | clojurebot | (clojure.core/deref foo) |
| 11:26 | ravster | is there any way to print out the source of a clojure function in the repl? |
| 11:27 | ravster | not for core functions, but user-defined functions? |
| 11:27 | trptcolin | only if it's on the filesystem, or if you're doing something fancy |
| 11:28 | Pupnik- | you can write your own doc in metadata when you declare a function can't you? |
| 11:28 | Pupnik- | or am i imagining things |
| 11:28 | trptcolin | Pupnik-: sure, but that's different than source |
| 11:28 | Pupnik- | ah, true |
| 11:28 | Pupnik- | but you could put the source in it :p |
| 11:29 | trptcolin | lein repl/reply's current release has some evil called (sourcery) that works by replacing user/defn and storing source in metadata |
| 11:29 | trptcolin | but i ripped it out in master; too evil |
| 11:30 | trptcolin | iirc correctly hugod has an nrepl middleware that's way more well-considered and either gets all of the way there or most of the way |
| 11:31 | trptcolin | heh, s/correctly// (redundancy department) |
| 11:32 | trptcolin | yeah, here's what i was thinking of: https://github.com/pallet/ritz/blob/develop/nrepl-middleware/src/ritz/nrepl/middleware/tracking_eval.clj |
| 11:32 | ravster | cool, thanks |
| 11:44 | ppppaul | thanks gfredericks |
| 12:02 | berdario | Hi, I'm trying to use parsley... but I keep getting shift reduce conflicts... I think that what I'm doing could be easier with LR(1) support |
| 12:02 | berdario | I found this discussion: https://groups.google.com/forum/?fromgroups=#!topic/clojure/6DBRgcQHJF8 |
| 12:02 | berdario | and cgrand said "Parsley is closer to LR(0) (but I'd like to make it LR(1) using Pager's lane tracing algorithm or IELR) however some ambiguities of LR(0) can be lifted in parsley thanks to the contextual tokenizer" |
| 12:03 | berdario | but in the parsley readme I don't see anything mentioning the contextual tokenizer |
| 12:03 | berdario | (aside from the paper that describes the technique) |
| 12:04 | berdario | so, I don't know how to use the contextual tokenizer... if it's available |
| 12:05 | berdario | I might be better off switching to another parser generator (I was about to look at clparsec) |
| 12:09 | hyPiRion | berdario: checked out instaparse? |
| 12:09 | hyPiRion | or do you have to do rule handling at reductions? |
| 12:09 | berdario | hyPiRion: never heard of it, I'll look at it now |
| 12:10 | berdario | hyperboreean: I think that with a lookahead of 1 I should be fine... I'm not sure what do you mean with "rule handling" |
| 12:10 | dsapala | Does anyone know how to destructure using an already defined keyword such as "name"? |
| 12:11 | hyPiRion | berdario: It came out for some days ago, and it's in my opinion very good if you don't mind working on a raw AST |
| 12:11 | rbxbx | berdario can't believe you haven't heard of it, it's been around for _days_ now :p |
| 12:12 | dsapala | What I meant was var, now keyword. Still learning. |
| 12:12 | berdario | lol |
| 12:12 | trptcolin | dsapala: locals can shadow vars |
| 12:12 | hyPiRion | instaparse, so hip you've probably never heard of it |
| 12:13 | dsapala | trptcolin: that was my understanding, but I'm having something weird going on using "name" |
| 12:13 | trptcolin | ref heap us? |
| 12:14 | trptcolin | https://www.refheap.com/paste |
| 12:14 | dsapala | sure |
| 12:17 | dsapala | trptcolin: I'm using the excellent enlive to transform some html |
| 12:17 | dsapala | https://www.refheap.com/paste/13526 |
| 12:18 | trptcolin | ,((fn [{:keys [name]}] name) {:name "ohai"}) |
| 12:18 | clojurebot | "ohai" |
| 12:19 | trptcolin | so it's not a problem w/ destructuring, unless enlive has its own custom destructuring |
| 12:20 | dsapala | Hmm… I'll have to look into that. I doubt it though. |
| 12:31 | dsapala | trptcolin: Thanks for the help. I'll try some more things and see what I can get to work. |
| 12:31 | trptcolin | dsapala: sure |
| 12:36 | berdario | hyPiRion: ok, thank you... I rewrote the grammar, and it almost works! |
| 12:37 | mabes | I'm finally moving over to nrepl (in emacs).. does anyone know if something like durendal-enable-auto-compile exists for nrepl & emacs? |
| 12:38 | technomancy_ | mabes: I suspect it could be added to nrepl.el |
| 12:38 | technomancy_ | mabes: the only reason durendal existed as a separate package was because we couldn't really add features to slime.el itself |
| 12:38 | hyPiRion | berdario: oh, sweet! |
| 13:11 | CookedGryphon | Does anyone know how the telnet nrepl transport works? I can't seem to get any responses back |
| 13:12 | CookedGryphon | alternatively, how to get the HTTP transport in cemerick.drawbridge working via curl |
| 13:12 | CookedGryphon | I only ever seem to get empty responses |
| 13:13 | CookedGryphon | (my aim is to send nrepl commands from a bash script) |
| 13:36 | cemerick | CookedGryphon: should be able to suss out curl usage with drawbridge via the docstring: https://github.com/cemerick/drawbridge/blob/master/src/cemerick/drawbridge.clj#L49 |
| 13:36 | cemerick | though, drawbridge has a couple of pretty killer bugs at the moment |
| 13:36 | cemerick | patches welcome, etc |
| 13:37 | CookedGryphon | cemerick: yeah, that's what I was working through, but I just kept getting back [ ] no matter what I sent |
| 13:37 | cemerick | CookedGryphon: be certain you have the right ring middleware applied upstream |
| 13:38 | CookedGryphon | cemerick: should the standard compojure site middleware contain it? |
| 13:38 | cemerick | yup |
| 13:38 | CookedGryphon | then yep |
| 13:38 | cemerick | ok |
| 13:39 | cmajor7 | anybody has an idea why BigInt may not be read (from file) by Datomic: https://www.refheap.com/paste/13531 ? |
| 13:39 | CookedGryphon | should i be able to send through a {"op":"eval","code":"(+ 2 3)"} and get something back? |
| 13:40 | dsapala | trptcolin: I figured out what was up with that. It had nothing to do with the snippet. It was the template. I typed ":#application", but the id was "applications" which was correct in the snippet. |
| 13:40 | cemerick | CookedGryphon: mmm, probably not, since the http response isn't going to wait around |
| 13:40 | dsapala | trptcolin: Thanks again for the help! |
| 13:40 | cemerick | CookedGryphon: you need to set up a session, send the eval, then GET to drain the nrepl responses produced up to that point |
| 13:41 | CookedGryphon | aha, how do i set up a session |
| 13:41 | CookedGryphon | that's probably what I'm missing |
| 13:41 | juhu_chapa | quit |
| 13:42 | cemerick | CookedGryphon: https://github.com/clojure/tools.nrepl/blob/master/doc/ops.md |
| 13:43 | CookedGryphon | cemerick: great, thanks, I'll have another go this evening |
| 13:43 | cemerick | CookedGryphon: oh, actually, the nREPL session will be generated automatically. I bet you're not tracking the *HTTP* session. Make sure you're using curl's cookie jar support, etc. |
| 13:44 | CookedGryphon | aha, okay |
| 13:44 | cemerick | Otherwise, every single curl request will get its own ring/http session, and you'll never ever get anything back. |
| 13:49 | CookedGryphon | cemerick: Ooh, eval-error! Now we're getting somewhere! |
| 13:50 | CookedGryphon | cemerick: Ooh, eval-error! Now we're getting somewhere! |
| 13:50 | CookedGryphon | oops, sorry |
| 13:50 | Raynes | gfredericks: ping |
| 13:52 | CookedGryphon | yeah, that gives me something to work with, I think I might end up tweaking the telnet transport in the end though, as parsing the output from this is going to be tricky in bash. |
| 13:55 | danneu | Assuming this middleware: (def app (C (B (A handler)))), if you wanted middleware C to output time spent in the wrapped B,C,&handler fns, would the implementation of middlewareC like this work as intended? (let [start (Sys/nanoTime) res (handler req) end (Sys/nanoTime] ...) |
| 13:57 | danneu | I actually am doing that in my middleware. my elapsed time numbers just feel too low |
| 13:58 | amalloy | danneu: clojure is just fast |
| 13:59 | cmajor7 | made it work throwing "eval" after "read-string". but it is not quite obvious, probably has to do with how Datomic reads BigInts, because a plain "123N" does not work. |
| 13:59 | jjido | danneu: if C is a sleep action? |
| 14:02 | danneu | haha |
| 14:02 | nightfly | So I'm trying to profile some clojure code with VisualVM. But at this point with all the reduces, maps, and memoizations the call stack is full of almost entirely meaningless names. Any advice to improve the situation? |
| 14:03 | S11001001 | nightfly: you can tell visualvm to profile only classes with some name prefix; this was usually good enough when I used it on clojure |
| 14:03 | danneu | yeah, duh. i don't know why i thought <1ms was weird |
| 14:04 | danneu | monolithic rails app isn't so far off from that either |
| 14:05 | trptcolin | dsapala: sure thing |
| 14:07 | nightfly | S11001001: I'll definitely try that. It just also occured to me that rather then passing the named functions directly I should build lambdas that call them, that might preserve their names in the call stack. |
| 14:08 | ppppaul | datomic questions anyone? |
| 14:10 | S11001001 | nightfly: pass #'function-name |
| 14:10 | S11001001 | nightfly: but, er, doing either won't do what you just said at all |
| 14:11 | S11001001 | nightfly: the function object's name is exactly as good as it gets |
| 14:12 | S11001001 | ,into |
| 14:12 | clojurebot | #<core$into clojure.core$into@101c211> |
| 14:12 | S11001001 | ,(class into) |
| 14:12 | clojurebot | clojure.core$into |
| 14:13 | S11001001 | ,(class (fn [& xs] (apply into xs))) |
| 14:13 | clojurebot | sandbox$eval101$fn__102 |
| 14:13 | S11001001 | ,(class #'into) |
| 14:13 | clojurebot | clojure.lang.Var |
| 14:21 | berdario | Hi, which version of core.logic should I use? by looking here https://groups.google.com/forum/?fromgroups=#!topic/clojure/Vcm3FA2Nmiw |
| 14:21 | berdario | it suggests 0.6.7 ...but when opening the repl it fails with CompilerException java.lang.RuntimeException: Unable to resolve symbol: defmacro in this context, compiling:(NO_SOURCE_PATH:1:5) |
| 14:22 | berdario | whoops, no it doesnt... it fails with CompilerException java.lang.ClassNotFoundException: clojure.core.logic, compiling:(NO_SOURCE_PATH:1:1) |
| 14:24 | berdario | uhm, the latest version is 0.8.3 I installed that, bu when doing |
| 14:24 | berdario | (use clojure.core.logic) I still get the classnotfoundexception |
| 14:29 | wink | wrong syntax highlighting is worse than using notepad.exe |
| 14:32 | AimHere | I'm okay with mistakes in keyword colouring and the like. But indentation bugs make me weep for the state of humanity. |
| 14:35 | wink | ok, so I give up. anyone can tell me the korma syntax for "Select * from foo limit 10"? |
| 14:44 | berdario | uhm, it seems I'm affected by this bug |
| 14:44 | berdario | https://github.com/trptcolin/reply/issues/106 |
| 14:45 | trptcolin | berdario: short-term, fix the ns to not be a compile failure. longer-term, wait for the next lein release |
| 14:48 | berdario | trptcolin: uhm, what do you mean with "fix the ns"? fix some ns inside reply or the ns in which I'm trying to execute code? |
| 14:48 | trptcolin | that bug is about what happens when the ns you have set up as the :init-ns has a compile failure in it |
| 14:48 | berdario | ok, how can I know the actual compile failure? |
| 14:49 | trptcolin | remove it from :main or :init-ns in the project.clj; open a repl, execute form-by-form |
| 14:49 | trptcolin | see what blows up |
| 14:50 | berdario | ok, found it |
| 14:50 | berdario | thanks |
| 14:50 | trptcolin | sure thing |
| 15:07 | kschrader | is there a way to call '.class' on a class using Java interop? |
| 15:08 | kschrader | (String/class) and (.class String) both fail |
| 15:08 | kschrader | wondering if there's some special way to do this |
| 15:09 | trptcolin | String.class in java is the same as String in clojure |
| 15:09 | trptcolin | ,(class String) |
| 15:09 | clojurebot | java.lang.Class |
| 15:09 | amalloy | &(identical? String (class "hello")) |
| 15:09 | lazybot | ⇒ true |
| 15:09 | clojurebot | Gabh mo leithscéal? |
| 15:10 | callen | why is the bot psychotic? |
| 15:11 | kschrader | hmmm, ok |
| 15:11 | kschrader | thanks |
| 15:11 | TimMc | callen: How can you tell? |
| 15:11 | kschrader | been trying to get some Annotations off of a class and nothing seems to be working |
| 15:13 | callen | TimMc: I know my own kind! |
| 15:14 | trptcolin | ,(seq (.getAnnotations javax.xml.ws.WebServiceRef)) |
| 15:14 | clojurebot | #<ExceptionInInitializerError java.lang.ExceptionInInitializerError> |
| 15:14 | trptcolin | &(seq (.getAnnotations javax.xml.ws.WebServiceRef)) |
| 15:14 | lazybot | ⇒ (#<$Proxy2 @java.lang.annotation.Target(value=[TYPE, METHOD, FIELD])> #<$Proxy1 @java.lang.annotation.Retention(value=RUNTIME)> #<$Proxy0 @java.lang.annotation.Documented()>) |
| 15:15 | pl6306 | Does anybody know how to add local jar to Leiningen 2? |
| 15:15 | kschrader | trptcolin: Thanks, must be something wrong with my Java class, because that works fine here |
| 15:15 | amalloy | ~repeatability |
| 15:15 | clojurebot | repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability |
| 15:16 | kschrader | retention policy looks correct though |
| 15:16 | kschrader | anyway, I'll figure it out, thanks |
| 15:17 | bobbrahms | hey so tivo has this thing where |
| 15:17 | bobbrahms | sorry misfire |
| 15:22 | TimMc | Man, who needs macros anyhow? https://gist.github.com/timmc/5366403 (highlights: hyPiRion, gfredericks) |
| 15:23 | gfredericks | TimMc: holy crap |
| 15:24 | Raynes | gfredericks: I said things to you. |
| 15:24 | gfredericks | Raynes: pong? |
| 15:24 | Raynes | You did not respond. |
| 15:24 | gfredericks | I just saw the ping |
| 15:24 | Raynes | Hah |
| 15:24 | Raynes | Nice. |
| 15:24 | gfredericks | should I go find them? |
| 15:24 | Raynes | No. |
| 15:24 | gfredericks | well here I am! |
| 15:24 | Raynes | gfredericks: You mentioned recently that you wish Clojure had a way to define both a function and a macro by the same name. definline does something like that. |
| 15:25 | Raynes | May not be precisely what you were after, but it exists nonetheless. |
| 15:25 | Glenjamin | TimMc: what's #= ? |
| 15:25 | gfredericks | Raynes: in what sense is it a macro? |
| 15:25 | gfredericks | Glenjamin: reader-eval |
| 15:25 | Raynes | gfredericks: In the sense that it is a macro. |
| 15:25 | gfredericks | Raynes: it defines a macro? |
| 15:25 | Raynes | It defines a macro and a function. |
| 15:25 | gfredericks | Raynes: the main use case I'm interested in is compile-time optimization like hiccup |
| 15:26 | gfredericks | so you optimize when the user lets you but the thing can still be used as a function |
| 15:26 | amalloy | gfredericks: definline isn't as flexible as defining separate macro and function versions, but you can use the underlying mechanism it uses |
| 15:26 | gfredericks | definline is defined in clojure? |
| 15:26 | amalloy | &(doc definline) |
| 15:27 | lazybot | ⇒ "Macro ([name & decl]); Experimental - like defmacro, except defines a named function whose body is the expansion, calls to which may be expanded inline as if it were a macro. Cannot be used with variadic (&) args." |
| 15:27 | gfredericks | it adds :inline meta |
| 15:27 | gfredericks | which means the compiler will inline it at its discretion? |
| 15:28 | gfredericks | I don't understand where you might do compile-time computation here |
| 15:29 | amalloy | gfredericks: the :inline meta is just a macro. you can put whatever you want there |
| 15:29 | TimMc | Glenjamin: It's an escape valve of sorts, and the reason why you always want *read-eval* bound to false when reading Clojure forms someone else provides. (Or use read-edn.) |
| 15:30 | gfredericks | amalloy: the metadata is a macro? this makes even less sense |
| 15:30 | gfredericks | oh wait |
| 15:30 | gfredericks | you mean the value of the :inline key is a function that the compiler calls the same way it calls a macro? |
| 15:30 | amalloy | yes |
| 15:30 | pjstadig | :inline is a fn that receives unevaluated args at compile time and produces a form that the compiler then compile- |
| 15:31 | gfredericks | the compiler is guaranteed to call it? |
| 15:31 | pjstadig | if the arity matches |
| 15:31 | pjstadig | ~source + |
| 15:32 | pjstadig | in the case of calling (+ a b) it gets inlined |
| 15:32 | pjstadig | other arities do not |
| 15:32 | gfredericks | and it doesn't preclude referencing it as a function |
| 15:32 | amalloy | right. :inline is very much like a compiler macro in some other lisps |
| 15:32 | gfredericks | is this an explicit feature? |
| 15:33 | gfredericks | because it sounds like it might be awesome. |
| 15:35 | amalloy | it's not a secret. and nobody's ever tried to censor it from public radio waves |
| 15:37 | gfredericks | should all compile-time-optimization macros switch to this tactic? |
| 15:37 | tomoj | &((juxt #(.c %) #(.methodName %)) (clojure.lang.Compiler/analyze clojure.lang.Compiler$C/EXPRESSION '(+ 1 2 3 4 5 6 7 8))) |
| 15:37 | lazybot | java.lang.SecurityException: You tripped the alarm! class clojure.lang.Compiler is bad! |
| 15:37 | tomoj | (looks like all arities >1 are inlined) |
| 15:38 | tomoj | ..which makes sense given the >1? |
| 15:39 | llll | (comment) doesn't seem to work on cljs |
| 15:40 | wink | anyone used korma with mysql lately? I have no clue how SELECT "clj".* FROM "clj" could ever have worked |
| 15:42 | gfredericks | wink: because the quoting syntax is wrong? |
| 15:42 | wink | gfredericks: that's the problem obviously |
| 15:42 | Glenjamin | but thats what korma generates? |
| 15:43 | nDuff | gfredericks: Huh? Doesn't look wrong to me. |
| 15:43 | Glenjamin | mysql wants ` for table/field names |
| 15:43 | pjstadig | tomoj: yeah the link from clojurebot is for an old version of clojure |
| 15:44 | pjstadig | i guess in newer versions if you use inline-arities >1? you can have an :inline function that is variadic |
| 15:44 | wink | Glenjamin: yeah. in (select. when I use sql-only I even get \" |
| 15:45 | tomoj | seems kind of weird that (+ x) and (+) aren't inlined |
| 15:46 | Glenjamin | wink: https://github.com/korma/Korma/blob/master/src/korma/db.clj#L95 |
| 15:46 | Glenjamin | when you defdb mysql, it sets the delimeter |
| 15:46 | Glenjamin | delimiter even |
| 16:00 | wink | Glenjamin: well it should, but it won't |
| 16:00 | wink | maybe it's just a bug or two. or I'm too stupid |
| 16:10 | wink | seems to work now. weord |
| 17:27 | TimMc | gfredericks: I came up with the #=(arity n) thing while trying to generate repetitive code for just a few parts of a deftype, instead of having a macro emit the entire thing. |
| 17:39 | pl6306 | What is wrong with this (re-pattern "\\d+")? |
| 17:40 | pl6306 | I get a runtime exception |
| 17:40 | gfredericks | ,(re-pattern "\\d+") |
| 17:40 | pl6306 | Unsupported character? |
| 17:40 | clojurebot | #"\d+" |
| 17:40 | gfredericks | ,(re-matches (re-patern "\\d+") "123") |
| 17:40 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: re-patern in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 17:40 | gfredericks | ,(re-matches (re-pattern "\\d+") "123") |
| 17:40 | clojurebot | "123" |
| 17:41 | pl6306 | Doesn't work I get ")\n((re-pattern " maybe it is La Clojure on Intellij? |
| 17:42 | gfredericks | do you have to do anything special with gen-class to override an abstract method in the superclass? Or just create the var with the appropriate name? |
| 17:42 | gfredericks | pl6306: if you use four backslashes instead of 2 does it work? |
| 17:42 | pl6306 | same thing with 4 strange |
| 17:43 | gfredericks | how bout 3? |
| 17:46 | pl6306 | I reset the repl and works now. Thanks! |
| 17:50 | ieure | Is there some support in codex for more elaborate ns summary/doc stuff? |
| 17:51 | ieure | Some of the stuff I write benefits from docs that are longer than one line. |
| 17:51 | ieure | Sample code, concepts overview etc. |
| 17:51 | ieure | But this all shows up inline in the ns list in the generated docs. |
| 17:51 | mrb_bk | yo yo |
| 17:52 | ieure | I'd like it if the first line / paragraph was in the ns list, and the full text in the ns details. |
| 18:19 | danneu | wow. all this time i never noticed that clojure-doc.org and clojuredocs.org were two different things. i was wondering why clojuredocs.org didn't have a homepage "articles" link to [clojure-doc.org's] amazing tutorials. |
| 18:39 | muhoo | that topic is almost flamebait around here :-/ |
| 18:45 | bttf | muhoo: how so? |
| 19:05 | danneu | a story brimming with scandalous controversy |
| 19:14 | ieure | technomancy, Is there any way to use a local JAR in my project without setting my hair on fire? |
| 19:14 | technomancy | ieure: sure; lein-localrepo? |
| 19:15 | ieure | technomancy, It didn't appear to work for me. |
| 19:15 | ieure | Let me poke more. |
| 19:15 | technomancy | disclaimer: haven't used it |
| 19:16 | ieure | technomancy, So I have the artifact in my local repo, but lein doesn't see it. |
| 19:17 | ieure | Do I have to manually add the local repo to the :repositories key in project.clj? |
| 19:17 | technomancy | my understanding is it would place it in ~/.m2, where it would be visible |
| 19:17 | technomancy | but yeah, see disclaimer above |
| 19:18 | ieure | Okay. Well, I see it in ~/.m2, but it isn't |
| 19:18 | ieure | technomancy, Do you never do this or what? |
| 19:18 | technomancy | do what? |
| 19:18 | ieure | Use a local JAR. |
| 19:19 | technomancy | pull random jars from people who don't bother to run a repository? |
| 19:19 | brehaut | http://www.12factor.net |
| 19:19 | ieure | technomancy, I have a patch to a lib I use. I want to test the patched lib in my project before I send a broken PR. |
| 19:19 | technomancy | can you just do `lein install`? |
| 19:20 | technomancy | or mvn install or whatever |
| 19:20 | ieure | technomancy, Sure, and it puts it in the local repo, and then lein says it can't find it. |
| 19:20 | ieure | Which is why I'm here. |
| 19:21 | technomancy | ok, gotcha. so I've never heard of a jar installed via `lein install` not being available to other projects. |
| 19:22 | ieure | technomancy, https://gist.github.com/ieure/5368034 |
| 19:23 | ieure | Any idea where to look? |
| 19:23 | ieure | Oh derp |
| 19:23 | ieure | Okay |
| 19:23 | ieure | I'm just dumb, disregard. |
| 19:24 | ieure | Well, not strictly a typo. |
| 19:27 | technomancy | I must confess my defense systems go up when anyone says "local jar" because it often means sketchy things are afoot |
| 19:27 | ieure | Ha |
| 19:27 | ieure | Yeah, that is totally fair. |
| 19:28 | tieTYT2 | technomancy: you made lein right? |
| 19:28 | technomancy | tieTYT2: with some help, yeah |
| 19:28 | tieTYT2 | nice, it's a solid product |
| 19:29 | technomancy | glad you like it =) |
| 19:30 | bbloom | Does anyone know of a clojure project that provides something similar to http://docs.racket-lang.org/guide/units.html or OCaml's functors aka parameterized modules? protocols don't really seem to fit the bill for a library of functions i'm playing with |
| 19:31 | bbloom | i assume i can just hack it with some conditionals, shared state, and load-file.... |
| 19:32 | callen | technomancy: leiningen is seriously awesome. I really wish I could use it with other languages :P |
| 19:32 | callen | Scala in particular needs it. -_- |
| 19:35 | technomancy | sweet |
| 19:35 | technomancy | callen: feel free to take over the lein-scalac plugin =) |
| 19:37 | callen | technomancy: I don't like Scala enough even if I like finagle. |
| 19:48 | ieure | Thanks for the rubber-ducking, technomancy. Got everything sorted out. |
| 19:48 | ieure | https://github.com/weavejester/codox/pull/25 |
| 19:49 | technomancy | cool |
| 19:49 | ieure | Hope that gets merged, it looks like that project hasn't seen a lot of active development lately. |
| 19:49 | technomancy | personally I usually let the maintainer handle version number bumps |
| 19:49 | technomancy | unless you're bumping to a snapshot |
| 19:49 | technomancy | but whatever |
| 19:49 | ieure | technomancy, Yeah, I already had to change everything to test. |
| 19:50 | ieure | Can just rebase that commit away if necessary. |
| 19:50 | ieure | But it makes it easy to merge & release. |
| 19:50 | technomancy | yeah, for a dormant-ish project it's less of an issue |
| 19:53 | ieure | Also, writing this fn made me awfully pleased https://github.com/ieure/codox/blob/36c102669c9375d1587c5099d8a5455f97d2adbf/codox.core/src/codox/utils.clj#L73 |
| 19:57 | amalloy | ieure: why does it take N regexes, instead of just one? |
| 19:57 | amalloy | #"\f|\n\n" seems a lot simpler |
| 19:58 | devn | hm, cool: https://github.com/cammsaul/instant-clojure-cheatsheet |
| 19:58 | ieure | amalloy, I want to split on \f if it's present, otherwise split on \n\n. |
| 19:59 | ieure | #"\f|\n\n" splits on both. |
| 19:59 | ieure | So, yeah, simpler, but it doesn't do what I want. |
| 20:01 | amalloy | i see |
| 20:28 | owls | anyone use the light-table editor? I want to add a binding for closing the command bar but I'm not sure which command to use |
| 20:56 | bttf | how come when I do (doto {} (assoc "a" "b")) i only get {} ? |
| 20:57 | metellus | ,(doto {} (assoc "a" "b")) |
| 20:57 | clojurebot | {} |
| 20:58 | egghead | hm? |
| 20:58 | clojurebot | benchmarking is https://github.com/hugoduncan/criterium |
| 20:58 | metellus | bttf: it returns the thing you gave it, which is an immutable map |
| 20:58 | egghead | ,(-> {} (assoc "a" "b")) |
| 20:58 | clojurebot | {"a" "b"} |
| 20:58 | metellus | (assoc {} "a" "b") returns a new map and doesn't alter the original one |
| 20:59 | egghead | doto is mostly just for java interop isn't it? |
| 20:59 | metellus | I think so |
| 20:59 | egghead | when you need to say foo.bar().baz().setThing() |
| 20:59 | bttf | oh, i think for some reason I thought doto behaved like -> |
| 20:59 | metellus | in that case you actually use "..." I think |
| 21:00 | metellus | err, .. |
| 21:00 | egghead | hmm |
| 21:00 | metellus | doto is for when you need foo.bar() and then foo.baz() and then foo.quux() |
| 21:00 | egghead | ah right |
| 21:00 | bttf | i see |
| 21:00 | egghead | (-> and (.. |
| 21:00 | metellus | which will sometimes have the same effect as chaining |
| 21:00 | metellus | but not always |
| 21:00 | egghead | right |
| 21:01 | egghead | for instance if baz returns void :p |
| 21:03 | amalloy | egghead: i don't mostly use doto for java interop |
| 21:03 | amalloy | it's for anything side-effecty, and there are plenty of such clojure functions |
| 21:03 | egghead | amalloy: can you show me an example |
| 21:07 | amalloy | (doto (read-config-settings) (apply-changes!)) to work with config files, (doto (f x) prn) to display some debug information...(doto (lamina/channel) (lamina/on-closed ...)) or (doto (atom nil) (add-watch ...)) to register callbacks on a thing |
| 21:07 | ztellman | you and your dotos |
| 21:07 | amalloy | (inc doto) |
| 21:07 | lazybot | ⇒ 1 |
| 21:10 | gfredericks | woah |
| 21:11 | egghead | hm interesting amalloy |
| 21:11 | egghead | hadn't thought to use it like that |
| 21:11 | gfredericks | (doto prn) is an easy way to insert a debug msg in a threading form isn't it |
| 21:11 | egghead | looks like it gfredericks |
| 21:12 | gfredericks | ,(-> 3 (+ 5) (doto prn) (+ 10)) |
| 21:12 | clojurebot | 8\n18 |
| 21:12 | gfredericks | (inc amalloy) |
| 21:12 | lazybot | ⇒ 50 |
| 21:12 | gfredericks | how do I still not know how to use clojure |
| 21:13 | gfredericks | ,(clojure.walk/macroexpand-all '(-> 3 (+ 5) (doto prn) (+ 10))) |
| 21:13 | clojurebot | #<ClassNotFoundException java.lang.ClassNotFoundException: clojure.walk> |
| 21:13 | egghead | simple things w/ big implications |
| 21:13 | gfredericks | &(clojure.walk/macroexpand-all '(-> 3 (+ 5) (doto prn) (+ 10))) |
| 21:13 | lazybot | ⇒ (+ (let* [G__38205 (+ 3 5)] (prn G__38205) G__38205) 10) |
| 21:14 | gfredericks | man that's a great example of macros working together |
| 21:24 | samvit | hey I've got a quick question about the implementation of persistent data structures in clojurescript |
| 21:25 | samvit | As I understand if i conj to a map or set right now it does a full copy |
| 21:25 | samvit | and there is a version of clojurescript which will be release soon that implements hash tries (the same one used on java-clojure) |
| 21:25 | samvit | so that conj to a map or set is near constant time |
| 21:26 | jimkcar | I'm having trouble with some interop. I am wrapping a Java library that has a class Foo. In clojure I would like do declare a type Foo with (deftype Foo .....). the Clojure Foo will implement some protocol functions that need to use the Java Foo objects. The problem is when I import the java Foo, i can't declare a Foo in my clojure namespace. Seems like I'm missing something.... |
| 21:26 | amalloy | samvit: i'm not an expert on that, but i thought cljs had had persistent data structures for a while |
| 21:27 | samvit | I'm looking at the cljs github and it looks like they have a release coming soon which is gonna give hash trie implementation of cljs persistant data structures |
| 21:27 | samvit | from my expirimentation |
| 21:27 | samvit | conjing to a big map or set on the client |
| 21:27 | samvit | gets very expensive very fast |
| 21:28 | samvit | (I'm implementing an frp engine) |
| 21:28 | samvit | so i guess my question is |
| 21:28 | samvit | if i want to use the code on github |
| 21:29 | samvit | i want to use their implementation of the data structures without requiring and referencing it all over the place manually |
| 21:29 | samvit | so that {} or #{} uses the one from github even though the cljs compiler does not have it integrated yet |
| 21:30 | samvit | and I was bit stuck on that |
| 21:30 | amalloy | i don't think you can do that |
| 21:32 | samvit | hmm I'll try to use it as the actual compiler |
| 21:34 | gfredericks | samvit: I'd be quite surprised if there was any copy-on-write behavior left in cljs |
| 21:46 | samvit | I was able to get the new persistent stuff working in cljs |
| 22:00 | alandipert | samvit: https://github.com/tailrecursion/cljs-priority-map may be useful if you're FRPing in cljs |
| 22:02 | samvit | hmm cool |
| 22:02 | samvit | what kind of thing did you have in mind that I could use this for? |
| 22:03 | samvit | i.e. is there a common fro-specific use case? |
| 22:03 | alandipert | you can use it as a priority queue, an impl. of which most FRP systems involve |
| 22:04 | samvit | ah gotcha |
| 22:04 | alandipert | yeah for rank maintenance and stuff, we use it in javelin over at https://github.com/tailrecursion/javelin |
| 22:05 | samvit | oh nice |
| 22:06 | samvit | I've got a fully functional frp engine right now, very similar to webfui but faster and with more in depth dom-diffs |
| 22:06 | samvit | will release sometime once its better |
| 22:06 | samvit | but |
| 22:06 | samvit | the one bottleneck I'm trying to get over |
| 22:07 | samvit | is that I have at some point a very large map |
| 22:07 | samvit | which gets merged with another map when some templates establish new dependencies |
| 22:07 | samvit | and when that happens the merge is slow |
| 22:07 | samvit | even though with the hash-trie implementation of cljs data structures it should be near instant |
| 22:08 | samvit | I'm thinking of using transients |
| 22:22 | mullr | I've got a a mixed clojure/java project, developing the clojure in emacs. If I change the java code, is there any way to recompile and load the changed version into the repl without restarting it? |
| 22:26 | alandipert | mullr: i don't know of a way but that could be a sweet piece of tooling |
| 22:26 | alandipert | mullr: use the compiler API and stuff |
| 22:30 | mullr | It appears there's not a simple way, tooling is required: https://groups.google.com/forum/?fromgroups=#!topic/clojure/XFPSlB8-MUs |
| 22:50 | john831 | hi |
| 22:51 | gfredericks | is there anything in core for converting a seq to an enumeration? |
| 23:00 | brehaut | gfredericks: diving into old java? |
| 23:01 | gfredericks | making a SequenceInputStream |
| 23:01 | gfredericks | for jsonp ring middleware |
| 23:01 | brehaut | this sounds like the sort of thing flatland has probably already done for you :P |
| 23:02 | gfredericks | this is for a library though |
| 23:02 | gfredericks | having a library depend on a flatland lib would be a little yucky |
| 23:04 | brehaut | what is this? a c program form 1995? |
| 23:06 | gfredericks | https://github.com/qerub/ring-middleware-jsonp/issues/2 |
| 23:09 | gfredericks | enumerations are like lazy seqs but they also have mutability so they're more powerful |
| 23:11 | technomancy | whoa qerub |
| 23:11 | technomancy | I wrote ruby codes with him in two thousand six |
| 23:11 | gfredericks | man I was 13 in that year |
| 23:12 | technomancy | this was like, before github |
| 23:12 | brehaut | gfredericks: are you messing ? |
| 23:12 | technomancy | hunter-gatherer-type OSS |
| 23:12 | mthvedt | too many young people hang out in this channel |
| 23:13 | gfredericks | I like trolling people several years older than me by claiming to be way younger and seeing if they believe me |
| 23:13 | gfredericks | works best on people ~10 years older |
| 23:13 | mthvedt | how old are you? |
| 23:13 | gfredericks | 26 |
| 23:14 | gfredericks | no clue how old I was in 2006 that information is long lost to history |
| 23:14 | brehaut | ~math |
| 23:14 | clojurebot | math is hard. |
| 23:14 | technomancy | heh; math. how does it work? |
| 23:14 | technomancy | http://p.hagelb.org/mystery.gif |
| 23:14 | technomancy | gfredericks: it's funny how I read your chats in that drawl of yours after hanging out at clojurewest |
| 23:14 | brehaut | technomancy: can i sell you a promise spec? |
| 23:15 | gfredericks | oh man I have a drawl |
| 23:15 | brehaut | haha |
| 23:15 | mthvedt | so do you age twice as fast as normal people |
| 23:15 | mthvedt | if you were 13 in 2006 |
| 23:15 | gfredericks | are you talking about deadpanning or some southern thing I haven't shaken yet? |
| 23:15 | technomancy | I dunno; just a very particular cadence more than anything else |
| 23:16 | gfredericks | I need to listen to myself talk more |
| 23:16 | technomancy | eh; that always weirds me out |
| 23:16 | gfredericks | are people from far away considering lambdajam? |
| 23:16 | technomancy | reeeeally wish I could |
| 23:16 | gfredericks | technomancy: yeah that's why I never do it :) |
| 23:16 | technomancy | group improv programming is one of my favourite things |
| 23:17 | brehaut | technomancy: gfredericks thinks i sound british |
| 23:17 | brehaut | wat |
| 23:17 | technomancy | lol commonwealth |
| 23:17 | brehaut | apparently we all sound the same |
| 23:17 | technomancy | I used to be able to fake a Singlish accent |
| 23:17 | technomancy | (from singapore) |
| 23:17 | gfredericks | technomancy: I was weirded out when I met british guy because he looked just like how I expected brehaut might look |
| 23:17 | brehaut | haha excellent |
| 23:18 | TimMc | gfredericks: Some folks at work are looking at different conferences we might go to this year, and lamdajam came up. |
| 23:18 | gfredericks | TimMc: +1 |
| 23:18 | brehaut | TimMc: right side up or upside down lambdajam? |
| 23:18 | TimMc | ? |
| 23:18 | gfredericks | (inc chicago) |
| 23:18 | lazybot | ⇒ 1 |
| 23:18 | brehaut | theres two |
| 23:18 | TimMc | Right side up; the one in the northern hemisphere. |
| 23:18 | TimMc | (I'm guessing.) |
| 23:18 | brehaut | right |
| 23:18 | brehaut | theres also one in aussie |
| 23:19 | TimMc | Ha, was I right? |
| 23:19 | brehaut | yeah |
| 23:19 | technomancy | brehaut: did you hear my joke about rhotic accents? |
| 23:19 | brehaut | i think stuart sierra is talking at the upside down one |
| 23:19 | brehaut | technomancy: always |
| 23:19 | technomancy | ok good; just checking |
| 23:19 | brehaut | wait, no |
| 23:19 | brehaut | sorry missread |
| 23:20 | technomancy | just that I want to make a T-shirt that says "Rhotic accents R the best" |
| 23:20 | technomancy | I... I'll see myself out. |
| 23:20 | brehaut | lols |
| 23:20 | TimMc | >_< |
| 23:20 | callen | technomancy: AND DON'T COME BACK |
| 23:20 | brehaut | much better than my idea: tshirt that says 'helvetica' but is set in akzidenz |
| 23:21 | TimMc | gfredericks: We're also looking at ICFP/CUFP, which is in Boston this year. |
| 23:21 | gfredericks | oh right |
| 23:21 | technomancy | brehaut: not comic sans? |
| 23:21 | technomancy | I think that one actually exists |
| 23:21 | brehaut | technomancy: been done, this is more subtle |
| 23:21 | technomancy | nice |
| 23:21 | gfredericks | I might have considered submitting to one of those if I hadn't banned myself from speaking |
| 23:21 | TimMc | Boston == basically not having to travel at all |
| 23:22 | brehaut | technomancy: akzidenz is (one of?) the font(s) that helvetica is derived from, and some people think its far superior |
| 23:22 | brehaut | eg helvetica to akzidenz ~= arial to helvetica |
| 23:22 | technomancy | brehaut: sounds like a worthy shibboleth |
| 23:22 | TimMc | Oh, I figured (on context) that it was a helvetica mimic. |
| 23:22 | technomancy | TimMc: https://mobile.twitter.com/al3x/status/322461785250742272?p=v |
| 23:23 | brehaut | TimMc: given the range of such mimics, its a good guess |
| 23:23 | gfredericks | chicago is the middle coast? |
| 23:23 | TimMc | OK, bed. I've had enough internet for today. |
| 23:23 | gfredericks | that's what I said 15 minutes ago |
| 23:24 | brehaut | yeah but you are terrible at following through |
| 23:51 | amalloy | gfredericks: c.l.SeqEnumeration? |