#clojure logs

2013-05-19

00:11callenit always surprises me how far I can get with just maps and keywords.
00:22robinkamalloy: Would zippers be appropriate for that kind of structure?
00:23amalloyprobably not, but *shrug*
00:23robinkhm
00:24amalloya rule of thumb for zippers: if you're not immediately certain you want a zipper, you probably don't
00:24amalloycertainly for a fixed-depth tree they bring very little to the table
00:37robinkamalloy: Gotcha
01:28mindbender1Has anyone tried pedestal and liberator?
01:32callenmindbender1: don't.
01:33wei_my response for wrap-restful-format is always blank. is this the right way to use it? https://gist.github.com/yayitswei/5606785
01:39tomojianeslick: sure
01:40tomojhow?
01:40clojurebotwith style and grace
01:44callenoddly that's from a presentation about Go
01:45tomojianeslick: nvm C-c I still satisfies my
01:45tomojme
01:55wei_wrap-restful-response is returning :body #<BufferedInputStream java.io.BufferedInputStream@265970bf> for the body. how can I make it a normal string?
02:03wei_figured it out; I needed to return a form of {:body {:clojure :map}} in the route
02:34mindbender1callen: why is that?
02:37callenmindbender1: waste of time
02:38mindbender1callen: what do you suggest? either or?
02:38recycle(setq erc-hide-list '("JOIN" "PART" "QUIT"))
02:40callenmindbender1: vanilla ring/compojure / Luminus
02:40mindbender1I've just started looking at pedestal but I must confess I don't really see the point they are trying to make!
02:41mindbender1With all those cryptic syntax
02:53callenmindbender1: it's nonsense, use ring/compojure.
03:19tomojmindbender1: callen: it's not nonsense...
03:19tomojwhat syntax?
03:19tomojit's just clojure
03:19callenyes it is.
03:19callenIt's a ridiculous waste of time for 99.9% of web apps.
03:19callento sell it as a general solution is disingenuous.
03:21tomojhmm.. I'm listening
03:22tomojwhat's the 0.1%?
03:32mindbender1tomoj: where you a part of that design?
03:32mindbender1what problems where you guys trying to solve?
03:36tomojI wish..
03:38mindbender1Would you consider that designsimple?
03:41tomojoverall I consider pedestal delightfully simple, though I have not actually tried building an app with it, so my opinion is probably not very valuable
03:42spoon16I am trying to do something like ,(apply + x) where x may be a seqable object (which works fine) or a single item
03:43spoon16what is the best way to handle the single item case
03:43spoon16,(apply + 1)
03:43clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Long>
03:43spoon16,(apply + [1])
03:43clojurebot1
03:50amalloyspoon16: don't try to handle "either a sequence or not a sequence". require a sequence, and if someone wants to call your thing on just one object, they can wrap it up themselves
03:52callentomoj: not in this case no. I've built a fair number of apps in Clojure (albeit not as many as some here) but Pedestal is a fool's errand if you actually want to get anything meaningful done.
03:52callentomoj: lots of ceremony that doesn't actually win you anything.
03:55hiredman(apply + 0 ...) is also nice in case they pass an empty seq
03:55callentomoj: contrast with something like Meteor which is deeply technically flawed and naive, but it actually *wins* you something.
03:58hiredmanoh, I guess for + it doesn't matter
03:58tomojcallen: I can't argue with such vague claims :)
03:59spoon16amalloy: ok
04:00callentomoj: you have two choices, figure it out for yourself in a day or two, or take my word for it
04:00callenI'm not going to expound endlessly on what is an obvious subject.
04:10callentomoj: stare 'til your eyes get dry or make an app. You'll see what I mean.
04:11ucbI have the following problem: I'm writing a pickle writer so that I can send batched data to graphite; that's a problem in itself, but let's ignore that for a second. I'm writing tests and for basic data types it's easy, pickle an int, a long, etc. When you get to tuples, still fine for tuple-1 (tuple-1 with an int, etc.) but when you get to tuple-2, then it gets complicated because of the sheer number of possible combi
04:11ucbnations. What would you guys recommend in this scenario?
04:12ucbsomething like quickcheck would be nice as it'd generate tests for me, but I'm working with midje and nothing else.
04:12callenucb: so for starters, stop using midje
04:12ucbright now I've opted for low coverage of combinations
04:13ucbcallen: far from helpful. Try again.
04:13callenucb: there's a reason for it, which you'll understand in two seconds
04:13callenhttps://bitbucket.org/kotarak/clojurecheck https://github.com/stuartsierra/lazytest
04:13callenucb: ^^ stop using midje.
04:13callenoh god fucking dammit, did my REPL just hang?
04:14ucbfair enough, I can use that too. midje will happily run clojure.test tests.
04:14callenucb: midje is the blind leading the credulous.
04:14ucbcall me both :)
04:14callenucb: you don't follow the mailing list?
04:15ucbcallen: I do, yes. But not that closely. Why?
04:15callenyou'd know why midje was a bad idea if you followed more closely earlier on. No matter.
04:16ucbfair enough.
04:16tomojcallen: ok, that is somewhat better than an incredulous stare. I will try
04:17callentomoj: the key element here is to contrast what working with a vanilla ring app is like vs. pedestal for a more-than-single-page app.
04:17callentomoj: say, a simple CMS or something.
04:17tomojhmm
04:18tomojvanilla ring and what's the client-side story?
04:18tomojnothing?
04:18clojurebot@ has nothing to do with whether sth is evaluated or not
04:18callentomoj: it's volitional.
04:18ucbbleh, clojurecheck won't cut it unfortunately; nothing wrong with it, it's just that ... meh, never mind
04:18tomojok
04:19callentomoj: you can run cljs with lein-cljsbuild and use one of the RPC wrappers
04:19tomojwell I have looked at interceptors for example
04:19callentomoj: or you can run with vanilla JS which gets back to my point
04:19tomojand I quite like them vs the vanilla ring stuff I've been doing
04:19callentomoj: cljs is wildly, massively impractical
04:19callentomoj: what you think of as a "client-side story" is goddamn foolish and a waste of time
04:19tomojI just mean are you serving static html or is there JS basically
04:19callentomoj: you're better using using vanilla jQuery for low complexity/density apps or AngularJS for more serious apps.
04:20tomojbut, yes, I'm not going to write an angular app :)
04:20callentomoj: it's a vanilla web server, you can do whatever the fuck you want.
04:20callentomoj: my point is that pedestal wins you nothing and makes common-sense web development more fraught with needless abstraction and complexity.
04:21callenif you want a stack that takes having a frontend story a lot more seriously, you'd look at Meteor/Derby/Firebase et al, but they're a bad idea for different reasons.
04:21tomojwhat is this "win you something"
04:22tomojmy guess is it's like DHH-ian "look at all the code I'm not writing"
04:22callentomoj: quite the opposite.
04:23callentomoj: pedestal is a huge mess of code trying to make you not write code that never needed to be written to begin with on top of a worst-practices-imaginable frontend story.
04:23callentomoj: vanilla ring/compojure apps let you do things how you want, but the idioms one tends to see are clean and simple and function within the web ecosystem perfectly.
04:23callentomoj: do you even do web dev at alL?
04:24tomojI'll just ignore that :)
04:24callenso you're just D-K'ing right along
04:24callengot it.
04:24tomojexample of the "worst-practices-imaginable"?
04:25callenno no, you ride your dunning-kruger rollercoaster by yourself.
04:26ucbheh - love it
04:32mindbender1I have a feeling people are not enjoying the kind of cljs clj dev enviroment I have been playing with.
04:33callenmindbender1: I can "deal" with it in vanilla ring with lein-cljsbuild but I don't think it's a good idea.
04:33mindbender1lein-cljsbuild? who uses that? not me
04:33callenthat's...far from the point.\
04:36mindbender1callen you're on point though.. I'm losing a grip on simplicity amidst all these new libs
04:37mindbender1sharing simple data seem so hard for most authors..
04:38mindbender1as Rich puts it.. " Eventual consistency is really hard for programmers"
04:39tomojeventual consistency?
04:39tomojI'm guessing you mean that in some non-standard sense?
04:40mindbender1yep
04:41tomojtoo many libs to understand?
04:41mindbender1no.. so much inconsisrency among them
04:42mindbender1inconsistency
04:42tomojah
04:42zoldarmindbender1: in what sense?
04:43mindbender1in how they expect you to communcate with them..
04:43mindbender1I like to see what I'm giving and what I'm receiving
04:43mindbender1don't do any more
04:46zoldarok, I feel stupid, but must admit that I don't get your point. Are you referring to referential transparency? because that's clearly not achieveable in every case
04:48mindbender1I mean thinking in data
04:48mindbender1re:stu
04:49mindbender1zoldar: remember this is clojure
04:51tomojdo you have any specific beef?
04:52mindbender1yes.. I have a beef with complecting
04:52mindbender1especially when I smell it within clojure
04:53tomojthat is not very specific
04:53mindbender1tomoj: you must be able to distinguish familiarity and simplicity
04:54mindbender1I can get familiar with pedastalin 2 months but is it simple?
04:55tomojpedestal is not that big
04:55tomojbut yeah I guess it would take a while to really realize the implications
04:55mindbender1there familiarity goes again
04:55llasramAh, the benefits of your language's BFDL sticking to language design and being Dutch
04:56mindbender1tomoj: are you familiar with closure ui model
04:56tomojno, I've perused those docs maybe once or twice
04:56mindbender1components control control-renderer state events
04:57mindbender1when I got familiar I realized it was not that *big*
04:57mindbender1It was a pure genius
04:58tomojI think this is at least the second time I've considered telling you "you're bending my mind man"
04:59mindbender1so familiarity is a disease because you tend to forget the barrier
04:59tomojoh, yes, I think I see what you're saying
05:01tomojI'm not familiar with pedestal :P
05:03tomojbut yeah, everyone thinks the stuff they use is simple I guess
05:04mindbender1that's why like Rich we must step back and take a second look
05:05tomojbut so do you have any specific complains about pedestal or are you just generally worried that it might not be simple?
05:07mindbender1Yes.. they don't have a simple js/ui approach
05:07tomojhmm
05:08tomojI think I totally agree :)
05:08tomojthe way I see it they just haven't addressed that part of the problem
05:09tomojor do you mean the stuff they wrote is actually complicated?
05:09tomojI do have some problems with the app model bits too
05:10mindbender1they should go study what closure has done and just make little modifications using maps and vectors
05:10mindbender1It's far simpler
05:10tomojoh, you really meant that closure ui is genius?
05:10tomojI thought you meant that it just seemed genius because you were familiar with it
05:12mindbender1it's familiar but not there because of the OOP paradigm but comparing it with pedestal is nothing to write home about
05:13mindbender1pedestal just makes me want to do OOP
05:13tomoj:(
05:14mindbender1I would have thought as functional lib they did have a simpler model but lo and behold code weaving
05:14tomojhmm, if I understand what you mean by 'weaving', I totally agree
05:15kmicu"pedestal just makes me want do OOP" hardcore
05:15tomojin the chat sample (which is pretty trivial) it seems like information about particular bits is spread all over
05:17mindbender1Just from reading the docs I already knew they were approaching the problem in a complex way
05:17kmicuDo we read the same docs?
05:17tomojI've been assuming you get the simple vs easy distinction?
05:21mindbender1what of A thinking about B, B thinking about A?
05:21mindbender1I was assuming you get the data-oriented programming paradign
05:22mindbender1do you call what they are doing there data-oriented?
05:22tomojI don't have any more data-oriented ideas
05:23tomojdo you?
05:23kmicuMaybe Pedestals DATA flow engine, and DATA model with separation from application model and UI/DOM model is not data oriented. Maybe...
05:24kmicuCall me maybe monad...
05:29llasramhah!
05:32mindbender1maybe monad: that not data
05:33mindbender1that's not the data been referred to in the instance. I'm taking representation.. what's been communicated
05:36tomojwe are talking about the dataflow stuff? I don't see how you can get more data-oriented than a bunch of data
05:37kmicux]
05:38tomojI mean wiring up a graph of fns bothers me but the stuff they're operating on seems as data-oriented as possible to me
05:40kmicuYou can go deeper, but you can fall into the data oriented limbo.
05:41mindbender1what you are forced to communicate with matters in this instance
05:42tomojwhat is your actual complaint? :)
05:42tomojlike what part of the pedestal docs seems complex
05:42callentomoj: you're prejudiced and foolish and don't see the real problems.
05:43callentomoj: you're also talking about a problem space you haven't done anything in.
05:43callenNobody cares if it's data-oriented, only if it helps with either scale or facility. It helps with neither.
05:43tomojof course I'm prejudiced and foolish and don't see the real problems
05:44callenPicking and choosing your tools based on which programming gods they sacrifice their goats to is a good way to end up in a hellhole.
05:44callencf. Haskell library ghetto
05:44callentomoj: what have you built that's a web app?
05:45callentomoj: you're like a person that buys a product based purely on brand, not on fitness for purpose.
05:45callen"oooh it's data-oriented. Forget the problen being solved, it MUST be awsum. <sic>"
05:46callenAnd Pedestal's fitness for purpose is very poor and the applicability is sparse at best.
05:46callenI would have to spend several hours thinking very hard before I could contrive a use-case for which pedestal would even be mediocre.
05:46callenProbably one involving an insane amount of boilerplate functionality.
05:47tomojI don't think I've claimed pedestal is awesome, I'm simply trying to understand mindbender1's complaint, because I want to get other perspectives on pedestal's fitness
05:47callentomoj: which really just harkens back to your misdirected accusation on my being in the DHH school, this framework is closer to that.
05:47tomojsorry, didn't mean to accuse, that was simply my best guess for what you meant
05:47callenI prefer small composable tools that just work and do their job well.
05:48callenIn this case, this means vanilla Ring and a raft of small libraries that each solve a particular problem in a way I favor.
05:49callenI don't even like Friend because it's too big and complicated.
05:49callenit tries to take over too much functionality all in one set of idioms.
05:49callensandbar was better
05:49clojurebotIt's greek to me.
05:49callenjjl`: :|
05:50kmicu80' was better
05:50jjs(Sure it takes 250% CPU, but I'm pegging 60fps...)
05:52tomojcallen: definitely sounds sensible to me
05:52tomojthe problem with pedestal is that it's big? or uncomposable? or both?
05:53noncomhow do i make the irc joined/quit notifications off?
05:53noncomi am on a qwebirc online client
05:54tomojwhen I started looking at pedestal I was pretty negatively biased because it seemed big and framework-y, but I've been pretty pleasantly surprised by how much it seems you can drop or swap out with your own stuff
05:54llasramnoncom: That's entirely a client detail -- you'll need to dig through your client's docs for that
05:55callentomoj: Introduces project complexity for as close to nil benefit as I've ever seen with any library or framework of any size. I had to reassure myself it wasn't a trolly attempt at making the most non-functional framework in existence.
05:55callentomoj: who cares if they let you move your food around on your plate?
05:56callenThe only reason I *don't* believe it's a troll is because of who is behind it, but knowing that just hurts my confidence in the thought-leaders of the community.
05:56callenReeks of ivory tower in the extreme.
05:56tomoj'move food' == 'drop or swap out'? or something else?
05:57callentomoj: moving food around on one's plate. never heard this idiom?
05:57callentomoj: it means to make some noise/sign of activity without accomplishing anything.
05:58tomojso that's "you don't win anything" again?
05:58noncomllasram: ehh.. that won't be easy :) con't find the manual for quebirc client
05:59callentomoj: no, you've misunderstood the idiom.
05:59llasramI haven't really been following anything about Pedestal. Are there any good longer-form analyses of it?
05:59callenllasram: none that aren't delusional, most of us are too disgusted to bother.
05:59llasramhah
05:59callenllasram: nobody really wants to be the public negative nancy.
05:59tomojit sounds like you're saying that you'd be just as good starting from an empty project?
05:59llasramMaybe you should write a blog post?
05:59callenwell except for me, I'm the 12th incarnation of Diogenes of Sinope so I might do it anyway.
05:59tomojthat's how I took 'without accomplishing anything'
06:00callentomoj: you'd be better off using vanilla Ring.
06:00tomoj..and angular
06:00callendon't be irritating, I said there was a specific type of project Angular was suited for.
06:00callenIf you're going to be disingenuous I'll stop entertaining your fatuous bullshit.
06:00callentomoj: it introduces project-level friction for deployment, creating negative value in that capacity and others.
06:00kmicuTrolling party!
06:01tomojI just mean that 'vanilla ring' seems to only address half of pedestal
06:01callenI'm not trolling, I'm sincere.
06:01callenyou don't need Pedestal to use cljs, far from it.
06:01kmicuVanilla Ring for everything!
06:01callenshoreleave solves that problem nicely.
06:01callenkmicu: vanilla Ring could be anything, given how many libraries you can use.
06:02kmicucallen: and interceptors are also bad?
06:02tomojcallen: if you don't want to have a conversation with me, feel free to stop talking to me :)
06:02callenhorofox_: spice and wolf?
06:03tomojI am however interested in understanding your perspective
06:03tomojbut am finding that difficult
06:03callentomoj: you're polluting the channel with this inane conversation.
06:03kmicuCuz it's ego trolling.
06:03horofox_callen: yeah
06:03rasputnikmorning (possibly?) all
06:03callenhorofox_: nice.
06:03callenhorofox_: great show.
06:03horofox_:)
06:03callenrasputnik: hai
06:03callenhorofox_: makes me want to watch it.
06:03horofox_callen: yeah, i love it
06:03rasputnikis there a idiomatic way to update a couple of keys in a map using conversion functions?
06:04callenrasputnik: conversion functions?
06:04callenrasputnik: I've not seen anything described thusly.
06:04rasputniki.e. i have a fix-field1 and fix-field2 function, and want to build up a function to run them across a seq of maps to 'correct' the values
06:04callen(map (assoc... ?
06:05callenrasputnik: you need a refheap sir.
06:05rasputnikcallen: works ok with update-in but it's a bit clumsy
06:05rasputnikwhat's a refheap?
06:05RaynesBest thing ever.
06:05Rayneshttps://www.refheap.com
06:05callenrasputnik: https://www.refheap.com/paste
06:06RaynesIt's like a ref, but then it's a heap.
06:06callenRaynes: do you have an alert for refheap?
06:06callenRaynes: that or you're a lurking pro.
06:06Raynes"Hey, you got ref on my heap!" "Hey, you got heap on my ref!" "mmmmm"
06:06rasputnikRaynes: :P
06:06RaynesI do not have an alert for refheap.
06:06callenI need to remember to get those tickets.
06:07rasputniki got 2 lines of clojure pulling data out of an XLSX. 2 of the fields are shitty though, because DATA ENTY IS HARD LOL
06:07samratRaynes: tried using least.authorize but I'm getting {:error 13, :message "Invalid method signature supplied", :links []}
06:07Raynescallen: http://www.stubhub.com/imagine-dragons-tickets/imagine-dragons-los-angeles-hollywood-palladium-29-5-2013-4248007/ Better hurry. They're getting uncheap.
06:07rasputnikso I just need to pass this lovely clean lazy seq full of cruddy data through some 'fixer-upper' functions
06:08Raynessamrat: Blugh.
06:08Apage43(map (comp thing1 thing2 …) uglystuff) ?
06:08samratRaynes: I think I've done exactly as the docs said
06:08rasputnikessentially this : https://twitter.com/rasputnik/status/335761576583913473
06:08Apage43where thingX is a (fn [icky] ..deickify some field..)
06:09Raynessamrat: Can you refheap your code sans tokens?
06:09rasputnikApage43: yeah, might be a usecase for the -> macro (never used that before, yay)
06:10Raynessamrat: Which part of things is failing? Is the get-token call or the get-session call failing?
06:10rasputnikah, i'll use update-in, it just seems a bit heavy.
06:10samratRaynes: least/write
06:10Raynessamrat: So the get-session and get-token calls work fine and you get a key back?
06:11Apage43is it two fields exactly?
06:11Apage43you might even
06:12Apage43(map (fn [{:keys [fielda fieldb] :as in}] (merge in {:fielda (demangle fielda) :fieldb (demangle fieldb)})) ickyseq)
06:12samratRaynes: yup. https://www.refheap.com/paste/14756
06:14rasputnikApage43: i'll need a demanglea and demangleb , but yeah that'll work
06:14rasputnikthis is that part where the code bloats up
06:14Apage43right, didn't know whether the input was ugly in the same way or a different way
06:14rasputnikthen tomorrow i get an aha and delete 50% of it. the code collapses like a dying star emitting awesome. you know the drill.
06:14Apage43mmhm
06:15Raynessamrat: Reproduced. One moment.
06:15Apage43deleted code is best code
06:15rasputnikApage43: learnt that back doing 4clojure, i'd write 30-odd lines of crap, look at someone elses answers and it'd be 20 characters.
06:15callenRaynes: ticket acquired.
06:16rasputnikok, i'll get this done. thanks all.
06:16Raynescallen: We're gonna have funs.
06:16Apage43fewer places for bugs to hide
06:17callenRaynes: aye, just need to figure out where to stay now.
06:18RaynesYour car, dude. That's the hipster way of life.
06:19Raynessamrat: Figured out the issue. It's because (:key session) doesn't work. It's under another level of nesting. Currently thinking of how best to fix it.
06:20rasputnikApage43: "no code is better than no code"
06:23Raynessamrat: Take a look at the documentation now. If you follow it this time it should work.
06:24RaynesCan nobody make a bloody consistent /rest API? Really?
06:24RaynesChrist.
06:24samratRaynes: ok, thanks. working for me now
06:26Raynessamrat: Just release 0.1.4 to make the (:session …) bit not necessary so now the old documentation works. Sorry. :p
06:27Raynesreleased*
06:27Pupnik-hey Raynes why does (doc def) throw an exception with lazybot, while (doc defn) or (doc defmacro) don't?
06:27Raynes&(doc def)
06:27lazybotjava.lang.SecurityException: You tripped the alarm! def is bad!
06:27Raynes&(doc defn)
06:27lazybot⇒ "Macro ([name doc-string? attr-map? [params*] prepost-map? body] [name doc-string? attr-map? ([params*] prepost-map? body) + attr-map?]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the... https://www.refheap.com/paste/14757
06:27RaynesBecause of the way the tester is designed in this case.
06:27RaynesThe symbol 'def' is blacklisted.
06:28RaynesSo when it sees 'def' it immediately throws an exception.
06:28RaynesThe other things work because they aren't 'def' and aren't explicitly blacklisted.
06:28RaynesBut they still can't be used, because if they are used they will expand to a call to 'def' and thus trigger the alarm.
06:28RaynesIt's pretty complicated.
06:28Pupnik-ah, makes sense
06:29samratRaynes: thanks
06:29Raynessamrat: Thanks for pointing out the issue!
06:30Raynescallen: Sorry I'm not more helpful on the stays stuff. I have exactly nothing. I don't even have a bed or a couch. No furniture at all. You'd be more comfortable in your car for real.
06:30callenRaynes: np at all, I'm wondering if you know of any decent hotels in the area.
06:31callenRaynes: I'm assuming you had to stay somewhere to interview.
06:31RaynesNever had to interview. I was an intern so I already had the job.
06:31RaynesI stayed at a place in Hollywood for 2 months before getting this place.
06:31RaynesBut it was a sublease deal with a random guy and not a hotel.
06:31RaynesAirbnb is pretty great for short term chepo places.
06:31Raynescheapo*
06:32RaynesAnd not-so-cheapo nice places.
06:32RaynesI have no clue about hotels.
06:32RaynesSomeone who has lived here longer would have to provide input about that.
06:32callenRaynes: relative to the stadium and your own location, what area should I look for in Airbnb?
06:32RaynesI live in West LA and the venue for Imagine Dragons is in Hollywood.
06:33RaynesAnywhere between or around those areas would be fine.
06:34callenRaynes: no that's quite helpful. I can take it from there. I'm just hoping I won't still be sick when I visit.
06:35RaynesSick with what?
06:37callenRaynes: I'm not really sure. Lots of weakness and shakes. Might be from lifestyle.
06:37RaynesToo many drugs?
06:37RaynesSorry, this isn't funny.
06:37callenRaynes: I didn't want it to seem like a humblebrag, so I wasn't specific but sleep/diet/exercise.
06:39callenI'm not trying to be "hardcore" or anything, I've just been trying to make progress and haven't been taking care of myself as well as I should've.
06:39Raynescallen: There was a whole month where I thought I had a brain tumor because I was dizzy the whole time. Saw a doctor and even ended up having an MRI. Scariest month of my life (side by side with my first month in LA).
06:39callenRaynes: was it anything serious?
06:40callendizziness is part of what I'm experiencing.
06:41Raynescallen: It just went away and hasn't come back.
06:41RaynesBut it lasted a month which blew my mind.
06:41Raynescallen: Is it room spinning stuff?
06:42callenRaynes: no, but I have trouble standing when it happens. I don't think the dizziness is the worst part, just the weakness and shakes.
06:44mthvedtcallen: not to be that guy, but have you seen a doctor
06:46callenmthvedt: I had a physical done recently prior to this starting, they knew at the time I would be upping the ante
06:46callenon diet/exercise and said nothing.
06:47RaynesIf you think it's lifestyle changes then it probably is.
06:47Raynescallen: You might consider having your blood sugar checked. Or buying a checker and doing it.
06:47RaynesWhat you describe can sometimes come along with hypoglycemia.
06:47callenRaynes: my mother has hypoglycemia
06:48callenI have a somewhat conflicted relationship with the subject, I'm trying to run a low-calorie/low-GI diet.
06:48mthvedtso your doctor doesn't know about this?
06:48RaynesI don't think hypoglycemia is hereditary fwiw.
06:49callenI guess not but when I got checked, my blood sugar was perfectly normal.
06:49callenI wasn't high nor low
06:49callenand my historical BS seemed within norm ranges too
06:49callenin fact the only thing "wrong" with me was a fairly shallow test of my LDL, which is from something perfectly normal and temporary anyway.
06:49mthvedtwell, i think emailing your doctor should be the first order of business
06:50RaynesWhoa
06:50RaynesEmailing?
06:50Apage43as in LDL was *lower* than normal?
06:50RaynesYou can do that with doctors?
06:50callenthere's nothing to fix nor be concerned about, I'm just moaning.
06:50RaynesMust be them fancy Californian doctors.
06:50callenApage43: higher, for expected and temporary reasons.
06:50mthvedti lived in chicago
06:50Apage43ah
06:50mthvedtwe're modern here
06:50callen'ish
06:51callenmthvedt: once I adapt to my current pace I'll be fine.
06:51Apage43higher is typically not worth worrying about unless accompanied by other stuff
06:51mthvedtcallen: if you think it's a lifestyle issue, don't adapt
06:51mthvedtovertraining your brain/work habits is just as bad as overtraining your body
06:52callenI don't think I'm over-training too badly, I'm doing 9-10 miles and 2-3 gym lifting visits a week
06:52callenor at all, for that matter.
06:52mthvedtoh, sorry, i got your words switched further up.
06:53callenmthvedt: yeah it's insomnia + few calories + exercise
06:53mthvedtrest is important for gainz
06:54callenmthvedt: I'm cutting, hence misery.
06:54mthvedtinvariant under sign flip
06:54callencutting + running + lifting is a special hell I wouldn't wish on my worst enemy
06:54callenI have a hard time even getting dressed
06:55callenthe problem is I'm a huge bitch so I need to moan about it :P
06:56mthvedtthat still doesn't sound healthy, although i am a non expert on cutting.
06:57callenit's unpleasant but I have enough fat that I'm in no real danger.
06:57callenThe obese can get away with not eating at all except for water and vitamins for weeks and months on end.
06:59mthvedtstill, chronic overstress on your body can have long term consequences
06:59callenso can being in bad shape
07:01mthvedtyes, but health:exercise is not a linear relationship. there's diminishing returns and, eventually, a maximum point
07:06Raynes#nutrition
07:09Raynes(just kidding, nobody is here)
07:16mthvedtis there no unchecked version of number comparisons
07:19OkasuRaynes: : stats/##nutrition: +o[1] +v[0] -o[44] - total: 45
07:19Apage43mthvedt: what would it not check?
07:20mthvedtagape43: if you dig into the clojure code it casts and boxes things
07:20mthvedthttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L218
07:21mthvedthang on, that's wrong
07:21mthvedtthat's a code generation piece for an :inline
07:22mthvedtno, i was right the first time. that's the actual fn
07:23mthvedti was tracing this code, and there's a weirdly high number of method calls and object constructions for comparing two longs. seems wrong
07:24Apage43looks like it has overloads for primitive types https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L3710
07:25Apage43.. sort of
07:25mthvedti'm looking at the inliner now… it seems to go away for some spots but not others.
07:25Apage43nothing for (long, long), just for (long, double) or (long, Object) or either flipped
07:26mthvedtmaybe i think i have a primitive where i actually don't somewhere
07:26Apage43perhaps, found the long, long one. Just further up https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Numbers.java#L1775
07:30Apage43something's probably causing it to box, but it shouldn't be < (unless inlining isn't happening)
07:31mthvedtwell, i fixed the boxing, but it didn't help, because there's more boxing further up
07:32mthvedti mean it did help a little
07:32mthvedtbut its not what i wanted
08:42GlenjaminTo release a lib as EPL, do I just slap an EPL licence on it, or are there some other steps?
08:57noncomhi, in my program i take data from audio sample buffer, and that operation shows down the execution from 1500 fps to 100 fps in my program. Asking the buffer array of the numbers is what takes so long. But I do not need that data more often than 60fps. What is the best way to split the threads and put the data acquisition in a separate thread, so that my main thread will not slow down?
08:58noncomi guess i better use an agent for that?
08:58noncombut then how do I avoid unnecessary calls for data update?
09:03echo-areaIs there anyone in NYC? How long does it normally take to go to Adams Street from Midtown?
09:04echo-areaI know this is off-topic. Sorry.
09:04noncomi will try it with promises
09:16bruceadamsGlenjamin: sure, so long as you wrote the lib, or have clear permission from whoever wrote it.
09:16Glenjamincool, thanks
09:23clojure-newhello
09:25clojure-newis there any markuplanguage->html library for clojure? I have form and in this form user can type things, what i want is after user submits this form parse it and transfrom into syntaxhightlighted formmatted text.
09:25clojure-newor maybe there is better approach to this, not sure
09:25clojure-newcan you recommend something?
09:35bruceadamsclojure-new: http://refheap.com does syntax highlighting of many programming languages, using the pygments library, code here: https://github.com/Raynes/refheap
09:39clojure-newi think i should use this one http://softwaremaniacs.org/soft/highlight/en/ but what approach do you recommend? Strip all html tags -> detect if inputs includes somthing like [[[code]]][[[/code]]] -> wrap it in div with id="highlight" -> hightlight with some highleghter
09:39clojure-newhow this sounds?
10:01clojure-newhow can i escape html in clojure?
10:01clojure-newis there lib for that
10:04jjttjjclojure-new: https://github.com/yogthos/markdown-clj
10:04jjttjjis that what you're looking for?
10:04jjttjjsee also: http://daringfireball.net/projects/markdown/
10:06clojure-newjjttjj: no, i'm looking for library for santize user input
10:06clojure-newto be morem presise - escape html from user input
10:10clojure-new,(-> "<h1>test</h1>" str (.replace "&" "&amp;") (.replace "<" "&lt;") (.replace ">" "&gt;")))
10:11clojurebot"&lt;h1&gt;test&lt;/h1&gt;"
10:11clojure-newhow do you think guys, is it secure?
10:12clojure-newit is not efficient, thats for sure
10:14xeqibasically what hiccup does, https://github.com/weavejester/hiccup/blob/1.0.2/src/hiccup/util.clj#L53
10:16clojure-newxeqi: thanks
10:21m0smithis anyone using nrepl-ritz?
10:22kmicuy
10:29noncomwhat is clojure's syntactic convention for getters?
10:29noncomfor naming them i mean
10:33bbloomnoncom: what's a "getter" exactly in the context of clojure?
10:34noncombbloom: well, yeah, it sound more like oop-ish, but think of specific functions that get specific keys/values from maps of a known format
10:35noncombbloom: ahh.. maybe it is more useful to name them according to their role? like 'extract-building-costs' or 'building-costs-of' or smth?
10:36noncomor should it simply be 'building-costs'? but that name seems somewhat unclear
10:36ddellacostais there any way to figure out what lein profile I'm running under in my actual app/lib? Or is that considered bad form for any reason?
10:36bbloomnoncom: keywords == getters for simple keys
10:36bbloomnoncom: (:first-name {:first-name "Brandon" :last-name "Bloom})
10:36bbloom,(:first-name {:first-name "Brandon" :last-name "Bloom})
10:36clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading string>
10:36bbloom,(:first-name {:first-name "Brandon" :last-name "Bloom"})
10:37clojurebot"Brandon"
10:37noncombbloom: yeah, but i want to extract comples patterns (subtrees)
10:37noncombbloom: i just had a cup of coffee :D
10:37noncomi just thought maybe there is some naming convention like with the '?' postfix
10:37noncomfor boolean returning funs
10:38bbloomnoncom: some people use the "get-" prefix, but i don't think it's necessary at all
10:38bbloomin fact, it's mostly redundant
10:39noncomyeah, probably, most of the times it is
10:40Glenjaminddellacosta: you're usually better using environ
10:40ddellacostaGlenjamin: yeah, I'm using an environment variable now, but it irks me that I'm setting that plus using test profile, for example
10:41ddellacostaGlenjamin: mostly 'cause I forget to set the environ sometimes. Doh.
10:41Glenjaminyou can have the environment variables in the project.clj
10:41ddellacostaGlenjamin: ah, that was the magic sauce I was looking for. Thanks, I'll look into that!
10:41Glenjamini've got things like :force-ssl under :production
10:41Glenjaminhttps://github.com/weavejester/environ
10:42ddellacostaGlenjamin: oh, I thought you mean like, environment variables--you were talking about something else entirely. Gotcha!
10:42ddellacostavery cool, thanks.
10:42Glenjaminthat lib wraps up a few similar things under one accessor :)
10:43ddellacostaThat is perfect, *exactly* what I was looking for.
10:43ddellacostaI'm trying to set a test db vs. dev db, and keep accidentally wiping my dev db 'cause I can't remember to set the frigging variable. This will save me lots of pain.
10:44Glenjaminah, for DB credentials i'd usually keep them out of version control
10:44Glenjaminbut i've got a few files I source into my bash prompt to set up the env variables
10:45Glenjaminor you could use an alias to only set the environment variables when you need them - depends how strict you want to be about config :)
11:18Glenjamingfredericks: i've just published my spies lib if you're still looking for something like that - https://github.com/glenjamin/q
11:25rlbif you need to force a file sync, is it reasonable to just create a FileChannel yourself and use force, or is there a better way?
11:57jaleyI want an API i'm writing to be called like this: (arrange-images images), or (arrange-images images :fast-but-ugly-method), (arrange-images images :slow-but-pretty-method), etc. I'd also like to plug in other implementations later… feels like multi methods? I just kind figure out how to make them do that
11:58llasramjaley: Looks exactly like multimethods
11:59llasramDo give some thought to argument-order though. There's some benefit to having the primary dispatch token come first -- `partial` etc
11:59llasramBut multimethods give you the flexibility to do it however you want
12:01Glenjamini'm using speclj to run my tests - it defines a lein task which calls leiningen.core.main/exit with the exit code - when I use this inside with-profile it causes an exception
12:01Glenjaminwhat's the correct way to handle this case?
12:02jaleyllasram: ok, that's what I thought. but… how? what would the dispatch function look like?
12:03llasramjaley: (fn [images algo] algo) should do it
12:04llasramThere's no magic
12:04jaleythen my methods take the same args?
12:04llasramThen (fn [algo & args] algo)
12:04llasramAnother reason to put the dispatch-token first :-)
12:04jaleyso, if i take your advice and move alto first
12:05Glenjamin(fn [images & [algo]] algo) will work
12:05llasramOr really (fn [images algo & args] algo) would work too
12:05jaleyright, but isn't it the case that the defmethods receive exactly the args the dispatch fn received?
12:05jaleyso they need to ignore the first arg?
12:05Glenjamincorrect
12:06jaley(defmethod foo :some-implementation [_ images] …) ; for example?
12:06jaleythis is what made me think maybe I was doing it wrong.. :P
12:07llasramThat's the way the method mungles
12:09jaleyok cool, that'll do it. thanks guys
13:45yogthostechnomancy: hey any chance you could nuke the luminus-template repo for me again? :)
13:45yogthostechnomancy: it's getting a bit big again :)
13:50winkyogthos: ah, got a sec for some luminus/general questions? :)
13:50yogthoswink: yeah sure
13:51winkyogthos: I'm unsure about how to handle optional GET-parameters. Like.. talking to a haskell user regarding the Request monad in yesod, if you know that?
13:52yogthoswink: uhm not really familiar with that one, can you give an example?
13:52winkyogthos: code example is https://github.com/winks/multiplex/blob/master/src/multiplex/routes/home.clj#L189
13:52winkoptional page=x&limit=y
13:53winkthat need to be passed inside quite a few functions. and it's about how to do it beautifully, not just "it works"
13:53yogthoswink: I think in that case you might want to grab the full request instead of destructuring
13:53yogthoswink: (GET "/user/:username" req-map ...)
13:53winkyogthos: but I'm not mistaken and libnoir has anything to work with requests specifically?
13:53winkI'd hate to pass the request-map everywhere
13:54yogthoswink: that part's mostly handled by compojure
13:54winkbut it's kind of "grab something from the global state per-request"
13:54yogthoswink: it does have a context
13:54yogthoswink: http://weavejester.github.io/compojure/compojure.core.html#var-context
13:54yogthoswink: sounds like that might be what you're looking for?
13:55ambrosebsSomeone might enjoy this: core.typed workshop from YOW! Lambda Jam http://www.youtube.com/watch?v=ZW7HinnoGhk
13:59winkyogthos: thanks a lot, will have a look
13:59yogthoswink: cool stuff
14:28arrdemhow would you guys suggest getting my feet wet with clojure.core's implementation?
14:29arrdembesides just a git clone and two weeks with code and coffee :p
14:34mhrHi, is there something like socketstream/meteor/derbyjs for clojure/clojurescript?
14:39mhraddittionally, I want to use clojure, but I'm concerned that if I use clojure for a gui-based app, it'll be slow because it's using java, so is there a port of clojure using C or C++?
14:41murphy_good afternoon! I realize I'm a bit out of date here, but if I'm looking for help with setting up vimclojure, is this the right place to ask?
14:41murphy_Or should I give up on vimclojure since it's a dead project and use fireplace instead?
14:41murphy_(I've liked using vimclojure in the past)
14:42ianeslickmhr: Depends on the GUI
14:42ianeslickJava can be plenty fast, depending on what you need it to do.
14:42mhryeah, I realize, but in my experience using java-based apps (I haven't made any java apps before), they seem to lag
14:43mhrI can't really point to a specific application
14:43ianeslickmhr: Are you thinking about Eclipse, for example?
14:43n_bIs your experience Eclipse? That's not a representative sample
14:43mhrnope, like I said, never made a java app before, so never used eclipse
14:43ianeslickmhr: For web, there is Pedestal, although it's still a little immature
14:43mhrmy main question is: is there a C/C++ port of clojure?
14:43ianeslickmhr: Short answer is no.
14:43mhrwhat's the long answer? :P
14:44n_bWhy use Clojure and not Chicken Scheme or similar?
14:44mhrpedestal, cool I'll look into that
14:45mhrgood question. clojure seems to have the better community from what I've read
14:45mhrthere's not exactly huge Chicken Scheme or Racket conferences
14:48ianeslickmhr: Clojure has quite a few improvements on the old Scheme / Lisp systems, but most importantly can interoperate with the massive base of Java libraries and applications.
14:49hyPiRionI think the most important part is that it has a large library base and is more pure/immutable/simple than any other
14:49mhrisn't that only useful if I'm coming from the java world and I am already familiar with all those libraries?
14:49ianeslickmhr: There is no fundamental reason why Java/Clojure has to be that much slower than C/C++, but it is easier to design slower systems in Java. Also, there isn't yet a good way (that I"m aware of) to tap native UI kits easily from the Java system. Although Win 8 apparently makes JS a first class language, so with some tooling pain you could use Clojurescript.
14:50ianeslickmhr: If you know the C/C++ landscape really well, then you might be better look into an Embeddable Scheme, or Lua, or something like that.
14:51TEttingeryeah LuaJIT is absurdly fast
14:51TEttingerkinda doesn't help with threads thougg
14:52mhrhaha I don't, I'm actually just learning C right now as a matter of fact. I think it'd be cool to be able to make a C-speed clojure gui application, particularly because clojure has all those concurrency advantages
14:53hyPiRioncheck out clojure-metal in 6 months or so
14:54n_bMany of those concurrency advantages are built on top of very powerful JVM tech.
14:54TEttingeryeah, that's true
14:54hyPiRiontbaldridge has a very straight plan on how to get it working properly
14:54n_bLike are reducers in cljs yet?
14:56mhrclojure-metal is exactly what I'm looking for, thanks
14:56mhrhmmm...maybe not...
14:56r0bglees0nisn't the JVM really fast though?
14:56lfranchiis there an idiomatic way in clojure to, given a list of ints, search for a subsequents of ints? e.g. 1 2 3 4 in '(2 4 1 2 3 4 9 9(
14:59ianeslickI think the idea that C is alot faster is mostly a red herring these days. Very few applications really require that degree of low level performance, and usually only in a small portion of the code.
15:00ianeslickYou pay alot more to write an application in C - of course if you could have a Clojure no the metal it would remove some of the overhead and allow you to use native frameworks like Cocoa, etc more easily.
15:01mhrI was thinking that the easiest way to make a C-speed clojure is to simply write a compiler for clojure in chicken scheme (because there's already a ton of already-included primitives that both scheme and clojure share) and then bootstrap it
15:02Okasumhr: https://github.com/takeoutweight/clojure-scheme
15:03n_bWhat is your application doing that speed is so paramount?
15:03cbp`lfranchi: That's a dynamic programming problem. No real straightforward implementation unless you wanna turn them to strings and use regex I guess. But java's regex are a bit slow I think.
15:03nightflyI would really love to see a selfhosting clojure native clojure with less reliance on a "host" language.
15:03mhrnothing, I just want to get speed as a given so I don't have to worry about it
15:06mhrOkasu: that's only cljs->scheme->C
15:08cbp`Wait not dynamic programming
15:08cbp`just pattern matching
15:09cbp`Still not the easiest algorithm :P
15:09lfranchicbp`: yeah i'll do it the boring way
15:11n_bthe way I'd do it is a recursive take-while or similar, but I'm not great at that sort of problem
15:12cbp`If you wanna implement a linear time algorithm you can check out these videos: http://nptel.iitm.ac.in/courses/106101060/14
15:12lfranchiyeah i can just do it with drop-while i think
15:12cbp`Naive implementation is O(n^2) irrc
15:12lfranchitake + dropwhile
15:13lfranchii don'tneed to win any benchmarks :)
15:13cbp`Well as long as it isn't a very important process :P
15:14cbp`O(n*m) i mean
15:17hyPiRionlfranchi: subsequence or substring?
15:31jjttjjis there a replacement in noir-lib for noir.util.test/with-noir?
15:31jjttjjlib-noir i mean
16:01gfredericksam I weird for using :type metadata on my own defrecord?
16:07jtoyanyone here using clojure and vim as their main environment? I had some questions on how to be most productive in vim
16:08winkjtoy: I am using this and I am totally the wrong person to ask, because I don't actually like this environment :P
16:09jtoyi use vim to edit, and while i am testing different pieces of code, i also have a repl in a terminal and reload the class and then rerun the function, i am doing this all day and seems kind of ineefficient
16:10jtoyi know in emacs ppl have a live connection to the repl
16:11llasramjtoy: I don't use vim myself, but we just did a "dev enviroments workshop" in the Atlanta Clojure meetup group, and got see vim fireplace
16:11llasramjtoy: As far as I can tell, it has nearly complete parity with what you can do in Emacs
16:11llasramYou get a running REPL, into which you directly chuck stuff from your editor
16:12jtoyllasram: do you know if there was a video of that?
16:12llasramNo... We're not quite that slick (yet), I'm afraid :-)
16:12jtoyi've heard of the concept , but i want to see it in action
16:12llasramIt appears to be very easy to set up though
16:12jtoyseems like clojure and vim is like going against the ide
16:12jtoytide
16:13llasramI would have said that prior to foreplay/fireplace. But like I said -- they look to have largely the same features
16:16winkhttp://clojure-doc.org/articles/tutorials/vim_fireplace.html looks good
16:18winkas of yet I haven't managed to work in a useful speed in emacs
16:26jtoythx
16:37ysawejHi all
16:38ysawejhow do I access "getAlgorithms" method of Provider.Service? http://docs.oracle.com/javase/6/docs/api/java/security/Provider.Service.html
16:39ysawejI tried (import '(java.security Provider)) then used (Provider.Service/getAlgorithms) but that doesn't work
16:39ysawej*getAlgorithm
16:39llasramysawej: Inner classes are a Java fiction. Their real JVM names are Outer$Inner
16:39ysawejoh!
16:40llasramSo probably importing Provider$Service, then calling Provider$Service/getAlgorithms
16:40ysawejI still feel new to clojure :)
16:41ysawejalso, it is a static class
16:42llasramGotta learn something new each day!
16:42ysawejso how does I access Provider$Service/getAlgorithm
16:43llasramJust like you would any other class + static method. This class just happens to have a '$' in the name
16:43ysawejyeah.. I have been using the immutable part of clojure for sometime, got to start delving into the "states" and also java interop
16:44llasramOh, It's not a static method
16:45llasramSo yeah, like I said above, only s,static,, :-)
16:48ysawejyup.. looks like I'll have to create a new Instance, then get algorithms, etc.. I'll could rather use java.security.Key/getAlgorithm
16:49ysawejthanks llasram !
16:49llasramnp!
17:09jtoyanyway to see the last results from fireplace? i closed the window by accident
17:11llasramjtoy: Can you evaluate the value of `*1`?
17:11llasramI'm actually not sure of the process of how those get set in REPL sessions, but might work
17:21gfredericks,#'*1
17:21clojurebot#'clojure.core/*1
17:26tomojgfredericks: does sound a bit weird..
17:27gfrederickstomoj: ah well :)
17:27tomojmight the :type have different values for a single record type?
17:28gfredericksyeah I only have one record actually
17:29Glenjaminoh, gfredericks - are you still looking for a stubs/spies lib?
17:29gfredericksGlenjamin: not actively
17:29gfredericksI remember there being a decent one last time I heard of the topic
17:29Glenjaminpublished mine today if you're after one again - https://github.com/glenjamin/q
17:29Glenjaminit's based off bond, but with more helper functions
17:30gfredericksah bond was the one I remembered
17:32gfredericksGlenjamin: looks like good stuff
17:37gfredericksis it wrong to say that a java method call is polymorphic in all the arguments (including 'this')?
17:38gfredericksI guess the "dispatch" on the non-this args is always done at compile-time
17:38gfredericksmaybe that's the main difference
17:42callenRaynes: http://www.youtube.com/watch?v=xzQvGz6_fvA
18:04jtoyim doing a new clojure project that will need to have a persistent backend, any recomendations that fit better with clojure, this is a toy project
18:06gfredericksjtoy: probably whatever you have an easiest time setting up :)
18:06jcrossley3jtoy: a lot fit well with clojure, but datomic is prolly the current hotness
18:07jtoyi normally use postgresql
18:07gfredericksI use postgres with java.jdbc and honeysql at work
18:07jtoyall my clojure projects have been processing files on disk, never worked with any persistent dbs before, i assume its mostly the same as other languages except for immutable issues
18:08gfredericksyou mean a lack of ORM issues
18:09jtoy? I've used both orms and raw db drivers, i'd rather use an orm for the almost all queries
18:09gfredericksthere's more than those two options
18:09gfrederickshoneysql+java.jdbc is a lot different from raw db drivers
18:09jtoyI mean in other languages, not clojure
18:10gfrederickssure; I just meant that most of the complexity in other languages is trying to make ORMs work
18:10jtoyhoneysql looks pretty cool
18:11jtoygfredericks: does honeysql do inserts? according to this https://github.com/jkk/honeysql it doesnt
18:11gfrederickscorrect
18:11gfredericksbecause java.jdbc is not terrible about inserts
18:12gfrederickstraditionally the worst thing about java.jdbc is writing SELECT queries
18:12gfredericksif you want any kind of composability you end up doing the awfullest of string manipulations
18:12jtoyi would like to use a solution where i dont have to write any java, i've never written any java
18:14gfredericksI don't think java.jdbc involves much
18:14gfredericksnone that I can think of off the top of my head
18:14gfredericksI assume by "java" you mean "java interop"
18:14gfredericksnot literally java code
18:15jtoyi havent written any java code at all, i have done some java interop code, but that assumes i've written java, which i havent so that part can be slow at times
18:15gfredericksmy hunch is all you really need to understand is the jvm object model
18:15gfrederickswhich is a lot simpler than e.g. ruby's
18:16jtoyi came from ruby before clojure, i really like ruby and clojure, dont like java much
18:16jtoyi will use honeysql and jva.jdbc with sqlite for this project, thanks!
18:17Raynesbleh
18:17gfredericksnp
18:17jtoyRaynes: why?
18:17Raynesjtoy: MongoDB is tons of fun.
18:17jtoyRaynes: i used mongodb for a proejct a few years ago, experience the disapearring data and never came back
18:18RaynesYou said this was a toy project.
18:19RaynesIn any case, I haven't had the disappearing data experience. *shrug*
18:19gfredericksRaynes: quick go check
18:20jtoyRaynes: true
18:20jtoytrying to understand datomic, if i use the free edition, is my data not persistant?
18:20RaynesNonetheless, you can use whatever you want of course.
18:20RaynesTrying to understand datomic is a full time position.
18:21Raynescallen: Good tune.
18:21gfredericksjtoy: it is persistent
18:21gfredericksin some kind of embedded jvm database
18:21jtoyRaynes: ok, so I guess I wont try that "new hotness" then
18:21AWizzArdI want: (defmulti foo #(class (first %)) and (defmethod foo Integer [& ints] (...)) When I now call (foo (int 10) (int 20)) I get an arity error. Ideas?
18:22gfredericksAWizzArd: you need the dispatch function to be variadic
18:22llasramYeah, try e.g. #(class (first &%))
18:22gfredericks%&
18:22AWizzArdah, sure
18:22jtoyi dont really understand why its so great anyway
18:22llasramEr, typo
18:22llasramThanks
18:22Glenjamin&% does variadic on #() ? thats ugly :(
18:22lazybotjava.lang.RuntimeException: Unable to resolve symbol: % in this context
18:23llasramGlenjamin: %& -- I typoed
18:23callenjtoy: the free edition has limited durability AFAIK
18:23Glenjaminoh, makes a bit more sense, but still a bit arcane
18:23RaynesGlenjamin: Well, you don't have to use it.
18:23Glenjaminmm
18:23RaynesThere aren't many options for short forms like this.
18:24RaynesIf it looks too bad, you can always just use (fn [] ..)
18:24jtoycallen: that makes it even harder to test then :(
18:24Glenjaminyeah, i think (fn [x & xs] x) is a bit clearer
18:24jtoysqlite it is
18:25gfrederickscallen: limited durability?
18:26Glenjaminjtoy: http://sqlkorma.com/ might be worth a look
18:30callenjtoy: just use sqlkorma and PostgreSQL
18:32RaynesOr if you leave and just go do your project you might actually get it done with something because if you stick around here asking what you should use everybody is just going to give you different answers and make you even more indecisive. :p
18:32callenjtoy: follow Raynes' advice, but use PostgreSQL and sqlkorma.
18:32Raynes~guards
18:32clojurebotSEIZE HIM!
18:32Glenjamini hear rethinkDB is cool...
18:33RaynesYeah, but callen hasn't finished his driver yet.
18:33Raynes:D
18:33Raynesyogthos: GOOD DAY TO YOU SIR.
18:34jtoywhich is better sqlkorma or honeysql ?
18:35Glenjaminkorma has a nicer website
18:36winkkorma needs some doc updates
18:36winkI found it awfully hard to jump into
18:37winkbut after that hurdle I'm quite happy
18:37callenjtoy: korma is superior.
18:40cbp`macros overused :-(
18:40cbp`need literal SQL :D
18:42cbp`callen ! when are you gonna put me to work :-D?
19:12AWizzArdIs there a better way than (instance? (class (double-array 0)) my-double-array)?
19:41llasram##(Class/forName "[D")
19:41lazybot⇒ [D
20:11muhoocallen: superior how?
20:12muhoook, is there a lein plugin that will make a lein template out of an existing project?
20:13Raynes&(l/parse-fragment "<p>fragment!</p>")
20:13lazybot⇒ ([{:type :element, :attrs nil, :tag :p, :content ["fragment!"]} nil])
20:14RaynesIt just occurred to me that you can use laser from lazybot cause it's a dependency. :D
20:22Sgeolaser?
20:27RaynesSgeo: https://github.com/Raynes/laser
20:28jimkcaris there a way to do a deftype with a type-hinted and unsynchronized mutable argument?
20:28SgeoAny relation to lenses?
20:28gfredericksjimkcar: do the deftype docs not say so?
20:30jimkcari don't see that it says they're mutually exclusive
20:30jimkcarI think its me not understanding the correct syntax
20:35jimkcar(deftype Foo [^{:unsynchronized-mutable true **type-hint**} myarg])
20:35jimkcarnot sure what to use in the **type-hint** area. it's a map, so what is the key for a type hint?
20:36gfredericksjimkcar: you can use multiple metadata syntaxes together
20:36gfredericksbut it's also good to know that ##(meta (read-string "^Foo bar"))
20:36lazybot⇒ {:tag Foo}
20:36gfredericks^ you could probably use :tag as well
20:37gfredericks(deftype Foo [^ItsClass ^{:unsynchronized-mutable true} myarg] ...)
20:43jimkcar@gfredericks thanks. now it seems to not like that ^ItsClass is a defrecord type
20:44gfrederickso_O
20:44gfredericksis it from another namespace? do you need to :import it?
20:44nerdfunkhi there
20:46jimkcaryeah I keep going in circles with that. this is in myapp.somens and i'm doing a :require myapp.core :as core and it wont find core/ItsClass
20:46jimkcarnot sure if that makes sense.
20:46gfredericksit does
20:46gfredericksclasses still have to be imported
20:47gfredericksas java classes
20:47gfredericksclassic gotcha
20:48jimkcarI see, so even though its clojure, I still have to import it.
20:48gfredericksexactly
20:49jimkcarand my :require is just pulling in all the defn from there
20:49gfredericksyeah, the vars
20:49jimkcarnot the deftypes and defrecords
20:49gfredericksright, not the classes
20:50gfredericksthough for a (defrecord Foo ...) you'll get vars called ->Foo and map->Foo
20:50gfredericksand those will be :require'd as normal
20:51jimkcarI know map->Foo, but what's up with ->Foo
20:51jimkcar?
20:51gfredericksfor (defrecord Foo [a b c]) it is equiv to (defn ->Foo [a b c] (Foo. a b c))
20:52gfrederickspretty much identical to the constructor, but it's a var/fn so more flexible
20:52jimkcarSo the Foo. doesn't get pulled in with the require?
20:54gfredericksright. that's just an interop form for the class's constructor
20:55jimkcarso should I be using ->Foo instead of Foo. everywhere?
20:55gfredericksmay as well; it's easier
20:56gfredericksonly reason I can think of to use Foo. is if you're trying to squeeze every last cent out of your perf
20:57jimkcarok, it at least makes things consistent between files
20:58gfredericks->Foo also lets you do aspect-oriented things like adding preconditions
21:00gfredericksso seems like good practice in general to avoid the constructor
21:00jimkcarBecause it's a full-on IFn, not a Java Constructor method?
21:01gfredericksright
21:01jimkcargot it
21:02jimkcarnow all I'm getting is a ClassNotFoundException I'm importing it.
21:03gfredericksI'm out of ideas then. You could post a code sample.
21:03jimkcarthe exception is in the typehint
21:03jimkcarsure, I'll try
21:04gfredericks(refheap.com)
21:20jimkcar@gfredericks https://www.refheap.com/paste/14772
21:20gfredericksjimkcar: ah ha
21:21gfredericksthe :as core does not apply to the imported class. You should be able to refer to it as simply ^MyType
21:22jimkcarshouldn't the fully qualified work too? i.e. ^my-app.core.MyType
21:22gfredericksyep
21:22jimkcarI've been trying all kinds of stuff, but its not working
21:23gfredericksoh whoops
21:24gfredericksfully qualified would be my_app.core.MyType
21:24gfredericksi.e., the classname has underscores in it
21:24gfredericksbecause java packages can't have dashes
21:24gfredericksthe thing is coming all the way from javaland and it got beat up there
21:24gfredericksso that applies to the :import as well
21:25gfredericksyeah the whole thing works for me after those tweaks
21:26jimkcaryep, all is right with the world as far as that goes. Thanks
21:27gfredericks:) np
21:27gfredericksclojure is just a giant pile of leaky abstractions
21:27jimkcarugh, now more....
21:28jimkcarin that last deftype, in the domorestuff i'm trying to do this .... (dostuff somearg)
21:28jimkcarusing the protocol fn from the other namspace isn't working
21:30gfredericksshould it be (core/dostuff somearg)?
21:31jimkcaryep! ;)
21:31gfrederickseventually it all starts to seem internally consistent
21:32amalloyhah. what a nice summing-up of computer science as a whole, gfredericks
21:32jimkcarwondering if I should change my app base namespace just out of spite
21:32gfredericksamalloy: consistent or leaky?
21:32jimkcarboth. lol
21:34jimkcarthanks again for the help gfredericks
22:57avishaitwo newb questions
22:57avishaiare binding vars visible to other threads? e.g. agents
22:58brehautyes and no
22:58llasramDynamic var bindings are explicitly thread-local, but see `bound-fn`
22:59nightflyReally? Hows the behavior if you create a thread within a binding?
22:59llasramThe new thread sees the root binding
23:00nightflyThat's kinda disappointing to me, but understandable.
23:01brehautllasram: im not sure thats right
23:01llasrambrehaut: Oh?
23:02brehautllasram: i just tested it with (def ^:dynamic d 1) @(future d) #_ 1 (binding [d 2] @(future d)) #_ 2
23:03llasramYeah, so 1.3 made things weird with `binding-conveyor-fn`, which is used by several things like send-off and future-call
23:03brehautcould be ive missed some semantics of futures, but im i think that test case is correct
23:03brehautright, so if i had used Thread. it would have been different
23:03llasramThose Clojure-specific constructs will carry along the thread binding frame of where they are defined
23:03llasramExactly
23:04llasramBut IMHO it's a misfeature which just makes dynamic scope even more difficult to reason about
23:04llasram(the behavior of `future`, not raw `Thread.` seeing the root bindings)
23:05brehaut(binding [d 2] (let [p (promise)] (.start (Thread. #(deliver p d))) @p)) #_ 1
23:05brehautas you suggest
23:05nightflyThat's really whacky behavior
23:06brehauthow did binding conveyance work prior to 1.3?
23:06brehautim sure that since pre 1.0 the docs have suggested the thread locals behave as per the future and send examples
23:07llasramHmm
23:07brehaut(first guess suggests that you could do it relatively easily, but it'd be slow as hell)
23:08avishaiwhat if i don't do (def)
23:08avishaijust (binding [d 3] (send a something))
23:08brehautavishai: if you want thread shared mutable values, defs are probably the wrong choice anyway. look at atoms and refs
23:08avishaii want a shared config
23:08avishaiatom seems overkill
23:08llasrambrehaut: My reading of the clojure git logs doesn't show any obvious-to-me earlier binding conveyance, but I only started using Clojure w/ 1.3, so I don't know
23:09avishaianother option is promise
23:09brehautavishai: atoms are extremely the right choice
23:09avishaireally? my gut said promises
23:09Apage43config seems like something you might want to change later
23:09brehautdepends if you want them to change
23:09Apage43which promises don't get you
23:09avishaino
23:09brehautllasram: im running on recollections of the docs not actual trying it out, so who knows :P
23:09avishaii just populate the config in main
23:10Apage43at any rate, promises *do* get you that anything that tries to read it will block until its delivered
23:11avishaiso, just to get my story straight:
23:11Apage43which might be what you want if you might be spooling off workers before you've loaded it
23:11avishaibinding is thread local
23:11avishaiand agents/futures dont see the values from it
23:11avishaithey see the value from root binding established by def
23:11brehautavishai they _do_ see values if you use future, future-call and send
23:12Apage43well, futures do
23:12avishaiand if there is no def, they see.... what?
23:12Apage43creating a future captures the current bindings at the point it was created
23:12llasramWhat is the sound of one thread binding?
23:13Apage43avishai, if that name is not def'd anywhere the code won't compile
23:13avishaii should write a few test programs to get familiar i guess
23:13avishai10x
23:13avishaianother question
23:14avishaisuppose i have a program, which uses agents for parallelization
23:14avishaiconsume from q -> process message -> analyze -> send emails
23:14avishaisend emails function is all about side effects
23:15avishaiit feels wrong to use agents send-off for it
23:15brehautavishai: also read the clojure.org docs on vars, refs, agents and atoms
23:15llasramThat is one thing the clojure.org docs are definitely good for
23:15avishaisince its state mutation is really artificial, the state change is really just to mark side effects happened
23:16avishaiperhaps a watch is a better fit?
23:16brehautive forgotten who wrote the great java exectuors from clojure perspective blog post
23:16llasramOr just a thread pool
23:17llasramOh, I'd be interested in reading that as well, brehaut
23:17brehauthttp://blog.raek.se/2011/01/24/executors-in-clojure/
23:17brehauti think thats the one i was thinking of
23:17brehautmaybe raek_ will jump in
23:19ysawejHi all, what happend to data.codec
23:19ysawejI want to use base64 encode/decode methods
23:20brehautysawej: looking at the github, its currently a snapshot only
23:21brehautyou'll need the central snapshot repo in your project.clj
23:21llasramEfficient base64 in pure Clojure is cool and all, but any reason not to just use commons-codec etc?
23:22brehautllasram: none that i have seen; i used commons-codec and it seems completely fine
23:22brehaut :repositories {"sonatype-snapshots" "https://oss.sonatype.org/content/repositories/snapshots/&quot;}
23:23brehauthttps://oss.sonatype.org/index.html#nexus-search;quick~data.codec
23:25avishaihmm:
23:25avishaiuser=> (def ^:dynamic test1 0)
23:25avishai#'user/test1
23:25avishaiuser=> (binding [test1 1] (send a #(conj % test1)))
23:25avishai‏#<Agent@21be6e23: [1]>
23:25avishaiuser=> (binding [test1 1] (send-off a #(conj % test1)))
23:25avishai‏#<Agent@21be6e23: [1 1]>
23:25avishaiuser=> (send-off a #(conj % test1))
23:25avishai‏#<Agent@21be6e23: [1 1 0]>
23:26ysawejokay, I was able to use it
23:26ysawejthank u brehaut
23:26avishaiit seems agents do see the binding changes
23:26ysawejwhen will these libraries make into clojure core
23:26ysawej?
23:26brehautysawej: the commons stuff is really easy to use though; its just two static methods
23:26ysawejyep
23:27brehautcontrib makes no garuntees or promises about a library moving to core
23:27brehauthttp://dev.clojure.org/display/doc/Clojure+Contrib for more
23:27ysawejyeah. but I feel there are many libraries for clojure in github, and its hard to differentiate well-designed ones from hacky ones
23:28brehautcontrib isnt exactly about highlighting projects as great
23:28brehautits more about licensing and copyright, and a more formal process
23:29brehautquality is an accidental consideration
23:29brehaut(licensing and copyright mean it _can_ be promoted clojure, not that it will)
23:29hiredmancontrib libraries can end up being light weight due to the dependency policies
23:30brehauthiredman: dependancy policies?
23:30hiredmanat least for a while there was a 3rd party dependency ban
23:30hiredmanmaybe still?
23:31brehauthuh. unsurprisingly the confluence doesnt state this in a super obvious place
23:32llasramI think all dependencies need to be in Maven Central or at least Sonatype. No Clojars-only deps. But that's just a vague recollection from list-chatter surrounding the release of core.types
23:32llasrams,core.types,core.typed,
23:41brehautambrosebs: how did lambda jam go?
23:41ambrosebsbrehaut: good thanks!
23:42adulambda jam?
23:42adusounds awesome
23:42brehautgood turn out to the core.typed stuff?
23:42brehautadu: depends, sometimes it tastes a lot like birds
23:43ambrosebsbrehaut: Yes, I was pleased. About ~110 ppl at the conference total, 3 tracks, probably about 20-30 people in the workshop.
23:43brehautnice!
23:44ambrosebsbrehaut: Scala and Haskell dominated as topics, so I wasn't sure how strong the Clojure presence would be.
23:44brehautall those haskell and scala nerds probably had Opinions?
23:44ambrosebsWas pleasantly surprised.
23:44brehautheh :)
23:44ambrosebsThey weren't very vocal about them :P
23:45ambrosebsbrehaut: did you see the workshop I posted?
23:45brehauti saw the link, but i havent had a chance to watch it yet
23:45brehautswamped with work :/
23:45brehaut(he says, while blathering in irc)
23:45ambrosebs:D
23:47avishaii'd like to re-raise my question about using agents for side effects
23:47avishaiis that a good fit or is a watcher a better fit?
23:51brehautor a threadpool, as suggested earlier