2013-02-12
| 00:00 | spjt | i'm just thinking of myself. I just moved from a job where I was the "senior developer" as a junior in college, because I could remember more obscure PHP BS than anyone else |
| 00:00 | yogthos | spjt: first they switch for writing concise java, then they learn about higher order functions, and then mind blown :P |
| 00:01 | spjt | I wrote a PHP "framework" based on "higher order functions" in the form of callbacks |
| 00:02 | spjt | well, my beef jerky is done, that means it's bedtime. |
| 00:05 | technomancy | anyone familiar with the guts of nrepl.el? I can't figure out how to initiate a connection without showing the *nrepl* buffer. |
| 00:10 | michaelr525 | hey.. |
| 00:12 | michaelr525 | anyone knows of an alternative webchat for freenode? |
| 00:12 | michaelr525 | my work blocks the official one.. |
| 00:15 | ppppaul | frozenlock, there are some github things, but no recordings as far as i know. |
| 00:17 | Xorlev | spjt: Scala in the wrong hands _is_ scary. I know of a company who was Scala <and> PHP, then their Scala developer up and left them. Heard it wasn't good Scala either. |
| 00:23 | ivan | so unfortunately you cannot raise TieredStopAtLevel from 1 to 4 at runtime because the flag is not writeable and management.cpp stops you |
| 00:25 | ivan | unless you want to do super bad things with JNI of course |
| 00:43 | michaelr525 | hey |
| 00:44 | JanxSpirit | how can I map over a map to call toString on the values, returning a new map with those values? |
| 00:46 | technomancy | JanxSpirit: (zipmap (keys m) (map str (vals m))) |
| 00:46 | JanxSpirit | technomancy thanks - I'll take a look at that |
| 00:51 | ivan | no love for obfuscation? (into {} (map #(assoc % 1 (str (val %))) m)) |
| 02:08 | ivan | &[java.lang.Long/TYPE (java.lang.Long/TYPE)] |
| 02:08 | lazybot | ⇒ [long long] |
| 02:17 | Raynes | ivan: It's a really long long. |
| 02:19 | ivan | by induction I should be able to wrap as many parens around a static field access as I want |
| 02:22 | amalloy | ivan: you've proved N=0 and N=1. i look forward to the proof for N=N+1 |
| 02:23 | amalloy | for reference, i provide ##(((((((((fn this [] this))))))))) |
| 02:23 | lazybot | ⇒ #<sandbox8276$eval16174$this__16175 sandbox8276$eval16174$this__16175@b29eda> |
| 02:23 | Raynes | What the fuoh I see. |
| 02:23 | Raynes | Took me a second. |
| 02:24 | Raynes | Nice work. |
| 02:31 | tomoj | &(dissoc (group-by #(subs (.getName %) 0 (.lastIndexOf (.getName %) ".")) (vals (ns-imports *ns*))) "java.lang") |
| 02:31 | lazybot | java.lang.SecurityException: You tripped the alarm! clojail.testers.ClojailWrapper@17305e0 is bad! |
| 02:31 | tomoj | well, it's BigInteger, BigDecimal, Callable, and Compiler |
| 02:33 | tomoj | RT, Keyword, Symbol, IPersistentMap etc are there, but commented out |
| 02:33 | tomoj | wonder why |
| 02:36 | Raynes | tomoj: What are we talking bout? |
| 02:36 | ivan | the bottom of https://gist.github.com/rednaxelafx/1165804 has a lot of great info about -XX:+PrintCompilation and JVM optimization/deoptimization |
| 02:36 | tomoj | the default imports |
| 02:36 | Raynes | Cool. |
| 02:37 | tomoj | &Compiler |
| 02:37 | lazybot | java.lang.SecurityException: You tripped the alarm! class clojure.lang.Compiler is bad! |
| 02:38 | arcatan | ._____. |
| 02:40 | Phonatacid | Hi. Is it possible to make an inherited constructor private in clojure. A bit like gen-class' expose-methods, but with the opposite effect. (if I remember well, this is possible in java). |
| 03:47 | tekkk | i have a sequence with multiple sequences and want to remove the wrapper sequence eg. '( (:foo) (:bar) (:baz) ) |
| 03:47 | tekkk | how can i do that? |
| 03:47 | michaelr525 | hey.. |
| 03:48 | cmdrdats | tekkk: (apply concat '(...)) ? |
| 03:49 | tomoj | where did you get a sequence with multiple sequences? :) |
| 03:52 | amalloy | Phonatacid: there is no such thing as an inheited constructor |
| 03:52 | amalloy | in clojure or in java |
| 03:54 | Phonatacid | So if ,say, I have a class extending the Exception class and want to force to initialize it with parameters (String message, SpecialObject so) instead of just (String message), there is no way to do it ? |
| 03:54 | Phonatacid | anyway I gave up gen-classing exceptions. |
| 04:04 | michaelr525 | Phonatacid: there is an example of exception gen classing here: https://github.com/maxweber/clj-facebook-graph/blob/master/src/clj_facebook_graph/FacebookGraphException.clj |
| 04:06 | Phonatacid | thank you, but I think I'll use slingshot from now on. |
| 04:10 | michaelr525 | y |
| 04:11 | michaelr525 | cool.. |
| 04:12 | michaelr525 | IRCing in emacs in tmux over ssh from work :) |
| 04:14 | alex_baranosky | latest release of Slamhound fixes a bug and makes it work nicer w/ clojure.test |
| 04:28 | MacCoaster | Hi folks, are there any better alternatives to writing this? http://pastebin.com/9Z0dkz1c |
| 04:40 | thorwil | MacCoaster: why (apply generate-post [file (second args) (nth args 2)])? doesn't (generate-post file (second args) (nth args 2)) work? |
| 04:40 | cmdrdats | MacCoaster: For starters, destructure args? (let [[x y z] args] (map (fn [file] (generate-post file y z)) (get-posts x))) |
| 04:41 | MacCoaster | thorwil: it's over a map, file is obtained from a list |
| 04:41 | thorwil | MacCoaster: so what? |
| 04:42 | MacCoaster | cmdrdats: looking up destructure args, thanks. |
| 04:43 | cmdrdats | MacCoaster: well worth while - will save you tons of first, second and nth pain :) |
| 04:43 | MacCoaster | yeah, that looks really nice. I'm just new to clojure :D |
| 04:44 | cmdrdats | MacCoaster: if you have control of generate-post, move the post arg to the end |
| 04:44 | cmdrdats | then you can (map (partial generate-post y z) (get-posts x)) |
| 04:44 | MacCoaster | what do you mean, move the post arg to the end? |
| 04:44 | cmdrdats | which is a bit nicer |
| 04:45 | MacCoaster | oh you mean the file? |
| 04:45 | cmdrdats | (defn generate-post [file y z]) to (defn generate-post [y z file]) |
| 04:45 | MacCoaster | aha, so basically currying. |
| 04:45 | MacCoaster | I was kind of looking for that. :) |
| 04:45 | cmdrdats | partial application :) |
| 04:46 | cmdrdats | I'm still trying to figure where the difference is, but apparently it's not quite currying |
| 04:47 | thorwil | i think it's called currying when it happens implicitly |
| 04:47 | cmdrdats | aha |
| 04:47 | MacCoaster | cmdrdats: currying is just n functions with single args each, which is what partial application of one argument kind of does |
| 04:48 | MacCoaster | from my understanding anyway |
| 04:48 | thorwil | MacCoaster: what i meant regarding apply: (apply str ["b" "e" "r" "t"]) vs (str "b" "e" "r" "t") |
| 04:48 | cmdrdats | ah, with partial application as clojure does it, if you ((partial generate-post y) z), you'll get an arity exception |
| 04:48 | cmdrdats | instead of a function that takes another arg |
| 04:49 | cmdrdats | so, not curried, but just partially applied |
| 04:49 | MacCoaster | thorwil: anyway, back to your so what: if i did (map (generate-post file (second args) (nth args 2)) (get-posts (first args))), where would file come from? |
| 04:50 | tgoossens | when using midje filter i get this error: lein midje :filter core |
| 04:50 | tgoossens | Exception in thread "main" java.io.FileNotFoundException: Could not locate :filter__init.class or :filter.clj on classpath: |
| 04:50 | tgoossens | at clojure.lang.RT.load(RT.java:432) |
| 04:50 | thorwil | MacCoaster: i did not suggest a change outside of the fn body |
| 04:51 | MacCoaster | thorwil: ah, I misunderstood |
| 04:54 | MacCoaster | thanks cmdrdats, thorwil! |
| 04:55 | thorwil | np |
| 04:57 | cmdrdats | MacCoaster: any time :) |
| 05:07 | tgoossens | I'm using nrepl in emacs for the first time now. I succesfully connected to a nrepl server but can't seem to find an easy way of a whole clj file in the repl. And later on evaluating an expression that gets evaluated on that repl server |
| 05:08 | cmdrdats | tgoossens: C-c C-l for loading a file, and C-M-x to push the current top level form? |
| 05:08 | cmdrdats | i think :P |
| 05:09 | tgoossens | i'll try that. probably going to search for a cheat sheet |
| 05:09 | tgoossens | *should |
| 05:15 | ljos | Is there anywhere I can read about creating my own exceptions and extending java exceptions in clojure? |
| 05:16 | ljos | It seems to be mostly really old information out there. |
| 05:16 | tgoossens | anyone uses emacs for other programming languages than lisp? |
| 05:16 | ljos | yes. |
| 05:16 | ljos | tgoossens: yes |
| 05:17 | tgoossens | ljos: tell me more |
| 05:17 | tgoossens | µ |
| 05:18 | ljos | tgoossens: I use it for everything except Java, but I plan to change that. |
| 05:18 | tgoossens | interesting java in emacs |
| 05:18 | tgoossens | just using emacs for the first time btw |
| 05:18 | ljos | I plan to change to eclim-emacs |
| 05:18 | ljos | but I dont do any Java right now so I haven't had the chance. |
| 05:19 | tgoossens | i now will have to work on a project in java for a few months |
| 05:19 | tgoossens | maybe i should try it out |
| 05:19 | cmdrdats | i tried to switch to java dev in emacs |
| 05:19 | cmdrdats | not a good idea - too much syntax cruft to haul around |
| 05:20 | ljos | I do Go, Python and Clojure for the moment. |
| 05:20 | cmdrdats | eclipse does a phenomenal amount of shifting for you, which emacs doesn't really deal with |
| 05:20 | tgoossens | mmmyes |
| 05:20 | cmdrdats | that was my finding, anyhow |
| 05:20 | ljos | I tried a couple of years back as well. I changed back to eclipse rather quickly, but with emacs-eclim it looks promising. |
| 05:21 | tgoossens | ljos: interesting. I've noticed that Go is gaining some popularity |
| 05:21 | cmdrdats | ljos: I'll check out emacs-eclim :) |
| 05:21 | ljos | tgoossens: I'm just learning it by myself right now. Not using it in production. |
| 05:23 | ljos | But emacs seems to be a good fit for it. There is even an official emacs-mode in it. |
| 05:26 | tgoossens | cool |
| 05:32 | cmdrdats | ljos: haha, just had a look at emacs-eclim - brilliant idea, am going to give it a shot |
| 05:35 | tgoossens | ljos: me too |
| 05:39 | tgoossens | interesting, emacs mode for sublime + eclim for sublime |
| 05:39 | tgoossens | its going to be a hard choice (certainly now i'm at the point of learning emacs) |
| 05:40 | tgoossens | because sublime looks also quite nice |
| 05:41 | ljos | One of the big reasons I am not using sublime instead of emacs is that emacs is open source. |
| 05:44 | cmdrdats | just having paredit for java is going to change my life... |
| 05:45 | cmdrdats | if I had to pick one feature in emacs I can't live without, it would be paredit |
| 05:45 | cmdrdats | and barely anything else implements it properly |
| 05:47 | tgoossens | Also a sublime paredit plugin is in the make |
| 05:48 | ljos | cmdrdats:paredit is the bees knees. |
| 06:46 | ljos | Which is the ideomatic constructor: (->Object) or (Object.) ? I like -> better... |
| 06:46 | tgoossens | How can i avoid having to type Math/abs Math/sin . Like an import static in java |
| 06:47 | cmdrdats | ljos: (Object.) :P |
| 06:48 | tgoossens | i just want |
| 06:48 | tgoossens | abs, sin , cos |
| 06:48 | vijaykiran | tgoossens: import-static http://richhickey.github.com/clojure-contrib/import-static-api.html |
| 06:48 | lazybot | Nooooo, that's so out of date! Please see instead http://clojure.github.com/clojure-contrib/import-static-api.html and try to stop linking to rich's repo. |
| 06:48 | cmdrdats | tgoossens: (defn abs [x] (Math/abs x)) |
| 06:48 | vijaykiran | but it isn't migrated yet |
| 06:48 | tgoossens | cmdrats: i'd prefer not to do that :p |
| 06:49 | Foxboron | cmdrdats: https://github.com/masondesu/sublime-paredit |
| 06:49 | tgoossens | foxboron: so far it doesn't work for mer |
| 06:49 | tgoossens | *me |
| 06:50 | cmdrdats | Foxboron: looks cool :) glad to see paredit making it's way around :D |
| 06:51 | cmdrdats | tgoossens: tbh - you should just live with Math/sin and Math/abs |
| 06:51 | ljos | What does ->Object do different then Object. |
| 06:51 | ljos | ? |
| 06:51 | cmdrdats | because you really do want your external calls fairly explicit |
| 06:51 | cmdrdats | which is probably why import-static wasn't migrated |
| 06:52 | tgoossens | cmdrdats: i'm not willing to do that :) |
| 06:52 | cmdrdats | same reason why (use) is a bad idea, vs (require) |
| 06:52 | cmdrdats | ljos: I understand (Object.) is idiomatic :) |
| 06:52 | cmdrdats | tgoossens: why not? |
| 06:53 | ljos | cmdrdats: It seems to be most often used, but what is the real difference between . and -> ? |
| 06:53 | cmdrdats | -> is the threading macro |
| 06:54 | cmdrdats | . is for java access |
| 06:54 | Foxboron | ljos, i believ Clojure Programming say (Object.) is the most preffered. |
| 06:54 | Foxboron | believe* |
| 06:54 | cmdrdats | so -> is more general |
| 06:54 | cmdrdats | (-> 1 inc inc) => 3 |
| 06:54 | ljos | ->Constructor is not the threading macro. |
| 06:54 | ljos | the space is important. |
| 06:55 | cmdrdats | oh.. well, then (->Object) is a bad idea from readability :P |
| 06:55 | cmdrdats | because it looks like a threading macro |
| 06:56 | tgoossens | because I don't want to type it over and over again. For the same reasons you use import static in java to make your code cleaner |
| 06:56 | ljos | No. Because you cannot use the macro with a constructor. |
| 06:56 | cmdrdats | then a (defn) is what you want, perhaps in a math ns? |
| 06:57 | cmdrdats | ljos: example? |
| 06:59 | ljos | cmdrdats: (->Integer 1) returns an integer of 1, but (-> Integer 1) is a type error. |
| 07:00 | ljos | wait. there is something wrong. |
| 07:01 | cmdrdats | ljos: ye, (->Integer 1) doesn't work? :P |
| 07:02 | cmdrdats | not sure why you want to (->Integer 1) instead of (Integer. 1)? |
| 07:02 | cmdrdats | or if you prefer (-> 1 Integer.) |
| 07:06 | cmdrdats | tgoossens: code cleaner vs code clearer.. trust me, implicit importing of functions drive you nuts down the line, but as the example shows, it's trivial to implement import-static in your own code if you really want it |
| 07:06 | alexnixon | ljos: you might be thinking of records, which implicitly have two constructor fns, ->RecordName and map->RecordName |
| 07:06 | tgoossens | ok |
| 07:06 | cmdrdats | alexnion: thanks - I forget about records! |
| 07:07 | ljos | alexnixon: that is it. |
| 07:07 | the-kenny | What's the hot thing for gui nowadays? |
| 07:07 | ljos | alexnixon: but I got the two mixed up and see that I can use the Record. as well. |
| 07:08 | ljos | * Record. constructor. |
| 07:09 | alexnixon | ljos: yeah, though the Record. version isn't a function |
| 07:10 | alexnixon | (map ->Foo [1 2 3]) ; works |
| 07:10 | alexnixon | (map Foo. [1 2 3]); doesn't work |
| 07:10 | michaelr525 | the-kenny: web |
| 07:11 | ChongLi | hmmm |
| 07:11 | the-kenny | michaelr525: Heh :D I need to do some hardware (serial) interfacing and I don't want to go the server/client route |
| 07:11 | the-kenny | too much hassle |
| 07:12 | ChongLi | when a cljs case gets turned into javascript the order of the clauses changes? |
| 07:12 | ChongLi | or is this the work of the closure compiler? |
| 07:12 | cmdrdats | the-kenny: web is probably your quickest route, but if you want to trudge through swing, seesaw is pretty neat |
| 07:14 | yedi | oh sick, postgresql supports arrays |
| 07:15 | ljos | alexnixon: I see. Thank you for the clarification. |
| 07:21 | michaelr525 | the-kenny: another options is to use ClojureCLR with WPF or WinForms :) |
| 07:22 | michaelr525 | I think I saw a blog post of someone who did it |
| 07:22 | the-kenny | michaelr525: I'm on OS X ;) |
| 07:22 | the-kenny | I'll try seesaw. Just wanted to check if there's something newer/better |
| 07:27 | michaelr525 | the-kenny: Qt with clojure: http://runningwithrails.com/2012/09/clojure-and-qt-for-desktop-applications/ |
| 08:21 | kaoD | is there any reason why conj behaviour is structure dependent? |
| 08:24 | ChongLi | kaoD: yes |
| 08:24 | ChongLi | it's optimal |
| 08:25 | ChongLi | conj puts elements on the front of list |
| 08:25 | ChongLi | and on the end of a vector |
| 08:25 | kaoD | so conj is guaranteed to be optimal |
| 08:25 | kaoD | k thx |
| 08:25 | ChongLi | if you want consistent behaviour |
| 08:25 | ChongLi | use cons |
| 08:29 | thorwil | i need to validate that a string is of the form "a-b" ("1-2", "flip-flop" ...) |
| 08:29 | thorwil | i thought i could just use split and count the pieces, but that fails for "a-b-" |
| 08:36 | gfredericks | thorwil: is "a-b-" valid? |
| 08:36 | gfredericks | what about "a-b-c"? |
| 08:37 | thorwil | gfredericks: "a-b-" should be invalid, but isn't now, since split drops the final "-" without adding a result |
| 08:38 | thorwil | gfredericks: "a-b-c" is invaild and easily recognised, because i test for the number of parts |
| 08:39 | michaelr525 | thorwil: maybe regex? |
| 08:39 | gfredericks | #"[^-]+-[^-]+" |
| 08:39 | thorwil | https://www.refheap.com/paste/11206 |
| 08:39 | gfredericks | thorwil: ^ that should work, eh? |
| 08:39 | gfredericks | also it looks a bit like a face which is a plus |
| 08:40 | thorwil | heh |
| 08:40 | pjstadig | gfredericks: that will probably match "a-b-c" though |
| 08:40 | pjstadig | you'll need like ^ and $ |
| 08:40 | gfredericks | pjstadig: I assumed re-matches |
| 08:40 | pjstadig | #"^[^-]+-[^-]+$" |
| 08:40 | gfredericks | ,(re-matches #"[^-]+-[^-]+" "a-b-c") |
| 08:40 | clojurebot | nil |
| 08:40 | gfredericks | ,(re-matches #"[^-]+-[^-]+" "a-bc") |
| 08:40 | clojurebot | "a-bc" |
| 08:41 | pjstadig | well that works then :) |
| 08:42 | gfredericks | w00h! you can always be right if you make up enough unstated assumptions |
| 08:42 | thorwil | cool, thanks! |
| 08:42 | thorwil | though i wonder if just testing for a final "-" and then maybe doing the split necessary anyway isn't much cheaper |
| 08:46 | pjstadig | i think a regular expression will end up being pretty performant |
| 08:48 | thorwil | i already see the code with re-matches is much shorter |
| 08:49 | gfredericks | regular expressions are _always_ the right answer |
| 08:49 | gfredericks | except when macros are |
| 08:49 | ChongLi | bonus points if your regexes are generated by macros |
| 08:50 | thorwil | or threads |
| 08:50 | gfredericks | man you should be able to unquote inside a regex |
| 08:50 | thorwil | just to mentions was has been brought up re 99 problems |
| 08:50 | gfredericks | ,`#"foo ~(+ 1 2)" |
| 08:50 | clojurebot | #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ExceptionInInitializerError> |
| 08:50 | pjstadig | huh |
| 08:50 | pjstadig | https://blogs.oracle.com/nashorn/entry/clojurescript_repl_if_you_build |
| 08:52 | ChongLi | yeah I don't know what's going on there |
| 08:53 | ChongLi | I hope Bodil will explain |
| 08:53 | ChongLi | ring in a volcano? what's lord of the rings got to do with this? |
| 08:53 | Bodil | ChongLi: Explain what? :) |
| 08:54 | ChongLi | Bodil: your little visit to oracle? |
| 08:54 | ChongLi | I guess oracle is mount doom? |
| 08:55 | Bodil | ChongLi: I think the Tolkien references in that post refer to this: https://twitter.com/bodil/status/299139231144607744 :) |
| 08:55 | ChongLi | ahh, haha |
| 08:56 | Bodil | Long story... Marcus told me a while back Oracle are hiring developers like crazy, I said "yeah, I guess you're staffing up to invade Gondor." |
| 08:57 | ChongLi | yeah, oracle is pretty scary |
| 08:57 | Bodil | (Marcus being the guy who wrote the post.) |
| 08:57 | ChongLi | but I'm glad they're hiring more developers rather than lawyers |
| 08:58 | pjstadig | Bodil: the nashorn repl looks cool |
| 08:58 | Bodil | Yeah, I was surprised to visit the Oracle office in Stockholm and find actual developers working on cool stuff. Not what I expected. :) |
| 08:58 | Bodil | pjstadig: It's really just the Rhino repl without the Rhino. Kind of waiting for Nashorn to become fast enough to make that count. :) |
| 08:59 | pjstadig | sure, but it'll be interesting to see how well nashorn can do |
| 09:00 | Bodil | Definitely. It's pretty slow right now booting the Cljs runtime, but according to the Oracle guys the JIT stuff isn't quite done yet and it should improve a lot when it is. |
| 09:00 | ChongLi | that'll be nice |
| 09:10 | ljos | When define a new type in clojure and want to use that in a different namespace I need to do (:import [ns type]), but if that ns has a - in it like this-ns, I have to do (:import [this_ns type]). Is this considered a bug or just something we have to live with? |
| 09:11 | gfredericks | ljos: not a bug |
| 09:12 | gfredericks | it's just the abstraction being leaky, which happens when you start doing java things |
| 09:13 | ljos | gredericks: I do understand that this because java-classes can not contain -, but I would have thought that in the import statement it would just auto-translate - to _. |
| 09:14 | gfredericks | I suppose it could do that. I don't expect most people would like that though. |
| 09:14 | ljos | gfredericks: But this isn't really java interop directly. Or is there a better way to import deftype created types? |
| 09:14 | gfredericks | import is always java interop |
| 09:14 | ChongLi | is there an idiomatic way to handle vendor-prefixed functions in cljs? |
| 09:14 | ljos | Ok. |
| 09:14 | gfredericks | ljos: you might be able to get away with using deftype without importing |
| 09:15 | gfredericks | e.g., use the ->Foo constructor function |
| 09:15 | gfredericks | but deftype is quasi interoppy already |
| 09:16 | TimMc | cmdrdats: There's actually some subtlety to the import-static thing, namely that cos as a fn requires reflection, and cos as a macro can't be passed around. |
| 09:16 | ljos | ofc it would call the underlying platform, but I wouldn't call or want it to be /interop/ as it is a language feature and sometihng that should be the same for different platforms. |
| 09:16 | TimMc | cmdrdats: Err, sorry, *as a fn requires boxing |
| 09:52 | Phonatacid | hey, is there a way to set a global exception handler in clojure. I can do this in java by using ThreadGroups... |
| 09:55 | ohpauleez | Phonatacid: You can do the same thing in Clojure, or you can use dynamic captue: http://oobaloo.co.uk/dynamic-error-capture-with-clojure |
| 09:58 | tsdh | Hi. I have some lib that has some deftypes and some protocols, and some protocols are extended upon types using (extend-protocol ...). Now I have some project that uses the lib, and in there I get IllegalArgumentException because some protocol method isn't defined for the class generated by deftype. But that's wrong. (extenders MyProtocol) lists the class. |
| 10:00 | tsdh | Oh, it seems it's some weird class loading issue. The class listed in (extenders MyProtocol) is not the same class than (class myObjectIWasInvokingTheProtocolMethodOn). |
| 10:01 | tsdh | The class in extenders was loaded by #<AppClassLoader sun.misc.Launcher$AppClassLoader@82aaec8>, and the class of the object was loaded by #<DynamicClassLoader clojure.lang.DynamicClassLoader@5e012913>. So it seems to be some class loading issue... |
| 10:01 | Phonatacid | ohpauleez: thank you. It was an interesting read and I'll try to build my code like this next time. But I'll just use java's Thread.UncaughtExceptionHandler since I'm trying to catch java exceptions. |
| 10:02 | ohpauleez | Phonatacid: totally welcome |
| 10:23 | yedi | callenbot: it doesn't support {{ block.super }} either?? cmon bro |
| 10:23 | yedi | callenbot: might beregretting that decision |
| 10:35 | Frozenlock | ohpauleez: Oh my poor eyes... that's a very little font you have there. |
| 10:35 | ohpauleez | :) |
| 10:36 | ohpauleez | I apologize |
| 10:36 | ohpauleez | Slides can be downloaded |
| 10:36 | ohpauleez | sorry if you're on a portable |
| 10:39 | Frozenlock | I'm on a dual 24 inches display and still find it tiny :/ |
| 10:49 | maio | I have to store list of some things and I need to be able to add items into this list from different threads (http requests). what should I use? atom, ref, var, ..? |
| 10:50 | ChongLi | atom |
| 11:26 | dnolen | stuartsierra: another CLJS release w/ 418 applied? |
| 11:27 | stuartsierra | working right now, but I'll take a look later |
| 11:28 | ohpauleez | thank you both |
| 11:28 | dnolen | stuartsierra: thx |
| 11:29 | bbloom | is there a bot shortcut to get to a ticket? |
| 11:29 | bbloom | $jira CLJS-418 |
| 11:53 | jjl` | hi folks. what's the standard way of supporting third party modules? i'm thinking they'll conform to an interface, but where to put them? and how to notify the main application of their existence? |
| 11:58 | brainproxy | best library for working with URLs? |
| 11:59 | hugod | jjl`: https://github.com/pallet/chiba is a small wrapper to load "plugins" based on them defining namespaces under known prefixes. It doesn't impose any interface. Often people use the final section of the namespace as a function name to look for within the namespace (c.f. lein plugins) |
| 12:00 | jjl` | hugod: and they'd just go somewhere in the classpath? |
| 12:01 | hugod | jjl`: yes |
| 12:01 | jjl` | excellent. thanks |
| 12:05 | technomancy_ | chiba city! =D |
| 12:05 | ChongLi | chiba city blues |
| 12:11 | technomancy_ | bbloom: I think lazybot only knows about github issues |
| 12:15 | hugod | bbloom: fwiw, https://github.com/hugoduncan/muir is the outcome of our conversation around ast transforms the other day |
| 12:16 | bbloom | hugod: i've been off the grid for a week & a half, my brain needs to be rebooted. remind me what we talked about |
| 12:19 | hugod | bbloom: I needed to write an ast transform that could pass information up the tree, and was wondering if fipp could help me - you basically suggested it wouldn't, and pointed me at analyze |
| 12:20 | bbloom | hugod: ah, right. ok, let me peek at this |
| 12:20 | bbloom | hugod: did you look at Attribute Grammars too? |
| 12:20 | hugod | bbloom: never heard of those |
| 12:21 | bbloom | http://en.wikipedia.org/wiki/Attribute_grammar |
| 12:24 | hugod | thanks for the pointer - looks like I have more reading to do :) |
| 12:25 | bbloom | heh, but cool stuff |
| 12:25 | bbloom | may i ask: what are you using it all for? |
| 12:28 | AtKaaZ | is this the right way to import an inner class? (import '[com.tinkerpop.blueprints TransactionalGraph$Conclusion]) |
| 12:30 | hugod | bbloom: in pallet, the user writes functions that call actions. These actions are not executed immediately, but are used to build an "action-plan". Each action returns a value, but the value can't be used until execution time. Pallet has functions/forms to handle expressions using action values, but it doesn't make for natural code. I'm experimenting with translating "plain" clojure into the correct pallet forms. |
| 12:31 | bbloom | hugod: ah, i see |
| 12:31 | bbloom | tricky business |
| 12:33 | hugod | I've tried all sorts of tricks so far - monads, macros, etc, but the code still isn't very obvious to write for advanced use cases |
| 12:38 | bbloom | hugod: this is a problem i've thought about a bit too.... you want to allow "arbitrary" code, but in reality it isn't arbitrary. it's some subset subject to some restrictions |
| 12:38 | bbloom | the same problem comes up in a lot of domains |
| 12:39 | bbloom | there's no good way to get the exact feature set you want short of writing your own language, but that means you lose a lot of features & predictability of the base/host language |
| 12:39 | bbloom | it seems that the problem is that the base language, in this case clojure, is too rich |
| 12:40 | bbloom | and there is no obvious way to thin it out |
| 12:45 | jjl` | you either have to allow arbitrary code or parse it properly |
| 12:46 | jjl` | in the case of arbitrary code, you trust they'll only do the things you permit, calling parts of a library to construct these plans |
| 13:03 | drorbemet | Hi, today I am looking for a clojure project on github or elsewhere, which gives a good example of how to configure a clojure project for TDD, debug, automatic documentation and deployment. Does any one have a hint which project to choose? |
| 13:04 | hugod | bbloom: indeed - I was looking at racket's languages for inspiration. There you can expose the host language, but restrict it too |
| 13:06 | bbloom | hugod: can you link me to that reference page? |
| 13:33 | aphyr | Anyone have a clue about getting lein-rpm to package a fat jar? |
| 13:33 | aphyr | I don't know at project time what the uberjar's file name is going to be, so I can't specify it in :sources |
| 13:34 | technomancy_ | aphyr: if you don't mind leaving out the version number from the filename you can set :uberjar-name in project.clj |
| 13:41 | hugod | bbloom: yet to find a good reference page. http://queue.acm.org/detail.cfm?id=2068896 is quite useful though |
| 14:03 | danlarkin | mmitchell: hi! |
| 14:03 | danielglauser | mmitchell: Wassup! |
| 14:03 | dakrone | mmitchell: hi! |
| 14:03 | yazirian | mmitchell: hi |
| 14:03 | hiredman | mmitchell: yo |
| 14:03 | pjstadig | mmitchell: yo |
| 14:03 | mmitchell | hello! |
| 14:04 | leathekd | mmitchell: yo |
| 14:04 | drewc | mmitchell: hey hey! |
| 14:05 | ChongLi | mmitchell sure is popular around here! |
| 14:06 | joegallo | whoa. |
| 14:06 | joegallo | wait a second. |
| 14:06 | joegallo | *the* mmitchell is here? |
| 14:06 | drewr | I can't believe it's mmitchell!!!11 |
| 14:06 | drewc | joegallo: I know! Amazing !! |
| 14:07 | TimMc | I don't even know who mmitchell is and *I'm* amazed! |
| 14:07 | scgilardi | joegallo: that's Mr. Mitchell to the likes of you |
| 14:07 | joegallo | i'm sorry sir! |
| 14:16 | svjson | Does "java.lang.NoClassDefFoundError: clojure/lang/ILookupHost" mean anything to anyone? |
| 14:16 | hiredman | it means you are trying to use code compiled with one version of clojure with another version of clojure |
| 14:17 | hiredman | (abi incompatible) |
| 14:18 | svjson | Aha, thanks |
| 14:30 | Marble68 | o/ |
| 14:35 | ChongLi | hmmm |
| 14:36 | ChongLi | GPU Process in chromium pegs at 100% CPU usage no matter how small the canvas is (even 10x10 pixels) |
| 14:36 | ChongLi | I find it hard to buy the argument that it's compositing that is causing this |
| 14:40 | atyz | Hey guys, I'm a bit of a clojure idiot, trying to deploy my first app with immutant. However i didn't create it with lein new immutant, how would i setup my project to work with it |
| 14:40 | atyz | its just a simple compojure app |
| 14:40 | brainproxy | anyone used clojure and one of PayPal's SDKs or their REST API to process payments or donations? |
| 14:41 | brainproxy | I've got an old creaky rails / activemerchant thing that I need to revamp (barely even remember how it works... built 3 years ago) |
| 14:42 | thalassios_xelon | hello :)) |
| 14:42 | thalassios_xelon | how to delete a value from a vector if you know the index?> |
| 14:43 | jcrossley3 | atyz: you shouldn't have to do much. 'lein new immutant' isn't required. it just creates a blank src/immutant/init.clj file for you. |
| 14:43 | thalassios_xelon | (fun? [1 2 3] 3) ----> [ |
| 14:44 | thalassios_xelon | (fun? [1 2 3] 1) ----> [1 3] |
| 14:44 | atyz | ahh jcrossley3 - so basically i can jsut run lein immutant init |
| 14:44 | atyz | thank you |
| 14:46 | jcrossley3 | atyz: sure thing |
| 14:47 | thalassios_xelon | how to delete a value from a vector if you know the index? |
| 14:48 | TimMc | thalassios_xelon: You just asked that. |
| 14:49 | dnolen | thalassios_xelon: there's no operation that does that |
| 14:49 | ChongLi | you could use keep-indexed |
| 14:50 | dnolen | thalassios_xelon: well it can be done, linearly. perhaps when Michal Marcyk gets further along w/ RRB-Trees it can be done efficiently. |
| 14:51 | thalassios_xelon | ok thx :) |
| 14:51 | thalassios_xelon | keep-indexed i dont know what that means... |
| 14:52 | dnolen | ,(doc keep-indexed) |
| 14:52 | clojurebot | "([f coll]); Returns a lazy sequence of the non-nil results of (f index item). Note, this means false return values will be included. f must be free of side-effects." |
| 14:52 | xavriley | hi could anyone help me with extracting a (defproject) from a project.clj file? |
| 14:52 | ChongLi | ,(keep-indexed (fn [i e] (when-not (= i 1) e)) [1 2 3]) |
| 14:52 | clojurebot | (1 3) |
| 14:53 | thalassios_xelon | ok,thx :) |
| 14:53 | dnolen | thalassios_xelon: note keep-indexed doesn't preserve the vector type, so you still need to combine with (into [] ...) to get the behavior you want. |
| 14:53 | akhudek | (let [v [1 2 3 4 5] i 2] (into (subvec v 0 i) (subvec v (inc i)))) |
| 14:54 | dnolen | thalassios_xelon: akhudek solution is a bit better for large vectors |
| 14:54 | xavriley | I've got this so far: (defn extract-defproject [#^LineNumberingPushbackReader rdr] |
| 14:54 | xavriley | (loop [leindef rdr] |
| 14:54 | xavriley | (when (= "defproject" (str (first (read leindef)))) |
| 14:54 | xavriley | (prn (read (first leindef))) |
| 14:54 | xavriley | (recur rdr)))) |
| 14:55 | ChongLi | though I'd imagine keep-indexed would be better if you want to remove more than one element |
| 14:55 | ChongLi | since you'd otherwise have to create a lot of subvecs |
| 14:55 | thalassios_xelon | ok i will do it with subvecs |
| 14:57 | dnolen | Bodil: btw, how well does the Nashorn CLJS repl behave, it's pretty cool that they talk about it here - http://blogs.oracle.com/nashorn/entry/clojurescript_repl_if_you_build |
| 14:58 | technomancy | xavriley: (first (drop-while #(not= 'defproject (first %)) (repeatedly (read rdr)))) ; maybe |
| 14:59 | Bodil | dnolen: They're the ones who helped me compile Nashorn in the first place so I could write the REPL, so it's nice to see them take responsibility for it. :) |
| 14:59 | ChongLi | how does nashorn compare to v8 etc? |
| 14:59 | Bodil | dnolen: It's essentially the same as the Rhino REPL except it's using Nashorn instead... benchmarks are currently not available. |
| 15:00 | dnolen | Bodil: is the startup time for Nashorn any different? |
| 15:00 | dnolen | Bodil: I imagine node-repl is still the best far as that goes |
| 15:00 | Bodil | dnolen: It's better than Rhino, but not much. I was promised a fix for that though - apparently they're still working on the JIT. |
| 15:01 | Bodil | dnolen: Yeah, Node is still noticeably faster than Nashorn. We'll see when they get their JIT patches in, though... once startup is finished, it seems very fast. |
| 15:02 | dnolen | Bodil: nice |
| 15:02 | ChongLi | why do chrome flags have names like "Disable accelerated 2D canvas: Enable" |
| 15:02 | ChongLi | so stupid |
| 15:02 | mrb_bk | that's awesome Bodil |
| 15:07 | xavriley | technomancy: thanks, it's not quite right but I can work on it. |
| 15:20 | brainproxy | recommendations on example/s of a robust clojure-based test suite for a clojure-based web service? |
| 15:28 | tommo | guys, i'm learning clojure and cannot think of any exercises at all, any ideas? |
| 15:28 | matthavener | tommo: 4clojure.com |
| 15:29 | tommo | matthavener: ahh perfect, ty |
| 15:29 | matthavener | no problem |
| 15:31 | cemerick | Brutal: inline deftype/record method implementations *must* be grouped by interface/protocol https://gist.github.com/cemerick/4773110 |
| 15:32 | lynaghk | cemerick: the second interface implementation for Object overrides the first one? |
| 15:32 | cemerick | lynaghk: or something equivalent |
| 15:32 | jweiss | if i want to take the quoted expression [[x y] [1 2]] and the quoted expression (+ 1 2) and build (let [[x y] [1 2]] (+ 1 2)) i have a problem where the expression may have a mix of qualified symbols and local ones. Is there any easy way to sort that out? my naive attempt ends up with 'Can't let qualified name: user/x'. |
| 15:32 | lynaghk | cemerick: do you get a warning from the interpreter_ |
| 15:32 | lynaghk | ? |
| 15:32 | cemerick | heh, no |
| 15:33 | cemerick | Thus, "brutal". :-) |
| 15:33 | lynaghk | cemerick: todo: add checker to kibit |
| 15:33 | dnolen | cemerick: yeah, a warning would be nice - that issue is probably a problem for CLJS too |
| 15:33 | cemerick | Stared at that a looong time before I tried forcing the impls together, thinking "nah, this can't be it" :-) |
| 15:34 | dnolen | cemerick: heh, I definitely don't think that style should be allowed |
| 15:35 | cemerick | dnolen: the implementations were being generated by a macro, and I didn't even think to bother collapsing the impls on a per-interface basis |
| 15:35 | cemerick | I don't really see a reason to disallow it. |
| 15:36 | dnolen | cemerick: because it's a pain, deftype/record macros already insane |
| 15:36 | cemerick | That's an implementation detail. :-P |
| 15:37 | dnolen | cemerick: it's also the kind of allowed redundancy around multiple :use, :require, etc |
| 15:37 | cemerick | it's all bad karma anyway, the result of my attempting to use the same macro from clj and cljs |
| 15:37 | dnolen | better to be stricter about what is allowed and give friendly warnings / errors |
| 15:37 | amalloy | cemerick: i have had a patch for that in jira for ages, rhickey told me to bugger off |
| 15:38 | hiredman | it never even occured to me to try and do it that way |
| 15:38 | amalloy | somewhere i have a macro that re-groups stuff by interface for you |
| 15:40 | cemerick | Whatever the approach, it's all in the 'fit and polish' category. |
| 15:43 | jweiss | $findfn ['conj 'clojure.core/conj] |
| 15:43 | amalloy | jweiss: [] |
| 15:43 | lazybot | [] |
| 15:44 | jweiss | hm, so once my symbol is bare-quoted, it's too late to get it resolved with syntax-quote? |
| 15:45 | jweiss | ,(let [x 'conj] `~x) |
| 15:45 | clojurebot | conj |
| 15:45 | amalloy | jweiss: for all X, (identical? X `~X) |
| 15:45 | amalloy | `~x is like (first (list x)) |
| 15:47 | cemerick | jweiss: how crazy do you want to get? |
| 15:48 | cemerick | ,(let [v (resolve 'conj)] (symbol (-> v .ns .name name) (name (.sym v)))) |
| 15:48 | clojurebot | clojure.core/conj |
| 15:48 | jweiss | amalloy: if I have an expression like (+ x y) and one like [[x y] [1 2]] can i build (let [[x y] [1 2]] (clojure.core/+ x y)) without using something like postwalk-replace? |
| 15:48 | tommo | guys, why doesnt #(str "Hello, " %) suffice for answering question 16 on 4clojure? |
| 15:49 | xeqi | tommo: wheres the ! ? |
| 15:49 | jweiss | cemerick: but you're starting with the var. i want to start with the bare symbol |
| 15:50 | tommo | xeqi: thanks lol |
| 15:50 | jweiss | ok i see |
| 15:51 | amalloy | why would you do this, jweiss? |
| 15:52 | amalloy | if you're relying on resolve to produce clojure.core/+, there's no difference between that vs producing + and letting the compiler resolve the symbol itself |
| 15:52 | jweiss | amalloy: i'm trying to treat automated tests as data, keeping the expressions unevaluated. (i had tried going the other way, saving the expressions with serializable-fn but that required all my callers to use it). |
| 15:52 | amalloy | except that in your case, if the user has (let [+ (fnil + 0)] ...) their version of plus curiously gets ignored |
| 15:52 | spuz | what is the ' seen in "(resolve 'conj)"? |
| 15:53 | amalloy | so? + is just as unevaluated as clojure.core/+ |
| 15:53 | jweiss | amalloy: the probelm isn't + really, it's x and y. they'll get resolved to user/x when i really want them to stay unqualified. |
| 15:53 | SegFaultAX | spuz: A quote. |
| 15:54 | SegFaultAX | &(+ 1 2 3 4) |
| 15:54 | lazybot | ⇒ 10 |
| 15:54 | spuz | SegFaultAX, is it clojure syntax for something? |
| 15:54 | SegFaultAX | &'(+ 1 2 3 4) |
| 15:54 | lazybot | ⇒ (+ 1 2 3 4) |
| 15:54 | SegFaultAX | spuz: Yes, it's a quote, see above. |
| 15:54 | spuz | ok thanks |
| 15:54 | amalloy | jweiss: only if you're surrounding them with `, which i can't really see why you'd be doing |
| 15:55 | jweiss | amalloy: well, eventually the expression will get passed to eval, so symbols have to get resolved |
| 15:56 | amalloy | uhhh. eval is going to use the same rules that ` would have used, except that it will understand not to resolve locals like x and y |
| 15:56 | amalloy | (eval '(let [[x y] [1 2]] (+ x y))) works just fine |
| 15:57 | amalloy | you don't need to interfere with symbol resolution at all |
| 15:57 | jweiss | amalloy: oh right, duh. i got stuck on this before and the answer was to bind *ns* to the same ns where the expression originally came from. |
| 15:59 | jweiss | sorry, forgot what that had been for. |
| 16:02 | dxeh | &'([1 2] [3 4] [5 6]) 2) [5 6]) |
| 16:02 | lazybot | ⇒ ([1 2] [3 4] [5 6]) |
| 16:28 | dabd | Here http://clojure.org/special_forms it says: "If a name symbol is provided, it is bound within the function definition to the function object itself, allowing for self-calling, even in anonymous functions." |
| 16:28 | dabd | if a name symbol is provided then the function is not anonymous, am I missing something? |
| 16:29 | llasram | ##((fn me! [] me!)) |
| 16:29 | lazybot | ⇒ #<sandbox8276$eval23310$me_BANG___23311 sandbox8276$eval23310$me_BANG___23311@571165> |
| 16:29 | Bodil | dabd: It's anonymous in the sense that it's not bound to any symbol external to the function. |
| 16:29 | thalassios_xelon | ,(+ 2 3) |
| 16:29 | clojurebot | 5 |
| 16:30 | TimMc | In a sense, *all* Clojure fn values are anonymous. |
| 16:30 | dabd | Bodil: whenever I define local functions I made them anonymous or use letfn |
| 16:30 | ChongLi | Bodil: you could also call it a pseudonymous function :) |
| 16:30 | dabd | I didn'«t know it was possible to name a function locally |
| 16:30 | tommo | ,(/ 22 7) |
| 16:30 | clojurebot | 22/7 |
| 16:30 | dabd | make them* |
| 16:30 | TimMc | tommo: Rationals are surprisingly useless. |
| 16:30 | tommo | :D |
| 16:31 | llasram | And the eponymous function: ##@#'fn |
| 16:31 | lazybot | ⇒ #<core$fn clojure.core$fn@7d948b> |
| 16:32 | dabd | the only purpose of naming a function locally is to allow self recursion since you can't use the name after the definition of the fn |
| 16:32 | dabd | or am I wrong? |
| 16:33 | Bodil | dabd: That sounds about right. |
| 16:33 | dabd | just tried this: (let [f (fn my-fn [x] x)] (my-fn 3)) |
| 16:34 | bbloom | hugod: sorry, had to run before. i checked the irc logs & saw your message. reading that acm post now |
| 16:34 | TimMc | Giving a fn a name also makes for better stack traces. :-P |
| 16:35 | dabd | you can also use recur with an anonymous fn so i don't think it is very useful unless it is for readability |
| 16:36 | Bodil | dabd: Recur only works for tail recursion. The named fn allows for non-tail recursion too. |
| 16:36 | dabd | ok |
| 16:37 | hugod | bbloom: let me know should you find anything better on racket's languages |
| 16:39 | dxeh | &(let [x 3, y 10] (- y x)) |
| 16:39 | lazybot | ⇒ 7 |
| 16:41 | leif-p | Hi, all. I am trying to get emacs nrepl autocompletion working, and getting a "ClassNotFoundException: complete.core" error. The top hits on google are bug reports that mark this as "fixed," but I think I have the most up-to-date elisp packages. Has anyone else here personally resolved this problem? |
| 16:49 | gfredericks | TimMc: rationals are not useless. |
| 16:51 | amalloy | TimMc: there is also some dark magic whereby when you let a function its local name becomes part of its classname: ##(let [foo (fn [] 1)] (class foo)) |
| 16:51 | lazybot | ⇒ sandbox8276$eval23388$foo__23389 |
| 16:53 | dabd | I am looking at the computer shootout language site comparing Clojure to OCaml http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?test=all&lang=clojure&lang2=ocaml |
| 16:54 | dabd | interesting how Clojure has a nice performance in some benchmarks |
| 16:55 | ChongLi | those benchmarks have little to do with the language |
| 16:55 | dabd | yes the code is tweaked for performance |
| 16:55 | dabd | if you compare the Ocam code looks more idiomatic |
| 16:56 | dabd | though in the imperative style |
| 16:56 | ChongLi | and the code for the different languages really varies in quality |
| 16:57 | ChongLi | also I think it's not really a good idea to compare dynamic and static languages |
| 16:57 | dnolen | dabd: and the benchmarks could probably be made to be faster than OCaml on nearly every single one. But's it's a fairly boring exercise. |
| 16:57 | dabd | a statically typed clojure would be an interesting language |
| 16:58 | ChongLi | https://github.com/frenchy64/typed-clojure |
| 16:58 | dnolen | dabd: if you know what you're doing you can nearly always gets Java performance out of Clojure. |
| 16:58 | dabd | dnolen: and probably the ocaml programs can be made even faster |
| 16:58 | ChongLi | err |
| 16:58 | technomancy | if java is currently beating ocaml in that benchmark it probably means the submission just isn't very good |
| 16:58 | TimMc | amalloy: The fn's classname also incorporates the enclosing fn's name, I think. |
| 16:58 | dnolen | dabd: perhaps, but my impression is that OCaml doesn't offer any significant advantage perfwise over Java |
| 16:59 | amalloy | sure, that much is pretty clear |
| 16:59 | dabd | dnolen: I thought ocamlopt produced native code almost as fast as C. Can Java beat that? |
| 16:59 | ChongLi | yeah and if you put enough work into it you can make any clojure program as fast as java |
| 16:59 | TimMc | &(class ((fn foo [] ((fn bar [] (fn baz [])))))) |
| 16:59 | lazybot | ⇒ sandbox8276$eval23432$foo__23433$bar__23434$baz__23435 |
| 17:00 | TimMc | Oh, I suppose they are "inner classes". |
| 17:00 | jcrossley3 | llasram: is the meetup in the same building as ARUG? |
| 17:00 | ChongLi | I think it's far more interesting to compare how complicated it is to write certain kinds of programs in various languages |
| 17:00 | dnolen | dabd: these are I've heard about here and there. But my impression of FP langs against C is - take any such claims with serious skepticism - at least in the arean of microbenchmarks |
| 17:01 | ChongLi | I'd like to see some people take a shot at rich's ant colony demo |
| 17:01 | ChongLi | (in other languages) |
| 17:02 | technomancy | ChongLi: someone tried to do it in CL, with hilarious results |
| 17:03 | hiredman | the ant colony demo is really showing off the stm, most languages don't have an stm, so people use locks and say "look you can do it in my language too" missing the point |
| 17:03 | ChongLi | sure, they can use locks |
| 17:03 | ChongLi | I just want to see what that'd look like |
| 17:03 | hiredman | which misses the point |
| 17:04 | ChongLi | I bet it'd be pretty non-trivial |
| 17:04 | desertmonad | Forgive my ignorance, but isn't stm implemented with locks? |
| 17:04 | hiredman | the ant colony demo is about getting consistent reports out of a complex process without impeding the process |
| 17:05 | hiredman | desertmonad: it is |
| 17:05 | ChongLi | but if you're going to write an stm first and then use that, you're cheating |
| 17:06 | ChongLi | just as someone writing a lisp interpreter in C in order to do a logic programming DSL is cheating |
| 17:06 | hiredman | ~cheating |
| 17:06 | clojurebot | cheating is clojure |
| 17:06 | drewc | ahem CL? STM? www.p-cos.net/documents/cstm.pdf |
| 17:07 | hiredman | thank you for jumping in to the middle of a conversation and completely missing the point |
| 17:07 | hiredman | it really helps |
| 17:09 | desertmonad | drewc: don't mind hired man, he's having his period |
| 17:10 | drewc | desertmonad: it happens. |
| 17:10 | technomancy | putting mutable data structures in STM doesn't really help; IIRC that was the conclusion MS research reached when they experimented with a C# STM. |
| 17:10 | technomancy | you have to have immutability baked in for it to make sense |
| 17:11 | hiredman | the reason that the common lisp impl for the ant colony demo someone put forward was laughable was exactly because it used a naive locking strategy that completely missed the point of the demo |
| 17:11 | hiredman | https://groups.google.com/forum/?fromgroups=#!msg/comp.lang.lisp/HQFMhGrKrcg/cGnhGgmRbKgJ |
| 17:13 | ChongLi | yeah it's not really an impl |
| 17:13 | ChongLi | it's an imitation |
| 17:14 | TimMc | desertmonad: That's not appropriate. |
| 17:14 | ChongLi | it doesn't satisfy the requirements (coordination and consistency) |
| 17:14 | drewc | hiredman: I remember that actually ... I was a lisper back then myself :) |
| 17:15 | hiredman | drewc: your immediate and unthinking defense of common lisp gave it away |
| 17:15 | desertmonad | TimMc: you are right. sorry hiredman. |
| 17:15 | hiredman | (when no one was attacking common lisp) |
| 17:15 | TimMc | Anyway, he's always like that. :-P |
| 17:16 | TimMc | Relevant: http://www.mit.edu/~jcb/tact.html |
| 17:17 | drewc | my defense? are you that flawed that you think it was a defense? ;) |
| 17:18 | gfredericks | TimMc: that's the most memorable thing I've read today |
| 17:18 | gfredericks | well maybe cgrand's decaying lists |
| 17:18 | gfredericks | but it's at least #2 |
| 17:18 | hiredman | drewc: I think reacting to "oh the specific port of the ants sim to common lisp is flawed because it uses with locks and not an stm" with "ahem, cl has an stm" is a knee jerk defensive reaction |
| 17:19 | hiredman | "* drewc has no idea what is going on or what is being chatted about, but saw CL and STM" |
| 17:19 | ChongLi | that the hell? adblock plus is telling me "It seems that you meant www.mst.edu" |
| 17:19 | ChongLi | what? |
| 17:19 | clojurebot | what is 2d6 |
| 17:19 | dxeh | are there any jvm bytecode manipulation libraries ____that are built in clojure____ |
| 17:19 | desertmonad | TimMc: perhaps I am neither a nerd or normal, but that essay reads to me like an excuse for nerds to be jerks. We can go to #emacs for that. I've always been struck by how generally kind and helpful the clojure community is. |
| 17:20 | TimMc | desertmonad: Yeah, it could be read that way. I see it as an educational tool for bridging certain cultural divides. |
| 17:20 | drewc | hiredman: is that what I was reacting to? amazing .. well thank you for telling me, at least now I know what was going on and being chatted about! |
| 17:20 | TimMc | #clojure is *fantastic*. I love y'all. |
| 17:21 | hiredman | dxeh: not really, there was a port of the clojure compiler to clojure that included it's own bytecode generation stuff written in clojure |
| 17:21 | TimMc | ChongLi: When that ABP feature went live it told me that instead of www.example.com perhaps I wanted www.example..com? (extra dot) |
| 17:21 | hiredman | dxeh: is there a reason not to use asm or bcel? |
| 17:21 | ChongLi | TimMc: I'll be sure to disable it |
| 17:21 | dxeh | hiredman: is it basically just a port of objectweb asm or something |
| 17:21 | SurlyFrog | I would /really/ appreciate it if anyone could take a minute and comment on a piece of code I wrote to merge two sorted seqs. It seems like I may have made it more complex than necessary. Feels like there must be a more idiomatic way to do this. http://pastebin.com/BQLSEvBs |
| 17:22 | dxeh | and hiredman because those are both designed with OO and it could get weird |
| 17:22 | dxeh | anyways doesnt matter i guess i will just write my own lib |
| 17:22 | hiredman | dxeh: I have no idea, it was generally dismissed out of hand as being silly to reimplement all that stuff |
| 17:22 | ChongLi | TimMc: OK that's weird; there's no preference for the anti-phishing option? |
| 17:22 | hiredman | dxeh: using asm from clojure is fine |
| 17:22 | amalloy | well, this won't work on sequences containing nil or false, for starters, SurlyFrog |
| 17:22 | TimMc | ChongLi: I think it offered to turn itself off. |
| 17:23 | dxeh | hiredman: not like its hard to implement anyways the jvm spec is amazingly documented |
| 17:23 | ChongLi | TimMc: still a bad UI choice |
| 17:23 | dxeh | i plan on writing a syntax tree structure anyways so it would be easier to start off from scratch |
| 17:23 | SurlyFrog | amalloy: true |
| 17:23 | TimMc | It's feeping creaturism. |
| 17:23 | hiredman | the only short fall I've had with asm is for parsing bytecode |
| 17:23 | ChongLi | TimMc: if I had enabled it, would I have ever had an opportunity to disable it again? |
| 17:24 | dxeh | ah, i actually wrote a few java "deobfuscator"s (using different libraries each time such as asm, bloat, bcel, serp, etc) |
| 17:24 | dxeh | basically they all reverse obfuscation techniques but ofc they were in java |
| 17:24 | amalloy | the general structure is basically okay, although since you're not using laziness or vectors it reads like a port from common lisp |
| 17:24 | hiredman | you know asm is in the jdk now with java 7 (re-rooted under sun.* somewhere) |
| 17:25 | dxeh | hiredman: not the latest version though |
| 17:25 | amalloy | SurlyFrog: for a working, lazy implementation, see https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L259 |
| 17:25 | dxeh | anyways im just gonna write my own bytecode lib |
| 17:25 | hiredman | sorry java 8 I mean |
| 17:25 | SurlyFrog | amalloy: yeah, that's what I was thinking. I mean, this is pretty much how I would do it in Common Lisp. If the seqs passed in as parameters are lazy, do I not preserve the laziness? |
| 17:25 | amalloy | no |
| 17:25 | SurlyFrog | how come? |
| 17:25 | SurlyFrog | where do I break it? |
| 17:26 | amalloy | everywhere. you don't attempt to do anything lazy |
| 17:26 | amalloy | tail recursion has exactly the opposite goal of laziness |
| 17:26 | SurlyFrog | hmmm…. |
| 17:27 | SurlyFrog | the laziness is giving me craziness... |
| 17:27 | leif-p | emacs nRepl autocomplete question: it works with [lein repl + M-x nrepl], works with [M-x nrepl-jack-in], but does *not* work if I put (nrepl/start-server …) in my app init fn. Anyone run into this problem? |
| 17:27 | gfredericks | if you wrapped the body in lazy-seq and replaced tail recursion with explicit recursion? |
| 17:27 | amalloy | *nod* |
| 17:27 | SurlyFrog | oh….I think I see what you mean... |
| 17:28 | hiredman | leif-p: you don't have all the nrepl middleware that lein includes |
| 17:28 | gfredericks | the lazy-seq macro immediately does nothing, and runs the body later when necessary |
| 17:28 | gfredericks | SurlyFrog: so each time the function gets called it just returns a thunk until you actually ask for something; so it'll only get realized once step at a time |
| 17:29 | SurlyFrog | gfredericks: okay, I'm following you. Just need to get my head completely around it. |
| 17:31 | SurlyFrog | so it would be something like: `(lazy-seq (cons (if (pred a b) a b) (merge-seqs seq-a seq-b) … with a bit of logic there to rip off the head and what not. |
| 17:32 | leif-p | hiredman: Thanks! So my best best is to dig into how the lein repl task starts its server? |
| 17:33 | hiredman | sure |
| 17:35 | gfredericks | SurlyFrog: sounds right |
| 17:46 | devinus | anybody know what the latest light table version is? |
| 17:48 | eriko | devinus: I believe 0.2.7 |
| 18:01 | jweiss | is there a way to check if a given expression will compile in a given namespace, without causing side effects of actually evaluating it? I know i could (eval `(fn [] ~e)) or some such, but it seems like that might end up wasting a lot of permgen space. |
| 18:13 | gfredericks | jweiss: that is a fascinating question |
| 18:13 | gfredericks | I'm fascinated by whether or not a correct implementation would be easy |
| 18:14 | gfredericks | likely not |
| 18:14 | Frozenlock | Would tryclojure be considered the smallest webrepl example? |
| 18:14 | jweiss | gfredericks: i'm experimenting with using expressions for my "tests" rather than no-arg functions, but I don't want to completely lose compile-time checking. so the above would probably do what I want, but seems like it would waste memory |
| 18:15 | amalloy | jweiss: that won't waste any permgen |
| 18:15 | amalloy | the classloader that eval uses will get thrown away, and then the classes it loaded will get thrown away |
| 18:15 | jweiss | amalloy: doesn't each anonymous function become a new class? |
| 18:15 | jweiss | ah |
| 18:15 | jweiss | good to know |
| 18:15 | gfredericks | woah that's crazygonuts |
| 18:16 | gfredericks | I had no idea classloaders were so disposable |
| 18:25 | amalloy | gfredericks: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Compiler.java#L6585 |
| 18:30 | gfredericks | amalloy: cool, thanks |
| 18:31 | tgoossens | Anyone read "Programming Language Pragmatics, Third Edition." . Would you recommend it? |
| 18:34 | ravster | hello all |
| 18:34 | ChongLi | hi |
| 18:42 | Frozenlock | !! https://github.com/technomancy/serializable-fn |
| 18:42 | Raynes | Frozenlock: Just now discovered that? |
| 18:43 | Frozenlock | Yeah, I'm late to the party, nobody invited me :( |
| 18:43 | Raynes | Frozenlock: https://github.com/flatland/clojail/blob/master/src/clojail/testers.clj |
| 18:43 | anykao | hi, folks. How do you develop clojurescriopt in vim interactively? |
| 18:43 | Raynes | Written entirely in terms of serializable functions. |
| 18:43 | Frozenlock | Raynes: Well I just discovered that by looking at the clojail doc :) |
| 18:44 | ravster | I'm working with the 'friend' auth system, and I'd like to know if I can have friend do some dynamic authorization. Specifically, I don't want to just know if a user has an account on the system, but I want to make sure that the user is allowed to access a particular path, and the path is going to have a 'department id number' in it. |
| 18:45 | ravster | We were thinking of populating the user ':roles' key with stuff that would have the correct auths for it. |
| 18:46 | ravster | I don't know if this is the right way to go about it, has anyone else tried something like this? Also, please let me know if I need to elaborate on the problem. |
| 18:51 | dxeh | http://pastebin.com/BH78bKHg results in Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: buf in this context, compiling:(cbml/core.clj:9) |
| 18:51 | dxeh | not sure why it would do that though |
| 18:52 | hiredman | dxeh: there are lots of things wrong there |
| 18:53 | hiredman | def creates a global binding of a namespaced name to a value |
| 18:53 | hiredman | you should not use it in side a function |
| 18:53 | dxeh | oh okay |
| 18:53 | Frozenlock | dxeh: www.refheap.com |
| 18:53 | hiredman | dxeh: let is lexically scoped, let bindings only exist in the body of the let |
| 18:54 | dxeh | right |
| 18:54 | dxeh | so is that what my error comes from, me trying to globablly declare within a function |
| 18:54 | hiredman | no |
| 18:54 | hiredman | you will not get an error for that |
| 18:55 | hiredman | look at the def magic line, look at the let binding for buf |
| 18:56 | dxeh | k fixed it lol |
| 18:56 | dxeh | i am just trying to pick up clojure :P i havent learned a lisp yet so i wanna use clojure :D |
| 19:09 | Frozenlock | Is adding something in your lein profile sufficient to add it in all projects? I'm trying to get serializable-fn to work, but I keep getting an error with (use '[serializable-fn]) in the REPL. Doing 'lein deps :tree' in the project I'm currently in also shows the serializable-fn package. |
| 19:09 | Frozenlock | Oh wait, it's serializable.fn ?! |
| 19:10 | technomancy | yeah, you should be able to add it to :dependencies in :user |
| 19:11 | Frozenlock | Yup, that's what I've done. It works now, I just assumed a bad namespace. |
| 19:13 | dxeh | ,defrecord |
| 19:13 | clojurebot | #<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/defrecord, compiling:(NO_SOURCE_PATH:0)> |
| 19:13 | dxeh | how do you make the bot link to articles? |
| 19:14 | Frozenlock | I wonder if something would break by using the serializable/fn in 'defn', instead of core/fn. |
| 19:20 | Frozenlock | Well no, everything seems to work... |
| 19:23 | Frozenlock | I must be missing something here; why is the serializable/fn not the default behavior in clojure? |
| 19:23 | technomancy | Frozenlock: memory usage, I think |
| 19:24 | technomancy | there's been talk for ages about some kind of "dynamicity knobs" that would let you tune usefulness vs memory usage, but nobody's done anything about it because jira |
| 19:25 | technomancy | well, other than allowing locals clearing to be disabled |
| 19:26 | tomoj | because jira? |
| 19:28 | technomancy | because jira is _ |
| 19:28 | Frozenlock | Shame.. I really like the serialization, but requiring it everywhere is a little cumbersome |
| 19:28 | technomancy | fill in the blanks as you choose =) |
| 19:30 | Frozenlock | Really fun: (second (read-string (pr-str my-fn))) --> ([x] (+ 1 x)) |
| 19:30 | tomoj | jira is so difficult to use that people can't communicate effectively enough about dynamicity knobs to get something done? |
| 19:31 | tomoj | I mean, I understand jira hate, but not what that has to do with getting something done |
| 19:31 | technomancy | tomoj: sure, that's a kind way to put it |
| 19:31 | tomoj | I'm actually probably a few weeks away from either running out of atlassian free time or buying jira :/ |
| 19:34 | Frozenlock | Would hooking 'ns' work to use/require stuff in each namespace? |
| 19:34 | abp``` | Seriously? No tools out there that do a better job tomoj? |
| 19:34 | abp``` | Wow I'm well over quoted. |
| 19:34 | tomoj | I'm sure there are, haven't found one yet. suggestions? :) |
| 19:36 | technomancy | anything? bugzilla would be an improvement. |
| 19:37 | abp | I don't know many from working with them, but there are a lot of hosted platforms for collaborative work.. |
| 19:37 | abp | pivotal tracker, fogreek stuff etc. |
| 19:37 | hiredman | does bugzilla even have an api? |
| 19:37 | hiredman | I guess it does |
| 19:38 | abp | Or are those not clunky enough to get any work done? |
| 19:39 | headshot | hiredman: crappy xmlrpc |
| 19:39 | hiredman | guys, you can write core.logic programs for querying jira, https://github.com/hiredman/jiralog, game over |
| 19:39 | tomoj | we pretty much just use greenhopper. I've wondered about trello |
| 19:40 | tomoj | the api looks interestingly complete |
| 19:42 | abp | tomoj: Greenhopper is an interface on top of jira? |
| 19:42 | cemerick | hiredman: problem solved :-P |
| 19:43 | abp | tomoj: Oh, no I see. |
| 19:43 | hiredman | cemerick: it doesn't work well with the clojure jira install for some reason |
| 19:43 | hiredman | the rest api doesn't return any fields there |
| 19:44 | TimMc | We use JIRA at work and I don't hate it. |
| 19:44 | hiredman | ditto |
| 19:44 | hiredman | it is better then what we used before |
| 19:44 | TimMc | We also don't use it for communication. It's just for issue tracking. |
| 19:45 | TimMc | If conversation on dynamicity knobs is not progressing, that's a social problem and not a technical one. |
| 19:45 | hiredman | yep, actually I just wired up a jenkins build to move issues around in jira to sync up with our code review pull requests |
| 19:46 | TimMc | Cute. |
| 19:46 | abp | Yea. |
| 19:46 | TimMc | Github really needs to get on the ball and make Issues and PRs play better together. |
| 19:46 | hiredman | I think the issue is the people who would most want the dynamicity knobs are the ones filled with the most bile around the current process |
| 19:46 | abp | Jenkins Clojure test integration is still lein test configured as cmd call? |
| 19:47 | hiredman | see, I am ok with jira, but I don't care about the knobs and don't really want them |
| 19:47 | hiredman | abp: we have a bin/ci script checked in to each repo that jenkins calls |
| 19:48 | cemerick | so, there are no base types in cljs (e.g. equivalents to java.util.List) |
| 19:49 | cemerick | and extend-protocol and extend-type both require symbols for types (not forms like (type foo)), so a dispatch for `default` can't extend a type to a protocol dynamically at runtime |
| 19:50 | cemerick | so it seems that protocol extensions must be specified explicitly for each concrete type ahead of time. Correct, or no? |
| 19:50 | hiredman | cemerick: in clojure you can get around that by using let or def |
| 19:50 | technomancy | TimMc: yeah, fair enough. I use "jira" as a shorthand for "jira and other deficiencies in the clojure contribution process" |
| 19:50 | abp | hiredman: To shell out to lein test? Or doing environment setup as nescessary, also? |
| 19:50 | hiredman | abp: yes |
| 19:51 | hiredman | abp: also publishing artifacts etc |
| 19:51 | cemerick | hiredman: well, there's often base types that you can extend to and be done with it; but, even if there aren't (e.g. with array types), you can do (extend-type (class foo) SomeProtocol ...) |
| 19:51 | hiredman | all that stuff is versioned that way |
| 19:51 | hiredman | cemerick: have you tried (let [x (class foo)] (extend-type x SomeProtocol ...)) ? |
| 19:52 | abp | I haven't done anything with Jenkins or any CI-server, ever. But soon have to. Assist in setup at least. |
| 19:52 | hiredman | if you use something like bin/ci you can keep build stuff in version control |
| 19:53 | technomancy | yeah, highly recommend using something like bin/ci |
| 19:54 | hiredman | we also have a little project for grabbing the xml build configs from jenkins, checking them in to git, and then a jenkins build that watches that git repo and re-pushes configs in to jenkins |
| 19:54 | hiredman | "we heard you like ci, so we ci'ed your ci" |
| 19:55 | abp | Could someone of you sketch out a little example from experience, please? Just found https://github.com/technomancy/leiningen/wiki/Jenkins while googling for Clojure with Jenkins. |
| 19:55 | hiredman | technomancy used to work here |
| 19:56 | abp | hiredman: You guys take project automation serious. :) |
| 19:56 | hiredman | oh |
| 19:56 | hiredman | that doesn't seem to be written by technomancy |
| 19:56 | technomancy | abp: those instructions are a lot more complex than they need to be |
| 19:56 | hiredman | oh, maybe it is |
| 19:56 | technomancy | no, some other guy |
| 19:56 | abp | I see some half-assed setup choking in dust on the horizon.. |
| 19:56 | technomancy | making a jenkins job for lein itself is unnecessary |
| 19:57 | technomancy | there's a proper jenkins plugin for lein now I think |
| 19:57 | abp | Didn't even looked into it that close. Just saw some resource and thought it would suffice. |
| 19:58 | cemerick | hiredman: that compiles, but does not appear to work |
| 19:58 | technomancy | https://wiki.jenkins-ci.org/display/JENKINS/leiningen+plugin |
| 19:59 | technomancy | personally I think it's easier just to use the bin/ci approach and pull lein in using the same mechanism you use to get jenkins |
| 19:59 | technomancy | but until lein2 lands in apt I must grant that this approach can be considered lacking |
| 20:02 | cemerick | hrm, perhaps it does |
| 20:02 | abp | technomancy: Well, wow. I thougt that plugin was dead when searching around. The github-link I found by that time was https://github.com/pyr/jenkins-leiningen, but that 404s. It's https://github.com/jenkinsci/leiningen-plugin now apparently.. |
| 20:03 | technomancy | abp: cool; feel free to update the wiki |
| 20:03 | technomancy | I already nixed the old instructions, but you could add this in |
| 20:04 | hiredman | cemerick: it works in clojure |
| 20:04 | technomancy | jenkins is a bit too clicky-clicky for my taste, but there are ways to set it up via proper config files |
| 20:04 | NeekuOfPersia | hiredman, am I still your biggest love? |
| 20:05 | technomancy | oh, except for the user management. that's just completely ridiculous. |
| 20:05 | cemerick | hiredman: well, you don't need the let in clojure anyway. i.e. (extend-protocol X (type []) (y [k] (count k))) just works |
| 20:05 | technomancy | last I checked anyway. |
| 20:05 | cemerick | though it does seem to work in cljs now that I restarted my repl..... |
| 20:05 | cemerick | using a let to get the type, that is |
| 20:06 | cemerick | s/get/capture |
| 20:06 | hiredman | cemerick: there is some case where it is (was?) required |
| 20:11 | hiredman | cemerick: that actually fails if (type []) isn't the first type the protocol is extend to |
| 20:12 | cemerick | hiredman: what version of Clojure? Not seeing that here with 1.5.blah |
| 20:13 | hiredman | 1.4 I guess? |
| 20:13 | hiredman | (extend-protocol X String (y [x] x) (type []) (y [k] (count k))) npes |
| 20:14 | cemerick | hiredman: oh, I thought you meant "first", temporally |
| 20:16 | hiredman | https://github.com/clojure/clojure/blob/master/src/clj/clojure/core_deftype.clj#L66 |
| 20:20 | gozaboru | is there a way to use partition-by with context? (e.g. how can I split a sequence ( [1 2 3 2 3 1] ) into increasing subsequences ( [1 2 3] [2 3] [1] ) ) |
| 20:21 | hiredman | partition-by > ? |
| 20:21 | hiredman | err <? |
| 20:21 | gozaboru | right, that's what I was thinking |
| 20:22 | gozaboru | but I'm doing it wrong |
| 20:22 | amalloy | hiredman: partition-by doesn't get two elements |
| 20:22 | amalloy | https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L224 ;; partition-between |
| 20:22 | gozaboru | excellent, thanks amalloy! |
| 20:35 | Frozenlock | How does one get the doc from a namespace? (doc clojure.core) just throws an error :/ |
| 20:40 | gfredericks | ,(-> clojure.core quote find-ns meta :doc) |
| 20:40 | clojurebot | "Fundamental library of the Clojure language" |
| 20:42 | Frozenlock | Oh sure, obvious :P |
| 20:42 | Frozenlock | Thanks |
| 20:46 | ravster | Hey, I'm getting a weird error in my program. I've got one function calling another function and passing in some variables. Those variables can be seen and are the correct type in the first function, but they are just 'nil' in the second function. I'm thoroughly stumped. I've been at this for a few hours. Any tips on what I should try to find out whats going on here? |
| 20:47 | hiredman | restart your repl |
| 20:47 | gfredericks | if that doesn't work, simplify your code as much as you can and give a paste |
| 20:49 | ravster | hiredman: will do. thanks. didn't think about that. |
| 20:50 | ravster | The second function is accessed through a few namespace changes. Would that be an issue? |
| 20:51 | hiredman | what do you mean by namespace changes? |
| 20:55 | ravster | function 1 is calling function 2 in another namespace. in the second namespace, function 2 is defined as a partial of a function in yet another namespace. We're dealing with datomic-simple, and trying to have functions not know about stuff they don't need to know. |
| 20:55 | gfredericks | ravster: that description sounded pretty tame |
| 20:55 | ravster | tame? |
| 20:56 | gfredericks | no obvious issues |
| 20:56 | gfredericks | regular usage |
| 20:56 | ravster | oh, okay. |
| 20:56 | gfredericks | should work |
| 20:58 | ravster | yeah, whats even more frustrating is that we have 2 partial functions to the same base function, and one of them works just fine. maddening as heck. |
| 21:12 | Frozenlock | Hmm... isn't (:refer-clojure :exclude [ns]) supposed to prevent 'ns' from being imported in the current namespace? |
| 21:12 | clifton | is there a good resource for either getting started doing web development with clojure, or a coherent collection of best practices? |
| 21:12 | clifton | ive read Clojure Programming and I'd like to make something useful |
| 21:13 | brehaut | clifton: what do you need that isnt covered by ring and compojure (as outlined in clojure programming) ? |
| 21:14 | gfredericks | Frozenlock: I thought so |
| 21:14 | Frozenlock | Not only does it still refer it, but I can't redefine it :/ |
| 21:15 | Frozenlock | (doc ns) will always give me the clojure.core/ns documentation. |
| 21:15 | clojurebot | "([name docstring? attr-map? references*]); Sets *ns* to the namespace named by name (unevaluated), creating it if needed. references can be zero or more of: (:refer-clojure ...) (:require ...) (:use ...) (:import ...) (:load ...) (:gen-class) with the syntax of refer-clojure/require/use/import/load/gen-class respectively, except the arguments are unevaluated and need not be quoted. (:gen-class ...), when supplied, defaults |
| 21:15 | clifton | asset packaging, development mode reloading, application structure etc |
| 21:16 | brehaut | clifton: back to front; app structure varies a lot depending on the app, front end requirements, datastorage etc |
| 21:16 | gfredericks | Frozenlock: that seems to be the case for me too |
| 21:17 | Frozenlock | :( |
| 21:17 | brehaut | clifton: dev mode reloading you can be handled by a ring library |
| 21:17 | Frozenlock | And ns-unmap won't accept a macro... |
| 21:17 | gfredericks | eh? |
| 21:17 | Frozenlock | Oh I need a symbol |
| 21:18 | brehaut | clifton: there isnt a huge amount of asset management stuff around at the moment. i think dieter might be the only thing in usable state atm, and its only for stuff that runs via node.js tools |
| 21:18 | Frozenlock | Done (ns-unmap *ns* 'ns)... still have 'ns' in my namespace. |
| 21:18 | Frozenlock | The indestructible 'ns' |
| 21:19 | brehaut | clifton: https://github.com/weavejester/ring-reload-modified |
| 21:19 | clifton | ah |
| 21:19 | clifton | thanks for the link |
| 21:19 | zach` | I've been using emacs for five minutes and it's already my irc client. :-D |
| 21:19 | brehaut | clifton: the #' on #'handler is vital for that to work right (its a var quote; ie you pass the var, not what the var is currently point to through) |
| 21:20 | Frozenlock | zach`: That's the path to enlightenment :P |
| 21:20 | gfredericks | Frozenlock: fortunately grepping clojure/src for 'ns' only gives 5407 results so this should be a snap to figure out |
| 21:20 | clifton | right, it needs a reference |
| 21:21 | ravster | zacht: wow. you catch on to it way quicker than I did |
| 21:21 | zacht | ravster it's nothing to do with me. I downloaded Emacs Live. |
| 21:22 | Frozenlock | gfredericks: I tried with other clojure.core macros and it doesn't behave like this. ns is magical. |
| 21:23 | gfredericks | Frozenlock: just kidding it's 5451 matches |
| 21:23 | Frozenlock | Ah! Easy as cake then. |
| 21:23 | Frozenlock | Which is a lie. Ohhhh I'm so funny. |
| 21:27 | brehaut | clifton: https://github.com/edgecase/dieter that was the asset thing i mentioned |
| 21:27 | clifton | thanks |
| 21:27 | clifton | found a good site scaffold generator |
| 21:28 | clifton | https://github.com/eprunier/lein-webapp-template |
| 21:28 | clifton | in case anyone else comes in here and asks |
| 21:29 | clifton | and noir isnt being updated anymore is it? |
| 21:29 | Frozenlock | clifton: nope |
| 21:29 | clifton | ah, too bad |
| 21:29 | brehaut | noir is deprecated, long live libnoir ? |
| 21:30 | brehaut | http://blog.raynes.me/blog/2012/12/13/moving-away-from-noir/ |
| 21:31 | clifton | and ring-reloader is the type of thing that you add to dev-dependencies only, right? |
| 21:31 | brehaut | the things that noir provided that libnoir does not tend to be abstractions that get in the road of just writing web apps the ring way |
| 21:31 | brehaut | which is to say, leveraging the crap out of middlewares |
| 21:32 | brehaut | its all fulcrums and levers, gfredericks |
| 21:36 | clifton | is there a good pattern to use for logging within a ring app |
| 21:37 | gfredericks | middleware? |
| 21:38 | abp | Would it make any sense to define named contexts in compojure like (context #paging "page/:page" [:page] (GET "/ugliness/#paging" ...)) for example? |
| 21:39 | abp | being able to |
| 21:43 | brehaut | abp: O_o what does that even mean? |
| 21:44 | brehaut | abp: are you meaning something different to the existing compojure context macro? |
| 21:44 | abp | brehaut: context at the end of the route instead of the beginning? |
| 21:44 | gfredericks | #paging looks like a data reader literal |
| 21:44 | abp | oh sure, not good |
| 21:44 | abp | more like :paging then. |
| 21:44 | abp | I'm tired and being stupid. |
| 21:45 | brehaut | abp: you could do that with a parametrically defined route (ie, a route returned from a function) using vector route definitions rather than strings |
| 21:45 | abp | # was just the first thing coming to my mind for context |
| 21:45 | Frozenlock | I give up, `ns' really is immortal. |
| 21:46 | brehaut | abp: compojure's existing context function is used for embeding a handler into another compojure route with a path prefix |
| 21:46 | abp | brehaut: Oh, ok. Should start a route experimenting project probably. I just need to define a lot of routes supportinh paging, so my mind is coming up with random ideas to abstract that. |
| 21:47 | abp | brehaut: sure and i wanted to make em *fix |
| 21:48 | brehaut | abp: you could always make a middleware that slashes the paging off the end of the url and chucks it into the request map |
| 21:49 | abp | brehaut: That sound much more reasonable anyway. Thanks. ;) |
| 21:50 | abp | The other stupid thing I was thinking about is more syntax sugar for defelem'd fns in Hiccup. Like (link-to :id.class ...) |
| 21:51 | abp | I need to hire someone to shut down my stupid ideas that keep me from sleeping at night. |
| 21:52 | Frozenlock | abp: You mean instead of (link-to {:class "id class"} ...) ? |
| 21:52 | Frozenlock | Oh wait |
| 21:52 | abp | Frozenlock: Yeah, those are getting really offensive at times.. |
| 21:52 | Frozenlock | (link-to {:id "some-id" :class "some-class"} ...) :-) |
| 21:53 | abp | Frozenlock: sure |
| 21:53 | abp | (link-to#id.class ..) would be even more hiccupish.. :x |
| 22:06 | abp | Frozenlock: But that does not work out, of course. Writing wrappers like hiccup-bootstrap or giddyup is the way to go. |
| 22:07 | Frozenlock | abp: Wow, I was planning on doing something on bootstrap... you just saved me so much boilerplate code... |
| 22:08 | abp | It's astonishing how well thought out Ring, Compojure and Hiccup are. |
| 22:08 | abp | Just to name a few. :) |
| 22:08 | abp | Frozenlock: Be sure to look at https://github.com/jkk/formative then. |
| 22:08 | abp | Frozenlock: Forms on steroids and bootstrap renderers in there too. |
| 22:08 | Frozenlock | abp: It's great hanging out in the Clojure world and realize how much OTHERS are so much more brilliant, isn't it? :P |
| 22:09 | Frozenlock | Ahhh forms! Of course I will watch that. |
| 22:09 | abp | Frozenlock: Yea, sure. At least there are always some people to invalidate my stupid ideas. But I've got so much on the plate that I don't move forward on anything anymore.. |
| 22:10 | abp | Frozenlock: I use formative on a current project, large time saver. Pushed some declarative constraint validators by catched jdbc-exceptions on top of it too. |
| 22:15 | abp | jkkramer is a dsl-generator. :) |
| 22:18 | jkkramer | I prefer DSVs ;) |
| 22:19 | danlarkin | volvos? |
| 22:19 | Sgeo | This is a thing, apparently, but I saw it from #lisp which is weird since they're a CL channel |
| 22:19 | Sgeo | http://www.kickstarter.com/projects/376627045/lispcast-introduction-to-clojure-videos |
| 22:19 | jkkramer | http://www.youtube.com/watch?v=3yvrs9S0RIw |
| 22:20 | danlarkin | :p |
| 22:20 | jkkramer | abp: glad to hear it's been a time saver |
| 22:24 | abp | jkkramer: Oh, indeed re DSVs! Formative is pretty cool. I set out on field specific validation-rules overwriting datatype-validations regarding https://github.com/jkk/formative/issues/9 Hope I get something satisfying cooked up. Did you think further on that? |
| 22:26 | jkkramer | abp: haven't had a chance yet; open to contributions. Will probably be hacking on it more in a couple weeks for a client gig |
| 22:27 | abp | jkkramer: Also I would be interested in getting some sort of i18n for verily. You too? :) |
| 22:28 | jkkramer | not a bad idea |
| 22:28 | jkkramer | I honestly haven't done much i18n stuff yet in clojure |
| 22:31 | abp | jkkramer: Me neither. But using formative without it is at least a little hurdle. Honestly, I have no idea what would be a good solution in Clojure. Timbre uses an atom for configuration, probably not what we want. But haven't thought about it.. |
| 22:32 | jkkramer | abp: at the very least, if all messages are customizable, someone can tailor it to their needs |
| 22:32 | jkkramer | they shouldn't be hardwired |
| 22:33 | abp | jkkramer: Yea, but you probably did it for your needs. Glad you're developing all that stuff in the first place. |
| 22:35 | jkkramer | abp: got tired of cranking out rigid, monotonous html for forms |
| 22:36 | jkkramer | abp: verily is also used in a db abstraction lib i'll hopefully get around to releasing soon… |
| 22:37 | abp | jkkramer: Cool, like de-duplicating all the sql-constraint validations? |
| 22:38 | abp | jkkramer: I just did an formative/with-fallback wrapping with-constraint-fallback that picks up an exception class to validation message mapping from the form spec. But only for key constraints. |
| 22:39 | abp | jkkramer: Pesky little hacks to keep going. |
| 22:41 | jkkramer | abp: mostly simple data model-level validations for "entities". the db lib validates relationships and such |
| 22:42 | jkkramer | abp: I hear you on the hacks. I don't want to release anything till it's been battle-tested and shaped by real needs |
| 22:43 | abp | jkkramer: Ok. So do you actually wire up formative, honeysql etc. into a tasty clj-web-app orchestra? ;) |
| 22:45 | jkkramer | abp: indeed :) though I try to keep concerns separated as much as possible |
| 22:46 | abp | jkkramer: Sounds interesting. |
| 22:46 | jkkramer | abp: I have a django-admin-style crud generator thing working now that pulls all these libs in. still needs a lot of work though |
| 22:47 | abp | jkkramer: Now it even sounds incredibly fascinating. :P I'm hacking crud stuff together like mad atm. Rapid prototyping under the flag of trying clojure.. ugh. |
| 22:48 | gozaboru | just broke 1k on 4clojure :) |
| 22:52 | jkkramer | abp: building the right abstractions is hard but I feel like once it's done right, building web apps in clojure will be insanely fun |
| 22:55 | abp | jkkramer: For sure. It's even now under pressure, just using what's there already. I'm lacking focus in my spare time, reading and trying way to much stuff, preventing me from getting many concretes out the door. My todo-lists are embarrassingly long.. |
| 23:03 | sorenmacbeth | Is there a better way for testing if function argument is a byte array using :pre that (= (.getName (class arg)) "[B") ? |
| 23:06 | sorenmacbeth | I thought I could do something with (instance?), but couldn't get it |
| 23:24 | amalloy | sorenmacbeth: http://stackoverflow.com/questions/14796964/how-to-check-if-a-clojure-object-is-a-byte-array |
| 23:26 | sorenmacbeth | amalloy: thanks |
| 23:26 | Frozenlock | amalloy: Any idea on how to exclude 'ns', or maybe redefine it in a repl? It seems to survive everything I try. |
| 23:27 | amalloy | don't do it, bro |
| 23:27 | Frozenlock | but I wanna! |
| 23:28 | technomancy | Frozenlock: can't be done, unfortunately |
| 23:28 | technomancy | it's hard-coded in really hard |
| 23:28 | abp | Hm, replacing for with mapcat can yield an inconvenient fn to map. |
| 23:29 | amalloy | abp: huh? |
| 23:29 | technomancy | I really wish it could; it's just anti-egalitarian the way it is |
| 23:29 | technomancy | (see ns+) |
| 23:29 | Frozenlock | technomancy: really really hard.. ns-unmap, exluce, redefining.. nothing works |
| 23:29 | Frozenlock | exclude even. |
| 23:29 | technomancy | Frozenlock: I think it's hard-coded in the java |
| 23:30 | Frozenlock | ns+? |
| 23:30 | clojurebot | Don't bash in place |
| 23:30 | technomancy | Frozenlock: ns+ is an ns replacement |
| 23:30 | abp | amalloy: (for [[x & more] xs :let [y (last more)] ...)) => (mapcat (fn [[x & more]] (let ...))) ? |
| 23:30 | technomancy | similar to what you're trying to do |
| 23:31 | abp | duh xs at end of mapcat |
| 23:31 | Frozenlock | ,(apropos "ns+") |
| 23:31 | clojurebot | () |
| 23:32 | SurlyFrog | Could someone explain something from "The Joy of Clojure" for me? In section 6.3, there is a discussion of laziness that includes this definition: http://pastebin.com/XAtdq5Mn Why does running `(lz-rec-step (range 200000))` give a StackOverflowError but `(dorun (lz-rec-step (range 200000)))` does not? |
| 23:32 | technomancy | Frozenlock: https://code.google.com/p/clj-nstools/ |
| 23:33 | Frozenlock | Gasp, clojure code not on github |
| 23:33 | technomancy | this is ancient code |
| 23:33 | technomancy | older than Clojure's move to github iirc |
| 23:34 | technomancy | SurlyFrog: the repl is forcing the whole seq to be realized at once |
| 23:34 | Frozenlock | "; The name had to be changed to ns+ because "ns" and "in-ns" cannot be redefined in any namespace." |
| 23:34 | amalloy | SurlyFrog: printing it is what causes the exception |
| 23:35 | Frozenlock | I refuse it! I'm supposed to be in control with a lisp! |
| 23:35 | amalloy | technomancy: not really a very interesting point of view: the whole seq is only two elements long |
| 23:35 | amalloy | it's just that it's very deep |
| 23:35 | technomancy | oh, ok |
| 23:35 | technomancy | Frozenlock: edit the java then =) |
| 23:35 | technomancy | this isn't symbolics =\ |
| 23:35 | SurlyFrog | technomancy: and amalloy: thanks I see it |
| 23:35 | abp | amalloy: proper https://www.refheap.com/paste/11238 |
| 23:36 | abp | amalloy: Isn't there a forcat yet? =D |
| 23:37 | amalloy | why would there be? just use for |
| 23:46 | abp | amalloy: Hell yeah.. |
| 23:50 | clifton | any advice on trying to read stacktraces? |
| 23:51 | abp | clifton: read |
| 23:52 | abp | clifton: http://blog.jayfields.com/2012/06/reading-clojure-stacktraces.html |
| 23:52 | clifton | thanks :) |
| 23:58 | yedi | how would i get data from my project.clj project inside of my clojure program? |
| 23:58 | yedi | and/or, do people usually use project.clj to do their own configuration, or is that just generally left alone for lein stuff? |
| 23:59 | amalloy | yedi: it's not really encouraged. technomancy likes lein users to build apps that don't need lein |