2013-11-07
| 00:00 | technomancy | uvtc: "I have to give this a name, but I can't be bothered to think of a good name for it" is how I read it |
| 00:00 | bitemyapp | ,(type (list* 1 (list* 0 ()))) |
| 00:00 | clojurebot | clojure.lang.Cons |
| 00:00 | bitemyapp | ,(list* 1 (list* 0 ())) |
| 00:00 | clojurebot | (1 0) |
| 00:00 | technomancy | uvtc: or "internal implementation detail; don't use this directly" |
| 00:00 | bitemyapp | ,(list 0 1 2 3) |
| 00:00 | clojurebot | (0 1 2 3) |
| 00:00 | bitemyapp | ,(type (list 0 1 2 3)) |
| 00:00 | clojurebot | clojure.lang.PersistentList |
| 00:00 | bitemyapp | ,(list* 0 1 2 3) ;; no dice grandma, only recursive conses |
| 00:00 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long> |
| 00:00 | bitemyapp | uvtc: ^^ primitive. list* is part of the bootstrap. |
| 00:01 | logic_prog | is there an idiomatic way to call clojure.edn/read on a filestream until it htis eof, and stores all objects read? |
| 00:01 | uvtc | bitemyapp, technomancy : nice, thanks. :) |
| 00:01 | seangrove | bitemyapp: Works like a charm, thank you! |
| 00:01 | muhoo | logic_prog: (->> "/file/path" slurp clojure.edn/read-string) ? |
| 00:01 | bitemyapp | seangrove: coolio. Doubtless there are further gaps in the coverage for JDBC (Korma should be comprehensive), but if you run into anything else let me know. |
| 00:01 | bitemyapp | I took the opportunity to refactor the code too. |
| 00:02 | logic_prog | muhoo: that only raeds first object |
| 00:02 | logic_prog | if there is say, 3 defs in a file, that approach only raeds the first |
| 00:02 | muhoo | logic_prog: oh. hmm, i saw something in day-of-datomic that did that |
| 00:02 | muhoo | it was used for database migration/schema ensuring |
| 00:02 | logic_prog | muhoo: any chance you can look it up? :-) |
| 00:02 | muhoo | there's also a good chance that i wrote something to do that too, and don't remember it :-/ |
| 00:03 | muhoo | logic_prog: hmm, looking now |
| 00:04 | bitemyapp | so much prettier *_* https://github.com/bitemyapp/blackwater/blob/master/src/black/water/jdbc.clj |
| 00:05 | bitemyapp | technomancy: https://github.com/bitemyapp/blackwater/blob/master/src/black/water/jdbc.clj look at what your library has helped me to do :) |
| 00:06 | technomancy | cool beans |
| 00:06 | muhoo | logic_prog: hahaha (->> "/file/foo.edn" slurp (#(str "[" % "]")) clojure.edn/read-string) |
| 00:07 | bitemyapp | muhoo: noice. |
| 00:07 | muhoo | *cough* *hack* |
| 00:07 | bitemyapp | muhoo: did you see that parseEval Scala thing that went around recently? |
| 00:07 | muhoo | bitemyapp: naw, i don't scala |
| 00:08 | bitemyapp | dude implemented SKI in terms of the parser behavior and was able to induce a stack overflow with 9 characters of input. |
| 00:08 | bitemyapp | pretty sweet. |
| 00:08 | bitemyapp | but don't tell a Scala user that syntax is a bad idea, no sirree. |
| 00:08 | muhoo | :(){:|:& };: |
| 00:08 | muhoo | bash$ :(){:|:& };: |
| 00:08 | muhoo | hilarity ensues |
| 00:09 | bitemyapp | oldest prank in the book, |
| 00:09 | bitemyapp | actually it was invented before books. |
| 00:09 | logic_prog | muhoo: lol; you win |
| 00:09 | bitemyapp | arrdem: alright, I managed to release a new version of one of my libraries. what are you up to? |
| 00:10 | bitemyapp | I'm going to start, ping me if you come up for air :) |
| 00:11 | muhoo | i have vague memories of sitting around a lab, and ssh'ing in to other machines in the lab, and doign "(eject /dev/cdrom0; sleep 1; eject -t /dev/cdrom0)" or similar |
| 00:12 | muhoo | just to watch the guys sitting at those machines go "wtf???" |
| 00:12 | technomancy | my favourite was to take a solitaire screenshot when you're one move away from winning and make it the desktop background |
| 00:13 | muhoo | technomancy: nice |
| 00:14 | arrdem | bitemyapp: blerg. still around? |
| 00:14 | bitemyapp | arrdem: yarr |
| 00:14 | arrdem | bitemyapp: that's my line Q_Q |
| 00:14 | bitemyapp | arrdem: get in mumbur |
| 00:14 | arrdem | bitemyapp: <plug> https://github.com/clojure/core.typed/pull/3 |
| 00:14 | arrdem | bitemyapp: trying to steal my buddy's box |
| 00:15 | muhoo | technomancy: then there's also fun with xwindows, $DISPLAY, xauth, and ssh. like popping up pr0n on someone's screen while they're in the middle of debugging |
| 00:16 | muhoo | ah, youth |
| 00:16 | technomancy | kids these days have no imagination |
| 00:16 | arrdem | muhoo: if they've `xhost +`'d they deserve whatever they get. |
| 00:16 | technomancy | when they want to mess with people they just do stuff like invent node.js |
| 00:17 | technomancy | which is actually maybe more impressive, whatever |
| 00:18 | technomancy | I mean as a troll |
| 00:22 | Raynes | $last |
| 00:22 | lazybot | Raynes is listening to: The O'Jays - Imagination [Imagination] |
| 00:22 | Raynes | technomancy: ^ |
| 00:22 | muhoo | $last |
| 00:22 | lazybot | muhoo last listened to: Limp Bizkit - Just Like This [Significant Other] |
| 00:22 | Raynes | Don't be telling lies now. |
| 00:22 | muhoo | hahahaa!!!! |
| 00:22 | muhoo | lazybot: YOU LIE |
| 00:22 | marcopolo2 | slast |
| 00:22 | marcopolo2 | :( |
| 00:22 | muhoo | i have never, ever, in my life, listened to limp bizkit. i resent the accusation. |
| 00:23 | muhoo | lazybot: i challenge you. pistols at dawn. |
| 00:23 | marcopolo2 | woah didn't see the $ read it as an s |
| 00:23 | marcopolo2 | $last |
| 00:23 | Raynes | It uses your nickname as your last.fm account. You can supply an argument for another name, or do $assoc <last.fm username> |
| 00:23 | lazybot | Couldn't find that user. |
| 00:23 | muhoo | there must be someone else with that last.fm account. and he or she has terrible taste, too |
| 00:24 | marcopolo2 | $assoc drchoc |
| 00:24 | marcopolo2 | $last |
| 00:24 | lazybot | Couldn't find that user. |
| 00:24 | Raynes | $help assoc |
| 00:24 | lazybot | Topic: "assoc" doesn't exist! |
| 00:24 | Raynes | $help lfmassoc |
| 00:24 | lazybot | Raynes: Associate your nickname with a lastfm username |
| 00:25 | Raynes | I lied, guys. It's $lfmassoc. Apologies. |
| 00:25 | marcopolo2 | $lfmassoc drchoc |
| 00:25 | lazybot | Associated your username. |
| 00:25 | marcopolo2 | $last |
| 00:25 | lazybot | marcopolo2 last listened to: Top 250 Hits of 90s - Eagle Eye Cherry - Save Tonight [1998] [Top 250 Hits of 90s] |
| 00:25 | marcopolo2 | awww yeeaaa |
| 00:25 | Raynes | Classy. |
| 00:25 | muhoo | arrdem: xhost + s isn't even necessary, if you have root and xauth |
| 00:25 | muhoo | or even if you have the user's login, don't need root. this all from memory, and it's been a while |
| 00:26 | arrdem | muhoo: root is pretty hard to come by these days... at least on shared systems |
| 00:26 | muhoo | this was in a lab environment. |
| 00:26 | muhoo | i don't remember the specifics, but there were shenanigans, for sure |
| 00:26 | arrdem | bitemyapp: my buddy locked his door for some reason. no gaming box tonight. |
| 00:27 | bitemyapp | arrdem: damn. oh well. I just clowned the fuck out of a terran. somebody should tell him you're not supposed to trade 1 for 1 with zerg. |
| 00:27 | bitemyapp | off to LoL then if you're not going to play :) |
| 00:27 | bitemyapp | arrdem: I didn't know you signed the CA? |
| 00:27 | arrdem | bitemyapp: sent mine in last week. maybe a little more ago. |
| 00:28 | bitemyapp | arrdem: interesting patch. Think it'll reduce the noise associated with (ann ...) ? |
| 00:29 | technomancy | that's not a patch |
| 00:29 | arrdem | technomancy: nor is it a moon |
| 00:29 | technomancy | it's a pull request, and thus an anathema |
| 00:30 | technomancy | you have failed to abide by the rules of the contribution process; don't let the door hit you on the way out; kthxbai |
| 00:30 | ambrosebs | *kicks arrdem* |
| 00:30 | arrdem | meh. |
| 00:31 | Raynes | ambrosebs: Yo. No. With the violence. Dude. |
| 00:31 | arrdem | well sue me for being new to this. |
| 00:31 | Raynes | $last |
| 00:31 | lazybot | Raynes is listening to: Paramore - Grow Up [Paramore] |
| 00:31 | Raynes | ^ |
| 00:31 | uvtc | Off-topic: speaking of pistols at dawn and interesting patches, anyone else here doing movember? |
| 00:31 | Raynes | I bet I have a song title in my library for basically every situation. |
| 00:31 | technomancy | arrdem: no, you're being totally reasonable; just messing with you |
| 00:32 | technomancy | it's just not going to get applied that way =\ |
| 00:32 | arrdem | bitemyapp: that's exaclty the idea. most of the noise of type-annotating my shitty VM of two days ago was (t/ann ...) forms. |
| 00:32 | arrdem | technomancy: is there a different technique I should be using? patch to clojure-dev? |
| 00:33 | technomancy | arrdem: if your soul contains the requisite fortitude, jira. |
| 00:33 | technomancy | many are called; few succeed. |
| 00:33 | arrdem | lol. that involves me opening a clojure-dev jira account and applying for mail-list agian... |
| 00:33 | bitemyapp | arrdem: yeah that stuff drives me nuts too. |
| 00:33 | technomancy | arrdem: neat patch though; I like the look of it |
| 00:34 | bitemyapp | nathanic: hey liked your stuff on core.typed! |
| 00:34 | bitemyapp | nathanic: check out arrdem's PR: https://github.com/clojure/core.typed/pull/3/files |
| 00:34 | seangrove | arrdem: git format-patch master --stdout > defn_gt_macro.patch, open an issue at http://dev.clojure.org/jira/browse/CTYP and attach it |
| 00:34 | bitemyapp | arrdem: and then take a trip to Thailand for the next 2 years. |
| 00:34 | bitemyapp | because that's ~roughly how long it'll take to get merged :P |
| 00:34 | technomancy | arrdem: ancient tomes tell of a path through the mists: http://dev.clojure.org/display/community/JIRA+workflow |
| 00:35 | seangrove | arrdem: I used to think it was a big deal, really isn't. At least dealing with dnolen anyway. |
| 00:35 | arrdem | bitemyapp: lol |
| 00:35 | technomancy | Thailand is nice this time of year |
| 00:35 | muhoo | he's of the young, fast-moving, githib generatiom |
| 00:35 | technomancy | and also other times of year |
| 00:36 | muhoo | github even |
| 00:36 | technomancy | "guthub" is my preferred typo for that |
| 00:36 | muhoo | core clojure patches move at a much more deliberate pace, and by design IIUC |
| 00:37 | bitemyapp | yeah to be fair, the other stuff clips along better. |
| 00:37 | muhoo | everyone loves to bitch about it tho |
| 00:37 | bitemyapp | muhoo: Scala is a good example of what can go wrong when you have open season on the compiler |
| 00:38 | muhoo | i'm a debian user, so i;m ok with slow |
| 00:40 | ambrosebs | arrdem: the process is to attach a patch to the core.typed Jira. |
| 00:40 | ambrosebs | arrdem: but PR is great for reviews |
| 00:40 | ambrosebs | arrdem: I figured I'd wait until you got your CA in until we worried about that :) |
| 00:40 | technomancy | ambrosebs: sorry, I know you don't deserve this snark; you don't have anything to do with it. |
| 00:41 | arrdem | should I be expecting a confirm from someone invoved with Core that my CA's been recieved? |
| 00:41 | ambrosebs | technomancy: :) |
| 00:41 | ambrosebs | technomancy: keep complaining, perhaps it might change one day :) |
| 00:42 | seangrove | arrdem: Yeah, the site will be updated at the very least |
| 00:42 | technomancy | ambrosebs: heh; I won't tell anyone you said that. |
| 00:42 | ambrosebs | technomancy: :D |
| 00:42 | seangrove | arrdem: Wehn your name is on here, your patches can be accepted http://clojure.org/contributing |
| 00:43 | seangrove | arrdem: Looks like you're on there already, no? |
| 00:43 | arrdem | seangrove: yep I am :D |
| 00:44 | ambrosebs | arrdem: nice. open a ticket here http://dev.clojure.org/jira/browse/CTYP |
| 00:44 | arrdem | ambrosebs: already done. |
| 00:44 | arrdem | ambrosebs: http://dev.clojure.org/jira/browse/CTYP-92 |
| 00:44 | ambrosebs | arrdem: great. |
| 00:45 | ambrosebs | arrdem: I honestly don't care, this isn't clojure.core :) |
| 00:46 | arrdem | ambrosebs: haha yeah I know. I was stressing over commit messages, then did a git log and had a laugh at yours. |
| 00:46 | ambrosebs | arrdem: lots of good reading there |
| 00:47 | arrdem | ambrosebs: changelog... changelog... update changelog.... |
| 00:48 | ambrosebs | arrdem: "lots of stuff, I don't know how to use git and I'm the only committer so there" |
| 00:49 | arrdem | ambrosebs: git commit --rebase HEAD~N, helping me hide my incompetence all summer at my internship :D |
| 00:49 | ambrosebs | arrdem: I don't like to pretend :) |
| 00:49 | arrdem | rebase. I meant reabase. |
| 00:51 | uvtc | Is there a pattern where you can tell which core functions are lazy and which are not? (I realize `doall` and `dorun` are eager). |
| 00:53 | ambrosebs | uvtc: other than check the docstring, I don't think so |
| 00:53 | ambrosebs | uvtc: if it returns a seq, it's probably lazy? |
| 00:55 | ddellacosta | hmm, why can I not require-macros in the latest CLJS/lein-cljsbuild? |
| 00:57 | uvtc | ambrosebs, Yes. Thank you. I remembered something from the "Clojure Programming" book, and just looked it up. Page 98 mentions that "laziness is restricted to sequences"... |
| 00:58 | ambrosebs | uvtc: right yes |
| 00:59 | ambrosebs | before I fix up the details, any feedback on this for a Typed Clojure landing page? http://typedclojure.github.io/typedclojure.org/ |
| 01:00 | ambrosebs | as you can see, I've been having a lot of fun... |
| 01:00 | ddellacosta | nevermind... |
| 01:02 | bitemyapp | ambrosebs: pretty cool :) |
| 01:02 | bitemyapp | ddellacosta: what was it? |
| 01:02 | ddellacosta | bitemyapp: me being a dumbass. The greatest cause of frustration with Clojure, in my experience. :-) |
| 01:02 | bitemyapp | ddellacosta: but seriously, what was it? |
| 01:03 | bitemyapp | ddellacosta: people have a LOT of problems with cljs tooling, I need to add to my mental database so I can help people. |
| 01:03 | bitemyapp | I don't care if it was a typo, I'd just like to know. |
| 01:04 | ddellacosta | bitemyapp: well, comes down to me forgetting about how macros work in CLJS |
| 01:04 | bitemyapp | ddellacosta: annnnd? |
| 01:05 | ddellacosta | bitemyapp: hold on, thinking about how to best explain it |
| 01:05 | bitemyapp | sorry :) *waits patiently* |
| 01:05 | ddellacosta | bitemyapp: I was confused why macro were not working in a very simple CLJS project, so I tried to simply print out the macro name |
| 01:06 | ddellacosta | bitemyapp: and that wasn't working--I was getting "undefined" |
| 01:06 | ddellacosta | bitemyapp: of course, that doesn't mean I haven't loaded it--it means that that var doesn't exist at run time |
| 01:07 | ddellacosta | bitemyapp: so I was dumping out the "go" macro from core.async, and was further confused why I couldn't see that either...and then I was like, "duh." |
| 01:07 | ddellacosta | now, you've gone and made me explain how foolish I was for posterity. ;-) |
| 01:08 | arrdem | ddellacosta: the malevolence engine has made further note of your inadequicies. so has clojurebot. |
| 01:08 | ddellacosta | arrdem: hahaha |
| 01:09 | ddellacosta | but now I'm back to square one, I have no idea what is wrong with my macro, and I'm not really sure how to debug it. *sigh* |
| 01:09 | bitemyapp | ddellacosta: aha, okay, that makes sense. Thanks. |
| 01:10 | ddellacosta | bitemyapp: sure thing...if anyone can benefit from my stupidity then it wasn't a total waste. ;-) |
| 01:10 | logic_prog | is there a more idiomatic way of writing: (defn make-space [n] (apply str (repeat n " "))) ? |
| 01:11 | arrdem | logic_prog: don't, because thanks to structural sharing that's really just (waste-space [n]) |
| 01:11 | arrdem | logic_prog: what's the rest of the problem look like? |
| 01:11 | logic_prog | identing a piece of code |
| 01:12 | arrdem | man... this is just not my night. |
| 01:12 | logic_prog | (format "%s ... %s ... %s ... ") and I need to fill in blanks with things like (n+4) blank spaces |
| 01:12 | logic_prog | arrdem: lol :-) |
| 01:12 | arrdem | logic_prog: I think that make-space is fine. |
| 01:18 | technomancy | ambrosebs: "null" and "cond" need to breathe |
| 01:18 | ambrosebs | technomancy: yes |
| 01:19 | technomancy | looks good though |
| 01:19 | ambrosebs | good to hear |
| 01:31 | brainproxy | there could be a metaphor in here somewhere with respect to using loop/recur to emulate global state |
| 01:31 | brainproxy | http://i.imgur.com/m7rnL02.jpg |
| 01:33 | arrdem | (inc brainproxy) |
| 01:33 | lazybot | ⇒ 3 |
| 02:00 | ddellacosta | trying to get a Clojure macro working in ClojureScript. Confused about what namespaces are available when calling eval in the macro--shouldn't it work the same as in Clojure, since macros get run in Clojure? |
| 02:09 | dnolen | ddellacosta: CLJS namespaces won't be available there, you can do some fancy stuff by hooking into the analyzer/compiler though |
| 02:10 | ddellacosta | dnolen: thanks. Yeah, I'm trying to wrap my head around how to convert this to CLJS: https://github.com/davidsantiago/tinsel/blob/master/src/tinsel/core.clj#L249 |
| 02:11 | ddellacosta | dnolen: I think I'll have to take a look at what you're suggesting re: analyzer/compiler. I haven't done a lot of macro writing in CLJS so I suspected it wouldn't be as straightforward. |
| 02:12 | ddellacosta | so -> but |
| 02:55 | satshabad | reduce |
| 02:55 | satshabad | everything is reduce |
| 02:55 | satshabad | O_o |
| 02:56 | TEttinger | satshabad, that's why reducers are a big deal |
| 02:57 | satshabad | yes. and I haven't even thought about them yet. Now it's just like "how do I solve thsi problem? Oh, it's a reduce..." |
| 02:57 | satshabad | every time |
| 02:59 | TEttinger | if you want one result from a collection, yep, that or loop, pretty much |
| 03:00 | bitemyapp | satshabad: yep. |
| 03:00 | TEttinger | reduce is amazingly useful, that's why google bet so heavily on it |
| 03:02 | bitemyapp | TEttinger: I wouldn't quite put it that way. |
| 03:02 | bitemyapp | TEttinger: the parallelizability of map and reduce were well understood at the time Google built out its early infrastructure. Less "bet" and more "common sense" |
| 03:02 | TEttinger | fair enough |
| 03:03 | bitemyapp | the real work was in making the damn shared filesystem scale. |
| 03:03 | TEttinger | they more bet that they could parallelize it and get good results, I guess |
| 03:03 | bitemyapp | TEttinger: you're still mischaracterizing it. |
| 03:04 | TEttinger | probably |
| 03:04 | bitemyapp | TEttinger: people were talking about hylomorphic lisps that would be more amenable to parallelization long before Google was a twinkle in Larry's eye. |
| 03:05 | TEttinger | I'm not saying google invented map/reduce, just that they decided to use it because it was very powerful |
| 03:05 | bitemyapp | TEttinger: even map is besides the point. |
| 03:05 | bitemyapp | map is just a specialization of left fold. |
| 03:05 | bitemyapp | filter too. |
| 03:05 | bitemyapp | all you actually need is fold and short-circuiting. |
| 03:05 | TEttinger | I think we got off track |
| 03:06 | TEttinger | reduce is good, and I believe a very substantial portion of clojure.core uses it internally |
| 03:07 | TEttinger | errr |
| 03:07 | TEttinger | no, right namespace |
| 03:08 | TEttinger | I'm rusty with clojure, been writing more creative-writing stuff |
| 03:18 | Raynes | bitemyapp: Praise our lord technomancy, May he continue to grant us good fortune. |
| 03:26 | satshabad | is there a way to stop the reduce somehow? |
| 03:26 | satshabad | like if I reduce on an infinite list |
| 03:26 | satshabad | and I reach some condition |
| 03:26 | satshabad | half way through |
| 03:26 | Raynes | In 1.5, calling 'reduced' ends a reduce. |
| 03:27 | satshabad | hmmm, |
| 03:27 | Raynes | Before that, Syast |
| 03:27 | satshabad | does that mean 1.5+ |
| 03:27 | Raynes | Er, darn iPad. |
| 03:27 | Raynes | Yes. |
| 03:27 | satshabad | like it will be around for a while? |
| 03:27 | satshabad | ah cool |
| 03:27 | Raynes | System/exit before that. :p |
| 03:28 | satshabad | ha! |
| 03:28 | Raynes | satshabad: It is very unlikely to ever go anywhere. |
| 03:28 | satshabad | just control-c it at the right time |
| 03:28 | satshabad | catch the exception |
| 03:28 | Raynes | Yes! |
| 03:28 | satshabad | parse the vale |
| 03:28 | satshabad | :) |
| 03:35 | satshabad | what's the most idiomatic way to get a list of keys out of a map? |
| 03:35 | satshabad | (map coll (keys coll)) |
| 03:35 | satshabad | ? |
| 03:36 | TEttinger | (doc keys) |
| 03:36 | clojurebot | "([map]); Returns a sequence of the map's keys." |
| 03:36 | satshabad | (doc values) |
| 03:36 | clojurebot | Pardon? |
| 03:36 | TEttinger | (doc vals) |
| 03:36 | clojurebot | "([map]); Returns a sequence of the map's values." |
| 03:37 | satshabad | hurry! |
| 03:37 | satshabad | hurray* |
| 03:37 | satshabad | thanks |
| 03:37 | TEttinger | they won't be in any particular order for regular maps |
| 03:37 | satshabad | yup |
| 03:37 | satshabad | no problem |
| 03:37 | TEttinger | sorted-maps will be the right way |
| 03:38 | TEttinger | *will be sorted the way you expect |
| 04:28 | noidi | is clojure.contrib.seq-utils/indexed part of the core now? |
| 04:29 | noidi | I know of map-indexed, but I need the indices in a doseq |
| 04:29 | iKillCypher | vector map and sets are hash array mapped tries? |
| 04:32 | muhoo | doe, or doe not, there is no trie |
| 04:39 | clgv | noidi: (doseq [[x i] (map vector coll (range))] ...) |
| 04:59 | noidi | clgv, that's what I'm doing, but indexed would've been prettier :) |
| 05:00 | clgv | noidi: humm that's not easily doable since doseq has the same complex "mini language" as for |
| 05:11 | terom | noidi, clgv: I guess one could use (map-indexed vector coll) instead of (map vector (range) coll). I've only used the latter, though. See http://stackoverflow.com/a/4196851 |
| 05:13 | clgv | terom: yes thats true. I had the general case with multiple collections in mind |
| 05:14 | terom | clgv: ah, good point |
| 05:33 | noncom|2 | using core.async what is the best way to send a message from arbitrary parts of the program to a swing label on a swing interface, made with seesaw? currently i use blocking sends allover the program and i use a (go) block created after creating the swing frame, and it sends udates to the label if it receives a message |
| 05:39 | weavejester | noncom|2: Why not an asynchronous send? Why blocking? |
| 05:40 | noncom|2 | weavejester: you mean i better use (go) with an async send? |
| 05:40 | noncom|2 | actually i use blocking for no particular reson i think... still researching core.async.. |
| 05:40 | weavejester | noncom|2: Sure. That way your sends are sent in the async pool. |
| 05:41 | noncom|2 | cool! i'll try that, thanks! |
| 06:02 | juxovec | Hi, in core.typed - I have state.edn file. I load it with (read-string (slurp "state.edn")) |
| 06:03 | juxovec | it returns def-alias type called state-type |
| 06:03 | juxovec | so I have a function for parsing data from file |
| 06:03 | juxovec | (ann string->state [String -> state-type]) |
| 06:03 | juxovec | (defn string->state [input] (read-string input)) |
| 06:03 | juxovec | but it fails because (read-string) expects [String -> Any] |
| 06:04 | juxovec | I need to force core.typed to check signature [String -> state-type] as right |
| 07:37 | smiler | How can I write this in a cleaner and more idiomatic way? https://gist.github.com/smiler/7353931 |
| 07:43 | `cbp | I guess you could remove the extra indentation |
| 07:45 | smiler | `cbp: Oops. That's a fuckup from my paste. |
| 07:47 | jballanc | smiler: something like this? https://gist.github.com/jballanc/7354050 |
| 07:48 | smiler | Ah |
| 07:48 | jballanc | :) |
| 07:48 | jballanc | the threading macros are *super* useful |
| 07:48 | smiler | I tried messing around with -> but I couldn't figure it out. My lisp-fu isn't too good yet. |
| 07:48 | jballanc | it takes a bit of getting used to |
| 07:49 | jballanc | you can try playing with macroexpand...might help understanding things (but then again maybe not) |
| 07:50 | jballanc | &(macroexpand '(->> thing (do-something arg-foo))) |
| 07:50 | lazybot | ⇒ (do-something arg-foo thing) |
| 07:50 | jballanc | &(macroexpand '(-> thing (do-something arg-foo))) |
| 07:50 | lazybot | ⇒ (do-something thing arg-foo) |
| 07:55 | smiler | Awesome |
| 08:01 | clgv | the docstring is pretty descriptive for -> and ->> as well ;) |
| 08:21 | cemerick | xeqi_: interested in your opinion on this: https://github.com/emezeske/lein-cljsbuild/issues/266 |
| 08:22 | jcrossley3 | cemerick: needs to be said, your issue descriptions are really top drawer. :) |
| 08:23 | cemerick | tcrawley|away: Also wondering if you have thoughts ^^ |
| 08:24 | cemerick | jcrossley3: hah, thanks. Largely compensating for my operating at the edge of legitimacy here :-) |
| 08:36 | mikerod | I have a question, with a little bit of a scenario behind it, so I put the question in gist @ https://gist.github.com/mjr4184/7354670 . |
| 08:36 | mikerod | So if anyone wanted to a stab at it, I'd be grateful :) |
| 08:49 | mdrogalis | mikerod: Try that on StackOverflow. |
| 08:52 | mikerod | mdrogalis: I suppose so, didn't know if it was worthy of a StackOverflow post. :) |
| 08:53 | supersym | i'm helping out a friend who renting appartments, he'd like to get his booking.com reservations in Google Calendar. But booking.com are a bunch of ^$&#( and don't have a API of any sort |
| 08:53 | supersym | cross-domain POST to the login form isn't allowed is it? |
| 08:54 | supersym | sigh...yup |
| 08:55 | supersym | Cross-Origin Resource Sharing may have to be supported and enabled on the target server |
| 09:02 | je | after updating clojurescript i get "Unable to resolve var: reader/*alias-map* in this context" when "lein cljsbuild once" |
| 09:03 | je | the "net" tells me that I have to use tools.reader 0.7.10, but I already do that... any other ideas? |
| 09:10 | supersym | did you do a $ lein deps :tree |
| 09:11 | supersym | check if its good, might be some conflicting packages... also $ lein ancient (pretty nice to check if anything outdated) |
| 09:25 | tcrawley | cemerick: feedback applied |
| 09:34 | nDuff | Hmm. |
| 09:35 | mdrogalis | Hm? |
| 09:37 | nDuff | Friend has a microcontroller project where core.async's model seems beautifully appropriate, if any of the Clojure->C compilation pipelines are potentially up-to-task. |
| 09:54 | xeqi_ | cemerick: have you considered "RELEASE" vs -SNAPSHOT? |
| 09:56 | cemerick | xeqi: That doesn't work in lein though IIRC? |
| 09:56 | cemerick | It's the same thing though, practically. |
| 09:56 | xeqi | cemerick: I believe `lein new` uses it to find the latest template |
| 09:56 | xeqi | pretty much, but with real versions |
| 09:56 | cemerick | ? Dunno, I haven't typed "RELEASE" in probably 5 years |
| 09:58 | xeqi | as for the overall problem, a [cljs-cljsbuild-compatibility-matrix ..] plugin that is transative from lein-cljsbuild and injects some middleware that walks the dep tree and checks against a black list is the best I can think of |
| 09:59 | xeqi | given the lack of semver |
| 10:01 | cemerick | xeqi: well, that's basically what's going on now; the question is, how to get an up-to-date blacklist / compat matrix in the first place. |
| 10:03 | TimMc | Are people actually using CLJS in production? |
| 10:03 | TimMc | For like, services or software people pay for? |
| 10:04 | TimMc | It's so freaking pre-alpha. |
| 10:06 | xeqi | cemerick: is there a set of tests that could be run as part of the lein-cljsbuild, and then if they all work allow compilation. Possibly with a tmp file for caching so it only runs once per project+cljs version? |
| 10:08 | seangrove | TimMc: Note your issues with it somewhere, tweet about it. There's a lot of awareness about shortcomings, and we want to get a lot of it taken care of as we head towards more stable releases |
| 10:08 | seangrove | TimMc: That said, quite a few companies obviously use it in production for software people pay for. |
| 10:10 | cemerick | xeqi: There's not systematic qualification process at all. e.g. I'll be updating the compat table based on personal experience / issue reports. |
| 10:11 | cemerick | TimMc: Yeah, but then again, I was shipping Clojure stuff in late 08, early 09? |
| 10:12 | xeqi | cemerick: :( |
| 10:12 | cemerick | xeqi: it's not like there's any qualification process for Clojure, either! :-P |
| 10:23 | TimMc | seangrove: I don't so much have issues with it as... well, it isn't presented as something that's even approaching ready-to-use. |
| 10:24 | seangrove | TimMc: Well, be more specific. I have a growing notepad of things that bother me, are broken, etc. I would really like all of it to shine in the next few months as we approach a more stable release. |
| 10:26 | seangrove | TimMc: We've had a lot of groaning from people new to clojurescript here with the tooling, hence my interest in seeing it brought up a few levels |
| 10:29 | TimMc | I haven't actually tried using it for a project. I'm not talking about specific bugs or features; it's just that the last couple times I checked in, there wasn't discussion of "Hey, let's standardize what this is going to look like." |
| 10:29 | seangrove | TimMc: API-wise? Visually? Docs? |
| 10:29 | TimMc | I'm not grousing, just amazed that people use such early stuff as an important component of production code. |
| 10:30 | TimMc | Mailing list, docs, IRC chatter. |
| 10:30 | seangrove | TimMc: Sure, just looking for points to improve on |
| 10:30 | seangrove | Thinking about putting together a cljs-tooling sprint here in SF to see if we can regularly improve the state |
| 10:31 | smiler | Is it possible to make lein cljsbuild auto not break on compilation error? I'd rather have it wait for a new file update. |
| 10:31 | seangrove | smiler: I think the new version (1.0.0-alpha) fixed that |
| 10:32 | smiler | Oh I see |
| 10:32 | seangrove | Otherwise roll back to 0.3.3 |
| 10:32 | TimMc | seangrove: And I know that Clojure doesn't have a spec either, but that doesn't mean CLJS shouldn't. :-P |
| 10:32 | seangrove | TimMc: For alternative implementations? |
| 10:32 | TimMc | Just... a spec, at all. |
| 10:32 | seangrove | I guess I don't see that helping new or existing users much |
| 10:33 | seangrove | Possibly tooling devs though |
| 10:33 | cemerick | smiler: 1.0.0-alpha1 |
| 10:33 | smiler | I'll give it a shot :) |
| 10:34 | cemerick | There's something close to a spec (or, common understanding?) re: analyzer output. Beyond that, not much. |
| 10:34 | seangrove | smiler: If you're using austin, be sure to update to to 0.1.2 and cljs 2014 - I had some trouble yesterday and today with browser.repl not compiling before I updated everything |
| 10:35 | cemerick | seangrove: announcing new releases across the board today |
| 10:35 | seangrove | cemerick: What would a spec even look like? Stable API's for analyzer, compiler, maybe reader phases, sure, but not sure beyond that |
| 10:35 | smiler | How do people keep track of all these version numbers? |
| 10:35 | seangrove | cemerick: I assumed so, just helping in the interim |
| 10:35 | cemerick | seangrove: no idea. |
| 10:35 | cemerick | seangrove: sure, thanks :-) |
| 10:37 | cemerick | There are some things around the compiler that I'd like to have better compartmentalized (e.g. bottle the js-specific stuff better), which would help a lot with alternative emitters/backends. But, stuff like that is always going to take a backseat to getting shit done. |
| 10:37 | TimMc | seangrove: A spec is an agreement on what is considered API vs. implementation details that shouldn't be relied upon. |
| 10:37 | TimMc | Clojure's lack of such a thing means it's hard to build certain tooling around it (e.g. alternative readers need to know what's a valid symbol). |
| 10:37 | TimMc | It's OK if the spec *changes*, it should just be intentional. :-P |
| 10:38 | seangrove | TimMc: I suppose, just doesn't seem immediately relevant or helpful |
| 10:39 | smiler | Does lein have something to check a project file and hint about never versions of stuff available? |
| 10:39 | seangrove | cemerick: I'd be happy to work on that, but the vast majority of the compiler right now is about the js-implementation details. What would you like to see pulled out? A more abstract constants emitter, etc.? |
| 10:42 | joegallo | smiler: https://github.com/xsc/lein-ancient |
| 10:42 | TimMc | I use Clojure *despite* these flaws, because it is otherwise very good in its space. CLJS so far has the same flaws, but less compensating draw, since I do less in the browser space these days. |
| 10:43 | smiler | joegallo: Cool! Thank you. |
| 10:43 | TimMc | Honestly, if someone forked Clojure and gave it better documentation, I'd be all over that. |
| 10:47 | seangrove | TimMc: Could be interesting, but for now I'm more interested in getting the existing tooling and apis better |
| 10:47 | seangrove | I can't do much around specs, but I can help out with code, issues, features, and bugs |
| 10:47 | TimMc | *nod* |
| 10:47 | seangrove | Especially bugs, I help create a lot of those |
| 10:47 | TimMc | Heh. |
| 10:47 | mdrogalis | HAh |
| 10:48 | llasram | Care and nurture, to raise bugs right |
| 10:50 | llasram | Damballa's all-engineering mailing list is named "bugfarmers". It still makes me smile |
| 11:07 | seangrove | Ah, damnit, I've forgotten how to access nested static classes |
| 11:08 | CookedGryphon | Class$Inner |
| 11:08 | seangrove | I thought so, doesn't seem to be working. I need to query the class to see what it looks like |
| 11:08 | CookedGryphon | you might need to import it separately? |
| 11:09 | CookedGryphon | if you're not fully qualifying it, i.e. (:import com.blah.ClassA) won't give you access to ClassA$Inner |
| 11:09 | TimMc | &java.awt.geom.Point2D$Double |
| 11:09 | lazybot | ⇒ java.awt.geom.Point2D$Double |
| 11:09 | CookedGryphon | you need to (:import com.blah.ClassA$Inner) as well |
| 11:09 | seangrove | CookedGryphon: Ah, that was it, I think I had to import it with the $ syntax |
| 11:10 | CookedGryphon | cool |
| 11:10 | seangrove | Thank you |
| 11:10 | CookedGryphon | np |
| 11:12 | TimMc | ,(.importClass 'PD java.awt.geom.Point2D$Double) |
| 11:12 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: importClass for class clojure.lang.Symbol> |
| 11:12 | TimMc | ,(.importClass *ns* 'PD java.awt.geom.Point2D$Double) |
| 11:12 | clojurebot | java.awt.geom.Point2D$Double |
| 11:12 | TimMc | ,(.getX (PD. 5 6)) |
| 11:12 | clojurebot | 5.0 |
| 11:12 | llasram | Heeeey. That's my trick |
| 11:12 | TimMc | :-) |
| 11:14 | llasram | Really should slap a nice interface on that |
| 11:14 | CookedGryphon | as a more general thing it would be nice to have renaming functionality |
| 11:14 | llasram | I'm v glad I haven't had to do too much with Hadoop `mapred` vs `mapreduce`, or the same-base-named classes would probably have driven me insane |
| 11:14 | TimMc | Huh, why is clojure.core/import* implemented as a special form? |
| 11:15 | llasram | TimMc: Probably so you can use it before implementing macros? |
| 11:15 | llasram | *wild guess* |
| 11:16 | joegallo | that importClass trick is neat as heck |
| 11:16 | llasram | Oh, but if it takes explicit symbols, no need for macros... Um. Huh. Yeah, no idea |
| 11:17 | llasram | Also, I am blathering nonsense |
| 11:18 | CookedGryphon | it would be nice if there was a (:require [thing :rename {this that}] and the equivalent import |
| 11:20 | TimMc | CookedGryphon: I was working on something like that a while back: https://github.com/baznex/imports |
| 11:20 | CookedGryphon | It would also be nice if the keywords in the ns form weren't restricted to clojure.core |
| 11:20 | llasram | CookedGryphon: There is for vars |
| 11:20 | CookedGryphon | llasram: oh? |
| 11:23 | hoangelos | I upgraded an app that uses ring.adapter.jetty. Now all my tests that use :truststores fail. There's really no documentation on using truststores. And no tests that do so either, so I'm really not sure how they are supposed to be used. |
| 11:28 | llasram | CookedGryphon: Tooked me a min to remember the details. Need to add a separate :refer form to ns (or call refer) |
| 11:28 | llasram | &(do (refer 'clojure.string :only '[split] :rename '{split str-split}) str-split) |
| 11:28 | lazybot | ⇒ #<string$split clojure.string$split@12dd7de> |
| 11:31 | CookedGryphon | is the :only necessary there? |
| 11:31 | CookedGryphon | &(do (refer 'clojure.string :only '[split] :rename '{split str-split}) str-split) |
| 11:31 | lazybot | ⇒ #<string$split clojure.string$split@12dd7de> |
| 11:31 | llasram | CookedGryphon: Yeah. Otherwise it'll `refer` everything |
| 11:31 | CookedGryphon | oops |
| 11:32 | CookedGryphon | sorry, didn't mean to paste that back. Hmm, that's annoying, doesn't fit with the recommended :require :refer way of doing things ,would be nice if it was just :require :refer :rename |
| 11:32 | llasram | Yeah |
| 11:32 | CookedGryphon | where the renames don't need to be referred |
| 11:32 | CookedGryphon | it bugs me that you can't override things in the ns form |
| 11:32 | CookedGryphon | when it's flexible enough to allow that |
| 11:32 | llasram | Technically you can.... It's just tricky |
| 11:33 | CookedGryphon | yeah, you need to inject stuff into clojure.core, right? |
| 11:33 | llasram | And of course would result in incompatibilities for libraries |
| 11:33 | llasram | Yep |
| 11:33 | llasram | You can do it with `user.clj`, and pjstadig figured out the fun/horrifying fun trick of using read-eval in `data_readers.clj` |
| 11:33 | TimMc | haha |
| 11:34 | TimMc | That's kind of brilliant. |
| 11:34 | CookedGryphon | hm |
| 11:35 | CookedGryphon | but yeah, so I did a little experiment with a lightweight library set up |
| 11:35 | CookedGryphon | with the idea of using a remote-require in the ns form |
| 11:36 | CookedGryphon | instead of having a full on jar dependency it would pull in individual functions/small namespaces from trusted sources and cache them for reuse |
| 11:36 | CookedGryphon | so if you jsut have a little hof or useful snippet, you can re-use it without all the hassle of a library version |
| 11:36 | CookedGryphon | but it might end up making your ns form look a bit messy and various other problems |
| 11:36 | llasram | Blorgh, CIDER didn't auto-move my nrepl.el customizations to their new names :-/ |
| 11:36 | jtoy | I am trying to make a library that has a macro, (defmacro defpage (layout ?)) ; the problem is layout is not defined at the time, my other code that will include this library will define a layout later, how can I make write the macro in my library so that this works? |
| 11:38 | CookedGryphon | jtoy, first rule of macro club... why do you need this to be a macro? |
| 11:40 | jtoy | CookedGryphon: I think I need a macro to do this, this is the exact macro: https://www.refheap.com/20564 even if it is a function, I will have the same exact problem |
| 11:40 | jtoy | the main reason is so i have the params and session always passed to me in my webpages |
| 11:41 | CookedGryphon | you can do that with clojures in returned functions |
| 11:41 | CookedGryphon | closures* sorry |
| 11:41 | S11001001 | CookedGryphon: :D that thing |
| 11:41 | S11001001 | jtoy: pass a function that takes those as arguments |
| 11:41 | jtoy | CookedGryphon: I am already using cloure :) |
| 11:41 | jtoy | clojure |
| 11:41 | S11001001 | anaphora are not your friends |
| 11:42 | jtoy | S11001001: I dont understand |
| 11:42 | S11001001 | the ~'... bits |
| 11:42 | S11001001 | that's why clojure defines if-let instead of aif |
| 11:43 | S11001001 | &c |
| 11:43 | lazybot | java.lang.RuntimeException: Unable to resolve symbol: c in this context |
| 11:43 | S11001001 | etc |
| 11:43 | TimMc | CookedGryphon: Caching might lead to unpredictable builds. |
| 11:43 | CookedGryphon | so jtoy, describe in a little more detail what you want to be able to do |
| 11:44 | CookedGryphon | TimMc: I was going to use hashes instead of version numbers, to disallow changing of the code under your feet too |
| 11:44 | jtoy | S11001001: so you are saying just check if the layout function exists? |
| 11:44 | CookedGryphon | TimMc: The idea being that there would be at most a couple of revisions, and you would have read the entire source file - it's only a short snippet, say an extension of a protocol ot a type or a hof |
| 11:45 | jtoy | CookedGryphon: I want a function that calls another function that isnt defined yet in my library. its in my userland code where the other function is defined |
| 11:45 | CookedGryphon | so you make a function that takes a function |
| 11:46 | jtoy | hmm, the whole point of the macro was so i dont need to pass in the layout everytime |
| 11:46 | jtoy | part of it |
| 11:46 | CookedGryphon | (defn thing-that-calls-function [f session] (fn [& params] (apply f session params)) |
| 11:46 | CookedGryphon | or something |
| 11:47 | S11001001 | jtoy: well, the things that are macro-needing in that macro are the def part — just def yourself, implicit def isn't a good enough reason for a macro — and the ~'... bindings — which aren't your friends, though they sound good now they will punish you — so this is best as a function. |
| 11:48 | CookedGryphon | jtoy: not sure that's the clearest example, I probably tried to cram too much into it |
| 11:48 | CookedGryphon | but you can pass your layout function in, and return a function out which knows about the session at the time you def it |
| 11:48 | jtoy | S11001001 CookedGryphon could either of you show me how you would transform my crappy macro into something better ? |
| 11:50 | CookedGryphon | I've got to go in a few minutes, but basically if you want a function which will call another function with some session baked in, see the line I posted earlier |
| 11:51 | jtoy | ok, thanks, I will explore it |
| 11:51 | S11001001 | jtoy: (defn page [f] (fn [{:keys [params session]}] (layout session (f params session)))), to use: (def name (page (fn [params session] body))) |
| 11:52 | jtoy | S11001001: will that work if layout is not defined when defining defn page? |
| 11:53 | S11001001 | jtoy: no |
| 11:53 | S11001001 | jtoy: or yes, depending on what "defined" means |
| 11:54 | jtoy | S11001001: that was my original problem, i want to have (defn page ) in a library , but the layout is not set yet, my userland code will define a layout and then call (def name (page (fn [params session] body))) |
| 11:55 | S11001001 | jtoy: well, the macro won't solve that problem either. It must be defined for ` expansion to work correctly. So macroization isn't the way to go, regardless. |
| 11:55 | CookedGryphon | jtoy: if you mean the user defines the layout function |
| 11:55 | CookedGryphon | tehn what you'll do is (def name (page layout)) right? |
| 11:55 | S11001001 | jtoy: in that case, layout should be an argument to the `page' function, along with f, as CookedGryphon says |
| 11:56 | jtoy | S11001001: ok, that seems painful to write that over and over.... |
| 11:56 | jtoy | i will try it though |
| 11:56 | S11001001 | jtoy: less painful than the maintenance headaches of anaphora. Take it from one who's used it extensively in common lisp. |
| 11:57 | CookedGryphon | jtoy: I'm not sure what you think is going to be repetitive |
| 11:57 | CookedGryphon | if you want to define a function with the session baked in to avoid having to call it again, then (def name (page layout session)) |
| 11:58 | CookedGryphon | (sorry if this is confusing, it's really hard to try and use your function names when i'm not quite sure what it's meant to be achieving) |
| 11:58 | justin_smith | so I am making progress with my request serialization / replay middlware for ring |
| 11:58 | justin_smith | and I settled on a name: groundhog |
| 11:58 | justin_smith | as in groundhog day |
| 11:59 | TimMc | :-) |
| 11:59 | justin_smith | I actually have replayed recorded requests, just need to clean up the api so it is generally usable |
| 12:00 | justin_smith | ie. put in a place for a "sanitizer" that would remove things like plaintext credentials before storing things persistently |
| 12:00 | jtoy | CookedGryphon: that part i feel is repetitive is if i have dozens of webpages and they all need access to params and session, i am using ring which gives you a request map, and each function i was pulling out session and params from request |
| 12:00 | jtoy | but this might work, i wrote that old macro months ago when i was still learning |
| 12:01 | jtoy | and also passing in the layout to the page |
| 12:05 | teslanick | So, the lein-light-repl package includes a bunch of duplicate classes. I'm pretty sure it's resolvable, and I'd like to raise it as a bug. Any idea where I should do that? |
| 12:08 | technomancy | justin_smith: sweet |
| 12:08 | technomancy | https://tinyurl.com/pftpvvs |
| 12:09 | justin_smith | heh |
| 12:09 | justin_smith | technomancy: as long as I can be Murdock |
| 12:10 | technomancy | deal |
| 12:40 | amalloy | S11001001: i have like one anaphoric macro in useful, which is great and i use all the time. but anaphora are definitely something you have to use very sparingly |
| 12:41 | amalloy | in case anyone is really excited about this idea, it just lets you write (lazy-loop [x 1, y 2] (when foo (cons x (lazy-recur y z)))) instead of ((fn step [x y] (when foo (cons x (step y z)))) 1 2) |
| 12:43 | Raynes | amalloy: Hah, it never occurred to me that lazy-loop is anaphoric. |
| 12:45 | technomancy | regular loop is arguably anaphoric too |
| 12:46 | Raynes | amalloy: lazy-loop is so awesome. Should be in core. |
| 12:46 | Raynes | Let's slip it into core when Stuart Halloway isn't looking. |
| 12:47 | S11001001 | technomancy: I did a talk about that |
| 12:47 | technomancy | oh, that'd b eme not paying attention |
| 12:47 | dnolen | stuartsierra: fyi, source maps significantly less half baked. might be bug still but should more less work even with web based work flows |
| 12:49 | stuartsierra1 | dnolen: Awesome. |
| 12:49 | stuartsierra1 | So many new features in ClojureScript lately, making my job of teaching at Clojure/conj next week harder! |
| 12:55 | hyPiRion | so how would you unapahorize (?) loop? Would you do something like (loop my-loop [a b] (if condition (recur my-loop my-arg1 my-arg2) ret-val)) ? |
| 12:55 | TimMc | Yep. |
| 12:55 | hyPiRion | or just functionize the whole shebang? |
| 12:55 | hyPiRion | ah. |
| 12:55 | TimMc | Like named let in Scheme. |
| 12:55 | technomancy | technically making recur a var might, but that feels like a nonsense solution |
| 12:56 | TimMc | (let foo [a 1 b 2] ... (foo 3 4)) |
| 12:56 | TimMc | (Ish. I think Scheme has more brackets.) |
| 12:57 | technomancy | someone in #emacs was asking about nested loop with inner-recur and outer-recur a while back |
| 13:05 | amalloy | hyPiRion: the only way would be to remove it and use lambda instead |
| 13:05 | amalloy | oh, i didn't scroll down far enough |
| 13:05 | jtoy | what is the name of the clojure function used to define an empty function ? |
| 13:06 | amalloy | jtoy: there's no such thing? |
| 13:06 | tbaldrid_ | jtoy: empty? |
| 13:06 | amalloy | like, (fn) is an empty function, although why you would define it is unclear |
| 13:06 | tbaldrid_ | jtoy: that is to say, what do you mean an empty function |
| 13:07 | mdrogalis | constantly? |
| 13:07 | jtoy | im describing it incorrectly, i saw there is a function that you call like (thiswillexistlater myfunc) so that code will not die |
| 13:07 | mdrogalis | declare |
| 13:08 | jtoy | yes, it is declare, thanks |
| 13:08 | mdrogalis | Sure. |
| 13:10 | xuser | How do you import a clojure source code file into to the lein repl? |
| 13:11 | mdrogalis | xuser: load-file if it's not on your classpath |
| 13:11 | llasram | `require` the namespace associated with the file |
| 13:11 | llasram | mdrogalis, xuser: load-file will work, but let's not spread bad habits! |
| 13:12 | xuser | ok, thanks |
| 13:12 | mdrogalis | Oh, he said 'lein repl'. My eyes glazed over the 'lein'. |
| 13:12 | mdrogalis | I think it's time to stop programming today :) |
| 13:13 | jtoy | im assuming decdare can be dangerous, anyone know of any good blog posts describing it in detail, i cant find much |
| 13:13 | jtoy | declare |
| 13:13 | technomancy | jtoy: FWIW declare is a macro that defines a var, not a function that defines a function |
| 13:14 | technomancy | jtoy: it's not dangerous so much as an indication that maybe you could think about removing circular references. it's a judgement call. |
| 13:16 | jtoy | technomancy: ah, thanks for the clarification, i will try to remove the circulr references , im trying to create a library for all my apps but the library expects a few things that are dependent on each app to define |
| 13:16 | jtoy | technomancy: I could also just generate all the code, that is what im partially doing already with my lein tempalte |
| 13:17 | technomancy | usually it's clearer withuot circularity but sometimes it is unavoidable |
| 13:19 | TimMc | Never unavoidable. :-P |
| 13:20 | technomancy | haha technically true |
| 13:20 | mdrogalis | The Swearjure guy is talking about clarity, get a load of this :P |
| 13:20 | TimMc | but some of the possible solutions might get you murdered by the next maintainer of your code |
| 13:20 | hyPiRion | yeah, you can just use the Y combinator |
| 13:27 | muhoo | hyPiRion: for what, funding your startup? |
| 13:27 | hyPiRion | oh, you |
| 13:35 | faust45 | hi guys |
| 13:35 | faust45 | i just got error which confused me |
| 13:35 | faust45 | i run leon repl |
| 13:36 | faust45 | and see error <CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException .proxy |
| 13:36 | llasram | I'm totally changing my name to "Leon Repl" |
| 13:36 | faust45 | but i comment out code related to proxy |
| 13:36 | faust45 | why i got this error? |
| 13:36 | faust45 | can some one help? |
| 13:37 | technomancy | llasram: http://www.linkedin.com/pub/lein-jenkins/43/3aa/3a2 |
| 13:37 | llasram | technomancy: Nice! |
| 13:37 | mdrogalis | faust45: Can you run `lein version` for us? |
| 13:37 | faust45 | mdrogalis: Leiningen 2.1.2 on Java 1.7.0_45 Java HotSpot(TM) 64-Bit Server VM |
| 13:37 | llasram | faust45: That error looks like you're putting the symbol `.proxy` somewhere where a class would be expected |
| 13:38 | mdrogalis | faust45: Upgrade Lein first, just cause :) |
| 13:38 | llasram | The error when running `lein repl` is probably because you either have `:aot` enabled or `:main` without `^:skip-aot` |
| 13:38 | faust45 | mdrogalis: but i comment out this code |
| 13:40 | faust45 | and now i remove this code related to proxy |
| 13:40 | faust45 | and still got error |
| 13:40 | faust45 | leon cached my files ? |
| 13:40 | mdrogalis | Leon doesn't cache files, no. |
| 13:40 | faust45 | ^lein i mean |
| 13:40 | mdrogalis | :) |
| 13:41 | faust45 | so why i see this error ? |
| 13:41 | faust45 | i remove code with proxy |
| 13:41 | mdrogalis | faust45: Is your project on GitHub? |
| 13:41 | llasram | faust45: First, remove `:main` from your project.clj |
| 13:41 | llasram | Then you can launch a repl and fix your code |
| 13:42 | faust45 | llasram: i drop :main |
| 13:42 | faust45 | but when i load my name space in repl |
| 13:42 | faust45 | i got this error again |
| 13:43 | llasram | Yes |
| 13:43 | llasram | But now you can launch your REPL |
| 13:43 | llasram | And actually figure out your problem |
| 13:43 | faust45 | how ? |
| 13:43 | llasram | Well, searching the file for `.proxy` might be a good place to start |
| 13:44 | faust45 | grep proxy |
| 13:44 | faust45 | i got nothing |
| 13:45 | llasram | You might have stale AOT code, although I don't how you'd AOT something that produces an error like this. You can try `lein clean`, then restart the REPL + relead NS |
| 13:45 | llasram | s,relead,reload, |
| 13:47 | faust45 | llasram: after leon clean, still see this error |
| 13:47 | llasram | I'm afraid you're on your own |
| 13:50 | TimMc | faust45: If the compiler isn't giving you a file and line number, the traditional approach here is to start bisecting your code. |
| 13:54 | TimMc | faust45: This might also be useful -- it modifies all your source files to add progress debugging statements: https://gist.github.com/timmc/7359898 |
| 13:54 | TimMc | (Obviously, you'll want to save off your work before running that.) |
| 13:55 | TimMc | It's very sloppy, but running lein compile after that should tell you where the compiler ran into trouble. |
| 13:58 | technomancy | or lein check |
| 14:07 | faust45 | technomancy: thanks, only when i fixed all issuer from leon check, that error was gone |
| 14:08 | faust45 | technomancy: but at my point will be better show root issue in repl, when i try reload namespace |
| 14:09 | faust45 | i got this issue only when try using proxy |
| 14:10 | faust45 | interesting why? |
| 14:10 | TimMc | So what was the issue? |
| 14:11 | faust45 | TimMc: i put wrong ns in one of my files |
| 14:11 | faust45 | i put "users" vs "jsondb.users" |
| 14:18 | TimMc | Hmm, doesn't sound like that would cause the error you posted. |
| 14:25 | lynaghk | I'm trying to use criterium to put together a perf benchmark test suite that I can run from the console |
| 14:26 | lynaghk | is anyone aware of a good way to set that kind of thing up? I'm tempted to just try and reuse "lein midje" with twiddled source directories |
| 14:26 | seangrove | bitemyapp: You going to the climate meetup tonight? |
| 14:26 | hiredman | lynaghk: https://github.com/davidsantiago/perforate |
| 14:27 | hiredman | I mean, I haven't used it, but it is the first google hit |
| 14:27 | lynaghk | hiredman: ahhh awesome. thanks. |
| 14:41 | faust45 | TimMc: actually i am not sure, its looks crazy i try to replicate this |
| 14:42 | faust45 | TimMc: and what i see: i have two ns models and db |
| 14:42 | faust45 | models require db |
| 14:42 | TimMc | Did you ever find a place you had written "proxy"? |
| 14:42 | faust45 | and when i implement proxy in models |
| 14:43 | faust45 | i don't need find it, i know this place |
| 14:43 | faust45 | i implement proxy in models |
| 14:43 | faust45 | then leon check |
| 14:43 | faust45 | got error |
| 14:43 | faust45 | then comment proxy code |
| 14:43 | faust45 | then leon check |
| 14:44 | faust45 | and got ClassNotFoundException: jsondb.models.proxy |
| 14:44 | `cbp | ^ mac user |
| 14:44 | faust45 | and only when i comment (def default (open "db/testdb")) |
| 14:44 | TimMc | ~leon |
| 14:44 | faust45 | in db ns |
| 14:44 | clojurebot | leon is a good sign it's time to turn off auto-"correct" |
| 14:45 | `cbp | clojurebot is all-knowing |
| 14:45 | TimMc | You said that grep didn't find it... |
| 14:45 | faust45 | TimMc: yes after i drop proxy |
| 14:45 | faust45 | grep not find it |
| 14:45 | faust45 | i try grep for proxy |
| 14:45 | faust45 | in case i forgot some places |
| 14:45 | faust45 | but nothing |
| 14:46 | faust45 | issue looks strange for me |
| 14:46 | faust45 | only when i comment (def default (open "db/testdb")) |
| 14:46 | faust45 | in db ns |
| 14:46 | faust45 | it works |
| 14:50 | sritchie | technomancy, I had asked this before, but still a little unclear - is a 95MB slug size reasonable? |
| 14:50 | sritchie | for an uberjar app |
| 14:51 | muhoo | justin_smith: did you end up pursuing that state-saving debug middleware? |
| 14:51 | justin_smith | muhoo: working on it right now |
| 14:51 | justin_smith | named groundhog |
| 14:52 | TimMc | sritchie: Why, back in my day, the JDK itself was 20 MB and that was a long download, let me tell you! *mutter mutter* |
| 14:52 | justin_smith | I am base64 encoding the body and passing along an identical stream, then turning that encoded body back into a stream for replay |
| 14:52 | technomancy | sritchie: no, I'd say that's medium-sized |
| 14:52 | justin_smith | I just added some opts and broke some stuff in the process, but I have succeeded in replaying stored requests |
| 14:52 | justin_smith | and should have something quite usable by end of day |
| 14:53 | sritchie | technomancy: for a 50MB uberjar |
| 14:53 | TimMc | If someone tried to fax you, you'd ave to start all over! |
| 14:53 | sritchie | though I can confirm that |
| 14:55 | technomancy | sritchie: sorry, "no" meaning not unreasonable |
| 14:55 | technomancy | misread the question |
| 14:56 | sritchie | okay, nice |
| 14:58 | justin_smith | muhoo: network hiccup, my last may not have gone through |
| 14:58 | bitemyapp | seangone: yes |
| 14:58 | justin_smith | if you want to store to a db you may want to remove plaintext passwords that would be in app specific places, to replay you may want to set a custom URI that responds to, and a retrieval method that is the categorical dual of your storage method |
| 14:59 | bitemyapp | sritchie: coming to the meetup tonight? |
| 14:59 | sritchie | IPO party, so I won't be able to make it, unfortunately |
| 14:59 | bitemyapp | sritchie: oh right! Congrats, have fun! |
| 15:00 | sritchie | next one, though! |
| 15:05 | sritchie | technomancy: btw, was there ever a resolution for this? |
| 15:05 | sritchie | http://grokbase.com/p/gg/clojure/1358zejkcr/new-relic-installation-on-heroku |
| 15:05 | sritchie | no data getting reported on new relic? I'm suspecting HTTPKit, perhaps |
| 15:06 | sritchie | it's odd, man. it connects, and I see "last data, two minutes ago" etc, |
| 15:06 | sritchie | but nothing in the overview, no numbers |
| 15:06 | sritchie | actually, memory usage per instance is looking good |
| 15:08 | technomancy | sritchie: I wouldn't be surprised if httpkit interfered with new relic's ability to collect data, but I don't have any specifics |
| 15:08 | sritchie | hmm |
| 15:09 | bitemyapp | technomancy: I could take a look. |
| 15:09 | bitemyapp | if it requires manual instrumentation I might be able to slap something together. |
| 15:10 | justin_smith | technomancy: muhoo: it's a start, it isn't perfect but it does what it claims to - https://github.com/noisesmith/groundhog https://clojars.org/noisesmith/groundhog |
| 15:10 | bitemyapp | oh, they're using some opaque java agent? |
| 15:10 | sritchie | bitemyapp: awesome |
| 15:10 | sritchie | lmk if I can change anything |
| 15:11 | bitemyapp | sritchie: Here's manual instrumentation: http://corfield.org/blog/post.cfm/instrumenting-clojure-for-new-relic-monitoring |
| 15:11 | bitemyapp | I'm a bit leery of New Relic in general, but I understand why they're popular. |
| 15:12 | sritchie | I'm moving over to my own riemann setup |
| 15:12 | bitemyapp | sritchie: yeah that's what I prefer. |
| 15:12 | bitemyapp | rolling my own, that is. |
| 15:13 | bitemyapp | New Relic charges more for their service than Heroku does for the dynos. Nutty. |
| 15:13 | sritchie | yup |
| 15:13 | sritchie | still on the free tier :) |
| 15:14 | nDuff | ...never played with New Relic, but the Tracelytics stack was a pretty easy one to work with. |
| 15:14 | bitemyapp | I haven't tried tracelytics. I'm capable of believing a company can do a good job with this sort of thing, but I really don't like the opacity of NewRelic's instrumentation and data. |
| 15:14 | nDuff | (...also, they built quite a lot of instrumentation for us just for the asking, all of it OSS, and provided assistance when I wanted to build our own). |
| 15:15 | bitemyapp | nDuff: wow, that's pretty great :) |
| 15:15 | technomancy | I think the pricing just changed a few days ago around new relic on heroku FWIW |
| 15:16 | technomancy | I haven't used them myself and their recommendations to check jars into source make me wary |
| 15:16 | bitemyapp | nDuff: they got bought by AppNeta. huh. |
| 15:16 | bitemyapp | oh they have a free tier so I can try it out. Hum. |
| 15:17 | bitemyapp | nDuff: what sort of applications have you used TraceView with? |
| 15:17 | nDuff | ...to be fair, I don't know how their JVM-centric instrumentation is; this was at a Python shop. |
| 15:18 | bitemyapp | nDuff: ah damn. |
| 15:18 | nDuff | ...well, this was before it *was* TraceView, but my primary usage was the full stack at Tippr -- instrumented everything from the SSL decoding systems and load balancers all the way back. |
| 15:19 | nDuff | ...the template engine we used was based on code generation, and reworking it to build in instrumentation to the templates was pretty darned straightforward. |
| 15:20 | seangrove | I cannot believe hard tedious getting certain google domain-wide delegation service account integration whatevers to work is |
| 15:26 | bitemyapp | seangrove: usually whenever I bump up into an interface made by Google, I end up unhappy. |
| 15:26 | bitemyapp | This goes double if it was made by Atlassian. |
| 15:26 | justin_smith | http://sprunge.us/hLgK?clojure is this a known bug? maybe it isn't a bug? |
| 15:27 | justin_smith | I would think a base64 encoder should produce output its own decoder can handle |
| 15:27 | justin_smith | or is an empty string explicitly outside the domain? |
| 15:27 | hoangelos | So, is anyone using ring.adapter.jetty? I upgraded to a new version and can't get the SSL to work. When I use truststore, it gives me an error about converting from String to java.security.KeyStore |
| 15:27 | ehtesh | Is there something like leiningen, but for regular java projects? I certainly like using leiningen since it's a commandline tool. Dunno what sort of equivalent for Java code there is. |
| 15:28 | justin_smith | hoangelos: I use jetty, but only in dev, so I don't do ssl via jetty |
| 15:28 | justin_smith | ehtesh: it is a frontend for maven (mvn) which is a java tool |
| 15:28 | bitemyapp | seangrove: just drink tea. |
| 15:29 | justin_smith | ehtesh: well not strictly a frontend, but they both use the same format / archive etc. |
| 15:29 | seangrove | bitemyapp: Got my jasmine tea right here. |
| 15:29 | TimMc | justin_smith: Looks like a bug. I see no reason an empty string should be out of domain. |
| 15:29 | bitemyapp | seangrove: supreme dragonwell brewing atm. |
| 15:29 | hyPiRion | Leiningen works fine for java projects, but you could also use maven if you want to. Or ant. |
| 15:29 | bitemyapp | I should bring my tea to the meetup. |
| 15:29 | seangrove | This is actually the second day. I decided to take a nap half way through yesterday and sleep early last night, thought it would help. |
| 15:29 | hyPiRion | People don't really want to though, so they tend to stay away |
| 15:29 | justin_smith | TimMc: of course I can handle it by making a special case for empty input, but yeah |
| 15:29 | bitemyapp | hyPiRion: or scala. |
| 15:30 | hyPiRion | bitemyapp: yeah, but they have sbt, which (from my knowledge) is okay |
| 15:30 | seangrove | bitemyapp: Nah, caffeine too late at night is no good |
| 15:30 | bitemyapp | hyPiRion: sbt is not okay. You take that back right now. |
| 15:31 | bitemyapp | seangrove: theanine helps. |
| 15:31 | hyPiRion | bitemyapp: well, my knowledge is limited, so I guess I learnt something today |
| 15:31 | seangrove | This link give a security warning for everyone else as well? https://samples.google-api-java-client.googlecode.com/archive/1dd135aa1dfa0b5d326ba2a0c795ed18cd052495.zip |
| 15:31 | hoangelos | anyone else use jetty with ssl? |
| 15:31 | bitemyapp | hoangelos: nope, use nginx. |
| 15:31 | seangrove | hoangelos: ah, bitemyapp beat me to it :P |
| 15:31 | bitemyapp | and I don't even use jetty, I use httpkit. |
| 15:32 | TimMc | seangrove: Yep, wildcards only apply to a single level. |
| 15:32 | hoangelos | yeah this is embedded in an app, so can't use any of that. |
| 15:32 | seangrove | TimMc: thanks |
| 15:32 | TimMc | seangrove: They need *.google-api-java-client.googlecode.com or samples.google-api-java-client.googlecode.com in that list. |
| 15:32 | justin_smith | TimMc: the doc string for decode mentions that length must be a multiple of 4, and for all inputs other than an empty one it outputs a multiple of 4 from encode |
| 15:32 | seangrove | I actually feel a bit sorry for Google, they have *so much* stuff going on, it must be difficult to maintain a consistent level, and the keep it all up to date |
| 15:33 | seangrove | That said, I suppose MS did/does it very well with MSDN |
| 15:33 | TimMc | &(/ 0 4) |
| 15:33 | lazybot | ⇒ 0 |
| 15:34 | ehtesh | justin_smith: so I can just keep playing around with Java code using Leiningen without bothering to drop into Clojure? |
| 15:35 | hoangelos | apparently the library changed how they use truststore. It was a String, and now is supposed to be java.security.KeyStore |
| 15:35 | hoangelos | error says: java.lang.ClassCastException: java.lang.String cannot be cast to java.security.KeyStore |
| 15:36 | ehtesh | also hyPiRion ^ |
| 15:36 | hyPiRion | ehtesh: yeah, you can see an example at e.g. https://github.com/hyPiRion/com.hypirion.io |
| 15:38 | ehtesh | hyPiRion: very useful project of yours, I'm going to go mirror it |
| 15:38 | ehtesh | hyPiRion: mirror the styles, rather |
| 15:39 | hyPiRion | ehtesh: oh yeah, be my guest |
| 15:40 | ehtesh | hyPiRion: I also have a jar file I've been putting on the classpath, I'm guessing there's an option to use leiningen with that? |
| 15:42 | hyPiRion | ehtesh: https://github.com/nickgieschen/lein-extend-cp - althought it's considered bad practice. You should attempt to use the :dependencies key if possible |
| 15:44 | ehtesh | I'm going through an algo course that has a stdlib.jar for helper functions. It's not on maven and it's small, so it'd be easier to include in the repo. |
| 15:45 | hyPiRion | yeah, then it's probably just fine |
| 15:50 | seangrove | Just got rickrolled by a google api java sample |
| 15:53 | yazirian | 404 NEVER GONNA GIVE |
| 15:58 | TimMc | justin_smith: I find it a little odd that base64/encode returns a byte array instead of a string. |
| 16:00 | faust45 | TimMc: the problem was: i create proxy class and use it as serializer for MapDB. next time when drop proxy and run lein check MapDB read file and try to find this serializer and raise error |
| 16:07 | ehtesh | hm... can I list the methods available from a jar file once it's loaded into Clojure? Say this one: http://introcs.cs.princeton.edu/java/stdlib/stdlib.jar . Would be convenient in Clojure. |
| 16:10 | joegallo | a jar file doesn't have methods |
| 16:10 | ehtesh | Even though the jar is in the classpath and shows up with (doall (map println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))) , I can't instantiate classes in it |
| 16:10 | ehtesh | joegallo: er, I guess the classes, then? |
| 16:11 | nDuff | ehtesh: can you show us what you're trying to do to instantiate classes, and how it's failing? |
| 16:11 | hiredman | ehtesh: the look like they are in the default package |
| 16:11 | hiredman | which is bad |
| 16:11 | nDuff | ...indeed; eww. |
| 16:12 | hiredman | generally frowned upon in java, and clojure's interop can have issues with that |
| 16:12 | llasram | ehtesh: I don't know why, but I've discovered in the past that you can't import package-less classes with the `ns` `:import` form |
| 16:12 | llasram | But you *can* import them with the `import` macro |
| 16:12 | llasram | ***MYSTERIES*** |
| 16:12 | nDuff | https://groups.google.com/forum/#!topic/clojure/Eo8Rhdyst1I |
| 16:12 | nDuff | ...from Rich: "Clojure doesn't support clrasses not in packages." |
| 16:12 | nDuff | err, except without the typo. |
| 16:12 | hiredman | llasram: well because that is silly |
| 16:13 | amalloy | llasram: import is a function, not a macro |
| 16:13 | hiredman | the only thing "import" does is let you refer to a class by it's name without the package |
| 16:13 | nDuff | ehtesh: ...from elsewhere in the thread: "You can't do it in Java either. Any Java class that is not in the default package cannot access any class that is in the default package. The default package is an isolated world unto itself." |
| 16:13 | amalloy | oh, wait, it's not? |
| 16:13 | amalloy | it could be |
| 16:13 | hiredman | those classes already don't have a package, so there is no reason to import them |
| 16:14 | llasram | amalloy: Yeah, I was surprised too. There was some chatter earlier, wondering why it's a macro, and why `import*` is a special form |
| 16:15 | nDuff | ehtesh: ...though you *can* retrieve them with (Class/forName "BinaryIn") and such. |
| 16:16 | llasram | hiredman: I never investigated further, but I found that `reify` did not work with a package-less interface unless I first `import`ed it into the namespaces |
| 16:16 | ehtesh | nDuff, hiredman: Well, I'm including a jar file with some extra classes. Here's the pastebin: https://www.refheap.com/20571 |
| 16:16 | hiredman | llasram: that is not true |
| 16:16 | hiredman | llasram: I use reify on java.io.Closeable without importing all the time |
| 16:17 | llasram | hiredman: Sure -- but not a packageless interface |
| 16:17 | nDuff | ehtesh: Is anything in that pastebin responsive to what I told you above? |
| 16:17 | llasram | Although my memory may be faulty |
| 16:17 | nDuff | ehtesh: ...it doesn't look relevant to the issue me. |
| 16:17 | nDuff | s/ me/to me/ |
| 16:18 | hiredman | ah |
| 16:18 | ehtesh | I think Rich saying that clojure doesn't support default packages is useful; is that the problem for me? |
| 16:18 | nDuff | ehtesh: yes. |
| 16:18 | ehtesh | nDuff: er, in the quote you mentioned |
| 16:18 | nDuff | ehtesh: a well-formed jar would have edu/princeton/yourclass/StdIn.class in it |
| 16:18 | nDuff | ehtesh: ...not just StdIn.class |
| 16:18 | nDuff | ehtesh: ...which is to say, the classes would be in a package. |
| 16:18 | ehtesh | well they do have a packaged version of their stdlib.jar |
| 16:19 | nDuff | ehtesh: what exactly do you mean by the word "packaged"? |
| 16:19 | nDuff | ehtesh: because when I look inside that jar, there's no package in it, just a bunch of classes in the default package. |
| 16:20 | nDuff | ehtesh: ..."package" in this context being Java terminology, roughly corresponding to directory structure inside of a jar. |
| 16:20 | ehtesh | Let me take that back, I'm referring to the text around "stdlib-package.jar" in this webpage: http://introcs.cs.princeton.edu/java/stdlib/ |
| 16:20 | hiredman | ehtesh: packaged in this case means the clases say they are part of a pacakge, it has nothing to do with the "packaging" of classes in to a jar |
| 16:21 | ehtesh | hiredman, nDuff: sure, you guys mean "package edu.princeton.yourclass;" statement at the top of a Java file, yes? |
| 16:21 | hiredman | yeah |
| 16:21 | nDuff | ehtesh: ...so, yeah, the -package version of the jar looks much better |
| 16:21 | nDuff | ehtesh: you should be able to use that from Clojure. |
| 16:22 | nDuff | ehtesh: you'll want to do something like (import '[edu.princeton.cs.introcs Draw Picture ...]) |
| 16:26 | ehtesh | nDuff: cool cool cool, thanks! |
| 16:26 | ehtesh | nDuff: actually, I'm going to be writing Java code, I'm just using Leiningen since I like it a bit |
| 16:27 | llasram | It also makes it easy to write your tests in Clojure, even if the main code is all Java |
| 16:27 | llasram | OTOH, it makes it kind of difficult to write the tests in Java... |
| 16:29 | TimMc | lein-junit works |
| 16:29 | llasram | Oh, cool. Last time I tried to use it, I had the troubles, but that was ~1 year ago |
| 16:30 | TimMc | I'm not doing anything fancy or extensive with it, mind oyu/ |
| 16:30 | TimMc | *you |
| 16:37 | bitemyapp | hyPiRion: what...is Halloway doing? |
| 16:37 | justin_smith | TimMc: I think that is because base64 is very specific about the bits making up the string, and the jvm is unicode-only for String things |
| 16:38 | justin_smith | TimMc: so the only clean way to ensure the exact bit level content of the base64 is probably a byte array |
| 16:38 | justin_smith | TimMc: in fact, a byte array is probably the only sure way to get exact bit level content of anything |
| 16:38 | hyPiRion | bitemyapp: Disabling broken tests |
| 16:38 | hyPiRion | obviously |
| 16:39 | bitemyapp | hyPiRion: but whyyyyy? |
| 16:39 | hyPiRion | don't ask me |
| 16:39 | technomancy | to get them to pass? |
| 16:40 | justin_smith | unit tests don't pass, better delete them |
| 16:40 | justin_smith | I've done it, though I am not proud |
| 16:40 | bitemyapp | well the conj is coming up. Maybe people can ask him why he's #_'ing tests. |
| 16:40 | bitemyapp | :P |
| 16:41 | llasram | He says right there "does not work on IBM JDK" |
| 16:41 | llasram | duh |
| 16:41 | bitemyapp | "Multimethod tables are now protected by a read/write lock instead of a synchronized method. This should result in a performance boost for multithreaded code using multimethods." |
| 16:41 | bitemyapp | o_O that explains a lot. |
| 16:42 | bitemyapp | oh, the RestFn patch isn't in this :( |
| 16:45 | muhoo | justin_smith: thanks for that. i have to say, default-sanitize has to be the most referentially-transparent function evr |
| 16:46 | justin_smith | muhoo: heh |
| 16:46 | hyPiRion | I wonder when my patch will be merged in |
| 16:46 | hyPiRion | http://dev.clojure.org/jira/browse/CLJ-1134 -- soon its one year birthday! |
| 16:47 | justin_smith | muhoo: pull requests welcome of course - I may add some stuff to store / retrieve requests from the fs or db, but really once it is a map of generic clojure readables anybody can do that stuff |
| 16:47 | Bronsa | bitemyapp: it's labeled 1.6 on jira so.. I guess there's still hope |
| 16:47 | muhoo | justin_smith: it looks pretty damn good. lots of hairy java stuff in there i'm glad i didn't have to deal with |
| 16:48 | hyPiRion | technomancy: http://www.youtube.com/watch?v=oAiVsbXVP6k ? |
| 16:48 | muhoo | justin_smith: only thing that might be good is some kind of queue/buffer if requests come blasting in too fast, so they all get queued to get saved |
| 16:48 | TimMc | justin_smith: Sure, but the base64 *output* is all ASCII. |
| 16:48 | justin_smith | muhoo: that is done already when you conj on an atom, no? or does the swap! block until it succeeds |
| 16:49 | muhoo | hyPiRion: the old italian saying is, that the pope asked michaelangelo when the sistine chapel would be ready, and michaelangelo replied "when it's done" |
| 16:49 | justin_smith | TimMc: true |
| 16:50 | justin_smith | muhoo: yeah, maybe the default method should put the swap in a future, so that the request continues immediately regardless of storage questions |
| 16:50 | hyPiRion | muhoo: Wish I could tell that to my boss |
| 16:50 | justin_smith | or even the lib could do the store action in a future, so all implementations benefit from that logic |
| 16:50 | muhoo | hyPiRion: it's funnier in italian. the punch line is "quand'e' finische" (sp) |
| 16:51 | llasram | muhoo: As someone who doesn't know any Italian, why does that make it funnier...? |
| 16:52 | hyPiRion | muhoo: I wonder the same thing as llasram does |
| 16:52 | devn | I can't brain good today. What is the function where, when you operate over the sequence with a predice, it returns the first item where the predicate is true? |
| 16:52 | devn | predicate* |
| 16:53 | justin_smith | some |
| 16:53 | justin_smith | oh, that returns the return value |
| 16:53 | amalloy | well, it's (comp first filter) |
| 16:53 | hyPiRion | (first (filter actually |
| 16:53 | hyPiRion | zing |
| 16:53 | devn | yeah, i could swear there was a built-in that did what im talking about, but maybe not |
| 16:54 | amalloy | devn: some comes close, in that it works when (f x) is either x or falsey |
| 16:54 | justin_smith | is a future that never gets derefed guaranteed to be run? |
| 16:54 | devn | amalloy: oh right, that's probably what I'm remembering |
| 16:54 | amalloy | justin_smith: yes |
| 16:54 | muhoo | hyPiRion: llasram: it's the rhythm of it, it has a very dismissive aroma to it. |
| 16:54 | hyPiRion | ah |
| 16:55 | muhoo | technomancy: and it's still open? http://bugs.mysql.com/bug.php?id=20786 yikes. |
| 16:55 | amalloy | insofar as any future is guaranteed to be run, of course. who knows, maybe someone fork-bombed your system already :) |
| 16:55 | justin_smith | cool |
| 16:56 | muhoo | devn: take-while? |
| 16:56 | muhoo | ,(doc take-while) |
| 16:56 | clojurebot | "([pred coll]); Returns a lazy sequence of successive items from coll while (pred item) returns true. pred must be free of side-effects." |
| 16:56 | justin_smith | muhoo: taking your suggestion, the new version of groundhog does the storage in a future so request handling is less likely to be hurt |
| 16:57 | muhoo | ,(take-while (partial not= 5) [1 2 3 4 5 6 7]) ; devn |
| 16:57 | clojurebot | (1 2 3 4) |
| 16:58 | devn | muhoo: no, that would take all of the elements up to the matching element |
| 16:58 | justin_smith | muhoo: https://clojars.org/noisesmith/groundhog version with that fix is up |
| 16:59 | muhoo | oh, i see. hmm, an inverse of it. i dunno, partition-by and second maybe |
| 16:59 | muhoo | nm, first filter is prolly easier |
| 16:59 | amalloy | muhoo: i think you are just woefully confused about what he wants |
| 16:59 | muhoo | justin_smith: cool |
| 16:59 | muhoo | amalloy: i had it inverted, yes |
| 17:03 | blr | hey, potentially weird one, has anyone moved a ring based app to vagrant and found the response times skyrocket? |
| 17:04 | blr | 180-200ms response running locally, 3-4s response in vagrant |
| 17:05 | TimMc | hyPiRion: Oh man, that video! |
| 17:05 | TimMc | THAT VIDEO! |
| 17:06 | TimMc | And that bug thread makes me want to punch everything, but particularly one person. |
| 17:09 | bitemyapp | Bronsa: that RestFn patch would ameliorate some pain in one of the few places I ever wrote performance sensitive Clojure code. |
| 17:09 | hyPiRion | TimMc: you sounded terribly excited over that video |
| 17:09 | bitemyapp | because of that damn patch, I'm now paranoid about using destructuring in loops. |
| 17:09 | bitemyapp | TimMc: MySQL has conferences, it's not out of the question. |
| 17:09 | bitemyapp | punching can happen. |
| 17:10 | bitemyapp | I will say that it really just reinforces my, "yawn, just use Postgres" attitude about RDBMS though. |
| 17:10 | bbloom | bitemyapp: i dunno if you saw, but Alex Miller expanded my patch to remove even more cruft :-) |
| 17:11 | TimMc | hyPiRion: I don't know if excited is the right word. I have a mixture of feelings. |
| 17:11 | TimMc | I appreciate how over the top it is. |
| 17:11 | bitemyapp | bbloom: I think I did, actually. |
| 17:11 | bitemyapp | bbloom: AM makes me happy :) |
| 17:11 | bbloom | i think that's basically his job now |
| 17:11 | bitemyapp | he's probably the only person to make Klishin happy, if he's capable of being so at all. |
| 17:11 | bbloom | to make you, bitemyapp, and the rest of the clojure community happy |
| 17:12 | bitemyapp | bbloom: that was my understanding from my conversation with him. |
| 17:12 | bitemyapp | does anybody have proof Klishin is capable of happiness? |
| 17:12 | bitemyapp | I need to settle a bet. |
| 17:13 | bitemyapp | `cbp`: I'm still pimping out Revise. |
| 17:14 | technomancy | you're taking a cut of Revise's sex worker earnings in exchange for protection? |
| 17:14 | technomancy | TMI dude |
| 17:14 | bitemyapp | technomancy: identifying Clojure + MongoDB users and encouraging them to ditch the sucky part of that equation. |
| 17:15 | bbloom | i haven't looked at rethinkdb at all... i guess you like it? |
| 17:15 | technomancy | ok, but can you do it without distasteful metaphors? |
| 17:16 | `cbp | bitemyapp: :-) |
| 17:17 | `cbp | bitemyapp: sadly no issues yet. I've not much of a clue what to enhance it with next! |
| 17:19 | bbloom | this makes me giggle: https://news.ycombinator.com/item?id=6692191 |
| 17:20 | TimMc | haha |
| 17:22 | `cbp | bitemyapp: on the look for more projects btw while i wait for the bugs to come down raining/think up of stuff to add :-) |
| 17:27 | logic_prog | is there a way to do a "map" of sorts, but keeps an extra "state" var? |
| 17:27 | logic_prog | for example, suppose I wnat to define a funciton mapping list 1 to list 2, |
| 17:27 | logic_prog | where the second list is an accumulating sum of the first list |
| 17:27 | logic_prog | now, I know there is reductions |
| 17:28 | logic_prog | but I'd prefer to have a generic map which allowed me to do a "stateful map" |
| 17:28 | technomancy | that sounds exactly like reduce |
| 17:28 | logic_prog | I am doing a bad job explaining this. |
| 17:29 | logic_prog | I have a list of objects {:width ... :height ... :data } |
| 17:29 | logic_prog | now, I want to create a new list of objects, where the :y field of each object is 0 |
| 17:29 | TimMc | `cbp: You're looking for projects? |
| 17:29 | logic_prog | and the :x field of each object is the sum of all previous :width 's |
| 17:29 | `cbp | TimMc: yeah! I gotta go now unfortunately ttyl |
| 17:29 | logic_prog | thus, I need a "stateful" map, where I somehow keep track of the sum of all previous :width's |
| 17:30 | joegallo | technomancy: you can lead a horse to water, eh? |
| 17:30 | technomancy | (reduce (fn [[m sum] x] [(assoc m :width 0) (+ sum(:width x))]) objects) |
| 17:31 | amalloy | technomancy: reductions there, not reduce, since he wants the lot of them |
| 17:31 | amalloy | plus you don't have a correct initial value |
| 17:31 | amalloy | but that's the general idea, logic_prog |
| 17:32 | logic_prog | ? |
| 17:32 | technomancy | amalloy: I blame lack of paredit |
| 17:32 | TimMc | Easy enough to do with a lazy-seq. |
| 17:32 | amalloy | yeah, actually usually easier that way, TimMc |
| 17:32 | TimMc | lazy-loop, perhaps? |
| 17:32 | TimMc | Haven't looked at the docstring, but it sounds close. |
| 17:32 | amalloy | well, of course! but not everyone already has useful in their project.clj |
| 17:32 | TimMc | pshaw, nonsense |
| 17:33 | seangrove | technomancy: what kind of backwater 17th-century irc client are you using that doesn't have paredit built-in? |
| 17:33 | logic_prog | ( {:width 20, :node "Hello"} {:width 30, :node "World"} {:width 20 :node "Tech}) -> {:w 20, ;x 0, "Hello"}, {:w 30, :x 20, :node "World"}, {:w 20, :x 50, :node "Tech"} |
| 17:34 | amalloy | logic_prog: you've already described what you want. nobody is confused about that. technomancy and TimMc have both given you answers; if they're not sufficient you'll need to explain why rather than restating the problem |
| 17:35 | technomancy | seangrove: cuneiform on clay tablets basically |
| 17:37 | TimMc | IRC over avian carrier |
| 17:41 | seangrove | technomancy: Well, it does have its charm, I can't deny that |
| 17:45 | technomancy | seangrove: you gotta ghost your alt nick, man. it's killing the whole tab completion thing. |
| 17:45 | seangrove | technomancy: hrmm.... |
| 17:46 | seangrove | There we go, back to erc it is |
| 17:47 | technomancy | nice |
| 17:47 | devn | best way to have an optional not-found in a fn? assuming [x y & not-found] -> (when (seq not-found) (first not-found)) |
| 17:48 | logic_prog | https://gist.github.com/anonymous/7363231 <-- is there a more idiomatic way to write this "stateful map" ? |
| 17:48 | devn | err, nevermind -- no need for &, just have a separate arity |
| 17:48 | justin_smith | devn: [x y & [not-found]] (or not-found ...) |
| 17:48 | logic_prog | perferably an answer with more detail than "yes, use reductions" |
| 17:48 | justin_smith | devn: or that :) |
| 17:49 | devn | i think im gonna do ([x y] ...) ([x y not-found] ...) |
| 17:49 | TimMc | logic_prog: If ans starts off as [] and you use conj, you can avoid the reverse. |
| 17:50 | yeoj___ | i'm trying to reference a classpath on the command line and it's telling my my jar file is not availebl.... i clearly see it is in t he directory it's referencing. What can i check? |
| 17:50 | yeoj___ | it's missing jtds.jar for database access.... is there a different one for 64 bit unix as compared to 32 bit windows or something? I just copied it over.... |
| 17:51 | logic_prog | TimMc: is that still linear time? |
| 17:54 | justin_smith | vecs are not linear time, but they are not slow either |
| 17:55 | justin_smith | probably faster than building a linked list and reversing it, if you go to any significant size |
| 17:56 | justin_smith | ,(time (do (reduce conj [] (range 10000)) ())) |
| 17:57 | clojurebot | "Elapsed time: 15.127097 msecs"\n() |
| 17:57 | justin_smith | (time (do (reverse (reduce conj () (range 10000))) ())) |
| 17:57 | justin_smith | ,(time (do (reverse (reduce conj () (range 10000))) ())) |
| 17:57 | clojurebot | "Elapsed time: 5.252221 msecs"\n() |
| 17:57 | justin_smith | oops |
| 17:58 | TimMc | You'd want to use criterium for that. :-) |
| 17:58 | justin_smith | yeah, just doing a quick dirty |
| 17:59 | logic_prog | ,(time (do (reverse (reduce cons () (range 10000))) ())) |
| 17:59 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long> |
| 17:59 | justin_smith | on my machine, with repeated invocations the reverse on () takes about twice as long as the [] |
| 18:00 | justin_smith | logic_prog: args are in the wrong order for cons sadly |
| 18:00 | justin_smith | ,(time (do (reverse (reduce #(cons %2 %) () (range 10000))) ())) |
| 18:00 | clojurebot | "Elapsed time: 5.998524 msecs"\n() |
| 18:01 | S11001001 | justin_smith: is that with cons chains, or IPersistentLists? |
| 18:01 | justin_smith | S11001001: the cons and conj versions with () as the base case were giving me about the same results |
| 18:02 | justin_smith | with [] / conj being just slower than twice as fast |
| 18:02 | S11001001 | ,(class (conj '() 42)) |
| 18:02 | clojurebot | clojure.lang.PersistentList |
| 18:02 | S11001001 | ok |
| 18:04 | justin_smith | the list/cons ones are much more variable in the time they take |
| 18:04 | justin_smith | I am assuming because of the difference in the allocation pattern? |
| 18:04 | justin_smith | (many small allocations, while [] allocates less often, with bigger chunks) |
| 18:05 | TimMc | logic_prog: If you want it to be lazy, you can look at clojure.core/lazy-seq |
| 18:05 | TimMc | Just wrap lazy-seq around the recursive call. |
| 18:14 | TimMc | ,((fn f [x] (lazy-seq (cons x (f (inc x))))) 5) ;; logic_prog, for example, this is a simple lazy counter; the current counter value is state |
| 18:14 | clojurebot | (5 6 7 8 9 ...) |
| 18:15 | TimMc | http://clojuredocs.org/clojure_core/clojure.core/lazy-seq |
| 18:21 | TEttinger | ,(iterate inc 5) ;; TimMc, what's the difference between that and this? I'm curious |
| 18:21 | clojurebot | (5 6 7 8 9 ...) |
| 18:24 | TimMc | Not a whole lot. :-P |
| 18:24 | S11001001 | TEttinger: the cons x and lazy-seq can swap, and probably are so in iterate |
| 18:25 | TimMc | Yep. |
| 18:26 | amalloy | S11001001: note that (cons x (lazy-seq ...)) has caused problems in iterate, because (realized? (cons x y)) throws an exception, and people expect iterate to return a lazy-seq |
| 18:26 | S11001001 | amalloy: apt punishment for using realized? :] |
| 18:27 | amalloy | well yes |
| 18:27 | amalloy | but if it's going to be defined, it might as well work |
| 18:27 | S11001001 | that's not the core lib philosophy IIUC |
| 18:28 | S11001001 | "...unless it impacts performance in some way" |
| 18:28 | amalloy | the core lib's philosophy does not embrace "functions we write should work"? |
| 18:30 | S11001001 | I don't even think this is a "library works" problem. realized? needs a lazy-seq. iterate doesn't return one. It's not on either of those if people are mistaken about what iterate returns or realized? expects |
| 18:30 | amalloy | well, realized? needs an IPending, which embraces lazy-seq, promise, future, and so on |
| 18:31 | amalloy | it could very well include Cons, and return true in that case |
| 18:31 | amalloy | easy enough to make Cons implement IPending |
| 18:31 | S11001001 | it could include Integer and return true in that case |
| 18:32 | S11001001 | seems like a case of whether or not to silence type errors |
| 18:32 | amalloy | not so. you can't make Integer implement an interface |
| 18:32 | S11001001 | you can make realized? widen its expectations though |
| 18:32 | amalloy | sure, but that costs performance, which you were saying is the point |
| 18:33 | amalloy | making Cons implement IPending costs literally zero performance |
| 18:33 | S11001001 | no, sorry, that was about something different. I was saying that the core lib will abandon correctness in some cases to gain performance. But then I thought, this isn't even a case where the core lib is incorrect, it's a library user error. |
| 18:35 | amalloy | S11001001: i disagree. iterate's docstring promises to return a lazy sequence, and realized? promises to work for a lazy sequence |
| 18:35 | bitemyapp | just replaced 7 lines of code with one. My clojure foo is improving. |
| 18:35 | yeoj___ | can anyone explain to me how this is possible; it's entirely clear its on the classpath: https://www.refheap.com/20577 |
| 18:35 | rasmusto_ | bitemyapp: but do they do the same things? |
| 18:35 | amalloy | i don't mind saying that it's a bug in iterate, rather than in realized?, but then lots of correct-looking code that happens to return something less-lazy becomes incorrect |
| 18:36 | mrevil | how do I know if a core.async routine is done? |
| 18:36 | bitemyapp | rasmusto_: precisely the same thing. |
| 18:36 | bitemyapp | well, one's a loop/recur, one's a reduce, but you know, same results. |
| 18:37 | rasmusto_ | bitemyapp: :), also, I giggled at clojure-foo |
| 18:37 | S11001001 | amalloy: how about both; fix iterate doc, extend IPending :) |
| 18:38 | bitemyapp | rasmusto_: https://www.refheap.com/20578 |
| 18:38 | bitemyapp | admittedly the old code was pretty damn bad, but you get the idea :) |
| 18:39 | amalloy | i wonder whether ambrosebs's annotated version of core.clj would catch (realized? (iterate f x)) as a type error |
| 18:39 | bitemyapp | amalloy: it should, if it doesn't. |
| 18:39 | rasmusto_ | bitemyapp: I have somethign where I do a (merge-with concat seq-of-maps), what's special about pop-merge? |
| 18:39 | bitemyapp | rasmusto_: (set ...) |
| 18:39 | amalloy | bitemyapp: do you know where i can find that? |
| 18:40 | rasmusto_ | bitemyapp: ok, that's what it looked like :) |
| 18:40 | rasmusto_ | bitemyapp: (merge-with (comp set concat) seq-of-maps) ? |
| 18:40 | bitemyapp | amalloy: https://github.com/clojure/core.typed/blob/master/src/main/clojure/clojure/core/typed/base_env.clj#L733 |
| 18:40 | amalloy | rasmusto_: merge-with into |
| 18:40 | rasmusto_ | bitemyapp: er, I guess that wouldn't leave the atoms untouched |
| 18:41 | amalloy | (concat (concat (concat ...))) is disastrous if you build enough of it |
| 18:41 | bitemyapp | rasmusto_: #(into #{} %) ? |
| 18:41 | rasmusto_ | Ohh, I see it now. Thanks. |
| 18:47 | hyPiRion | bitemyapp: isn't that just set? |
| 18:49 | bitemyapp | hyPiRion: more or less. |
| 18:49 | bitemyapp | well, (hash-map ...) isn't equivalent to (into {} ...), right? |
| 18:50 | bitemyapp | ,(apply hash-map [:a 1]) |
| 18:50 | clojurebot | {:a 1} |
| 18:50 | bitemyapp | ,(into {} [[:a 1] [:b 2]]) |
| 18:50 | clojurebot | {:a 1, :b 2} |
| 18:50 | amalloy | bitemyapp: right, but for set and hash-set it is equivalent |
| 18:53 | bitemyapp | amalloy: the problem here is that it's not just a set, pop-merge is keys to set values. |
| 18:53 | bitemyapp | so reducing a "dumb set" isn't good enough. |
| 18:54 | bitemyapp | the idea being that you get a set of all known values that existed for a given key across all hash maps. |
| 18:54 | amalloy | bitemyapp: i'm not paying any attention to the full problem, i'm just agreeing that #(into #{} %) is identical in every observable way to the function set |
| 18:54 | bitemyapp | amalloy: wish you and Raynes were up here in SF for the meetup tonight. |
| 18:54 | bitemyapp | amalloy: yeah the problem is a bit different from that. |
| 18:54 | amalloy | what's the meetup topic? |
| 18:55 | bitemyapp | (merge-with pop-merge {:a 1} {:a 2}) => {:a #{1 2}} |
| 18:55 | bitemyapp | amalloy: something something big data doc brown something somethimg arrays. |
| 18:55 | bitemyapp | I don't even care about the topic per se, I just show up to talk to people. |
| 18:55 | amalloy | sure |
| 18:56 | rasmusto_ | ,(merge-with set {:a 1} {:a 2}) |
| 18:56 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core$set> |
| 18:57 | bitemyapp | rasmusto_: nice try, I'm not that dumb :) |
| 18:57 | bitemyapp | rasmusto_: that can work if you use Fluokitten though! |
| 18:57 | rasmusto_ | wtb some boxes |
| 18:57 | bitemyapp | functors for the fucking win. |
| 18:58 | lpvb | does anyone mind reviewing my code and telling me where I can improve? |
| 18:58 | lpvb | http://cljbin.com/paste/527c2933e4b02f49e2e851d3 |
| 18:59 | lpvb | excuse my noobiness |
| 18:59 | technomancy | is that the new Adobe Source Pro face? |
| 19:00 | technomancy | lpvb: letting rest and first should become a single destructuring let |
| 19:01 | lpvb | let [[y & ys] sequence] ? |
| 19:01 | hyPiRion | lpvb: There's a lot of loop and recurs. Generally you can put them into separate functions, and perhaps even convert them to reduces if composed correctly |
| 19:01 | rasmusto | lpvb: yeah |
| 19:01 | technomancy | indeed |
| 19:02 | bitemyapp | lpvb: reduce is your friend. learn it, live it, love it. |
| 19:03 | technomancy | bitemyapp: doesn't seem to be an accumulator; maybe doseq instead |
| 19:03 | lpvb | so with a reduce, I would still use a vector of a stack and a sequence to reduce over? |
| 19:03 | technomancy | oh, nm |
| 19:03 | lpvb | I tried doseq |
| 19:03 | lpvb | but idk how to have a stack |
| 19:03 | technomancy | no, reduce is needed for stack |
| 19:04 | technomancy | lpvb: I would separate out overall flow from the individual side-effects happening. different functions. |
| 19:05 | lpvb | I also get a nullpointer exception when I change the line under make-example to |
| 19:05 | lpvb | (let [menu-bar (create-menu-bar ["File" ["Open" (fn [] (println "Menu Item clicked.")) |
| 19:05 | lpvb | I don't really know where it's coming from |
| 19:06 | lpvb | I have trouble reading the stack trace |
| 19:06 | joegallo | paste us the stacktrace |
| 19:06 | joegallo | we won't have trouble reading it |
| 19:06 | joegallo | and someday you won't either! :D |
| 19:06 | amalloy | (inc joegallo) |
| 19:06 | lazybot | ⇒ 2 |
| 19:06 | technomancy | joegallo: brave words my friend |
| 19:06 | technomancy | we'll see if you're so brave when faced with three pages of javax.swing.* |
| 19:07 | joegallo | lol |
| 19:07 | lpvb | joegallo: http://pastebin.com/L6yNejgr |
| 19:07 | amalloy | terrifying indeed, technomancy |
| 19:09 | lpvb | and I wouldn't be trying to create a tree of menu stuff with a macro right? I read that if you can do it at runtime then it's better than using a macro |
| 19:13 | devn | I have a coll of maps: [{:a 1 :b 2} {:c 3 :d 4}] -- I have a second coll of maps: [{:a 1 :b 100} {:c 101 :d 102}]. for each map in the first coll, I want to attempt to find a map in the second coll whose value of the same key in first coll matches. When I find a map who has the same key/value pair, I want to merge those two maps with the same value for :a, for instance. |
| 19:14 | justin_smith | devn: for starters, group-by should help |
| 19:14 | justin_smith | that is, for finding all the maps in the second group with an :a of 1 etc. |
| 19:15 | justin_smith | (get (group-by :a second-group) 1) |
| 19:15 | devn | thank you. i dont brane good today |
| 19:15 | rasmusto | whoa, using a keyword as a group-by predicate ;o |
| 19:16 | justin_smith | its good for when your map is really a two way relation |
| 19:16 | justin_smith | which is devn's case |
| 19:16 | rasmusto | ,(group-by :a {:a 1} {:b 2 :a 3}) |
| 19:16 | devn | rasmusto: yeah, keywords are callable |
| 19:16 | clojurebot | #<ArityException clojure.lang.ArityException: Wrong number of args (3) passed to: core$group-by> |
| 19:16 | rasmusto | ,(group-by :a [{:a 1} {:b 2 :a 3}]) |
| 19:16 | clojurebot | {1 [{:a 1}], 3 [{:a 3, :b 2}]} |
| 19:17 | rasmusto | devn: yeah, I use it like that all the time, just not in the context of group-by |
| 19:53 | devn | simplest way to get from {:a 1 :b 2 :c 3} to [:a 1 :b 2 :c 3]? |
| 19:53 | brehaut | devn: maintaining order? |
| 19:54 | devn | *nod* |
| 19:54 | brehaut | haha |
| 19:54 | devn | c'est impossible! |
| 19:54 | bitemyapp | devn: (vec (mapcat concat ...)) |
| 19:55 | devn | brehaut: why do you laugh? |
| 19:55 | devn | bitemyapp: thanks |
| 19:56 | brehaut | devn: maps dont strictly support ordering right? its just an accidental implementation detail that some maps will seq in the order the keys are defined |
| 19:56 | brehaut | otherwise i think ##(mapcat identity {:a 1 :b 2 :c 3}) |
| 19:56 | lazybot | ⇒ (:a 1 :c 3 :b 2) |
| 19:57 | metellus | or ##(apply concat {:a 1 :b 2 :c 3}) |
| 19:57 | lazybot | ⇒ (:a 1 :c 3 :b 2) |
| 19:58 | bitemyapp | metellus: ahhh you bastard. |
| 19:58 | devn | golfing FTW |
| 19:58 | devn | so yeah, well, i guess it's time for a sorted map |
| 19:58 | bitemyapp | devn: well...yes. |
| 19:59 | devn | no wonder clojure.data.csv spits things out and slurps them up as [[a b c] ...] |
| 19:59 | rasmusto | ,(apply concat (sort {:a 1 :b 2 :c 3})) |
| 19:59 | clojurebot | (:a 1 :b 2 :c ...) |
| 20:00 | bitemyapp | oh, yes, one of those problems where I can't repro the test failure in the REPL. Cool. |
| 20:00 | devn | i of course turned my rows of a CSV into a map using the headers |
| 20:00 | rasmusto | you can't REPLoduce it? |
| 20:00 | Raynes | rasmusto: gtfo |
| 20:00 | bitemyapp | devn: csv isn't rows of associative data structures, they're row/column. |
| 20:01 | rasmusto | Raynes: it's that time of night |
| 20:01 | bitemyapp | rasmusto: AAAAAAGH |
| 20:01 | Apage43 | :{ |
| 20:01 | devn | bitemyapp: i'm well aware, but it's pretty common to manipulate the result of reading a CSV as a collection of associative things |
| 20:02 | devn | like they're records, y'know? |
| 20:03 | bitemyapp | devn: I can buy that, but still. |
| 20:03 | bitemyapp | also, I would just like to make it known that the problem I am coping with would be cleared up in a jiffy if I had a type system helping me out. |
| 20:03 | devn | maybe i'll use array-map |
| 20:03 | rasmusto | devn: I do a lot of (zipmap (first csv) (apply map list (rest csv))) |
| 20:03 | bitemyapp | because it's very obviously me propagating the wrong type in some kind of edge case |
| 20:03 | bitemyapp | I just can't find *WHERE* |
| 20:03 | devn | bitemyapp: simple-check |
| 20:04 | bitemyapp | devn: nah I have data repro'ing it. I mean I need an actual type system |
| 20:04 | bitemyapp | to help me untangle where my fuck-up is. |
| 20:04 | bitemyapp | prn only goes so far. |
| 20:06 | Squee-D | Holas |
| 20:06 | technomancy | http://p.hagelb.org/slamhound-nrepl-discover.html <- I think I can throw out slamhound.el now? |
| 20:06 | devn | rasmusto: yeah, same here (let [[headers & rows] (csv/read ...)] (map #(-> (zipmap headers %) (walk/keywordize-keys))) |
| 20:06 | devn | err put rows on the end ^ |
| 20:06 | Squee-D | Member counts gone up quite a bit in the last year :D |
| 20:07 | rasmusto | devn: I like keywordize-keys, I'll use that :) |
| 20:08 | bitemyapp | no wait, still no repro at another layer of the problem |
| 20:08 | bitemyapp | DAFUQ |
| 20:09 | bitemyapp | wait a second |
| 20:09 | bitemyapp | wait |
| 20:09 | bitemyapp | a |
| 20:09 | bitemyapp | fucking |
| 20:09 | bitemyapp | DATOMIC YOU MOTHERFUCKER |
| 20:09 | bitemyapp | map? is false for Datomic entities. |
| 20:09 | bitemyapp | I'm going to go cry bitter tears now. |
| 20:10 | Apage43 | ah |
| 20:10 | Apage43 | wow |
| 20:10 | technomancy | cemerick: am I going to have to wait to the conj before you spill the beans on your nrepl-discover-like thing? |
| 20:10 | bitemyapp | datomic.query.EntityMap Dicks. |
| 20:10 | bitemyapp | What a fucking dick move. |
| 20:10 | bitemyapp | this is like the third fucking type (map? EntityMap) => false has bitten me. |
| 20:10 | bitemyapp | third time* |
| 20:11 | bitemyapp | (defn mappish? [v] (or (map? v) (= (type v) datomic.query.EntityMap))) |
| 20:11 | bitemyapp | fuckers. |
| 20:11 | rasmusto | I do the muscle memory thing sometimes too :), types probably would have helped here |
| 20:12 | technomancy | I feel like I talked three separate people into trying nrepl-discover over the past few weeks... has anyone used it successfully? |
| 20:12 | bitemyapp | rasmusto: hum, you responding to me? |
| 20:13 | rasmusto | bitemyapp: yeah, on time -> type |
| 20:13 | bitemyapp | rasmusto: yeah, it would've. |
| 20:13 | bitemyapp | deeeefinitely. |
| 20:13 | bitemyapp | that was friggin' dumb. |
| 20:14 | bitemyapp | joyously I think the code still broken, just in new and interesting ways. |
| 20:15 | bitemyapp | hrm, query sets aren't sequential either. |
| 20:16 | bitemyapp | yeah this is awesome. |
| 20:17 | Apage43 | maybe throw https://github.com/ztellman/collection-check at it |
| 20:17 | Apage43 | not that you can do anything about what it says |
| 20:17 | Apage43 | but knowing |
| 20:18 | bitemyapp | I'll look into that later, don't really have time to integrate a library. |
| 20:18 | bitemyapp | just kinda generally mad. |
| 20:18 | bitemyapp | Apage43: you going to be at the meetup? |
| 20:18 | Apage43 | what when |
| 20:18 | bitemyapp | Apage43: tonight, 6 pm, weather corporation. |
| 20:18 | Apage43 | oh |
| 20:18 | Apage43 | no |
| 20:18 | bitemyapp | sorry, Climate corp |
| 20:19 | bitemyapp | Apage43: :( |
| 20:19 | Apage43 | its quite a trek |
| 20:19 | bitemyapp | Apage43: where are you? |
| 20:20 | Apage43 | Sunnyvale/Mountain View |
| 20:20 | bitemyapp | oh damn. |
| 20:20 | bitemyapp | Apage43: get on the meetup group so you get reminders |
| 20:21 | Apage43 | i'm on it, maybe my email stuff isn't set up right |
| 20:23 | bitemyapp | hrm. you can't assoc entity maps either. |
| 20:23 | bitemyapp | ...oooo...kay... |
| 20:23 | Apage43 | man |
| 20:24 | bitemyapp | I don't know how I avoided all these fuck-ups for this long |
| 20:24 | bitemyapp | at all |
| 20:24 | bitemyapp | but types would've saved me this belated confusion. |
| 20:24 | bitemyapp | https://groups.google.com/forum/#!topic/datomic/IzRSK9e7VJo |
| 20:25 | bitemyapp | so I'm not the only one. |
| 20:25 | technomancy | types...or just not inventing a new thing and using a map to begin with |
| 20:26 | Apage43 | there |
| 20:26 | Apage43 | meetup is now pointed at the email address I actually read |
| 20:27 | sritchie | have you guys seen cljs errors like this? Uncaught InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable. |
| 20:27 | sritchie | I'm worried that I may not be hooking in to the proper event to load stuff. |
| 20:27 | bitemyapp | coercion for the win. My code works now. |
| 20:27 | bitemyapp | bastids. |
| 20:27 | sritchie | I see this intermittently, and sometimes, on a websocket, that the websocket was CLOSING or CLOSED… but if I manually call my init function at the console, I'm good to go |
| 20:28 | bitemyapp | sritchie: maybe need to wrap socket access with (ensure-socket s) type dilly to resuscitate when it goes down? |
| 20:29 | sritchie | bitemyapp: write that func, you mean |
| 20:29 | sritchie | ? |
| 20:30 | bitemyapp | sritchie: yeah, but my approach is usually to hit things with a hammer until they work so that might not be what you want. |
| 20:30 | bitemyapp | sritchie: if you want to *investigate* why, do what you can to break the socket to see if it reproduces the errors. |
| 20:31 | sritchie | ugh, when I put the socket in an atom, I get an InvalidStateError - attempt was mode to use an object that is not, or is no longer, usable |
| 20:32 | bitemyapp | sritchie: wrapping it in an atom in cljs causes this? what happens if it's bare? |
| 20:33 | sritchie | let me show you my pattern I'm using |
| 20:34 | sritchie | https://gist.github.com/sritchie/7364870 |
| 20:34 | sritchie | bitemyapp: that's my pattern for initialization |
| 20:34 | sritchie | without the atom |
| 20:34 | sritchie | whoops, forget about that extra @ |
| 20:35 | sritchie | so if I do that, I get Uncaught InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable. |
| 20:35 | sritchie | but then, |
| 20:35 | sritchie | if from the console I call init manually, |
| 20:36 | sritchie | ugh, now I'm confused |
| 20:36 | bitemyapp | sritchie: I don't like the bare-def at all. |
| 20:36 | bitemyapp | sritchie: I think you should wrap access to it with functions that handle init-if-nil. |
| 20:37 | bitemyapp | (atom nil) for init state in the def. |
| 20:37 | bitemyapp | Awww yisssss http://www.rethinkdb.com/docs/install-drivers/ |
| 20:37 | sritchie | okay |
| 20:37 | sritchie | every damned example has bare defs |
| 20:37 | bitemyapp | sritchie: I know. I think they're a bad idea. Might be superstition on my part but I've had AOT and other things break because of bare defs. |
| 20:37 | bitemyapp | so I use a safer/more fn oriented pattern. |
| 20:37 | sritchie | well, this is in cljs |
| 20:38 | bitemyapp | that would make me more, not less, paranoid. |
| 20:38 | blr | does weavejester/james reeves visit #clojure? hoping he'll have an explanation for this lein ring weirdness :) |
| 20:39 | bitemyapp | blr: not recently but it happens. You're best off just asking in here and maybe following up with a github issue if you can't resolve it. |
| 20:39 | xeqi | $seen weavejester |
| 20:39 | lazybot | weavejester was last seen talking on #clojure 14 hours and 58 minutes ago. |
| 20:39 | blr | ah thanks xeqi |
| 20:40 | blr | oh xeqi, kerodon is great thank you, just started a project with it and trying my best to do outside in TDD :) |
| 20:41 | blr | bitemyapp: it's a bit vague for a github issue unfortunately, just some inexplicable latency when running lein ring server-headless in a VM that I _dont_ get starting ring in a repl on the same box |
| 20:42 | xeqi | blr: I'm glad its useful |
| 20:44 | sritchie | ah! |
| 20:44 | sritchie | bitemyapp: |
| 20:44 | sritchie | java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.FutureTask@4e77f4e7 rejected from java.util.concurrent.ThreadPoolExecutor@256f91f0[Terminated, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 279] |
| 20:44 | sritchie | in the logs |
| 20:44 | sritchie | for httpkit |
| 20:44 | sritchie | which is VERY troubling, actually, since I only have a single browser connected :) |
| 20:45 | sritchie | oh. I bet i need to destroy this thing on unload. |
| 21:07 | dobry-den | don't worry about kernel_task eating 2gb memory, they said. |
| 21:07 | dobry-den | osx will free it up if it needs it, they said. |
| 21:07 | arrdem | silly memory manager... |
| 21:10 | dobry-den | not to mention i have 3 `main` apps running somehow http://i.imgur.com/csMgzKs.png |
| 21:10 | dobry-den | but ending one to free up memory is a game of minesweeper |
| 21:21 | sritchie | bitemyapp: found part of my issue... |
| 21:21 | sritchie | these http-kit channels are reporting open, |
| 21:21 | sritchie | but printing like this |
| 21:21 | sritchie | #<AsyncChannel 0.0.0.0/0.0.0.0:8080<->null> |
| 21:26 | amalloy | dobry-den: jps -v |
| 21:36 | bitemyapp | sritchie: ouch. |
| 21:36 | sritchie | https://github.com/http-kit/http-kit/issues/91 |
| 21:36 | sritchie | filed a bug |
| 21:36 | sritchie | tough times :) |
| 21:37 | bitemyapp | complaining about my own bad code at meetups is fun :) |
| 21:37 | sritchie | but yeah, messing with the proper callbacks fixed my websocket |
| 21:37 | sritchie | clj meetup going on now? |
| 21:37 | bitemyapp | sritchie: yep, speaker just started talking about Doc Brown (array store) |
| 21:37 | sritchie | nice |
| 21:41 | cemerick | technomancy: ech, forgot about it entirely |
| 21:42 | allenj12 | hey if i want to let something but i want it to be bound based on a condition how would i do that? for example something like "(let (if (= v 3) [in 2] [in 6]))" |
| 21:43 | seancorfield | (let [in (if (= v 3) 2 4)] ...) |
| 21:43 | allenj12 | seancorfield; oh thnx! |
| 21:44 | technomancy | cemerick: thinking of pushing an 0.0.1 of nrepl-discover |
| 21:51 | `cbp | TimMc: hi |
| 21:51 | cemerick | technomancy: I don't have any objections, I don't have any working alternative a.t.m. |
| 21:51 | cemerick | technomancy: FWIW, this is what Sam and I sketched out: https://gist.github.com/cemerick/7365536 |
| 21:51 | bitemyapp | `cbp: http://www.rethinkdb.com/docs/install-drivers/ |
| 21:52 | `cbp | bitemyapp: success |
| 21:52 | cemerick | basically eliminating the "discovery" part, making it all a bit more explicit and driven by connecting clients vs. classpath |
| 21:52 | technomancy | cemerick: looks more imperative |
| 21:53 | cemerick | technomancy: which part? |
| 21:53 | technomancy | cemerick: the exclamation points I guess |
| 21:53 | cemerick | ah |
| 21:53 | cemerick | well, "more flexible" ;-P |
| 21:54 | ssutch | does anyone know of any oauth 2 provider support for friend? |
| 21:54 | cemerick | technomancy: I didn't want the ops or the lifecycle to be tied to the classpath / load-time |
| 21:54 | ssutch | (eg an oauth 2 server, for providing REST api authentication) |
| 21:55 | `cbp | bitemyapp: how fares the error handling? |
| 21:55 | cemerick | er, discovery-time |
| 21:55 | technomancy | cemerick: yeah, I punted and require all op-containing nses to be loaded too |
| 21:55 | technomancy | and then just do (all-ns) |
| 21:56 | technomancy | I'll give this a closer look though, thanks |
| 21:56 | cemerick | technomancy: Also, Sam apparently has a use case where he wants to have an op totally change its effect on demand (not surprising given his performance stuff?), so this seemed more natural than swapping in different impls of underlying fns, etc |
| 21:57 | cemerick | The namespace-discovery stuff should be able to sit on top, if you're interested in that. |
| 21:57 | technomancy | cemerick: the big thing is agreeing on a client/server vocabulary though |
| 21:58 | cemerick | That made me comfortable enough to decide to put it into nREPL straight away...though, of course, it hasn't actually happened :-P |
| 21:58 | cemerick | technomancy: yup, for sure. This stuff is comparatively minor |
| 21:58 | technomancy | I don't think the actual handler stuff is all that interesting compared to that |
| 21:58 | technomancy | no offense =) |
| 21:58 | cemerick | hah, none taken! |
| 21:58 | cemerick | The aim is to make nREPL itself the most boring thing possible |
| 21:59 | ssutch | ah, im actually watching cemerick's clojurewest talk, and at the end, my question was pretty much answered |
| 21:59 | cemerick | I'm quite happy that it's generally been static for so long at this point and hasn't inspired angry fixing, etc. |
| 22:00 | cemerick | ssutch: sorry, didn't notice the question :-) Yeah, friend-oauth2, it's demoed on http://friend-demo.herokuapp.com |
| 22:01 | ssutch | cemerick that implements an oauth 2 provider? (eg create client, access tokens, refresh tokens, all that crap) |
| 22:01 | cemerick | ssutch: it's client side, as is all of friend |
| 22:03 | ssutch | right, so i can log in with github, which acquires my identity from github |
| 22:03 | ssutch | just found https://github.com/pelle/clauth |
| 22:04 | bitemyapp | `cbp: no time for that yet. |
| 22:05 | `cbp | :-) |
| 22:05 | bitemyapp | `cbp: work craziness, trying to open source Datomic migration toolkit. |
| 22:20 | bitemyapp | `cbp: soon *cringe* |
| 22:21 | `cbp | :-o |
| 22:22 | bitemyapp | `cbp: I know I need to do it. |
| 22:22 | bitemyapp | `cbp: part of it is caution, I'd like to write tests reproducing various error cases first. |
| 22:22 | bitemyapp | but I just need to write the damn code. |
| 22:22 | `cbp | what kind of errors are you thinking about |
| 22:35 | ToxicFrog | Hmm. |
| 22:35 | ToxicFrog | How do I distinguish between {:foo nil} and {}? |
| 22:35 | amalloy | &(doc contains?) |
| 22:35 | lazybot | ⇒ "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or ... https://www.refheap.com/20581 |
| 22:35 | amalloy | &(doc get) |
| 22:35 | lazybot | ⇒ "([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present." |
| 22:36 | ToxicFrog | Awesome, thanks |
| 23:00 | muhoo | now that's the weirdest lein exception i've seen in a while: https://www.refheap.com/20582 fixed it by "lein clean" but wtf? |
| 23:07 | muhoo | also, golf, this seems unnecessarily complicated https://www.refheap.com/20583 |
| 23:08 | logic_prog | I'm writing a web app. Client side = clojurescript. Client side = apache + clojure/http-kit. I want to test for robustness, so I want some intermediate layer that fucks up ajax-requests + web-sockets. Suggestions? |
| 23:26 | devn | amalloy: Your memory palace is impressive. |
| 23:28 | amalloy | devn: a good memory, fast reading, and nimble fingers: a perfect storm for winning IRC karma |
| 23:28 | amalloy | (what'd i do, though?) |
| 23:29 | devn | You're always around when I need a push in the right direction. I've been mucking with clojure since 2009 and I still find myself coming in here when I'm having writer's block, and you're always there to help. |
| 23:29 | devn | I wish Clojure has a "Clojure Hero Aware" thing like the Ruby community to give people in the community credit for helping people. |
| 23:30 | devn | Award* |
| 23:30 | amalloy | haha aww |
| 23:30 | devn | It's a noble thing to do, and I don't expect most people do it for recognition, but some people deserve it, and you're one of them. |
| 23:30 | devn | <3 |
| 23:31 | amalloy | thanks a lot, devn. it's nice to be appreciated |
| 23:31 | devn | I was thinking about it w/r/t technomancy and cemerick the other night, too. Phil's emacs-starter-kit, leiningen, and the list goes on. |
| 23:32 | devn | There are a lot of people who just deserve a round of applause, y'know? |
| 23:32 | muhoo | indeed |
| 23:32 | muhoo | (inc amalloy) |
| 23:32 | lazybot | ⇒ 75 |
| 23:33 | muhoo | devn: we could always set up bitcoin addresses for 'em, and maybe integrate that into lazybot |
| 23:34 | amalloy | yeah, i heard Raynes discovered recently he's been getting money from git-tip for a while now |
| 23:34 | muhoo | huh, never heard of git-tip |
| 23:35 | amalloy | incidentally, since i've got all this community goodwill at the moment, does anyone know of some interesting jobs available? clojure would be a plus, of course, but i'm sure i can learn anything |
| 23:35 | muhoo | :-) |
| 23:36 | muhoo | always looking for alternatives to capitalism. |
| 23:57 | arohner | amalloy: are you interested in CircleCI? |
| 23:58 | amalloy | don't know much about them, arohner, but i'll take a look. are you involved? |
| 23:59 | arohner | yes. founder/cto :-) |
| 23:59 | arohner | allen@circleci.com, jobs@circleci.com |