#clojure logs

2014-03-02

00:02dfsairyantm: checking out paredit. WOW.
00:03amalloydfsai: yeah, if you don't have something like paredit the parens can be pretty cumbersome. but paredit is like...amazing
00:05koreth__Though the vim one takes a bit of getting used to. (Not an Emacs guy so I can't vouch for the original.) It still trips me up pretty often but saves more time than it costs, so definitely worth checking out.
00:05ambrosebsFWIW I use vim with rainbow parens.
00:05dsrxdfsai: paredit is awesome
00:07dsrxand yeah, rainbow parens + a good indenter can help you to unpack the structure of a form a bit too
00:08dfsaido you guys use rainbow parens exlusively over syntax highlighting (or are they even in opposition to each other?)?
00:08ambrosebsI use both
00:08dsrxthey complement each other very nicely
00:08dfsaiat the same time? Like, in one given moment?
00:08dsrxanother option is to use a mode that highlights matching parens
00:08dsrxlike, as your cursor is on them
00:10bob2highly recommend keeping http://www.emacswiki.org/emacs/PareditCheatsheet open, and every time paredit frustrates you, read it to figure out how to do the thing you want
00:10bob2took a few days for me to go from hating it to enabling it in other non-lisp modes
00:11justin_smithalso, with paredit, C-w and C-q are your "cheat codes" to do the things paredit tries to prevent
00:11justin_smithsometimes it is just easier to use those (especially when first learning paredit)
00:12`cbp`C-q?
00:12bob2and sometimes C-u
00:12justin_smithit literally inserts the next character
00:13justin_smithCq-) will insert ) regardless of paredit rules
00:13justin_smithfor example
00:13justin_smithI use C-q " to break up strings in paredit (there is likely a more elegant solution, but it only comes up so often for me)
00:15amalloyi mean, it's convenient to have an escape hatch like C-q (quoted insert, adds the following character regardless of keybindings) or C-u C-d (delete next character regardless of keybindings). otoh, if you find yourself in a situation where you want those, it's often better to check the cheatsheet to see if there's a better answer
00:15dfsaiDoes paredit come with emacs 24?
00:15amalloyi have to use those escape hatches like...once a month
00:15dfsaibundled? Or do you get it from marmalade?
00:15amalloydfsai: i think just marmalade
00:15`cbp`justin_smith: M-S
00:17justin_smithanother good trick: C-u M-x paredit-mode will turn on paredit, even if the buffer is not currently balanced
00:18amalloythat's like an anti-trick, justin_smith. better to clean up the buffer than have paredit confused
00:18justin_smithamalloy: repl buffer
00:18justin_smiththe output of the repl can confuse paredit
00:18amalloyehhhhh, i guess. i don't really find it worthwhile to have paredit on in my repl
00:18amalloybut i suppose if you do, you'll want to be able to force it on
00:18goldfeldwhen paredit annoys me, i do evil things to it
00:19goldfeldworks out well for me
00:19justin_smithyeah, I use that, plus the C-q / C-w tricks in order to never have paredit turned off, which big picture is the bigger win
00:19goldfeldalso bob2: thanks for the cheatsheet link, i really need to deepen my paredit usage
00:20`cbp`i rarely type on my repl. I use keybindings that send expressions to it =)
00:20goldfeldamalloy: at first i didn't have it in the repl, but once i got used to having it there too, i couldn't go back
00:20amalloygoldfeld: yeah, i understand that's a valid workflow used even by people who are not crazy, but i'm with `cbp`
00:26justin_smithwhen I type in my repl, I then have the persistent repl history
00:26justin_smithit's useful for remembering things I tried out in the past (that have some validity between projects)
00:28seangroveHrm, it seems like onScroll isn't working quite right through Om
00:30nopromptseangrove: what are you doing with onScroll?
00:30seangrovenoprompt: Trying to build a StackPanel component
00:31seangroveI need to be able to scroll events to know what sub-components are in the view currently though
00:31nopromptStackPanel?
00:31seangrovehttp://msdn.microsoft.com/en-us/library/cc294551.aspx
00:32seangroveIt works in the javascript, I'm not sure what I'm doing wrong in the cljs though
00:33nopromptseangrove: are you listening for onscroll in the component?
00:34seangrovenoprompt: Listening on *everything* at this point ;) https://www.refheap.com/d3191167e441a1369dc3aa231
00:34seangroveI would expect to see "SPV Scroll" in the console when scrolling through the overflow on the div
00:34seangroveIf I grab the element in js and listen, it works
00:36seangroveUhg, is there a way in chrome to switch between sourcemaps and javascript? Source maps are getting in my way at this point
00:36seangrove(I don't want to disable them entirely though, just want to be able to toggle back and forth)
00:37bbloomseangrove: you only need onscroll for virtualizing. have you got non-virtualizing working yet?
00:38seangrovebbloom: I'm not sure what non-virtualized stackpanel is, other than a div with a fixed height and overflow-y: scroll;
00:38seangroveThat renders subcomponents, obviously
00:38bbloomseangrove: yeah, the non-virtualizing stack panel renders all children and sets their style property to absolute positions
00:38bbloomit just does layout, not culling
00:39seangroveAh, I see, ok, hold on, will do that
00:39bbloomonscroll probably doesn't work via delegation b/c it's too noisey
00:39bbloomnoisy*
00:39seangrovebbloom: It's supposed to work, if you look in #react
00:39bbloomoh yeah, it totally SHOULD work, i'm just saying not if you're trying to catch all events w/o explicitly registering for it
00:39bbloomlooking at your code, i see that's not the case
00:40seangrovebbloom: Wondering if I hit an Om bug. I'll take care of the positioning first though
00:40bbloomyup
00:40seangrovenoprompt: Any chance you could try to get an onScroll event working on your side?
00:41nopromptseangrove: i'm in the middle of patching a secretary bug.
00:41seangrovenoprompt: No worries, just thought if you were in ankha already ;)
00:41nopromptseangrove: and working on a sass->garden in ruby.
00:42seangrovenoprompt: That's a strange project... migrating your legacy stuff?
00:43nopromptseangrove: it's not about legacy; it's about portability. there's a lot of good sass code out there that can be migrated to garden easily by hooking in to the Sass AST and emitting EDN instead of sass.
00:45nopromptseangrove: it's not perfect and won't work in every case but it will work in several of them.
00:45seangrovenoprompt: That's very clever actually. Really like the idea
00:45noprompt$foo: 1px => (def $foo "1px)
00:46noprompta {b: c; d {e: f}} => ["a" {:b "c"} ["d" {:e "f"}]]
00:47nopromptit's just a pain in the ass because i have to implement to_edn for a bunch of node types.
00:48dsrxnoprompt: neat, got a migration story for functions/mixins? ;)
00:48nopromptdsrx: i'm covering the low hanging fruit first before adventuring in to that territory.
00:48nopromptdsrx: mixins/functions will likely be the last node types i look at.
00:49nopromptagain my goal is to get at least 60-80% code generation. if the other 20-40% have to be filled in by hand that's worth it to me.
00:50gtrakseems like I might be able to get the compiled files, but not the evals.
00:50gtrakre: cljs
00:50dsrxnoprompt: is the ast you're using the one that's made after mixin/functions are evaluated/expanded?
00:51nopromptit's definitely a weekend project.
00:51nopromptdsrx: yes. all that stuff is available in the sass parse tree.
00:52nopromptdsrx: essentially i'm working with the code just before it's emitted as css.
00:52dsrxah, got it. is there some kind of marker on those nodes indicating which function/mixin generated them?
00:53nopromptdsrx: i'm still exploring: https://github.com/nex3/sass/tree/stable/lib/sass/tree
00:53nopromptthe cool thing is i'm learning a bunch about the sass internals.
00:54nopromptnot that it matters alot.
00:54seangroveHrm, can I not do (dom/div nil (repeatedly 50 #(dom/div nil "example"))) /
00:54nopromptseangrove: btw, i'm always down to drop everything for a pairing session. ;)
00:54seangroveI guess I'm confused about raw om syntax
00:55seangrovenoprompt: Definitely, we'll have to find time for it sometime!
00:55nopromptseangrove: i think i ran in to something like that while working w/ ankha.
00:55nopromptseangrove: it's weird. now that i pair everyday of the week i'm kind of addicted to it.
00:56seangroveI can do (apply dom/div (concat [nil] (repeatedly 50 #(dom/div nil "example"))))
00:56nopromptseangrove: well 5/7 days of the week. :)
00:56seangroveI guess that's kind of what I want...
00:56seangrovenoprompt: I like pairing, but probably not that much
00:57nopromptseangrove: at first it was tough and somedays you really need to let people know you want to work alone for a bit.
00:57bbloomi've found pairing to only really be valuable when i have shit i don't feel like doing
00:57bbloomtakes 2 people to maintain focus when you'd otherwise slack off on your own :-P
00:58ruzuand if the other person feels the same, time to start tripling
00:58nopromptthe nice thing about pairing is a lot of the stupid mistakes you'd make your pair catches.
00:58seangrovebbloom: For remote teams, it's pretty crucial. Helps spread experience
00:58bbloomseangrove: that makes some sense
00:58nopromptalso bugs that might take hours for one person to spot can be resolved quicker w/ two eyes on the code.
00:58nopromptseangrove: that and familiarity w/ the codebase.
00:59seangrovebbloom: But the answer to that is "try not to have remote teams"
00:59bbloomseangrove: i did 3 months remote where i was the senior engineer... it was really tough
00:59nopromptseangrove: i wish i could agree but considering that i live in a place where i'm pretty much the only clj/cljs programmer for another 300 miles it's a godsend.
00:59bbloomseangrove: hipchat helps, ghangouts helps, but ultimately, a flight was the best thing for team building
01:00noprompti won't move to san francisco because the cost of living is retarded.
01:00nopromptplus i don't like big cities.
01:00seangrovenoprompt: I'm with bbloom ;)
01:00seangroveIt's a tradeoff, certainly
01:00koreth__There are cheaper, less city-like places near SF, but "cheaper" is relative (the whole area is ridiculously expensive).
01:00seangroveAnd that's fine, just pick your value points and live with them
01:01seangrovenoprompt: You could join bitemyapp in austin, I head good things
01:01nopromptfresno is working fine for me and i don't see any reason to leave just because "tech is happening in city x"
01:01seangroveA few people I like and think ahve a good balance live out that way
01:01nopromptseangrove: i have a kid on they way, can't do it. :(*
01:01nopromptseangrove: fresno?
01:01nopromptwat?
01:02noprompti doubt it. everyone here is either a php/python/ruby dev and functional programming is "too X" excuse to get in to.
01:02noprompti nearly shit my pants when i heard there was an erlang programmer in town.
01:03seangrovenoprompt: Ah, no Austin. Fresno's fine too. But just have to realize the limitations that come with it, like less likelihood of bumping into clojure devs :)
01:03nopromptseangrove: for a person like me it's great. :)
01:04seangrovenoprompt: Then that's awesome :)
01:04nopromptseangrove: why did bitemyapp bail for austin though?
01:05seangrovenoprompt: He felt it was more his style than SF for a few reasons
01:05nopromptseangrove: i talked to him last night but didn't ask.
01:05nopromptseangrove: he's a nice guy, but the dude is totally misunderstood.
01:06seangrovenoprompt: Yeah, he definitely comes off better in person. I enjoy drinking with him.
01:07nopromptseangrove: never got the chance. :(
01:07nopromptseangrove: i was hoping to see him in march.
01:07noprompterr this month.
01:07seangrovenoprompt: I'm sure there'll be chances in the future, heh
01:08bob2hm, midje mode is a bit bizarre
01:12ddellacostaseangrove, noprompt: funny to hear you talking about bitemyapp...sounds like he really hated SF when I talked to him
01:12ddellacostaI have to drop him a line
01:13nopromptddellacosta: i can only handle that city in small doses.
01:13ddellacostanoprompt: yeah, I'm thinking of heading back to North America myself and got to figure out where I'm going to end up
01:13ddellacostanoprompt: SF seems...unappealling, which is sad since there is so much awesome stuff going on there in tech
01:14ddellacosta*unappealing
01:14nopromptddellacosta: i'd vote for a small town near natural beauty but not so isolated you'd go nuts.
01:14ddellacostanoprompt: yeah, as I get older that seems more and more appealing. I think that was in bitemyapp's mind too
01:14nopromptddellacosta: imho, big cities are overrated. small town folk are generally more "human" from my experience.
01:15seangrovebbloom: Ok, that's a working non-virtualized StackPanel https://www.refheap.com/71d4dd6181a8316ed2bf087b1
01:15nopromptddellacosta: there's plenty of land. ;)
01:15ddellacostanoprompt: I dunno, I have a mixed opinion of that. Growing up in a small town put me off the small-town attitude in many ways. But it is true that small-town folks tend to be more family-like, in sense
01:16seangrovenoprompt: Heh, not to paint with too broad a brush, I'm sure
01:16nopromptddellacosta: i guess it's all about what you want to be around everyday. do you want a big back yard with a blue sky over your head, or tiny space in concrete jungle.
01:17nopromptseangrove: i try not too which i why i suffixed that statement w/ "from my experience"
01:17bbloomseangrove: O_o so many require statements :-p
01:17nopromptseangrove: i've met awesome people in big cities too.
01:18ddellacostanoprompt: well, to be fair, you should compare "big back yard with blue sky..." with "amazing variety of cultural resources, diverse group of people (potentially), amazing food, and concentration of industry"
01:18seangrovebbloom: Oh, just pulling in my existing stuff to populate the stack panel
01:18bbloomseangrove: hehe, ok
01:18ddellacostanoprompt: the trade off is the small space, yes--but it is all about tradeoffs. Much like building software...heh
01:18seangrovebbloom: Ignore them, it just needs om.dom and om.core
01:19bbloomseangrove: yeah, you've also got some non-general cruft in here, like the activities stuff
01:19nopromptddellacosta: those are great things for sure. i dunno i've lived in a few different countries and in a big city and at the end of the day i could really care less.
01:19seangrovebbloom: One second, I'll pull that out so it's passed in
01:19ddellacostanoprompt: yeah, I don't mean to claim one is better than the other, don't get me wrong.
01:20nopromptddellacosta: as long as i have access to clean water, good food, and ample time for my hobbies, family, and dogs everything else is just sugar.
01:20noprompt:0
01:20noprompt:)
01:20noprompti'm a pretty simple dude.
01:20ddellacostanoprompt: you are really reminding me of the things bitemyapp was saying. ;-)
01:20nopromptddellacosta: i blame the drugs.
01:20noprompthaha
01:20ddellacosta noprompt: haha
01:21nopromptddellacosta: i mean you live in japan though right?
01:21ddellacostalazyboth says I have messages? Never seen that before
01:21ddellacosta*lazybot
01:21ddellacostanoprompt: yep, for now
01:21nopromptddellacosta: i'm not sure what the attitude about gaijin is these days but i'd love to live in aomori.
01:21nopromptmy guess is that'd be hard.
01:22ddellacostanoprompt: woah, why Aomori? Like the cold and apples? I'm sure that if you could manage their weird dialect you'd be fine.
01:22noprompt... or close to sapporo.
01:22nopromptddellacosta: that and all the trees. :)
01:22ddellacostanoprompt: actually my wife keeps threatening to move us to Hokkaido. I've contemplated that too
01:22nopromptddellacosta: is kanai still the right word?
01:23nopromptddellacosta: hokkaido looks amazing.
01:23nopromptddellacosta: everyone wants to go to honshu. :(
01:23ddellacostanoprompt: eh, it's kinda old-fashioned. I just use the more formal okusan as I'm progressive that way...haha
01:24nopromptddellacosta: and i guess shujin is out too huh? haha!
01:24ddellacostanoprompt: yeah, we went snowboarding yesterday and one of our friends lived in Hokkaido and was raving about how easy it was to go to the mountain
01:24ddellacostanoprompt: naw, that's fine. ;-)
01:24nopromptlol
01:24nopromptdoesn't that approximate to "master"?
01:24nopromptsorry my japanese is bad. :(
01:24ddellacostanoprompt: it all depends on who you're talking to, and why. My wife usually calls me "danna" when talking to others
01:25ddellacostanoprompt: and actually never uses "go-shujin" or anything. Mostly she just calls me Dave though.
01:25ddellacostanoprompt: don't worry, I'm surprised you know so much!
01:27ddellacostaso, what is up with messages + lazybot?
01:28ddellacostaah, from seangrove. Thanks! Didn't know you could send messages like that, neat
01:28seangrovebbloom: I got your general right here https://www.refheap.com/943df98afaf0877fc3aa277a6
01:29nopromptddellacosta: i studied japanese for a few years. i have tons of japanes lp's from the 70's. bit of a collector.
01:29ddellacostanoprompt: oh, nice.
01:30seangrovebbloom: Pretty speedy as is, actually.
01:30nopromptdeadghost: i always wanted to go but never had the money. now that i finally do, i've got a kid on the way. :(
01:30nopromptddellacosta: ^
01:30nopromptdeadghost: sorry :P
01:31seangrovebbloom: Now, curious how you would extend this to be virtualized in a composable way - a VirtualizedStackPanel component that sits on top of it, transfers the props it receives to the child StackPanel, does the calculations, and filters what it passes to the StackPanel to render?
01:31ddellacostadeadghost: bring your kid! I guess after a year or so...
01:32nopromptddellacosta: i think you meant that for me. i accidentally mis-tabbed :|
01:33deadghostyes, luckily I have no kids
01:33ddellacostadeadghost, noprompt: oh, yeah, sorry for the confusion.
01:36seangrovehah!
01:36ddellacostaseangrove: I have a simple question re: Om/sablono issue--do you see any correlation in whether you use build vs. build-all?
01:37seangrovebbloom: Another problem with this is keeping things sized correctly as browser dimensions change
01:37seangroveddellacosta: Don't use build-all, you can't pass a per-component react key
01:37nopromptsablono is awesome :)
01:38ddellacostaseangrove: okay, I think this is coming clear...one sec
01:38nopromptgah! almost got this bug fixed.
01:40ddellacostaseangrove: when you say per-component, do you mean per-instance of component?
01:41ddellacostaseangrove: since build-all calls build, you should have no problem passing keys/react-keys into build
01:43seangroveddellacosta: I don't see react-keys in here at all.. https://github.com/swannodette/om/blob/master/src/om/core.cljs
01:43seangroveddellacosta: Ah, yes, I meant per-instance
01:44ddellacostaseangrove: https://github.com/swannodette/om/blob/master/src/om/core.cljs#L527 https://github.com/swannodette/om/blob/master/src/om/core.cljs#L560-L562
01:44seangroveddellacosta: But how do you pass that via build-all
01:45ddellacostaseangrove: you can pass a third arg into build-all which is the map of options: https://github.com/swannodette/om/blob/master/src/om/core.cljs#L589-L591
01:46seangroveddellacosta: ? The map is static though
01:46seangrove(build-all my-com {} {:react-key "com-1"})
01:46seangroveerr, (build-all my-com [{} {}] {:react-key "com-1"})
01:46seangroveWon't all the instances of my-com get :react-key "com-1" ?
01:47seangroveThey're siblings, so they need to have unique keys
01:47nopromptlol marilyn mason...
01:47ddellacostaseangrove: why can't you give them distinct keys? I mean, I'm only advocating for using this if you need a collection of items rendered. Otherwise use build itself
01:48noprompts/mas/mans/
01:48seangroveddellacosta: I guess I'm missing how each instances gets a unique
01:48seangrovekey
01:49seangroveddellacosta: Each my-com gets its own cursor/data, but the opts-map is the same for all of them
01:49bob2if I'm writing a command line tool, and would like a couple of different commands, what's the best path to go down? symlinks + examining argv[0]? multiple Main classes + sh wrappers?
01:50ddellacostaseangrove: But, you can change it yourself--I thought that was the point?
01:50seangroveddellacosta: change it where?
01:50ddellacostaseangrove: it can be a value in what you pass into build-all, which you could pull from your data, for example
01:51seangroveddellacosta: Can you post a gist?
01:51ddellacostaseangrove: yeah, let me hack something up
01:51seangroveWorth hashing out
01:51ddellacostaone sec
01:51ddellacostayah
01:58seangroveJesus christ, I can't believe how annoying positioning is in browsers
01:58seangroveCan't wait to fix this and not have to worry about it again
02:02noprompt(inc seangrove)
02:02lazybot⇒ 3
02:09ddellacostaseangrove: I've figured it all out. Your issue has nothing to do with sablono, I don't believe: https://www.refheap.com/49985
02:10ddellacostaer, I *do* believe
02:10ddellacostaah, let me try it with "raw" Om to be sure
02:10seangroveddellacosta: I'll check it with the React Devtools in a few minutes
02:11ddellacostaseangrove: k
02:11seangroveThey're pretty nice, looking forward to the latest changes to get deployed for both
02:13ddellacostaseangrove: which do you mean, sorry?
02:13seangroveddellacosta: https://dl.dropboxusercontent.com/u/412963/screenshots/d5.png
02:13seangroveddellacosta: Notice the tag names
02:15ddellacostaseangrove: woah...x-tags? what is this?
02:15seangroveddellacosta: https://github.com/facebook/react-devtools
02:15seangroveAlso lets you look at attributes like key, reactKey, onScroll, onClick, children, etc.
02:16ddellacostaseangrove: oh, it's mapping the component name?? That is freaking awesome...
02:16seangroveSadly, the names won't work unless you use master react-devtools and master Om. But the attributes work out of the box (though a little bit more messy), and I'm sure both will be pushed live soon
02:17ddellacostaseangrove: man, this stuff is so freaking cool. I get mini brain explosions every day lately
02:17nopromptseangrove, ddellacosta: omfg this is awesome
02:17ddellacostaseriously
02:17seangroveddellacosta: Yeah, same here. Wait until we have rich components that we can jsut take and reuse. I've just about finished up with the stack-panel
02:17nopromptand it's totally cool w/ cljs?
02:18seangrovenoprompt: It'll be messy for now unless you're on master for Om and RDT, but it works, yeah
02:20ddellacostabrb
02:21nopromptpushed secretary v1.0.2
02:22seangrovebbloom: Ok, so I've ported our stuff to use this stack-panel, but window resizes need to be handled. Will think on how to do it cleanly
02:24ddellacostanoprompt: nice. Been meaning to ping you about secretary actually. Have some use-cases I want to run by you
02:26seangrovenoprompt: That include my wish-list? :)
02:26nopromptddellacosta: wtr?
02:26nopromptgrrr.
02:26nopromptwrt?
02:27nopromptseangrove: yep. it's definitely gonna happen.
02:27seangroveNice!
02:28ddellacostaseangrove, noprompt: what is on seangrove's wish list?
02:29seangroveddellacosta: Just this for now https://github.com/gf3/secretary/issues/16
02:29dsrxseems like lately #clojure is much more about clojurescript :)
02:29seangrovedsrx: They overlap a bit
02:29dsrxI'm not complaining
02:29seangrovedsrx: You can think of it like late-nigth public radio ;)
02:30nopromptseangrove, ddellacosta: basically break everything for v2.0.0. :)
02:30dsrxseangrove: haha
02:31nopromptseangrove: so long as there's position relative on the containing element why not?
02:31seangrovenoprompt: There are two clojure meetups here, a clojure dojo, a clojurescript meetup every month, and I regularly hack with people on random things once a week
02:31muhooi have to say, this is the most fun i've had programming in i cannot remember how long
02:32nopromptseangrove: the problem is for folks like me who can't drive 3.5 hours just for an in person hangout.
02:32seangrovenoprompt: means you need to handle dimensions all the time
02:32seangrovenoprompt: Well, there's clojure/west, we'll hangout then
02:32nopromptseangrove: yeah, that can be harry, but not too bad.
02:32seangrovenoprompt: Need to think if that's part of the global ui state, or component-local
02:32nopromptseangrove: sure, but the problem is that not everyone everywhere can physically meet or be on IRC, etc.
02:33nopromptfor example i brought up a problem w/ dnolen on the mail list about the cljs exists? function
02:33nopromptit's horribly named, but he only queried folks in IRC about it.
02:33noprompthad i know i would have recommended a different name.
02:34nopromptexists? is an awful name for a function that really should be called supports? or browser-supports?
02:34seangroveddellacosta: Why not?
02:34nopromptseangrove: uh, he's in japan dude. :)
02:34ddellacostaseangrove: I just can't afford to fly there and get a hotel and take a week off of work
02:34seangroveddellacosta: Heh, fair enough :)
02:35ddellacostaseangrove: and pay for the conference, and eat, and etc. Will cost me in excess of $2K
02:35muhoonoprompt: you're in fresno?
02:36dsrxit seemed like the LA Clojure meetupa all stopped happening as soon as I joined the meetup.com group :\
02:38seangrovedsrx: Push for another meetup, or organize it yourself. People tend to come when given a chance :)
02:39nopromptmuhoo: yeah lol
02:39muhoodsrx: there are quite a few active clojure folks in LA. see if you can drag them to a meetup. maybe volunteer to present something, or find someone to present
02:39noprompti still think an online meetup would be a good idea.
02:39dsrxyeah, I know a couple companies here that use it, like factual
02:40dsrxin fact, they organized all the previous meetups it looks like
02:40nopromptif people are willing to physically go to a meetup i don't see why they wouldn't be open to it virtually...
02:40noprompterr whatever.
02:40nopromptddellacosta: what were your thoughts wrt secretary?
02:41muhoonoprompt: i'd heard there was someone doing clojure out there. cool.
02:41muhooit'll be fun to put faces to names at cljwest
02:41seangrovemuhoo: Costs money to record/stream
02:41seangroveOr else we'd do it for Cljs
02:41ddellacostanoprompt: oh, I find that we use it in a way where we have standard loading/unloading actions, and so I was wrapping the defroute macro...in a macro, but it's not ideal
02:42ddellacostanoprompt: I was thinking it would be useful to provide a mechanism for before/after filters
02:42ddellacostanoprompt: just functions really
02:42muhoodsrx: it's possible that the hardcore clojure folks in LA are burnt out on meetups. volunteering might help, bringing in new blood might help, i dunno.
02:42ddellacostanoprompt: I see that you're moving more and more in the direction of making the routes match the way compojure works
02:50arubinseangrove: Any idea what the costs are like?
02:50seangrovearubin: I don't, couldn't even find someone to do it for the last meetup :P
02:50arubinSeems like a perennial problem that should be solved by now.
02:51arubinChicago's Clojure group is quite active.
02:51seangrovearubin: Maybe.. it's pretty intensive, I think. Equipment, labor and expertise for operating it, time for editing, and uploading
02:52charecch
02:52charei return.
02:52bob2https://www.refheap.com/49987 <- I seem to be misunderstanding how map destructuring works, top line is from (println (keys themap)) just before the call
02:54bob2ugh, duh
02:54muhooextra & ?
02:54bob2it's not a rest argument
02:57nopromptddellacosta: yes that's the idea and eventually it'll probably end up doubling as cljs+browser/cljs+node/clj router
02:58nopromptddellacosta: if weavejester had merged the cljx pull requests things might be different.
02:58ddellacostanoprompt: oh, didn't see those
02:58seangrovenoprompt: Well, cljx is a bit of a nightmare
02:58nopromptseangrove: not really.
02:58ddellacostaseangrove: why do you think so?
02:59nopromptseangrove: garden has a pretty large cljx set up and it's really not that bad.
02:59seangrovenoprompt: Getting sablono to run locally in a project subdir took a bunch of tweaking of source paths, etc. We use it in our production apps too, and it's just finicky.
02:59seangroveIt's definitely cool and useful, but looking forward to feature-expressions in clojure proper
02:59nopromptsure there's a little more thought/effort but really people should be thinking of that when releasing a librry.
03:00nopromptseangrove: i did not run into that w/ sablono.
03:00seangrovenoprompt: When using sablono, or hacking on it as a subproject of your project?
03:01nopromptseangrove: ah, no i didn't try that. yes, that can be an issue.
03:01seangrovenoprompt: Definitely consuming it isn't bad at all
03:02nopromptddellacosta: i did borrow clout's route lexing style.
03:03nopromptddellacosta: but i changed i did things a bit differently.
03:03noprompt:(
03:03nopromptgah, getting tired...
03:04ddellacostaseangrove, noprompt: I think the most confusing part of CLJX is integrating it smoothly; that should be documented better (case in point: https://github.com/lynaghk/cljx/pull/30)
03:04nopromptthe render-route thing was something we came across on our own though and thought was a good idea.
03:04ddellacostabut once you get it going it is wonderful to use
03:06seangroveddellacosta: Well, I think feature-expressions will probably help clear some of it up by standardizing things
03:06nopromptseangrove: definitely.
03:11nopromptddellacosta: feel free to open an issue if you have a good idea btw. :)
03:11seangrovebbloom: Alright, https://www.refheap.com/53df41f4d9e74dc128bd9ead6 works very well for subcomponents that are all the same height, and it's pretty speedy as well. Handling varying heights seems very difficult though, I'm not sure of how we can do it since we won't know anything about the components rendered dimensions until after rendering. It's a difficult challenge at midnight, certainly.
03:11ddellacostanoprompt: re: filters/pre-/post- actions, does it seem like something you folks would be into?
03:12ddellacostanoprompt: we actually wrote a library for the same thing in Compojure
03:12nopromptddellacosta: handlers has been on my mind, but i'm not sure what that would look like.
03:13nopromptddellacosta: you *can* do that before and after secretary/dispatch! though.
03:13nopromptddellacosta: i guess we'd have to see what it looks like to get an idea of what you're thinking and how we could fit it in.
03:13ddellacostanoprompt: well, it's less relevant there since it would mean duplicating some effort in parsing and interpreting the route args
03:14ryanfI momentarily forgot what cljx was, saw react stuff, and was therefore thinking cljx was xml literals for clojurescript :)
03:15ddellacostanoprompt: for example, we have a Page protocol, which has loading and unloading functions. Every time you load a page it calls a load function mapped to a Page mapped to the current route. Similarly, it unloads the last Page (also based on history fragment)
03:15nopromptddellacosta: oh. now, that sounds pretty cool.
03:15nopromptddellacosta: that would actually plug in really well w/ the om style of thinking too.
03:15ddellacostanoprompt: and that's not even all of it. But it is the same exact thing every time, and it happens post-routing. So I originally wrote a macro that wrapped defroute. But 1.0 broke it because of how it checks for names
03:16ddellacostanoprompt: yeah. :-)
03:16ddellacostanoprompt: ...which is not a bad thing, 'cause I didn't like the macro wrapping the macro anyways
03:16ddellacostanoprompt: but I think it would be slicker to just offer this somehow within secretary if you guys are game
03:17ddellacostanoprompt: yeah, it is exactly made for working w/Om actually.
03:17ddellacostanoprompt: but obviously could be anything, not just Om
03:17seangroveryanf: Could be a great April 1st announcement :)
03:18nopromptddellacosta: yeah, that's an awesome idea. IWillNavigate/INavigate/IDidNavigate?
03:18ddellacostanoprompt: oooooh, interesting, yeah
03:18seangrovenoprompt: seems nice, yeah
03:18ddellacostanoprompt: alright, let me get a pull request together then. :-)
03:19nopromptdammit you guys. :)
03:19noprompti'm never gonna get garden 2.0.0 out the door w/ his nonsense. :P
03:20ddellacostanoprompt: haha...well, I'm do my best to get you something in the next few days
03:21ddellacostanoprompt: although that probably means more like the end of the week
03:21nopromptddellacosta: which means by the end of the month? :P
03:21nopromptddellacosta: you can always just open the issue first and reference our chat here. :)
03:21ddellacostanoprompt: no comment
03:21noprompthahaha
03:21nopromptno kidding.
03:21ddellacosta;-)
03:22ddellacostanoprompt: first I have to finish my blog post on protocols in CLJS, and my om-svg post...*sigh*. Oh right, and then there's my job
03:22ddellacostaanyways, seriously, will get you something ASAP
03:22ddellacostawe need this at work so I have an excuse
03:23nopromptwhenever i see "patch welcome" in an issue i've learned to read that as "i'm busy and would love to see this feature but you do it." :P
03:23nopromptddellacosta: i'm mostly interested in how that would work.
03:25nopromptddellacosta: the dispatch-fn would need to implement IFn i think.
03:25nopromptwell maybe not.
03:26nopromptno, secretary/dispatch! would be an alias for INavigate (navigate [...])
03:26ddellacostanoprompt: hmm, I dunno. My first instinct is to simply have something in defroute that checks if there is a pre- or post- fn, and runs it before or after the form passed in
03:27ddellacostanoprompt: I dunno, it depends. I to fully read through secretary first, I've only read bits and pieces so far
03:27nopromptddellacosta: we could do a hangout and i could explain the internals quickly.
03:27noprompt:)
03:28nopromptit's fairly strait forward though.
03:28nopromptall of this stuff should be implemented via protocols though.
03:28ddellacostanoprompt: yeah, not that I object to a hangout but I think it's relatively clear (looking at it now)
03:28nopromptchecking for a pre/post map is just screaming protocol.
03:29ddellacostayeah, I suppose you're right
03:29ddellacostanoprompt: but then, would you expect people to pass a type into the route, or do something w/reify like with Om?
03:29nopromptbehavioral/domain questions generally are a good sign there's a protocol.
03:30ddellacostanoprompt: it feels a bit like overkill for common usage patterns. At the same time, I suspect this is something you'd want to expose to users of the API, rather than people implementing something on top of it.
03:30nopromptddellacosta: i'm not sure.
03:30ddellacostanoprompt: I'm not debating that it could/should be a protocol, I'm just not sure on what level it would work
03:30nopromptddellacosta: yes, you nailed it.
03:31ddellacostanoprompt: I mean, I guess it could be an option, used kind of like how you can do om/component or (reify <Protocols> ...)
03:31ddellacostanoprompt: ...in Om
03:31nopromptddellacosta: this has been my experience using garden. i'm not expsosing enought protocols which is limiting the usage of the library.
03:31ddellacostanoprompt: gotcha.
03:32nopromptddellacosta: i just now rounding out the corners of a new ISelector protocol for garden which makes selectors SUPER powerful.
03:32nopromptother protocols will follow suit. :)
03:32ddellacostanice. :-)
03:33ddellacostanoprompt: yeah, I feel like you don't want to require people to all of a sudden add more ceremony to the basic (defroute "/myroute" params <form>) structure
03:34ddellacostanoprompt: maybe that could be the default, and then you could optionally do (defroute "/myroute params (reify IPreRouteAction (pre-route-action [this] ...) IRouteAction (route-action [this] ...) IPostRouteAction (post-route-action [this] ...))
03:35ddellacostanoprompt: and by default in defroute it could simply check if the form passed in satisfies any of those protocols...
03:36seangrovebbloom: #react suggested a good approach. I could see it causing major layout thrashing, but I'm going to sleep on it and see if I wake up with any solutions to that.
03:36ddellacostanoprompt: ha, that could be awesome 'cause then you could define something like a Page type which implemented IPreRouteAction ...yeah, this is starting to make more sense. What do you think?
03:37nopromptddellacosta: yeah, i think it's a good route to go. i think we should definitely flesh it out in an issue.
03:37ddellacostanoprompt: okay, I'll start with this and we can go from there.
03:37nopromptddellacosta: i want this now. because it's a problem we faced recently where something like that would have been awesome.
03:38ddellacostanoprompt: yeah, I suspect it could be really useful for many use-cases.
03:40nopromptddellacosta: it's just going to take a minute to think of how the api i should look.
03:40nopromptfwiw, my keyboard is acting really weird...
03:41nopromptsomething about this mac.
03:41ddellacostanoprompt: yeah definitely. Also, I want to be clear that I'm proposing something that is post-dispatch, but the names you suggested above (IWillNavigate/INavigate/IDidNavigate) imply that you are thinking of pre-navigation as well. However, I think that would have to be something unrelated to defroute...maybe?
03:44nopromptddellacosta: it's hard to say because ultimately what all of that means is keeping track of a) where you were b) where you are going and c) where you are.
03:45nopromptmaybe it's a bad idea?
03:45nopromptjust sketching here.
03:45ddellacostanoprompt: yeah, I don't know
03:45ddellacostanoprompt: I think it's important obviously not to try to do *too* much in the lib, certainly
03:45noprompt=> true
03:46ddellacostanoprompt: history stuff I think should not be incorporated, but it wouldn't be bad to have a protocol, for example, for previous
03:46seangrovenoprompt ddellacosta: I assume the IWillNavigate would be perfect for setting up e.g. the go loops waiting for data to be loaded
03:46nopromptddellacosta: the other thing we were interested in, is the possibiity of faking verbs (ie. GET/POST/PUT/DELETE)
03:47seangroveOr possibly could be anyway... maybe not. Anyway, headed to bed for now
03:47nopromptddellacosta, seangrove well i think if we put our heads together and think through everything we might be able to come up w/ something.
03:47ddellacostanoprompt: what is the motivation for that? I'm wary of mapping too much to HTTP patterns, but I haven't thought too deeply about it anyways
03:47seangroveG'night!
03:47ddellacostagoodnight seangrove!
03:47nopromptseangrove: sweet dreams lol!
03:57ddellacostanoprompt: https://github.com/gf3/secretary/issues/21
03:58ddellacostanoprompt: and with that I'm going to go help my wife with some stuff--thanks for talking through this! Look forward to next steps. As soon as we decide what we want I'll put together a pull request. :-)
03:58nopromptddellacosta: awesome. this looks like a great start! thanks!
03:59ddellacostanoprompt: definitely, thank you!
04:36szymanowskiHi, how can i turn a string to regex? like "foo" => #"foo"
04:37amalloy&(doc re-pattern)
04:37lazybot⇒ "([s]); Returns an instance of java.util.regex.Pattern, for use, e.g. in re-matcher."
04:38szymanowskithank you
05:03john2xanyone using midje-mode here? is there anything else I need to do besides turning it on? I'm trying `C-c ,`, but it can't resolve symbol 'fact'. (I've already `use`d midje.sweet)
05:26_oggyis there a de facto standard parsing library for clojure? incremental parsing would be a plus, if it doesn't add too much complexity
06:24muhoostackoverflow is pretty useless for puzzling out css issues when using cljs. the #1 top rated answer is always "use this jquery plugin! +1!" :-/
06:24systemfault:/
06:24systemfaultHow is cljs related to css though?
06:26muhoocss/dom issues in general. the solution usually seems to use a jquery plugin to hack around limitations and/or cross-browser problems
06:27systemfaultWell, normalization is jQuery's strength
06:27muhooindeed. but cljs is based on closure and seems to get good backwards-compatibility browser support via that
06:28muhooi dunno. there's probably a much simpler solution but i'll have to sleep on it. just spent hours wading through bootstrap and other css documentation, trying experiments, etc
06:29systemfaultOh
06:29systemfaultI've yet to try cljs... still learning basic clojure at the moment.
06:29muhooi was just venting that the top answers aren't "here's an explanation of the theory of why this is a problem, how to fix it, etc", it's just "use this jquery plugin and your worries are solved"
06:29systemfaultWhat is your problem? Is it something big?
06:40ddellacostamuhoo: I've done a lot of CLJS + CSS + dealing with stupid browser issues, so if you describe the process may be able to help.
06:46PhonatacidHi. Im loooking for doubly-linked versions of clojure datastructures. I'm almost certain I once stumbled upon a github repo (something in core of "contrib") that offered exactly this. Can't find it again though. Any help ?
06:55szymanowskihello, i've got a string like this: "(+|#)" and would like to make a regex with it, when I try this: (re-pattern "(+|#)") it return an error because the + is not escaped, How can I do?
06:57szymanowskisince I can't escape the + char in a regular string
07:00arcatanyou can escape it with \\. (re-pattern "(\\+|#)")
07:02szymanowskithank you
07:10szymanowskione last thing, I would like to replace all occurences of the + character in a string with \\+ but when i'm trying (clojure.string/replace "foo+" #"\+" "\\+") it returns "foo+" instead of "foo\+"
07:15szymanowskisorry my question was nonsense
10:29seangroveddellacosta: Anything you can add here? https://github.com/r0man/sablono/issues/18
10:42john______Could someone tell me what is meant by annotations?
11:01gfredericksTimMc: my point was that *compile-files* doesn't refer to the source files, it refers to the .class files
11:14ddellacostaseangrove: added a comment. And on that note, I'm off to bed...
11:18TimMcgfredericks: OK, that was my understanding as well.
11:19gfredericksTimMc: ah; you said something about loading sources out of the db and that sounded orthogonal
11:19TimMcgfredericks: So gen-class requires writing to disk?
11:20gfredericksTimMc: I don't know for sure about that...where does compiled code normally go when not doing AOT?
11:21gfredericksjust stays in memory via a special classloader?
11:21TimMcThat's what I was imagining.
11:21gfredericksI expect gen-class can work that way
11:21TimMcIs there some other way I should be trying to dynamically load up code that extends a concrete class?
11:22gfredericks,(doc *compile-files*)
11:22clojurebot"; Set to true when compiling files, false otherwise."
11:22gfredericksTimMc: proxy can extend a class
11:22TimMcYeah, but what does "compiling files" mean?
11:22TimMcgfredericks: Bonus, I need the result to be a Class to pass around.
11:22gfredericks,(proxy [java.util.List] [])
11:22clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: iterator>
11:23gfredericks,(type (proxy [java.util.List] []))
11:23clojurebotsandbox.proxy$java.lang.Object$List$3ec5a5e
11:23gfredericks,(class (proxy [java.util.List] []))
11:23clojurebotsandbox.proxy$java.lang.Object$List$3ec5a5e
11:23gfredericks^ is that good enough?
11:24TimMcI thought a proxy's Class wasn't reliable to work with.
11:24gfredericksmaybe just across JVM restarts? dunno really
11:25TimMcLet me give context: I'm working with Zuul, and if I want to give it filters written in Clojure, I need to be able to give it a Class file on demand when it hands me a blob of source code.
11:25gfredericksfrom the filesystem?
11:26TimMcYeah, but I think it can also load from DB.
11:26TimMcI think it then calls the constructor, which is a problem for proxy and reify.
11:26gfrederickswhy?
11:26clojurebotgfredericks: because you can't handle the truth!
11:26gfredericks(is it a problem)
11:27TimMcWell, maybe I'm wrong. Let me give this a try in REPL.
11:27gfredericks(reify) gives you a 0-arg constructor
11:28gfredericksif you're gonna use locals though that's a different story :)
11:28TimMcSo I had been trying to use :gen-class, but Compiler/compile wasn't giving me a Class.
11:28gfrederickswell gen-class lets you pick the class name
11:28gfredericksso presumably you could just look it up afterwards?
11:28TimMcIt's not there. :-(
11:28gfredericks,(gen-class)
11:28clojurebotnil
11:29gfredericks,(gen-class :name 'Taco)
11:29clojurebotnil
11:29TimMccompile returns nil, so I was reading and inspecting the ns form and trying to use Class/forName to get the Class, but it was saying ClssNotFoundException or whatever.
11:29gfredericks,Taco
11:29clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: Taco in this context, compiling:(NO_SOURCE_PATH:0:0)>
11:29gfredericks,(binding [*compile-files* true] (gen-class :name 'Taco))
11:29clojurebotnil
11:30gfredericks,'Taco
11:30clojurebotTaco
11:30gfredericks,(Taco.)
11:30clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: Taco, compiling:(NO_SOURCE_PATH:0:0)>
11:30gfredericksoh right
11:31TimMc,(class (.newInstance (class (proxy [java.util.LinkedList] []))))
11:31clojurebotsandbox.proxy$java.util.LinkedList$0
11:32TimMc\o/ Maybe that will work!
11:33gfredericks...
11:33gfredericksis (class (.newInstance foo)) not the identity?
11:33TimMcJust checking. :-)
11:37TimMcgfredericks: But not the other way around.
11:38TimMc,(.toString (proxy [java.util.LinkedList] [] (toString [] "override")))
11:38clojurebot"override"
11:38TimMc,(.toString (.newInstance (class (proxy [java.util.LinkedList] [] (toString [] "override")))))
11:38clojurebot"[]"
12:17bbloomseangrove: back. was sleeping :-) i'm looking at https://www.refheap.com/53df41f4d9e74dc128bd9ead6 now
12:18bbloomlooks like you're doing a parallel map over the sub-component-datas w/ range (which is just a map-with-index, no?)
12:19koreth_Any opinions on Enlive vs. Selmer vs. Fleet vs. ??? I really like Enlive's conceptual model but every time I've tried to use it, it's felt like I'm writing twice as much code as the problem ought to require. Is that just a learning curve?
12:22bbloomseangrove: for that parallel map, i'd just do (subvec (mapv vector sub-component-datas (range)) ...)
12:23bbloomor just (->> (map vector sub-component-datas (range)) (drop N) (take M)))
12:23bbloomwhere N is calculated by scroll position
12:23bbloomand M is calculated by component height
12:25bbloomseangrove: M is just (Math/ceil (* (/ viewport-height (* sub-component-height (count sub-component-datas)))) over-draw-factor))
12:25bbloomseangrove: holy hell those names are long :-P
12:25TimMcgfredericks: Anyway, I'll let you know if I come up with something. Until I come up with something better, I'll just rely on AOT and not on dynamic loading; I'll write a Clojure "compiler" that just loads the AOT .class file and returns the Class. :-P
12:26dissipatebbloom, 'stack-panel' looks too long. can you break that function up?
12:28bbloomdissipate: not my code :-P
12:28bbloomdissipate: also, it doesn't seem that bad to me...
12:28dissipatebbloom, functions should be small. i would like to see the unit tests for that beast.
12:28bbloomdissipate: oh that's right, you're a troll
12:29dissipatebbloom, how so?
12:38mischovkoreth_: I used to love Enlive/Laser, but I was converted to using Selmer because I feel Selmer code is just more maintainable than Enlive/Laser code.
12:39mischovkoreth_: Enlive/Laser gives you some amazing power, though, and they're good options.
12:39seangrovebbloom: Will clean it up in a bit. Was thinking about how to handle the variable heights, think I have it.
12:40seangrovebbloom: But the (drop N) will affect the scroll position
12:44koreth_mischov: Haven't looked at Laser yet -- will check that out before I give up on the approach. Thanks. I definitely see what you mean, though. My last job was at a place that used PHP for HTML rendering and, for all its warts, PHP does have the benefit of letting you iterate really quickly on user interface code. But the code-in-HTML approach makes it harder to go as quickly from mockups to code.
12:44dissipatekoreth_, what about AngularJS?
12:47koreth_dissipate: Is that client-side-only? Seemed like it when I took a brief look a while back, but I haven't actually tried it. Search engine friendliness is my big worry with client-side rendering.
12:47koreth_(Obviously not an issue for any non-public-facing sites, though.)
12:47dissipatekoreth_, yeah, it renders client side
12:48seangrovebbloom: If I'm dropping/re-rendering components all the time, then I guess I'll essentially need to fake the scroll position
12:48Rayneshttps://github.com/cgrand/enlive/blob/master/src/net/cgrand/enlive_html.clj#L135 conjconjconjconjconj
12:49koreth_I do wish Google and others would run JS engines in their web scrapers so they could meaningfully index client-rendered sites, but I guess then you'd have people trying to write sites to crash their crawlers with infinite loops and such.
12:50seangrovekoreth_: Just punish the site if it crashes, same as they do now for empty sites
12:51dissipatekoreth_, Google recommends using 'HTMLUnit' for that: https://developers.google.com/webmasters/ajax-crawling/docs/html-snapshot
12:52koreth_dissipate: Huh, hadn't seen that page before. Thanks!
12:53dissipatekoreth_, np. at the last company i worked at, we actually used a 3rd party plugin for SEO. it basically stuffed a bunch of keywords into the pages, non-visible to the user of course.
13:10bbloomseangrove: you don't need to fake it, you just put an oversized child in there
13:10bbloomseangrove: sorry, i assumed you were already doing that
13:11seangrovebbloom: Ok, that makes sense
13:11bbloomyou have the viewport div w/ overflow scroll and you have the content div, which is mostly empty space, then you absolutely position in there
13:11seangrovebbloom: Got it. working on it now.
13:18muhoohow do i define inline css styles in om? i tried :style {:width "500px"} in the props, but no luck
13:18dnolen_#js {:style #js {:width "500px"}}
13:18dnolen_muhoo: ^
13:20muhoodnolen_: thanks for confirming that. that's what i did, i must have done something else wrong somewhere else
13:20muhooand thank you for om! this is fantastic.
13:31seangroveI'm using om/update!, why am I getting an error about manipulating cursors outside of render phase with this? https://www.refheap.com/4e0bbea0eda926b30b7aad607
13:37danielszmulewiczseangrove: Because you're in a go block.
13:37danielszmulewiczYou need to deref the cursor
13:37seangrovedanielszmulewicz: In order to om/update! it?
13:37danielszmulewiczseangrove: yes, try (om/update! @panel-data :scroll-position inc)
13:38seangrovedanielszmulewicz: Same error
13:38seangrovehttps://www.refheap.com/45aedb90486bd8981e5676c47
13:38seangrove(just to make sure that looks right)
13:39danielszmulewiczseangrove: Looks right, but if you get the same error, it's something else.
13:40seangrovedanielszmulewicz: It's not important for the time being, I was just using it to test some functionality, but I'l like to know why
13:41danielszmulewiczseangrove: I was facing the same kind of problems. Trying to wrap my head around certain errors. I'm still learning. If you discover something, pls share your wisdom.
13:42seangrovedanielszmulewicz: Will do, thanks
13:46muhoodanielszmulewicz: seangrove: i can confirm that derefing inside a go block makes that error goes away, and works
13:46danielszmulewiczmuhoo: Nice.
13:46muhoofor reading but om/transact! wants the un-derefed cursor, it seems
13:47muhooso (if (:foo @app) (om/transact! app somestuff))
13:55goldfeldseangrove: i saw the next clojurescript meetup is march 31, not sure if it's even a good thing for a meetup to have one-time attenders, but wouldn't in be possible to have it thu or fri after clojure west? i'll only be in sf for the week, maybe others too who could show up
13:57muhooso, this is the react-ish way to listen for a resize. is there a more om-ish way to do it? http://stackoverflow.com/questions/19014250/reactjs-rerender-on-browser-resize
13:57muhooi'm not sure if adding event handlers is very om.
13:58muhoosorry, official react docs, not sure if i should literally translate it into om or do something else: http://facebook.github.io/react/tips/dom-event-listeners.html
14:05seangrovegoldfeld: I see, so instead of the last Monday of the month as usual, make an exception and do it Thursday (day after Clojure/West) for out-of-towners to come?
14:10goldfeldseangrove: i know it may be too much to ask since many people will be busy out of clojure west and will have to present lightning talks at the meetup..
14:10whodidthisreact probs has nothing to do with browser size so event listeners are the correct approach
14:11seangrovegoldfeld: I think that's a reasonable idea. I'll send an email out to the group to get people's reaction
14:12goldfeldseangrove: that would be truly amazing. i know i extended my trip into thursday and friday precisely looking forward to post-clojurewest followups and opportunities like this
14:13goldfeldseangrove: especially since i'm very immersed in cljs and integration with nodejs right now, as opposed to jvm-based clojure
14:13dnolen_seangrove: that should work, did you enable source maps to determine if the error is what you think it is?
14:15goldfeldseangrove: thanks anyhow for considering regardless of how it turns out
14:15seangrovednolen_: Yeah, I'll come back ot it later
14:16seangrovegoldfeld: No problem of course, sending the message now
14:16seangroveOh, jesus, it already filled up :P
14:17goldfeldoh, i see
14:17seangrovegoldfeld: don't worry, Etsy lets us have 50 people, I just set it at 20 to keep the size small
14:22dnolen_danielszmulewicz: you can't deref if you want to use update!
14:22sverihi, i am using midje for my unit tests, how can i test something like this: (:keyword map) => (not (nil?))?
14:25seangrovegoldfeld: Email sent, we'll see how it goes
14:26goldfeldseangrove: awesome! i guess i can check the meetup event for updates?
14:26seangrovegoldfeld: Yeah, please do so
14:30benmossis there any way in Chrome to get an error object's "stack" method to return source-mapped lines?
14:31benmossor to jump from the js line to the cljs line?
14:31nopromptbenmoss: hmm. the stack traces themselves usually should show the source files.
14:31dnolen_benmoss: should just work
14:31benmossthey do when they print the uncaught exception
14:32benmossbut if you catch it and call stack i get js lines
14:32dnolen_benmoss: nothing special you need to do in the debugger or profile tools
14:32dnolen_benmoss: refresh, also make sure to clear breakpoints (things get weird over multiple compiles)
14:33benmosshttp://i.imgur.com/d5jy2iQ.png'
14:33benmossthis is just from using "Pause on uncaught exceptions"
14:35dnolen_benmoss: you should be looking at the debugger if you want to navigate the stack, not the console
14:36seangrovebbloom: Ok, definition om/set-state! that's causing it here: https://www.refheap.com/50275
14:36seangroveActual error http://dl.dropbox.com/u/412963/Screenshots/d7.png
14:36benmossyeah, the problem is the exception's stack is different from the current stack
14:37benmossthe stack at the time it's thrown that is
14:37steckerhalterany idea how I encode a string that has \ü inside so that it becomes %FC ? I need to imitate that encoding to scrape a website. it seems that the characters > 127 are "hex" encoded like this. the others are not touched
14:37benmossso i have to determine the original stack, insert a breakpoint there
14:37benmossjust wondering why exception.stack() isn't mapped
14:38seangrovednolen_: It looks like owner in this case is the data passed into stack-panel, maybe I'm mixing up the order somehow
14:38bbloomseangrove: huh?
14:38steckerhalterI tried MimeUtility from Java but couldn't get that behavior. als URLEncoder does something different. hmm
14:38bbloomseangrove: was that for dnolen_ ?
14:39seangrovebbloom: It was, sorry. Almost have virtualized rendering with variable-size subcomponents going though. Last two steps are to get the sub-components reporting their bounding-rect on render, and the figure out how to catch scroll events
14:40bbloomseangrove: i'm curious to find out what overdraw factor will make sense. i suspect it may depend on the number of items that fit in the viewport
14:40bbloomseangrove: b/c the browser will scroll faster than you'll get scroll events & re-render
14:40seangrovebbloom: Ah, I guess the other bit is to handle window resizing
14:40seangrovebbloom: Yeah, I suspect there will be some flicker of blank content on fast scrolls
14:41seangroveI'll think about how to smooth that out once we get there though
14:41bbloomyeah, we can cross/burn that bridge when we get to it
14:41dnolen_seangrove: that's just way too much context for me to look at
14:41bbloomlots of mitigation strategies
14:41seangrovednolen_: Heh, ignore it then
14:42dnolen_benmoss: no idea, but what are you trying to do that requires this?
14:43steckerhalterok, found it out it's ISO-8859-1
14:44benmossdnolen_: just trying to debug an error on upgrading Om. Tried using "Pause on uncaught" to try to figure it out, wondered if anyone had a solution to that issue i've seen
14:45dnolen_benmoss: it just works for me, are you using :optimizations :none?
14:45clojurebotExcuse me?
14:46benmossdnolen_: yeah. the stack method gives you source mapped stuff? weird. console.trace() works, but ex.stack() doesn't.
14:47dnolen_benmoss: I never use the stack method, I just use the debugger
14:47benmossright
14:47benmossbut this is a case where i don't know where to insert a debugger
14:47dnolen_benmoss: if you catch uncaught exception why do you need to know?
14:47dnolen_in the debugger
14:47benmossbecause the thrown exception has a stack that is different from the current stack
14:48muhooso, i'm sorry about maybe being more fuzzy about this than i should, but what is the om-like way to force a bunch of elements to re-render? i.e. at window resize time?
14:48dnolen_benmoss: and why is that? (or you don't know)
14:49dnolen_muhoo: those elements should probably listen to the window resize event and either set-state! or transact! to trigger refresh
14:49muhoodnolen_: perfect, thanks
14:51benmossdnolen_: dunno, it's React's renderComponent call stack, so it's shifting scope
14:51dnolen_benmoss: React 0.9.0?
14:51benmoss0.8.0
14:52dnolen_benmoss: yeah I think the exception stuff is much improved in 0.9.0, 0.8.0 could be very confusing at times
14:52benmosshm, weird, i just upgraded to om 0.5 and did a cljsbuild clean, let me try that again
14:53benmossdefinitely one of the more annoying workflow things right now
14:54benmossoh, my page is requiring react directly, duh
14:55benmosswhy isn't it recommended to use externs for development?
14:56dnolen_benmoss: they don't do anything outside of advanced
14:56benmossah
14:58muhoothis has been a damn good cocktail of deps and setup for me so far: https://www.refheap.com/50279
14:59_oggy(f 1) throws an exception; (type (f 1)) returns instaparse.gll.Failure. how do i catch this particular exception in a catch (how do i access the type)?
14:59`cbp`muhoo: no core.match? :)
15:00muhoohaven't needed it yet.
15:00muhooor sablono, etc. might tho
15:01`cbp`core.match is my best weapon against nil
15:01muhooreally? good to know.
15:05muhoohmm, looks like core.match could be a great weapon against nested ifs too.
15:07dnolen_muhoo: just be careful w/ core.match inside core.async - they do not play well together
15:08muhooalso good to know, thanks
15:09_oggyerg, stupid question. instaparse.gll.Failure is not an exception, just a regular return value
15:12seangrovednolen_: Somehow it looks like I'm in a state where owner.props.__om_cursor is just a normal cljs.core.PersistentArrayMap - is that normal?
15:13dnolen_seangrove: if you constructed a value that you passed to a component that you didn't get out of the app-state - yes
15:13seangrovednolen_: Ah, that's it then
15:14seangrovednolen_: Should I not be doing that, generally?
15:14dnolen_seangrove: it just depends - it's sometimes useful to construct such values
15:15seangrovednolen_: Should I convert them to a cursor then, so I can use om/set-state! in the component I'm building?
15:15dnolen_seangrove: but if you want component local state to work you need to (om/build foo-view (om/graft random-value cursor))
15:15seangrovednolen_: Ah, ok, I hadn't realized what om/graft was for
15:16benmossdnolen_: is it a typo on https://github.com/swannodette/om/wiki/Documentation under "IInitState" that the IRenderState function is named "render" as opposed to "render-state"?
15:16dnolen_benmoss: typo, feel free to fix
15:17benmosswas hoping i had discovered why my build-all call was never getting to my render-state
15:23benmosshm, if i change "build-all" to "build", it calls my component's render-state fn, but as "build-all" it never does. no exceptions, just the "bunch of weird numbers on the page" error i've seen before
15:32dnolen_benmoss: can you gist/refheap your build-all call?
15:37benmossdnolen_: https://gist.github.com/benmoss/9313406
15:38dnolen_benmoss: so that build-all call won't work anymore - build-all no longer returns an array
15:38benmossah
15:38dnolen_(apply dom/tr #js {:key (:position (first %))} (om/build-all square % options))
15:46benmossthanks
16:03codebxHi guys. I was curious what the best way was to insert a new map into an existing one. For instance, I have {:company {:info {:total_files 10}}} and I'd like to add in {:uploader "name" :files 1} inside of the :info key so that it looks like {:company {:info {:total_files 10 {:uploader "name" :files 1}}}} -- hopefully that makes sense. I've been struggling with this for several hours sadly enough.
16:04codebxi've been trying something similar to (assoc-in data_map [:company :info] {:uploader "name" :files 1}) and it just seems to overwrite whatever is currently within :info already
16:04bbloomcodebx: {:total_files 10 {:uploader "name" :files 1}} doesn't make sense. you need to have key/value pairs
16:04bbloom,{:total_files 10 {:uploader "name" :files 1}}
16:04clojurebot#<RuntimeException java.lang.RuntimeException: Map literal must contain an even number of forms>
16:05bbloomsee?
16:05hyPiRioncodebx: bbloom beat me to it. You need to attach it with a key
16:06bbloomcodebx: i'm just guessing for your data, but you probably want something like {:total_files 10 :uploaders []}
16:06bbloomthen you can use update-in with conj:
16:06codebxoh I think I see. so I need a key associated with the {:uploader "name" :files 1} map like uploader_list: {:uploader "Name" :files 1} i suppose?
16:06codebxbtw - I really appreciate your help (bbloom / hyPirion)
16:06bbloom,(update-in {:company {:info {:total_files 10 :uploaders []}}} [:company :info :uploaders] conj {:uploader "name" :files 1})
16:06clojurebot{:company {:info {:total_files 10, :uploaders [{:uploader "name", :files 1}]}}}
16:06codebxokay that's a good idea too
16:06Bronsacodebx: maybe you want ##(update-in {:company {:info {:total_files 10}}} [:company :info] merge {:uploader "name" :files 1}) ?
16:06lazybot⇒ {:company {:info {:files 1, :uploader "name", :total_files 10}}}
16:07codebxYeah I was hoping to have something like {:company {:info {:total_files 1 {:uploader "john" :files 10} {:uploader "tim" :files 10} {:uploader "robert" :files 15}}}}
16:08codebxi'll take your advice though - I like using a vector
16:08codebx(thanks Bronsa, bbloom)
16:09bbloomcodebx: yeah, what you want is kinda XML-ish, where you have a node with attributes and children. we don't have any idea of attributes+children in clojure, we just have maps w/ key value pairs, so you just invent a key for the children & put a vector there
16:09codebxthat's perfect, bbloom. I'm glad I asked! :)
16:11seangroveOff-by-one. Getting close though...
16:11bbloomseangrove: haha, off by one error? surely that means you need some kind of sliding window abstraction :-)
16:12seangrovebbloom: Going to lean on you on how to clean this code up once it's ready
16:12bbloomseangrove: heh ok
16:12bbloomseangrove: nevermind that i have no idea what any of Om's API methods do
16:12bbloomit's hilarious every time i talk to david and i'm like "yeah, i've never even tried Om, but I tell everybody it's the best thing ever"
16:13seangrovebbloom: Semi-informed evangelists are the best ;)
16:14bbloomseangrove: i understand the underlying model deeply, so the communication challenge is primary vocabulary :-)
16:15akyteAnyone here do any android dev with neko?
16:17seangroveIs there an equivalent of ffirst for llast?
16:18bbloom(comp last butlast) ?
16:18bbloomwhy do you need that/ heh
16:18amalloybbloom: i think he means (comp last last)
16:18bbloomoh
16:18amalloybut yeah, trying to use that suggests you should have a vector or something :P
16:18bbloomeither which way, not sure why that's necessary :-)
16:19Raynesllllllast
16:20bbloomi think there's at least one lisp implementation out there that parses symbols of the form /c[ad]+r/
16:20bbloomcadddadadaddddar
16:20amalloybbloom: i have a macro that does that in clojure, for laughs
16:21bbloomamalloy: i'm laughing
16:21amalloy(with-cxrs (... (caaddaddaddar xs)))
16:21bbloomhaha
16:21benmosshow would you dynamically create instances of different record types?
16:21bbloomdo you also have with-fflls
16:21bbloom?
16:22bbloomffnlffexters
16:22amalloysadly no. left as an exercise for the reader
16:22benmosslike if you have the record types [Foo Bar Baz] and you want to map over them and create instances of each
16:24benmossah, "new" works for that
16:24codebxIs there a good way to update the value inside a specific map of a vector? so I have something like this: {:ruby {:info {:uploaders [{:uploader "Joseph", :files 1} {:uploader "Greg", :files 1]}} and I want to update the :files by passing the value to inc. I can get the vector doing (get-in data_map [:ruby :info :uploaders]) but how in the world do I then get a particular map out of the vector and then update the :files value for
16:24codebx it? Say that I wanted to update the :files for :uploader "Greg" -- is there an easy way? I suppose I need to use one of the walk functions?
16:27amalloyuhhhhh, new will only work with a class literal. you can't map it over a seq
16:27benmosscodebx: you can just use "update-in" to get to the vector and then map to update the ones you want. probably a better way out there, but that should work I think
16:28amalloycodebx: well, your structure doesn't make it possible to do very efficiently - if possible, best would be to have a map from uploader to files, rather than a list of uploader/file pairs
16:29codebxI see. Thank you gentlemen. I appreciate it
16:30amalloywith what you have, the best you can do is something awful like (update-in m [:ruby :info] (fn [m] (map m (fn [x] (if (= (:uploader x) "Greg") (update-in x [:files] inc) x)))))
16:30benmossbut yeah {:ruby {:info {:uploaders {:uploader "Joseph", :files 1} {:uploader "Greg", :files 1]}}
16:30benmosserr
16:32benmoss{:ruby {:info {:uploaders {"Joseph" {:files 1} "Greg" {:files 1}}} would allow for just update-in to work
16:33codebxThanks amalloy and benmoss. I'll definitely think about both solutions. this really requires a new way of thinking.. it's blowing my mind
16:33codebxyour help is much appreciated though. thank you!
16:33amalloycodebx: well, choosing good data structures is a good idea even in imperative languages :)
16:34codebxfair enough :)
16:34benmossamalloy: so is there a way to construct a dynamic class? i see now "new" doesn't work inside a map
16:34amalloybenmoss: have you thought about whether you'd be happier if you just used hashmaps instead of N record types?
16:35benmosswell the reason i am switching to types is so I can use protocols instead of multimethods
16:35amalloywhy?
16:35clojurebotwhy is the ram gone
16:36amalloyi mean, there are good reasons to use protocols and records, but they're not great as a default choice
16:37bbloomso far, i have regretted records 9/10 times i've used them
16:37benmossmostly because Schema doesn't have a macro for annotating defmethods, and because I read that multimethods should be "rarely needed" or something
16:37benmossso no good reasons, just trying it out to see how it would fit
16:37bbloombenmoss: do you have a pressing need to use Schema?
16:38benmossof course not
16:38bbloomyeah, i think the correct answer here is: back to basics :-) strip out scheme, switch to maps, use multimethods if you really have something polymorphic
16:38bbloomonly use records if you've profiled & proven you need to
16:38bbloomonly use protocols if you've got a deftype
16:39bbloomand only use deftype if you truly have some new thing that isn't a vector, map, etc
16:39benmossaye aye captain
16:39bbloomfinal step: be happy :-)
16:40benmossjust felt like the "types" of my maps were starting to feel overwhelming, so thought I'd try Schema to see what it could offer
16:40bbloombenmoss: when faced with excessive complexity, the solution is to reduce complexity, not to label it
16:40bbloomthere are good reasons to use schema, but unless YOU can articulate them, then you shouldn't use it
16:41benmossso you have to learn what they are by not using it?
16:41bbloomheh, well that's one way
16:41benmossvery zen
16:42bbloomrealize that the prismatic guys have a many rich APIs (their public one and their internal services) and they treat the various components of even a single jvm process as separate services
16:42seangrovebbloom: Ok missing a few scroll/resize handling, but with hardcoded M/N this works https://www.refheap.com/50377
16:42sverihi, using the friend library, is there a way to get the username of the currently loggedin user?
16:43seangroveHandles variable-sized subcomponents by reporting back to SP on the componentDidMount event
16:43bbloombenmoss: they use schema for internal documentation and dynamic "type checking" so to speak, but more importantly, they use it to generate API endpoints, enduser documentation, etc. it's a metalevel that you shouldn't adopt unless you need it
16:43bbloomseangrove: you got it running somewhere i can try it?
16:44seangrovebbloom: Let me see if I can get off of master Om/Sablono and push
16:44bbloomsurely we need OmFiddle
16:45bbloomseangrove: i'd rename "sub-com-datas" to simply "items"
16:45benmossseangrove: when did IDisplayName get added? hadn't seen that before
16:46bbloomseangrove: then :sub-com can be clearly :item-component
16:46bbloomand :sub-com-opts can be :item-options
16:46seangrovebenmoss: It's in Om master. dnolen_ Would you be willing to push a point update with IDisplayName added?
16:46bbloomseangrove: and :sub-com-height => :item-height
16:47bbloomseangrove: what's this height best guess thing about?
16:47bbloomis that for variable heights?
16:48seangrovebbloom: Yeah, it's for the user to supply a reasonable best guess about what the items are going to be, cut down on jumping
16:48bob2I've had the same probplurtunity as benmoss - many map 'types' being created in a bunch of places. what're some approaches for ensuring consistent sets of keys etc?
16:49bbloomseangrove: this feels more complex than i'd expect, but i have to soak it in for a bit
16:50bbloomseangrove: so you're storing each component's height?
16:51bbloomassuming they are variable?
16:51bacon1989Hello, I was wondering if there's a limit on how big a vector can be within clojure, and if there's a way to change how big it can be?
16:51seangrovebbloom: Yeah, in order to calculate the offset for the next component
16:51seangroveAnd yes, assuming they're variable
16:51bacon1989I have a 400 element vector that won't seem to evaluate
16:52bob2400 is small
16:52bob2what are you doing and what happens when you do it?
16:52dnolen_seangrove: yes but will have to be later
16:52bbloomseangrove: is this storing ALL the heights, or only the heights for the rendered items?
16:52bacon1989it says "runtime: unmatched delimiter"
16:52bacon1989i'll post the code, one sec
16:53seangrovebbloom: All the heights right now
16:53seangrovebbloom: Honestly could just store the offsets
16:53bacon1989ooo...
16:54bacon1989does putting a zero infront of a number make it octal?
16:54bacon1989http://pastebin.com/MQKY0cdC
16:54bbloomseangrove: i think you should start by splitting this up more. you could easily make a separate ScrollPanel component
16:54bacon1989it doens't affect my problem
16:54bob2yes
16:55bbloomseangrove: i'm trying to figure out how to handle the "measuring"
16:55bbloomseangrove: it's a two-step process w/ upward communication, which is tricky. which is why i suggested a fixed height to start
16:55seangrovebbloom: The measuring is in there currently
16:56bbloomseangrove: yeah, but the channel approach seems hairy to me
16:56seangroveWe use a sub-component 'panel-entry' that listens for render, grabs the node, gets the height, and passes it up
16:56seangrovebbloom: Definitely open to suggestions in that case
16:57bacon1989so I took out all of the zeros, and it seems to be compiling now
16:57bacon1989not really sure what the deal is with that
16:58bob2unmatched delimiter just sounds like you had a typo
16:58bob2I kinda worry that you were doing eval or something though
16:58bbloomseangrove: doesn't Om work with the react event model? why not just have an on-resize event?
16:59seangrovebbloom: For detecting the window change?
16:59seangrovebbloom: Or for the window problem?
16:59seangroveerr, measuring-problem*
16:59bbloomseangrove: measuring
17:01seangrovebbloom: Sounds like it could be a good idea
17:01vt240anyone here done any genetic programming with clojure?
17:01bbloomseangrove: involving channels just seems like unnecessary overhead & complexity: you just need a way for the parent to ask the last known size of the child
17:02Foxboronvt240: i know a friend's master thesis was genetic programming
17:02Foxboronin clojure
17:02bbloomseangrove: so the parent can just keep a map of key=>height
17:02bbloomseangrove: btw: http://referencesource-beta.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/VirtualizingStackPanel.cs#22e1b692280b25fa
17:02bbloomseangrove: much more feature rich, but holy hell tha tcode is verbose :-P
17:03seangrovebbloom: 404?
17:03seangrovebbloom: Nevermind, erc mangled the url
17:03bbloomseangrove: try http://referencesource-beta.microsoft.com/#PresentationFramework/src/Framework/System/Windows/Controls/VirtualizingStackPanel.cs
17:04seangroveWill look at it in just a moment
17:04bbloomseangrove: it's also got features like scroll-to-child and scroll-to-index and recycling of objects in memory
17:04bbloomabsurdly complex though
17:05bbloomthey have an interesting layout model though: it's a two pass system: 1) Measure and 2) Arrange
17:05bbloommeasure is a post order walk, then arrange is a preorder walk
17:06bbloomin the measure pass, children are offered an amount of space (potentially infinite on either axis), then they respond by saying how much space they'd like
17:07bbloomin the arrange pass, parents tell children which layout rectangle slot they've been assigned, and children attempt to fit themselves in to that space
17:09bbloomsadly, react doesn't have a way to walk the tree outside of the render pass
17:11bbloombut it shouldn't be an issue in general: just pick an initial guess for children sizes, assign rectangles to children during render and propegate actual measurements as events, storing responses in the parent, overriding the guess, then the next render frame will patch it up
17:11bbloomif your initial guess is good, then it will render fine, otherwise, you might get one frame of pop
17:12bbloomi dunno if you can force the react render pass to happen multiple times before yielding to the browser. if so, then just pump render until the measurements stableize
17:15bbloomseangrove: anyway, all that is to say: simplify by making splitting out the scroll-panel in to it's own component
17:16seangrovebbloom: Yeah, that's similar to what I was doing with the stored heights/offsets
17:17seangrovebbloom: What does the scroll-panel do? Just to div with overflow-y: scroll and an oversized child?
17:17seangroveAlso, won't the over-sized child + absolutely positioning elements prevent a resize event from happening?
17:19bbloomseangrove: the scroll-panel should also embody the scroll-position state
17:20bbloomseangrove: by resize event, i guess i mean a synthetic resize event. maybe call it "measure"
17:23bbloomthis gets messy though b/c we start getting in to a desire for subclassing and behavior composition :-/
17:23bbloomlike that panel-entry thing is just some wrapper that does the measurement logic, yeah?
17:24bbloomi guess you can just stack together components....
17:24seangrovebbloom: Yeah, it isn't clear how to handle extension beyond composing in Om, yet
17:24bbloomseangrove: btw, how's this all work so far? much faster than the many item issue you had before?
17:24seangrovebbloom: I'll keep working on it, but you should be able to get it running locally very quickly https://github.com/sgrove/omchaya/tree/stack-panel-com
17:25seangrovebbloom: It seems faster, but I'll wait until things are tidied up before taking actual measurements
17:25bbloomseangrove: would help if you get rid of the linear space for measurements & only measure items in view
17:26seangrovebbloom: Linear space?
17:26seangrovebbloom: Here's the current source https://github.com/sgrove/omchaya/blob/stack-panel-com/src/omchaya/components/stack_panel.cljs, appreciate all the guidance
17:27bbloomseangrove: by linear i'm just referring to the fact that you don't technically need to measure off-screen components
17:28bbloomyou can approximate their size and if you scale your approximation by distance to the beginning or end, it will smoothly converge, baring some browser quirks
17:28bbloom(doc last)
17:28clojurebot"([coll]); Return the last item in coll, in linear time"
17:28bbloomyeah, you want peek
17:28bbloom(doc peek)
17:28clojurebot"([coll]); For a list or queue, same as first, for a vector, same as, but much more efficient than, last. If the collection is empty, returns nil."
17:30bbloomgotta go, good luck
17:59seangrovednolen_: Do you see any reason why onScroll wouldn't work with Om? Have you gotten it to work in any examples?
18:01dnolen_seangrove: never tried it no idea
18:01dnolen_seangrove: though I don't see how there could be any issues
18:02seangrovednolen_: Thanks. I'll keep digging then
18:03jlpetersFolks, I'd love some help on extracting all of the 'names' from a set of subvalues from a nested hash. The use case here is I have a json blob for a user and I'm trying to extract the names of all of the 'roles' that the user has. I can drill down to the "roles" within the parsed json but can't figure out how to iterate over that to just extract the names
18:03jlpetersof those roles. For example, a user may have multiple roles such as:
18:03jlpetershttp://pastebin.com/qaiu4QEL
18:03jlpetersI can use get-in to drill into a single record, for example given a user 'u' I can use "(get-in u [:roles 0 :name])" but I'd like to iterate over all of the "roles" and extract all of the "names" of those roles.
18:04jlpetersI know I'm missing something dreadfully easy here, but I'm rather new to clojure.
18:11ryantmjlpeters, use map
18:11jlpetersI've been playing with map and I must just have the syntax wrong. I'll keep working at it.
18:11ryantm(map :name your-vector)
18:11clojurebotIt's greek to me.
18:13jlpetersCrikey, I've been massively overcomplicating that for about an hour. Thanks, ryantm
18:14ryantmjlpeters, you're welcome
18:19Nyyxepl license isn't viral is it? I can choose any license for my code with epl dependencies?
18:23seangroveAlright, a basic VirtualizedStackPanel https://dl.dropboxusercontent.com/u/412963/basic_virtualized_stack_panel.mov
18:25seangroveInvoked like https://www.refheap.com/9d134d828829c1587bc0b90ef and it takes care of rendering the list in a scroll-view and only rendering the visible items + overdraw
18:26bbloomseangrove: i just got back from my errand :-P can you explain what's happening in this video? negative overdraw for testing?
18:26seangrovebbloom: I'm simulating a smaller window and having it scroll through, not rendering items at the top as the pass out of view, and not rendering items below that aren't in view yet
18:27seangrovebbloom: There are actually 250 items in that list, but only 10 showing at any one time
18:27bbloomseangrove: ah ok cool. how smooth is it when it's configured for real?
18:27seangrovebbloom: Don't know. Moving onto the actual scroll detection now
18:33bbloomseangrove: btw, can you imagine how much work this would be w/o react? lol
18:33bbloomfucking adding and removing components and all that nonsense
18:34seangrovebbloom: It's a lot of work with react
18:34seangroveI don't even want to think about it with something like jQuery :P
18:34dnolen_seangrove: looks pretty cool!!!
18:34dnolen_seangrove: everyone will use this
18:34seangrovednolen_: That's the idea. This shit just needs to be done.
18:35seangroveThen building apps, and tooling to build apps just becomes sensible
18:37bbloomseangrove: another trick you can do is favor overdraw in the current direction of scrolling
18:37seangrovednolen_: I was thinking about an 'OmStudio' waaaay off in the distance, something equivalent to Interface Builder. I've wanted that for years now. It'd be nice if there was a protocol for components to expose all of the keys that they care about in cursors and document them for introspection
18:40bbloomseangrove: i did viewport tracking for delayed loading of profile photos
18:40bbloomin a jquery project at some point
18:40bbloomwas a PITA
18:41bbloombasically had to find/fix a plugin for enterviewport and exitviewport events, then store loaded state on each profile tile. on enterviewport, it would swap out the little missing-photo image with the real image href
18:41bbloomworked reasonably well, but soooo much less general
18:42bbloomand had to hack the viewport for "overdraw" otherwise on slow connections you'd constantly see photos popping
18:43bbloomthen we discovered that pressing the [end] key in some browsers caused every damn photo to load, so had to address *that* issue
18:43seangrovebbloom: Were all photos the same dimensions?
18:43bbloomyes
18:43bbloomthat little photo-loading perf optimization turned out to be a nightmare
18:46bbloomseangrove: here's a "mega list" impl in jquery: https://github.com/triceam/MegaList/blob/master/src/megalist.js
18:46bbloomit doesn't work right at all w/ the scroll gesture on my mac touch pad
18:46bbloomnearly 700 lines of js :-P
18:47dnolen_bbloom: madness
18:51vt240I just tried to do (use 'clojure.contrib.math) and it said it couldn't find it
18:51vt240I'm using clojure 1.5.4 - where is the expt function supposed to be?
18:52Nyyxanyone know why I'm getting this error on lein repl? "CompilerException java.lang.ClassNotFoundException: chip.gui.settings, compiling:(chip/gui/app.clj:21:29)"
18:54bob2vt240, http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go -> https://github.com/clojure/math.numeric-tower/
18:54bob2when doing what
18:54vt240thanks bob2!
18:55Nyyxwhen just doing "$ lein repl" in the project directory
18:55vt240I don't seem to be able to (use 'clojure.math.numeric-tower) either though
18:55vt240do I need to add some lein dependency?
18:55bob2yes
18:55Nyyxchip.gui.settings is a deppendency of chip.gui.app which itself is a dependency of core
18:55bob2and you'd want (:require [clojre.math.numeric-tower :refer expt]) not use
18:56amalloymeh. use is fine for playing around in a repl
18:56amalloyplus he has two fewer errors than your suggestion, bob2 :P
18:57vt240I'm trying to do some automatic code generation, so I'm creating functions in text files and doing (load-file filename)
18:57vt240to experiment with genetic algorithms
18:57bob2heh
18:57vt240and some of these functions need expt
18:58bob2didn't realise it was repl
18:58vt240not sure if that's the best approach
19:00vt240I want to evaluate the file in a context that has a lot of math functions available
19:02Nyyxanyone?
19:02clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
19:04vt240Nyyx I'm a noob but have you tried repl deps ?
19:04NyyxWhy do I get this error? "CompilerException java.lang.ClassNotFoundException: chip.gui.settings, compiling:(chip/gui/app.clj:21:29)"
19:04NyyxI thought leiningen would be smart and pull in all code required by the dependencies at the top of the core.clj?
19:06michaniskinNyyx: you need to :require or :import any names or java classes from other namespaces that you use in your namespace
19:07Nyyxahgg I keep forgetting I still need require even when I qualify the name fully
19:07Nyyxmichaniskin: thanks
19:08michaniskinsure, no problem
19:22seangrovednolen_: Is there a way to store local state in an Om that won't trigger a re-render?
19:22seangroveTrying to keep track of when the user is scrolling/finished scrolling/scroll position, and so I'm trigger dozens of rerenders while scrolling
19:22seangrove(by using om/set-state!)
19:23dnolen_seangrove: there isn't but it's something I've suspected would be useful.
19:23dnolen_seangrove: the question is whether it actually matters
19:23dnolen_seangrove: you're not really trigger "dozens" of re-renders - just one for the next frame
19:25seangrovednolen_: But as I scroll, scroll event are continuously triggered, so I'm going to be rerendering as much as Om lets me until I stop scrolling
19:32seangrove,(doc partition-by)
19:32clojurebot"([f coll]); Applies f to each value in coll, splitting it each time f returns a new value. Returns a lazy seq of partitions."
19:34dnolen_seangrove: you're never going to render more than 60fps
19:34seangrovednolen_: Yes, but I don't need to re-render at all :)
19:34seangroveAnd I'm cutting through a lot of items on scroll
19:35dnolen_seangrove: open an issue for set-state! w/o refresh and I'll think about it.
19:35seangrovednolen_: Thanks will do
19:41quarkGluonPlasmaquit
20:17mzdravkovI am trying to test a simple macro for making infix notation in clojure with 2 arguments: (defmacro infix [[a op b]] (op a b)). When I call with with (infix (1 + 2)) it returns 2...
20:27saolsenA macro should return a clojure expression
20:27saolseneg
20:27saolsen(defmacro infix [[a op b]] `(~op ~a ~b))
20:28michaniskinor (defmacro infix [[a op b]] (list op a b)), which is what the above emits
20:30chouserAnyone know if core.typed adds (or could add) metadata to Clojure forms, indicating its understanding of the forms' types?
20:31brehautchouser: i think it adds the type annotations these days?
20:31chouserI guess I should just try it.
20:32brehautfrom memory it initially stored all that stuff in its own space but it was changed due to popular request
20:32brehautit may only be vars though, rather than forms in general?
20:32chouserhmm
20:33mzdravkovhm saolsen, michaniskin, thanks, those worked. Ive tried with '(op a b), but it didn't do the job (why is that, isn't the '() syntax equivalent to (list...) )
20:33brehautchouser: perhaps try #typed-clojure too
20:35chouserbrehaut: thanks!
20:40saolsen'(op a b) will return exactly the list "(op a b)" the ~ syntax is unquoting which evaluates the form which in this case gives the values that were passed in and it results in "(+ 1 2)"
20:44saolsenhttp://www.braveclojure.com/writing-macros/ is a really good overview, there are a lot of different nuances to quoting and unquoting
21:09quizdri need some debugging advice. when you get a Null Pointer Exception, it would be nice to know how to pinpoint it in some way besides just going over every form in the function call, is there a better way?
21:11seangrovebbloom: It's working pretty well, but I'm sure you'll have a problem with the complexity :)
21:12bbloomseangrove: heh, it's cool. i'm sure you or others will improve on it in time
21:13seangrovebbloom: I hope so. It's super simple to use at least, and pretty speedy. Going to do a gut-check test to compare it with the naive-approach (would like to automate this perf testing eventually)
21:14seangroveAh, forgot about window resizing though, bummer
21:24dnolen_seangrove: is it up somewhere?
21:25seangrovednolen_: It's part of Omchaya on a branch. I can push it if you're interested in trying it
21:33dnolen_seangrove: sure will give it a shot later
21:33seangroveAlright, I'll push it in a bit, will let you know
22:19devnpurname is really cool
22:19devnpurnam*
22:19devnpretty sure i said that last night, but im really enjoying it
22:19nopromptdevn: what's cool about it?
22:20devnnoprompt: (def.n square [x] (obj :value (* x.value x.value)) vs (defn square [x] (let [o (js-obj) v (aget x "value")] (aset o "value" (* v v))) o)
22:20devnhttps://github.com/purnam/purnam
22:21nopromptdevn: i'm familiar w/ the library. i was just curious what you thought was interesting about that.
22:21noprompt*it
22:21devni think the testing portion of it is really nice also
22:21nopromptdevn: yeah, but the problem w/ that is he should have extracted it as a separate lib.
22:21nopromptkind of unfortunate.
22:21devnnothing precludes that from happening
22:22devn"patches welcome" and all that
22:22devnhe asked for help maintaining on the ML
22:22nopromptdevn: true. true. true.
22:23nopromptpersonally i don't like the idea of doing keyword style lookups on js-objects unless they've been reified to work like that.
22:23devni can see it both ways
22:24devndesigners who are already skiddish about stepping into cljs might be encouraged by it
22:25nopromptimho this is bad: https://github.com/purnam/purnam.native/blob/master/src/purnam/native.cljs
22:26nopromptthere's no need to "patch" everything when most of the time you can get by w/ reify and plain old (.-property obj)
22:27nopromptthat kind of code makes it difficult to see where the boundaries between clojurescript and javascript art.
22:27noprompt*are
22:27noprompti don't think it's a good idea to bring newbies in to cljs by teaching them bad patterns.
22:30bob2do you think the angular-clojurescript integration stuff is a bad idea also?
22:30nopromptbob2: yes.
22:30bob2(I'm looking at using it for my next thing)
22:30nopromptbob2: angular and cljs are like mixing oil and water.
22:31nopromptbob2: the style encouraged by react/reagent/om is better suited for cljs.
22:31noprompti like angular but i found it too painful and weird to use from cljs.
22:32nopromptalso, i'm not sure if it's a good idea to wrap an entire framework in cljs.
22:33nopromptwrap libraries.
22:33bob2intereseting
22:36munderwoHi all. Im using compojure and have an optional http Params. Im passing the parameters in directly, but sometimes I get an error when they are not supplied. I'm using a (param :key) form to extract the parameter, but is there a way I can set a default on that extract if the key doesn't exist?
22:36nopromptmunderwo: what's your route look like?
22:37nopromptmunderwo: make a paste on refhead w/ your error. :)
22:39munderwonoprompt: https://www.refheap.com/50639 ..
22:39munderwoThat should be everything that you need.
22:39munderwoAll of the params into trucks list are optional (both current-location and distance)
22:40munderwoalso I'm not sure if I should be using read-string to convert the distance string into an integer.
22:41munderwoits going to be a float, but I couldn't find the equivalent for parse-int
22:41nopromptmunderwo: well the problem is w/ read-string according to the trace. (params :distance) is nil in that case.
22:42munderwonoprompt: yeah, so I think I need a default value, or a better way to do it.
22:42nopromptmunderwo: you probably want to provide some defaults like {:keys [distance] :or {distance "0"}} params, etc.
22:44nopromptmunderwo: also, read-string is probably too big of a gun. shoot for something like (Integer. distance)/(Float. distance)/parseInt etc.
22:45munderwonoprompt: yeah coolies. i'll see if I can work that out. links to syntax for the default values for maps? Im a total clojure n00b
22:46nopromptmunderwo: no worries. well there's a few things you can do. a) use the destructuring syntax a mentioned above. b) use a map look up with a default value (:distance params "0")
22:46nopromptmunderwo: you can also handle that stuff in the route before you call truck-list.
22:47nopromptmunderwo: for "/food_trucks" i'm guessing your using a query string?
22:47munderwonoprompt: ahh cool. I think I have an inkling of how I can do it. Which is the best kind of starting point.
22:47munderwoyup
22:48munderwocan params come from a body?
22:48nopromptmunderwo: i think you'll want {params :query-params}
22:49munderwooh? does params mean both things?
22:49nopromptmunderwo: ah, maybe not. nm.
22:50nopromptmunderwo: yeah, you're good. :)
22:52munderwothanks for your help~!
23:22firefauxis there an elegant way to get a sequence of a map's keys, sorted by their values?
23:23bob2(sort-by (partial get somemap) (keys somemap))
23:23bob2or so
23:24firefauxthat's perfect
23:25bob2also i don't know if partial is considered idiomatic
23:25firefauxwould it be more idomatic to use a lambda?
23:26bob2i do not know
23:26amalloy(sort-by some-map (keys some-map))
23:26firefaux(fn [k] (somemap k))
23:26bob2ahhh duh me
23:26firefauxooh
23:27firefauxlol, that's actually what my lambda did, come to think of it
23:29lotiahi all. any recommendations of a libary I can use to do http content negotiation?
23:30bob2which part do you want to do?
23:36amalloyactually, (vals (sort-by key some-map)) is probably better
23:39firefauxamalloy: are you talking about my question about sorting keys?
23:40amalloyindeed
23:40firefauxamalloy: that doesn't do what you think it does
23:40firefauxI think it sorts the values by key
23:40firefauxI was doing the opposite
23:40firefauxand swapping vals for keys doesn't make it work, like I thought it might
23:41firefauxoh wait
23:41firefauxlemme try something
23:41firefauxaha
23:41firefaux(keys (sort-by val m))
23:41firefauxthat does it
23:50gfredericksin trying to use laser to do something really basic I have somehow managed A) NPE B) IOOBE C) hanging the process
23:51AimHereI don't know what IOOBE means, but I do hope the last four letters stand for 'Out of Body Experience'
23:51gfredericks,([] 1)
23:51clojurebot#<IndexOutOfBoundsException java.lang.IndexOutOfBoundsException>
23:52AimHereHeh, I've seen many of those before, but it didn't click
23:53gfredericksI've never seen the acronym before
23:54gfredericksfun clojure golfing: pick a built in java exception and try to find the shortest way to throw it