#clojure logs

2012-09-12

00:04l1xo hai
00:07l1xhow could i get this working? i am interested []s which are not violating the #{} when i add "a" "b" and "a * b" to the #{} https://gist.github.com/3704221?
00:08l1xmaybe i could do it the filter and return it with that
00:10llasraml1x: Or add `:when (not= a b (* a b))` to the bindings in your `for`
00:10l1xhmm rite, thanks!
00:10llasramActually, that won't quite cut it -- need to be all distinct. But you get the idea
00:10l1xyep
00:11l1xi come up with a predicate which can be used in the :when
00:11l1xthanks!
01:01mkhow can I improve http://pastebin.com/cBtReXqV ? (no errors, mostly style)
01:01mkthe code for the listeners seems a bit ugly
03:10yanneI solved http://www.4clojure.com/problem/27#prob-title with this: #(= (apply str %) (apply str (reverse %))) but I consider it cheating. Is there a way to solve it without instance checks?
03:12carkhave you looked into the seq function ?
03:14yanneprobabaly not, thanks for the pointer :)
03:14cark=)
03:24yannecark: just what I needed, somehow missed it on the doc page
03:24carkgreat =)
03:25carkby using (apply str) you were calling seq under the hood (i think)
03:26carkand reverse must be doing something like it too
03:31kralmorning
06:18no7hingis it possible to use nrepl in a production application without the need to wrap commands?
06:20no7hinglike if you started the app with a repl in the first place
06:20no7hingwith/via
06:22clgvembedding a repl in you application should be possible. I used clojure's standard repl in one of my projects in the standalone jar when I specify a certain commandline parameter
06:36naeghow can I remove the redundant calls in this snippet: http://bpaste.net/show/OjzDLlSiV4fu4s10EWGF/
06:36naeg(it's core.logic, but I guess it's the same for a normal (cond))
06:42clgvnaeg: with `cond` you cant. there is `case` though - but does it have a core-logic equivalent?
06:43clgvnaeg: oh the numbers are within the `some-goal`. hmm then case probably does not fit. or is this a different core.logic syntax?
06:43naegclgv: some-goal could be a simple function in a cond. it's always the same in each case, only one argument differs
06:44naegclgv: I could replace it with a macro though?
06:44clgvnaeg: oh, you can use a `partial? then
06:44clgvargs `partial`
06:44clgv,(map (partial + 10) (range 5))
06:44clojurebot(10 11 12 13 14)
06:45pyrhhoI'm trying to mount a java servlet (specifically one of these: http://metrics.codahale.com/manual/servlet/) into my ring app. Ideally it would be mounted on a sub-path. anyone have any experience doing that? or is there a better way to do it?
06:45naegclgv: that would just save me from writing the [a b b d] each time, I actually want something that would expand to each of these cases
06:45clgvnaeg: then you need a macro
06:46naegclgv: but that would be overdone if I just use that macro once I guess?
06:46clgvnaeg: but is the redundancy after macroexpansion really needed?
06:47naegclgv: as far as I can tell, yes. I'll paste the actual code...
06:48clgvnaeg: can you reason why?
06:48naegclgv: http://bpaste.net/show/f6uEIczpyn83NkHIfuop/
06:49clgvnaeg: so whats `conda` doing with those?
06:49naegclgv: It's a algorithm for checking a connect four field. in (check-board) I first determine distinct indices for each coordinate in the field, and then I try to find patterns in these indices. a +1 pattern is a row, a +10 a col, +11/+9 are diags
06:50naegclgv: it tries the first goal, if that succeeds, it's finished. if it failed, it moves on to the next goal and so on
06:50naeglogical disjunction with short-circuit behaviour on first success
06:51clgvnaeg: ah ok. couldnt you just use a logic variable with domain = #{1 10 11 9} instead of the repetition?
06:52clgvthat's how I would have done it in prolog
06:52naegclgv: how could I create a disjunction between each of those then?
06:53naegfrom my understanding I need a cond here (conda is just better than conde because of it's short-circuit behaviour - no need to check cols and diags if rows already won)
06:53clgvnaeg: does the order of those statements matter to your problem?
06:54naegclgv: nope, don't care whether he checks diags before rows or whatever
06:54clgvnaeg: ok. then introduce a local logic variable with the domain #{1 10 11 9} and use it in your goal
06:55naegclgv: of course! now i understand what you meant - thanks
07:04naegclgv: It's a good idea, but it's _a lot_ slower
07:04clgvnaeg: oh. it does not short circuit I guess
07:05clgvnaeg: can you add short circuiting behavior after the first match? maybe some local "fail"
07:05naegclgv: hmm...I'm not sure, but I think it should. I'm telling core.logic to search only for one solution
07:05clgvnaeg: disclaimer: I never tried core.logic so far
07:07naegclgv: one problem is that I can't use a actual domain, but have to use (membero diff [1 10 11 9]) instead
07:07clgvnaeg: why cant you use an actual domain?
07:08naegclgv: bug in the FD stuff of core.logic :/
07:09clgvtoo bad :|
07:10naegclgv: ok, it's fast when using domains. but it sometimes results into true when it shouldn't
07:11clgvnaeg: what is core.logic trying to do when you just use (membero diff [1 10 11 9]) ?
07:11naegclgv: the logic var diff has to a member of this list
07:11naegthat takes a lot more time than using a domain
07:12clgvnaeg: so it does enumerate through all values?
07:12naegI do think so
07:13naegthe bug seems not to effect my new version with two domains though, but obviously is a bug
07:22naegejackson: you were the one suggesting a core.logic solution for an algorithm to check a connect four field, right? here it finally is: http://bpaste.net/show/mp5AEFjlQlxI6c3w5Iwm/
07:26clgvnaeg: you should generalize it for variable field sizes^^
07:28naegclgv: the other algorithms I wrote aren't that general either :P
07:31clgvnaeg: I thought it as exercise. would work with variables in 2d grid and dx,dy in #{-1,0,1} instead of diff ;)
07:32naegbasically everything I do is an exercise, but I want to move on now. spent about two weeks just on the checking algorithm for my connect four game :P
07:32clgvoh ok. then it is time ;)
07:33clgvnaeg: core.logic could use some more comments ^^
07:34naegclgv: well, it's straighforward to someone familiar with core.logic. and for the others i'm writing a blog post about all those different algos, including a in-depth explanation (especially for core.logic ;))
07:35clgvnaeg: I meant comments within the implementation^^
07:37naegthat will for sure happen while writing the blog post
07:39clgvnaeg: I meant the core.logic implementation, in particular clojure.core.logic ;)
07:39naegclgv: oh^^
07:40naegwell, I learnt about it by watching talks, reading the wiki and then sometimes look into the source
07:41clgvnaeg: I just wanted to check how +fd works but got last in blocks of code ;)
08:22no7hingclgv: thanks
08:23no7hingbut wait
08:23no7hingthat's for starting the app with a repl right away?
08:24no7hingi'm looking for something like erlang's console
08:24no7hingthat you can attach to a running application
08:25clgvno7hing: I just told that as an example. embedding nrepl in your application should be possible as well.
08:26no7hingbut then i have to wrap all my commands like this: (repl/message {:op :eval :code "(time (reduce + (range 1e6)))"})
08:27no7hingor am i not getting something here?
08:27no7hingbased on that example i'd love to be able to just enter (time (reduce + (range 1e6)))
08:27clgvno7hing: maybe there is a comfort function that does that already. otherwise it is an easy exercise ;)
08:27xeqino7hing: thats if you are connecting without using a pre-built frontend
08:27no7hingoh
08:28xeqi`lein repl :connect ...` would let you use the reply frontend connected to the embedded nrepl server
08:28no7hingthanks and seems like i have some more reading to do!
08:45no7hingclgv/xeqi: works like a charm
09:05clgv:q
09:05clgvups
09:05wmealing_#
09:48dgrnbrghey, which package is the .?. macro located in?
09:51antares_dgrnbrg: sounds like something highly experimental. Are you looking for it in the new contrib?
09:53chouserwow, that's not even in https://github.com/rplevy/swiss-arrows
09:53dgrnbrgi can't remember where i saw it
09:54dgrnbrgit was a lib that had -?>, -?>>, .?.
09:54ejacksonwhat does it do ?
09:54ejacksondgrnbrg: core.incubator has the first wo
09:54dgrnbrgif you get nil at any step, it immediately returns nil
09:54ejacksontwo
09:54dgrnbrgthus preventing NPEs
09:54chouseryou could use perhaps (-?> foo .bar .baz)
09:54dgrnbrgchouser: i think that'll be it, thanks :)
09:56ejacksondgrnbrg: yup. its core.incubator: https://github.com/clojure/core.incubator/blob/master/src/main/clojure/clojure/core/incubator.clj#L37
09:56clgvclojure.walk does not preserve metadata :(
09:57cemerickclgv: Because transients (and therefore into, used by walk) in 1.4.0 don't preserve metadata. Use a 1.5.0 build.
09:57cemerickI discovered that last week myself. It's a shame the bugfix didn't get into 1.4.0.
09:59clgvcemerick: you are way ahead of me. I use walk in 1.2.1 - couldnt update that project yet
09:59clgvit's next on the todo list though
10:00cemerickRIP 1.2.x ;-)
10:00ejackson1.2 !
10:01ejacksonwhen I was a boy we had to use 1.2 and fight of leopards to use the village compiler !
10:01clgvcemerick: hopefully. I guess I plan a week for it ^^
10:01ejackson:P
10:01cemerickejackson: I know, right? Remember when we had to load our numerics into little boxes and cart them all over the place like that?
10:02cemerickclgv: Upgrading shouldn't be that tough :-)
10:02ejacksonand the boxes were always the wrong size, and we had to open them with out teeth.
10:02ejacksons/out/our/
10:02clgvcemerick: oh there is a lot of contrib in there.
10:03cemerickAh. RIP contrib, then.
10:09clgvcemerick: now I have a meta preserving `walk`^^
10:11clgvjust wrapped it in another function
10:13mytrileHey, guys. I'm new to clojure and I'm trying some things but I have a problem: Say we have json with dates and text for almost every day. I've wrote some function to get the data for the current date, but I don't know how to find the next date if no data exists for the current date: https://gist.github.com/3917ad97e498e4c0dd78
10:21no7hingis alter-var-root and a dynamic var the best way to store e.g. a server
10:21no7hing?
10:22no7hinglike in (def ^:dynamic *client* nil) and in the init-fn (alter-var-root #'*client* (fn [_] client)) ?
10:23ejacksonno7hing: dunno about best, but I've often used atoms to store servers and things
10:24ejacksonmytrile: maybe read the file into a something that can give you proper handle of dates and times. Like a map keyed by date-time. That way you can do these things easily. Depends.
10:24no7hingso (defonce client (atom nil)) and then (reset! client the-client)
10:25no7hingi'am torn :D
10:25ejacksonno7hing: 'zakly
10:26mytrileejackson: the dates are transformed to map: { :01 { :01 "Some text" :02 "Some text" }} etc
10:26ejacksonmytrile; but that's only within a month
10:27konr_trabHow can I download a file to an object in memory in clojure? Via clj-http?
10:27mytrileejackson: When you read the whole json file you have all months
10:27ejacksonkonr_trab: yes.
10:28ejacksonmytrile: yes, but if the missing 'today' is the last in the month, you have a problem no ? Maybe I misunderstand.
10:28mytrileejackson: When today is the last of the month I should get the first date of the next month
10:29mytrileIf a date is missing/last I should get the next one
10:31ejacksonbasically, somehow, it doesn't matter how, you need to be able to create an ordered list of the existing dates, a function to to map real dates to that representation, as well as a next date. All of that is free if you just transform everything to date-time out the gate.
10:32ejacksonif you have a sorted vector of the dates in your file, you can easily check if today exists, as well as the next exsting day after today.
10:32jweissanyone have a link to Rich's rant referenced here (or some other link containing roughly the same arguments)? https://twitter.com/timcharper/status/13992964908
10:33mytrileejackson: sorted vector, got it
10:33mytrileejackson: thanks
10:34ejacksonbest of all would be a sorted-map, where the keys are date-times (clj-time.core)
10:34ejacksonthen you can get the dates easily by calling keys on your sorted-map, and can lookup fast into the map
10:36mytrileejackson: yeah, but what's going on when an element in map is not found, that's my problem
10:42ejacksonmytrile:if they're dates (or something comparable) then you can do something like (first (filter #(> % query-date) existing-dates)
10:42ejacksonbut only do that if the lookup fails.
11:12nsxtany recommended libs for managing/differentiating between environments (dev, test, production)?
11:15nsxtnever mind, just found environ
11:30DrPheltRight5/cr
11:34gtrakhow do I disable URI path uri-decoding in a compojure route?
11:53abaloneclojurescript one setup requires lein 1.x for lein bootstrap? hm.
11:56abalonei wonder what will happen if i skip the lein bootstrap and just stick with lein 2
11:56abaloneoh. i can't "go". :-P
12:26ohpauleezcemerick: ping
13:06casionwhat would be an idiomatic way to find the index of the first occurrence of a sequence of values in a vector? I came up with https://www.refheap.com/paste/5045 and neither seems terribly good
13:08casionI guess I could use map-indexed and subvec too
13:08ohpauleezcasion: I'm digging through some of my code, I swear I've done this too
13:09ohpauleezand I think I used a mix of some and subvec
13:10casionohpauleez: I was thinking of that now, but getting the index still would mean using .indexOf or similar wouldn't it?
13:12dnolen(some (fn [[i a b]] (if (= [a b] [x y]) i)) (map vector (range) v (rest v)))
13:14casiondnolen: ohh, that's clever
13:15ohpauleezcasion, usually if you say the words "filter first" in your problem statement, `some` is in the answer
13:15ohpauleezjust a little rule of thumb you might find handy
13:15casionhmmm
13:17casiondnolen's solution seems to be much slower than the recursion solution I put on refheap, but more readable
13:18dnolencasion: definitely slower, quite a few allocations. not sure if that matters for what you're doing.
13:18keugaergcasion: but IMHO , donolen's answer is workings lazily
13:19casionkeugaerg: I don't need lazy unfortunately, I'm processing a file header
13:19keugaergcasion: ok no pb :-)
13:20casionohpauleez: dnolen: out of curiosity any other way you'd imagine doing it? This kind of problem still stumps me in regards to functional thought processes
13:21casiontook me 2 days just to come up with what I did :\
13:23ohpauleeznope. I'd think: (first (filter ..)), some, loop/recur, or dropping into Java to see if there was a quick efficient way to pull it out. dnolen's solution would probably take me about an 30 minutes to an hour to tease out. The real trick to functional programming is thinking about how you're REALLY getting through the data and the higher-level constructs you have to capture that promise
13:23ohpauleez"I just need to filter through this data to find the first occurrence of …" => `some`
13:24ohpauleez"To find the first occurrence I need to …" -> (fn [] ..)
13:24casionohpauleez: yeah, that's actually the first thing I thought of, then I couldn't figure out how to get the index using some...
13:26casioneither way, thank you both :) I feel more confident with this by the day
13:26thorbjornDXI have two seqs of seqs, and I'd like to turn each of the inner seqs into a set, and merge the two together (to form one seq of sets). What's the best way to do this?
13:26ohpauleezAwesome. Totally happy to help
13:26nDuffI recall there being an actively-maintained site covering 3rd-party packages for Clojure, but its name escapes me. Could I ask a reminder?
13:26technomancynDuff: clojuresphere?
13:27ohpauleezclojure toolbox
13:27ohpauleezclojurewerkz
13:27ohpauleezthat's it I think
13:28nDuffAhh -- it's Clojuresphere I had in mind. Clojurewerkz puts out some good tools, but it's more the aggregator I was looking for.
13:28nDuffThanks!
13:33technomancydon't do it!
13:33ohpauleezhaha
13:34nDuff...hmm. Lazytest actually looks closest to what I'd like as a workflow, but it doesn't exactly appear to be actively maintained.
13:34technomancyI think you could easily port the lazytest workflow to clojure.test
13:34technomancyorthogonal things should be orthogonal
13:34ohpauleeznDuff: test.generative, lazytest, Midje, expectations
13:34technomancyit's silly that the triggering mechanism is tightly coupled to the testing framework =(
13:35ohpauleezI used lazytest for a long time, and since switched over to clojure.test and test.generative
13:36ohpauleezI too really like the layout and approach in Lazytest
13:36technomancytest.generative isn't really a framework, is it?
13:36ohpauleeznot so much, but another approach to testing
13:36ethanishey folks, I'm having issues with leiningen + clj-time
13:36ethanisand they're only happening on my machine running openjdk
13:36ethanisI cannot reproduce them on mac os, for whatever reason
13:37ethanisI get an Exception: "caused by: java.lang.ClassNotFoundException: clj_time.core.DateTimeProtocol" when doing lein run
13:37dnolencasion: I would just use my solution unless performance is really critical. Based on your description it seems like you're already dumping the file header into a vector which seems like needless work - if you have the data already as a String why not just call String .indexOf directly?
13:38ethanisis this a matter of having to compile things ahead of time if they contain protocols which extend java classes (like org.joda.time.DateTime)?
13:39ethanisis there some known idiosyncrasy with clojure/leiningen + openjdk
13:40thorbjornDXI ended up doing (for [s1 (map set seq1) s2 (map set seq2)] (into s1 s2)), tell me if it's terrible please! :)
13:40ethanislooking inside my ~/.m2 directory, I see two copies of clj-time
13:40technomancyethanis: never heard of any issues with openjdk, no
13:40ethanisis it possible that my project is failing to resolve the newer copy?
13:40technomancyplenty of issues with AOT and protocols though
13:40hiredmanethanis: you should run lein clean in both places
13:41ethaniswill do
13:41nz-ethanis: try lein deps :tree and see if you are using correct version of the lib
13:41S11001001thorbjornDX: it will re-setify all seq2 elements for each seq1 element
13:41ethanisgreat pointer
13:41abaranoskyis there a way to run all tests recursively under one subdirectory: i.e. `leon test plant.fruit.*` ?
13:42thorbjornDXS11001001: so I should just make a set from one of the two seqs?
13:42technomancyabaranosky: you could use a test selector for that
13:42thorbjornDXS11001001: or do '(into #{} s1 s2)
13:42S11001001thorbjornDX: into's second argument is always seq'ed
13:42technomancyI wonder if test selectors should support partial application
13:42thorbjornDXS11001001: ah, okay. Thanks.
13:43ohpauleezthorbjornDX: Also, can you just use map to pull out the second seq from both? So you can avoid the comprehension?
13:43ohpauleezI'm not exactly sure how your data looks
13:45nDuff...hrm. The ease of invocation without using lein certainly varies a bit between those. (Can't use lein due to dependencies in an Ivy repo).
13:45thorbjornDXohpauleez: I don't quite follow. My data is a seq of seqs about ~10 elements long, with ~7 elements per inner seq.
13:45abaranoskytechnomancy: I'd need to list each namespace explicitly to use test selectors, right? Or alternatively I can add metadata like "(deftest ^{:unit true}"? Is that correct?
13:46S11001001ohpauleez: a map wouldn't be necessary at all
13:46ohpauleezthorbjornDX: Ah my bad, I thought you had a two seqs, each with two inner seqs
13:46ethanishmm, lein reps :tree reports the same (correct) version of clj-time in both cases
13:47hiredmanabaranosky: you can do stuff like check the namespace name of the var to have selectors apply to entire namespaces
13:47ohpauleezand you wanted to merge the second of each of the second seqs
13:47hiredmanor just put a doseq at the bottom of your test file that tags all the test vars
13:47technomancyabaranosky: yeah, what hiredman said, but each prefix would have to be its own test selector
13:47technomancywhich is why I was musing about partially-applied test selectors
13:47thorbjornDXohpauleez: I do have two seqences, with the same number of 'inner' sequences (sorry my last statement didn't make that clear)
13:48technomancylein test :prefix/plant.fruit
13:48ethanis*lein deps
13:48technomancyprobably not the right syntax, but it looks tidy
13:48hiredmanethanis: did you run lein clean?
13:48ethanisyep
13:49thorbjornDXohpauleez: '('(1 2 3) '(4 5 6)) '('(3 4) '(6 7)) ; I don't know if that syntax is 100% right
13:49hiredmanethanis: and did anything change? do you get errors on both places now?
13:49abaranoskyleon midge has something like `leon midge plants.fruit.*`
13:49technomancyleon?
13:49clojurebotleon is a good sign it's time to turn off auto-"correct"
13:49abaranoskycrap sorry I'm not awake yet :)
13:49technomancyhaha
13:49ethanishiredman: now I'm trying running the errant machine as "dev", since I was formerly trying to run it in "production" mode.
13:49technomancyabaranosky: yeah, I think partial test selectors are a much more general approach that would get you that kind of functionality
13:50ethanis(this is an application built atop noir: that's where the prod/dev distinction comes in)
13:50abaranoskywait a sec, that wasn't me, I think Colloquoy automatically altered those words because it though tI misspelled them???
13:50lazybotabaranosky: Oh, absolutely.
13:50abalonelein git-deps says it's setting up a dependency and then says Cannot run program "git" (in directory ".lein-git-deps") CreateProcess error=2 cannot find the file specified. ... this is windows .. my cmd prompt knows what lein is and what git is... and the directory .lein-git-deps exists... wha should i do?
13:50technomancyabaranosky: yeah, it's a macosecks "feature"
13:50hiredmangit deps are dumb, so this is the universe telling you not to use them
13:51technomancyit's always amusing to run into someone who hasn't turned it off yet =)
13:51ethanisand lein run in dev mode yields the same problem, so that's seemingly not the issue
13:51thorbjornDXohpauleez: er, I don't need those inner quotes
13:51hiredmanethanis: but what about on the osx machine?
13:51abalonehm. ok
13:51ethanishiredman: switching the osx machine to prod? Will try that now.
13:52hiredmanethanis: my guess is you have a stale class file on the osx machine that is causing it not to throw this error, but if you had a fresh environment it would show the same error
13:52ohpauleezthorbjornDX: (set (flatten ['((1 2 3) (4 5 6)) '((3 4) (6 7))])) ?
13:53ohpauleez&(set (flatten ['((1 2 3) (4 5 6)) '((3 4) (6 7))]))
13:53lazybot⇒ #{1 2 3 4 5 6 7}
13:53ethanishiredman: classfiles should live exclusively in ~/.m2 if I haven't changed my configuration from the defaults, right?
13:53hiredmanethanis: nah, ./classes/
13:53thorbjornDX&(for [s1 (map set '((1 2 3) (4 5 6))) seq2 '((3 4) (6 7))] (into s1 seq2))
13:53lazybot⇒ (#{1 2 3 4} #{1 2 3 6 7} #{3 4 5 6} #{4 5 6 7})
13:53hiredmanwhich lein clean should clean out
13:54ohpauleezohhh
13:54thorbjornDXohpauleez: ^ is what I would prefer to get.
13:54ohpauleezYeah, the comprehension makes sense
13:54abaranoskytechnomancy: I'm not really a fan of Colloquoy; do Macs have a better alternative?
13:54thorbjornDXohpauleez: so by using 'for', I have to realize all of the sequence?
13:56technomancyabaranosky: erc or irissi would be my recommendations
13:56technomancyabaranosky: but from what I've heard that is an OS X problem, not a Colloquoy problem
13:58ohpauleezthorbjornDX: Yes, for will realize the entire sequence
14:02shinobi_onecan someone help me with this function? :) http://pastebin.com/mG5YY2L5
14:02S11001001shinobi_one: read doesn't read a line
14:03thorbjornDXohpauleez: ok, thanks for the help.
14:03S11001001,(doc read)
14:03clojurebot"([] [stream] [stream eof-error? eof-value] [stream eof-error? eof-value recursive?]); Reads the next object from stream, which must be an instance of java.io.PushbackReader or some derivee. stream defaults to the current value of *in* ."
14:03shinobi_onehmm so how can i modify this to work?
14:04nDuffshinobi_one: In the future, by the way, please consider using a pastebin without the annoying ads. gist.github.com and refheap are both good.
14:05ethanisINTERESTING
14:05ethanis"lein repl
14:05ethanisException in thread "Thread-1" java.io.FileNotFoundException: /home/ubuntu/startlabs/target/stale/dependencies"
14:06shinobi_onenDuff: oh sorry, I use ad block so I never see any of those xD
14:07shinobi_onei forgot the internet had ads xP
14:10casiondnolen: data isn't string, I'm working with an input-stream so it's a byte-array that I'm processing
14:11TimMcshinobi_one: I think java.io has LineReader or something. clojure.core/read is somewhat unrelated.
14:11casionand some delimiters can cross byte-boundaries for god knows what reason :|
14:12shinobi_oneTimMc: I can do (with-open [rdr (reader "some file")] (count (line-seq rdr))) to count the number of lines in a file so it can't be too unrelated
14:12TimMcreader != read
14:12shinobi_oneah true!
14:12shinobi_onei misread clojure.core/read for clojure.core/reader good point
14:13TimMc(drop 5 (line-seq ...))
14:13ethanishey hiredman: it looks like I've resolved things
14:13TimMcor nth or something
14:13abalonei asked the following on #clojurescript but there are more users here, so apologies for the crosspost... hello :) what's the best setup for unit testing clojurescript code? (is there a setup that works with lein 2? i see a few things that require lein 1.x)
14:13ethanisthanks for the help
14:15ethanisnow a question for the audience: is it insecure to run a jetty server on port 80 as root?
14:16ethanisand if so, why would running it behind an apache instance be any more secure?
14:16technomancyethanis: usually it's placed behind apache or nginx
14:16TimMcethanis: "root" is the problem.
14:16ethanisyes, but doesn't apache require you to run it as root?
14:17dnolenabalone: CLJS doesn't have a testing setup like clojure.test yet.
14:17ethanis(to bind port 80, specifically)
14:17TimMcI believe the actual network-facing processes are run as "apache".
14:17TimMcGood point about port 80, though.
14:18nz-ethanis: apache binds the port and then gives away the root privileges, i think
14:18technomancyethanis: right, but the point is your application code doesn't need to be in the same process that way
14:18ethanisnz, technomancy: completely valid, thanks for the rationale
14:18nz-ethanis: so most of time apache process doesn't have root access
14:19ethanisalright, that does sound like a valuable thing to do then
14:21ethanisone more question: is there anything tricky about piping an nrepl session through ssh that I should be aware of?
14:21abalonednolen: ok thanks.
14:22technomancyethanis: no, that should be pretty straightforward
14:22technomancyyou can do it over https too though; see drawbridge
14:24ethanisawesome, thanks for the heads up, technomancy
14:24ethanisI always learn a ton from the clojure IRC channel
14:25technomancythe clojure channel consistently ranks in the top 10 for user satisfaction on language-related freenode channels in a series of recent studies
14:26Hodappthis is why I was sent here as an asshole troll to give some other channels a chance
14:26HodappHA HA JUST KIDDING
14:26Hodapp>_>
14:26Hodapp<_<
14:32jkkramer-=784
14:36gfredericksjkkramer: you bought something?
14:37jkkramergfredericks: my cat likes to jump on the keyboard when I leave the room
14:38gfredericksdoes the cat always emit code fragments?
14:40jkkramerI suspect they are encoded messages. so far unable to decode them
14:41jkkramerwonder if I could rebind my caps lock key to be cat lock
14:43gfredericks~rimshot
14:43clojurebotBadum, *tish*
14:43S11001001jkkramer: your cat is telling you to use a language that permits in-place decrement, i.e. variables
14:43abalonejkkramer: S11001001 insulted your cat
14:44jkkramershe is partial to purrl
14:44borkdudethere was this thing on clojure lately in the twitterverse mentioning indicators for higher salary and clojure, what was it?
14:44borkdudeI have to promote clojure a bit in front of java people and I might mention it ;)
14:45borkdudething on twitter I mean
14:45borkdudeeh no on clojure (fuck I'm tired)
14:45abaloneso if i avoid stuff in clj that doesn't exist in cljs, then i can write my code and unit test it normally with clojure.test ... and have a symlink to a .cljs file and build my js and be happy.
14:45gfredericksborkdude: that was a few weeks ago right?
14:45borkdudegfredericks yes I think so
14:45technomancyborkdude: it was pretty suspect; it listed sketchy stuff like peoplesoft and certifications
14:45gfredericksI think ssierra tweeted it, as I sow
14:45technomancyI wouldn't take it seriously
14:46borkdudeany other tips on how I can promote clojure in just a few slides in 5 minutes are welcome!
14:46borkdudetechnomancy ok
14:46gfrederickstechnomancy: my favorite part was how it described clojure as being useful because it runs on the jvm which runs in web browsers
14:46technomancygfredericks: applets _are_ the future, man
14:46gfredericks~applets
14:46clojurebotGabh mo leithsc?al?
14:47gfredericksclojurebot: applets |are| the future, man
14:47clojurebotRoger.
14:47gfredericks~applets
14:47clojurebotapplets are the future, man
14:47gfredericksmission accomplished
14:48technomancygfredericks: RISC architecture is going to change everything, man! http://www.cnet.com/i/bto/20091209/3675717991_f750f4a35f_o.jpg
14:48borkdudeclojure in 5 minutes… any tips…. guys?
14:48gfredericksborkdude: that is a challenge
14:48abaloneborkdude: compare code bloat in one language with clojure ?
14:48S11001001borkdude: "take it easy" is the clojure motto
14:49technomancyborkdude: referential transparency and easy access to JVM libs
14:49gfrederickssell them on the immutable data structures, sane concurrency constructs, and static metaprogramming
14:49technomancyimmutable data structures by themselves are a hard sell, but the fact that they enable referential transparency (which makes most concurrency headaches disappear) is easier to buy
14:50borkdudeabalone that was my idea. any appealing examples?
14:50gfrederickstechnomancy: depends on the audience I would think
14:50technomancytrue
14:50cgagi wanted to do a 5 minute talk about clojure at my company but it seemed like so much to talk about in 5 minutes
14:50abaloneborkdude: there are probably existing examples
14:50antares_many Java experts have been recommending sticking to immutable data structures for many years
14:51scriptormaybe mention enlive or hiccup, and talk about how its just clojure data
14:51Chousukereferential transparency helps immensely even if there is zero concurrency
14:51hyPiRionborkdude: For whom are you giving this?
14:51abaloneborkdude: haha, compare cljs to generated js
14:51gfredericksdoes hiccup let you use a map for the :style attribute?
14:51borkdudescriptor that's a nice, show a few cool clojure libs? I was thinking Seesaw maybe also
14:52borkdudehyPiRion my colleagues (lectureres at a polytechnic)
14:52scriptoryep, anything that shows how useful macros can be if they're used reasonably
14:52scriptoris also good
14:53gfredericksif you talk about macros, emphasize that it's all compile-time so it's actually conceivable to wrap your head around the effects
14:53gfredericksin contrast with e.g. ruby
14:53borkdudegfredericks good one
14:54scriptorborkdude: also, when showing code listings, focus on one piece of code at a time
14:54scriptoras in, smaller code examples
14:54gfredericksand white-out all the parens so they can actually see the code
14:54scriptorpeople seem to get turned off by large blocks of lisp
14:55borkdudeok guys, tnx for the advice, I have enough to fill 5 minutes
14:55carktho the advantages of clojure are best seen when coding in the large
14:55scriptorthrow in the matrix quote about not seeing the code
14:55jkkramerborkdude: not sure about how effective it is as a 5-min selling tactic, but for me the biggest factor in convincing myself and others to use clojure has been simplicity & composability: clojure makes it easier to build modular, maintainable software with less code
14:55borkdudea colleague of my still thinks of clojure as a scripting language and doesn't think you can build large systems with it ;(
14:56gfredericksman if only clojure were useful as a scripting language
14:56carkgfredericks: haha so true
14:56gfredericksplease somebody invent clojuresh
14:56gfrederickswhatever that would mean exactly
14:56carki read somewhere that clojure in python has good startup times
14:57carkdidn't try it myself
14:57gfredericksoh how is that project coming?
14:57borkdudewasn't there something on really fast start up time lately?
14:57gfredericksyeah drip
14:57carkisn't drip a little buggy right now ?
14:57borkdudeah yes, drip I think
14:58carkthere was nailgun too ?
15:00gfredericksthe only solution is to build a JPM
15:01carkwhat's a jpm ?
15:03luxbockwould you recommend a newbie like me to learn clojure? I know the basics of Python but have never programmed anything beyond simple scripts with it
15:03luxbockor am I better of getting better at Python, and considering clojure later on?
15:04S11001001luxbock: what do you like about python?
15:04scriptorluxbock: python's different enough from clojure that it wouldn't help all that much, and clojure should be fine on its own
15:04borkdudethis image from cemerick's clojure survey might also be worth showing: http://bit.ly/Pjfqb5
15:05scriptoralthough documentation wise, there is far more for complete beginners for python than there is for clojure
15:05luxbockI was first learning Python many years ago as a teenager when I had a phase where I wanted to learn how to program, but I moved on to other ventures before I really got good at it
15:05dnolenborkdude: what languages do your colleagues use? always good to put things in relation to what people already know.
15:05luxbockso now that I'm trying to pick up on it again, Python was the most natural thing for me to get to
15:05carkluxbock: clojure is the better, simpler language. but it's harder to get started with clojure because of the whole jvm hosted thing
15:06borkdudeluxbock Python: nice. Clojure: watch out, another addicting computer activity.
15:06borkdudednolen mainly Java, some Python
15:06borkdudednolen that was what I was going to do: show that learning clojure, might be useful for understanding concepts in other languages too (closures, lambda's, etc)
15:07dnolenborkdude: then perhaps highlight problems people encounter with those languages that Clojure addresses.
15:08carkborkdude: database access =)
15:08luxbockI don't really have any specific purpose for what I want to do with programming, but I figure it's one of those skills that can come handy at a lot of times so while I have a lot of free time and find it interesting, I might as well
15:08dnolencertainly Clojure offers quite a bit over Java pain points. If your colleages mostly use Python for simple scripting I'm not convinced Clojure offers enough.
15:08borkdudednolen hmm, I don't think a lot of my colleagues do heavy concurrency problems, it might be difficult to sell clojure for that
15:08amalloycark: knowing gfredericks, i'd guess he meant jpm to mean "java python machine", as superior to "java virtual machine"
15:09borkdudednolen not a lot do Python, some use it for scripting, but mainly for sysadmin people
15:09gfredericksamalloy: java physical machine
15:09amalloywell, those exist though, right?
15:09gfrederickscark: sorry, was being productive
15:09carkgfredericks: huu wow that's been a while since i last heard of *that*
15:09gfredericksamalloy: maybe, I'm not hip enough to know that kind of thing
15:09borkdudednolen a lot of my colleagues don't feel the pain of Java, because they simply don't know much about other OO langs
15:10cgagi'm sure they'd appreciate having literals for vectors and maps
15:10dnolenborkdude: yes so concurrency advantage doesn't by you much in this case. but the benefits of simpler reasoning about state is somethign they can identify with.
15:10borkdudednolen about other (even other OO) langs I mean
15:10dnolenborkdude: but your colleages must create bugs
15:10dnolenborkdude: where do these bugs come from?
15:10carkborkdude: i would pick some activity they're doing in java, and show that you can do it with 20% the line count and 20% the bugs of java
15:10scriptorborkdude: if you have enough time, you could try to rewrite some company code in clojure
15:11borkdudeI think I'm going to show them some REPL fun a swell
15:11cark20% being quite conservative =P
15:11borkdudeas well
15:13abalone+1 for the idea of rewriting company code in clojure
15:13ejacksondnolen: all horrors arise from the bottom of the Mandlebrot set
15:13borkdudeabalone scriptor don't think I have enough code, and we're not a company ;
15:13borkdudeabalone scriptor enough time I mean
15:14scriptorborkdude: ah, what would you use clojure for if it was chosen?
15:14borkdudescriptor everything
15:14hyPiRionheh.
15:15hyPiRionclj-OS - the operating system for all your needs.
15:15dnolenborkdude: in 5 minutes sounds like you emphasize the fun part of Clojure - don't over hype the advantages.
15:15borkdudednolen yes, well, it's only because I taught some students clojure and have to present something about this course
15:15scriptorand make sure to distinguish fun from "toy"
15:16borkdudednolen so I guess I need to sell it a bit for the learning experience, more than financial benefit, or etc
15:16borkdudednolen students only had Java and C#, so with learning clojure they not only know clojure, but also about other FP languages and programming concepts, etc, blabla
15:16dnolenborkdude: development speed is also a plus. A demo building a UI on the fly w/ Seesaw would probably wake people up.
15:17scriptorborkdude: can you expand more on "everything"? Sounds like you'd teach it in class?
15:17borkdudescriptor I have taught it, just 6 lessons
15:18carkborkdude: demonstrate higher order functions: map, filter and how that all can be defined as reduce, with a concrete example of a vector containing meaningfull maps
15:18antares_borkdude: you can sell clojure as a small productive language with good performance baseline and impressive stability, running on a very mature runtime
15:18nDuffoooh
15:18nDuffshiny
15:19borkdudehmm, elections have closed here in NL…
15:19antares_borkdude: best of both Java and Ruby/Python worlds, lets you concentrate on the problem. That is all. Selling macros and advanced features is not necessary.
15:20borkdudetnx
15:20ghadishaybanAny way to do macroexpansion without symbol resolution *and* without having to put ~' in front of every symbol?
15:21xeqicemerick: have you used friend and wrap-anti-forgery together?
15:21dnolenghadishayban: no
15:21cemerickxeqi: not yet
15:21cemerickproblem?
15:21clojurebotPeople have a problem and think "Hey! I'll use a regular expression!". Now they have two problems....
15:21ghadishaybandnolen: ok…
15:22xeqiit will login fine, but the next request doesn't pull out an identity
15:22carkghadishayban: you're trying to do variable capture ?
15:22xeqiI'll see if I can track it down
15:22ghadishaybandnolen: you can do codewalking calling (eval) everytime you see an unquote….but then you don't have access to local bindings
15:22xeqijust checking to see if you had and knew what the problem was
15:22ghadishaybanwithout some &env voodoo
15:23ghadishaybancark: yeah I'm trying to send in a form to clojurescript browser attached repl...
15:24borkdudetnx guys, for all the input, cya
15:24ghadishaybanas in… (let [foo (some java land call)] (send to cljs (def bar ~foo)))
15:24ghadishaybanyou can always call a macro and put ~' everywhere
15:25ghadishaybanbut then you have ~' everywhere
15:25dnolenghadishayban: not sure what you're trying to do. you can't send CLJS forms directly to the browser REPL, the browser REPL compiles to JS and sends JS for eval.
15:26dnolenwell I mean CLJ data literals but not code in general.
15:26ghadishaybandnolen: right, i'm talking about sending a proper form to the CLJS compiler, with inserted literals from java-land
15:28dnolenghadishayban: oh you're generating CLJS code w/ CLJ?
15:28ghadishaybandnolen: si
15:29ghadishaybaninject a form into cljs-land that defs something
15:30ghadishaybannot something you'd do in a production setting. most of the cljs-clj communication involves the cljs asking for data furnished by clj.
15:30ghadishaybanand communication happening through (read-string)
15:31jweisscan anyone point me to some "encapsulation is folly" material, to persuade OO-trained coworkers that they don't need it?
15:31jweisshttps://twitter.com/timcharper/status/13992964908 <- a tweet suggesting suggesting the arguments are out there, but this particular one probably not on a webpage
15:31ghadishaybanbut for some deftests, it would be useful to set some constants in the browser, like credentials
15:32ghadishaybandnolen: is this crazy?
15:34dnolenghadishayban: I need to think about it some more. but yeah syntax-quote behavior won't be very helpful in this case ...
15:39ghadishaybandnolen: it's really no problem for a couple one off forms…
15:39ghadishaybani just have that sneaking suspicion that there's an easier way to do it
15:43dysingertechnomancy: I built a project that works under leiningen 1.7.x but under 2.0 it bails during uberjar with "duplicate entry: META-INF/LICENSE.txt" all the classes after this entry are not included in the uberjar.
15:43dysingerjust fyi
15:46meliponehello! Do I need to just change the JAVA_HOME env variable to change the java running clojure? I'm trying to replicate the experiment http://blog.gonzih.org/blog/2012/09/07/clojure-on-beaglebone-openjdk-vs-oracle-embedded-jre-benchmark/
15:46hiredmanmelipone: why?
15:46hiredmanjust use the full path to the java you want
15:47hiredmanI think I am getting my bealge board back from the beagle hospital on monday, I can't wait
15:47meliponehiredman: I understand
15:48meliponehiredman: I don't understand what you say about the java full path.
15:49hiredman/usr/local/whatever/java …
15:49meliponehiredman: but I'm using clojure not java!
15:50hiredman/usr/local/whatever/java -jar clojure.jar
15:50meliponehiredman: but what if I do lein run? what does it do?
15:50hiredmanmelipone: if all you want to do is run the code from the website there you don't need lein
15:51hiredmanyou just need a clojure repl
15:52meliponelet me ask another way: how do I find the java version running clojure in clojure itself?
15:52hiredman(System/getProperties)
15:52meliponehiredman: thanks
15:53hiredmanmelipone: http://thelibraryofcongress.s3.amazonaws.com/beagleboneled.html if you setup nrepl you can dev locally with a remote repl
15:54hiredman(editor etc on your laptop, repl on the beaglebone)
15:55xeqicemerick: heh, they alternate returning sessions without info from the other middleware
15:55cemerickut-oh :-P
15:55cemericka pox on our respective houses, I guess
15:56xeqilogin -> response :session has friend identity but no ring-forgery code; redirect -> response :session generates new ring-forgery code since previous one disappears, but no identity
15:56xeqiyeah, should be work-aroundable
15:57xeqibut poxes!
15:57nDuffCan one do a thread-local unbinding of a var with a root binding present?
15:58TimMcxeqi: Butt poxes? Sounds bad, dude. Go see a doctor.
15:58TimMcSorry, I'm 8 years old today.
16:00gfredericksTimMc: no peanut-butter celery for you
16:04naegis there some convention when passing around HOFs as arugments? like putting -f on the name: (fn [some-f] (some-f 1 2 3))
16:05ohpauleeznaeg: typically, I add -fn
16:05ohpauleezbut I don't think there's a set convention
16:05naeg-fn makes more sense than -f though
16:05ohpauleezsome people just call the arg f
16:06hiredmanhttp://dev.clojure.org/display/design/Library+Coding+Standards
16:07xeqiI use f, g, h, if they are meant to be any function, prolly a math background
16:07xeqipred if its more a predicate type function
16:08ohpauleezI do the pred arg too
16:08naegI like to be a bit more explaining with my arguments
16:09hiredmanI often end up with (defn f …) (defn g …) while writing code, and then sit around trying to figure out names
16:09naeg(especially because i'm currently writing code which is probably read by clojure newcomers)
16:09konr_trabIs there a parser generator for Clojure, or something nicer than having to import antlr?
16:10HodappI thought it had combinators...
16:10S11001001konr_trab: a couple
16:17xeqikonr_trab: I've seen a couple, but nothing up to date or on the scale of parsec :/
16:21konr_trabxeqi: this one looks good, but it's from 2010 http://lithinos.com/clj-peg/
16:22cemerickxeqi: feel free to file an issue, maybe on both libraries :-P
16:22TimMcLIB FIGHT
16:23ohpauleezkonr_trab: I've used JParsec and ANTLR with success. In Clojure I wrote some stuff with fn-parse. A little dated, but parsers aren't something that need to be continuously updated. Once they do their job, they're done.
16:23ohpauleezkonr_trab: If you like the looks of clj-peg and it works in your project go for it. Or fork the repo and update whatever you need
16:25xeqikonr_trab: that one might work, I was thinking of fnparse and its clojure-contrib dependency for one thats not up to date
16:26xeqicemerick: yeah, I think I'll wait a bit and ask weavejester some questions. Its almost like the ring-response generated in the app should be filling the session
16:27xeqi* filling the session with default values based on the request's session
16:38xeqiweavejester: I'm running into some session problems trying to use both ring-anti-forgery and friend. They like to return session values at different times, which then causes the other one to be forgotten.
16:38xeqiis it desired for the app's response to contain default session values based on the request?
16:39visheshfor refs if I have (def a1 (ref 1000)) and (def a2 a1), and I ref-set any of a1 or a2, other changes too. Why is that?
16:41cark(def a2 a1) creates a var a2 which resolves to the value of var a1
16:44carkhum i might be misunderstood : redefining a1 afterwards does not change a2's value
16:45hiredmana ref is a cell
16:46hiredmane.g. (def a2 a1) stores the value of a1 (the ref) as the value of a2
16:46hiredman(var a1) -> ref -> 1000
16:46hiredman(var a2) -> same ref -> same value 1000
16:47brainproxyhaving an issue w/ arguments I'm passing to a macro
16:48nDuffvishesh: If you want to refer to the value inside a ref, rather than the ref itself, you need to use deref
16:48nDuffvishesh: otherwise, you're creating a second var pointing to the same ref
16:48brainproxyI can pass a literal like [:a :b :c] just fine, but if I need to "compute the literal" before using it as an argument I'm having trouble
16:48nDuffbrainproxy: ...as in, you want to eval it?
16:49amalloybrainproxy: a macro can only perform operations on source-code literals. that is how they work
16:49visheshhiredman, nDuff: Thanks. I guess I wasn't clear about the ref being a cell part...
16:49nDuffbrainproxy: ...generally, wanting to use eval inside a macro is a code smell, meaning things could/should be designed differently.
16:50brainproxynDuff: don't want to use eval inside
16:50nDuffbrainproxy: ...then I don't follow the question.
16:50cark(defmacro do-it [the-code] `(do ~the-code))
16:50visheshThe commute function, during commit takes the most recent value globally and applies the func if I
16:50brainproxycark: right, but inside the defmacro I have a thing like ~@(map ... arg-i-passed)
16:51visheshThe commute function, during commit takes the most recent value globally and applies the func if I'm right?
16:51brainproxyin other words to build up the `(...) parts I need to work over some data I'm passing into the macro
16:51brainproxybut I guess I need to break up the macro into pieces
16:51brainproxyand do the map prior to the call to my macro/s
16:52brainproxyas a way around that, I wasn't sure if I could take a computed value and turn it back into a literal that I could pass into the macro
16:52carki think you can't make a macro run the code you pass to it at compile time
16:54brainproxycark: you can do things like `( ... ~@(map #( ... `() ...)) ... )
16:54carkmhh i don't follow
16:54brainproxyyou aren't restricted to just one top-level `()
16:55brainproxyyou can unqoute within that and do a computation and hand back more `() inside the top-level `()
16:55carkright, but you macro will not be using the code you pass to it to do its job, it can lay it down , use it as a pattern, but not as code to be run
16:55TimMc,`(+ 1 ~(count `(+ 0 0 0)))
16:56clojurebot(clojure.core/+ 1 4)
16:56zerokarmalefthas anyone taken over maintainership of lein-hadoop? seems like https://github.com/ndimiduk/lein-hadoop hasn't been updated since 1.1
16:56brainproxycark: yes I know
16:57brainproxywell, anyway, I think the easy solution is perhaps to use a dynamic and refer to that in the macro, binding it to my computed value before I call the macro
16:57carkbut what is it exacly you're trying to achieve ?
16:58SegFaultAX|work2Is DSLs in Action any good?
16:58brainproxyeither that or break it up into 2+ macros and do the map outside the macro
16:58brainproxycark: I'm trying to build up a (do ...) that has a rather complex body
16:58TimMcbrainproxy: You can always call out to helper functions.
16:59TimMcNot everything has to be one big `() block.
16:59carkTimMc: right that's what i do when it gets hairy, easier to debug too !
16:59TimMcYou can explicitly call gensym in a let-block outside of it, pass those gensym values to helpers, etc.
17:00carktho i find i'm using macros less and less
17:02brainproxyTimMc: i know, but in the end I need to map over a collection, and I either need to do it inside the macro, but around one of the inner `(), or I need multiple macros and do the map before I ever get to calling the macros
17:02brainproxyor ... there's the dynamic option
17:02carkwould you have a minimal example ?
17:03brainproxycark: let me get past the hump and I'll see if I can gist up an example
17:06Sgeo__Oh, brainproxy
17:06Sgeo__Um, perhaps have the macro emit code that does a let?
17:07Sgeo__Or is that difficult in your situation
17:18carkbrainproxy: after reading agaibn what you said, i can only think of one of these two things https://gist.github.com/3709981
17:21weavejesterxeqi: What did you mean by "likes to return session values at different times"?
17:35xeqiweavejester: when I first hit a page, the ring forgery token is added to the session
17:35weavejesterxeqi: Yep
17:36xeqiwhen I :post to "/login" friend adds a friend/identity to the session, but the ring forgery token is not assoc in the map
17:36xeqiso its forgotten
17:36weavejesterxeqi: That sounds like a bug in friend
17:36xeqion the redirect a new ring forgery token gets assoced, but the friend/identity token is forgotten
17:37weavejesterxeqi: And perhaps a bug in ring-anti-forgery, too!
17:37xeqiI guess I would have both to always add the tokens they want to the session
17:37hiredmancould that result from having the session middleware multiple times in the stack?
17:37xeqinot just when they change
17:38xeqibut I just want to make sure I'm not suppose to be returning default values of the session as seen in the request
17:38weavejesterThe problem is that both middleware doesn't correctly add to the session
17:38xeqihiredman: nope, its (-> app friend ring-anti-forgery hiccup/site) basically
17:39xeqik, I'll file bugs on both then
17:39xeqijust wanted to confirm before hand
17:39weavejesterThey should modify the session in the request and add the updated session to the response.
17:40weavejesterI need bed now, so I'll fix ring-anti-forgery tomorrow :)
18:24brainproxycark: I appreciate your taking the time to write that gist; i ended up being able to move the problematic map inside the top-level `(...) of my map and now all is well
18:25brainproxyi got to hung up on thinking that a (doall (map...)) inside that part of my macro was going to be problematic, but with a little refactoring it worked out to do it that way
18:26brainproxywhoops, above i meant to say "`(...) of my macro"
19:57SrPxCan Clojure libraries be used on Clojurescript?
20:00nDuffSrPx: Only ones written to use the subset of the language that cljs supports
20:00jtoyj #bash
20:00nDuffSrPx: ...generally, when those exist, it's very intentional.
20:01SrPxnDuff: I see
20:02SrPxnDuff: so most Clojure libraries would not be
20:02SrPx(compatible)
20:03thorbjornDXSrPx: (source compatible)
20:03thorbjornDXSrPx: my brain is broken methinks
20:05nDuffSrPx: Correct.
20:09typeclassyis there any way to add clojurescript as a dependency for a leiningen project? putting compiler.jar in lib/ doesn't seem to give me access to the cljs namespace
20:10dslsdI was reading about generating functions and it seems like it's considered a bad idea in general. I'm used to things like define_method from ruby. (intern *ns* ...) seems to not be a good idea. I would like to generate functions for monday-friday: monday?, friday?, etc.
20:10dslsdHow should I do that?
20:11technomancydslsd: the best way to generate functions in clojure is partial application and composition
20:13dslsdtechnomancy: i guess i hadn't really thought about using partial for this -- i think that will probably get me close, but it would be nice to have some cozy functions like (friday? date) for a date, instead of (is-it? :friday date)...
20:13technomancy(def friday? (partial is-it? :friday)) ; season with metadata to taste
20:14dslsdsure, it's just the names I'd like to generate, but say no more. I think that's okay.
20:14dslsdThanks.
20:14amalloyor with a macro if you must. (with-day-questions (friday? x)) can expand to (letfn [(friday? [d] ...)] (friday? x))
20:15technomancy(let [[sunday? monday? ...] (map (comp partial is-it?) [:sunday :monday ...])] ...)
20:15technomancyboo
20:47gfredericksit is interesting that cljs functions aren't IWithMeta
20:47gfredericksyou'd think that would be feasible since JS functions can have properties
20:47hiredmanmetadata on fuctions is fraught with issues
20:48gfredericksor maybe that would require being able to clone functions :/
20:48gfrederickshiredman: what sort?
20:48hiredmangfredericks: the contract for things like with-meta brings equality in to play
20:49hiredman(= x (with-meta x {:foo 1}))
20:49gfredericksah right
20:49gfredericksthat will be false on jvm and js
20:49gfrederickswhat does with-meta do for vars?
20:49hiredmanyou cannot with-meta vars
20:49hiredmanthere are two different metadata paths
20:50hiredmanone for mutable references and one for immutable values
20:50gfredericksoh that's terribly interesting
20:50hiredmanI am sort of surprised you are not aware of this
20:50gfredericksI don't do a whole lot with metadata
20:51gfredericksbut I'll take your expectation as a compliment :)
20:51hiredmanwell there is a single path for reading metadata, two paths for "writing" depending on which interface the object implements
20:52gfredericksso then why not make functions act like reference types?
20:52hiredmanI dunno, cause they aren't?
20:52hiredmanIObj and IReference are the two paths for setting metadata
20:53hiredman(these days, that has changed a few times)
20:53gfrederickswell just because it's called IReference doesn't mean it necessarily has to do with references specifically, does it?
20:53gfredericksjust with non-values?
20:54hiredmanI don't know
20:54gfredericksthe interface seems to have to do strictly with metadata
20:54gfredericksanyhow, good learnings; thanks
21:15dslsdHow do people deploy Clojure web applications? I can't seem to find anything but information about Heroku, but I'd rather have more control over my deployment and environment. Tomcat? Are there any nice "put together" solutions for configuring an EC2 instance and deploying a clojure app to it?
21:18emezeskedslsd: I've heard that it's reasonable to just "lein run" your project
21:18gfredericksexecutable jars good too
21:20emezeskedslsd: You might look at http://palletops.com/ if you want to automate the deployment
21:22hoover_dammdslsd, with ring I believe the default behavior is with jetty or tomcat
21:22hoover_dammdslsd, but there's nothing stopping you from using immutant
21:23gfredericksis there still nothing standard for cljs testing? I'm whipping up a clojure.test immitation for myself atm
21:23hoover_dammit supports ring too
21:25emezeskegfredericks: https://github.com/kumarshantanu/clip-test
21:25emezeskegfredericks: Haven't used it myself, but maybe it's helpful?
21:28gfredericksemezeske: this looks promising; thanks
21:30xeqidslsd: clojars uses an executable jar w/ run-jetty in it. Uses an nginx frontend as well
21:33gfredericksin cljs how do I catch arbitrary errors?
21:33gfredericks(catch js/Error e ...) will miss strings, etc
21:54KhaozWhen i enter in clj execute use '[clojure.string :only (split)] it does not persist for the next commands ?
21:55gfredericksyou have parens around the use?
21:55gfredericksi.e., (use '[clojure.string :only (split)])
21:56Khaozyoure right.. i'm still getting used with the parentheses
21:56Khaozbut i like them, no matter what :D
21:56Khaozgfredericks: thank you very much
21:56gfredericks:)
21:56gfredericksno problem
22:49abalonegfredericks: how's clip-test going for you?
22:50gfredericksabalone: I didn't try it; was already at a point where it was easier to finish building my own, which worked great for my purposes
22:51gfredericksspent all of 25 minutes on getting deftest and is working correctly
22:58abalonegfredericks: wow. nice work! did you see my comment earlier about my cheat?
22:59abaloneas long as i stick to the cljs subset of clj, i can use clojure.test. and when i'm done, copy the file to file.cljs and generate js
23:00gfredericksah right
23:00gfrederickswait wat
23:01gfredericksuse clojure.test for what? running your tests on the jvm?
23:01abaloneyeah :-P lame right?
23:01gfredericks(i.e., did you mean "the clj subset of cljs"?)
23:01abaloneyeah.
23:01gfredericksah ha; gotcha; well I'm testing interactive raphael diagrams
23:02gfredericksI thought for a little bit about trying to use jasmine
23:12gtuckerkelloggi've been using swank-clojure, and am considering moving to nrepl.el. Has anyone modified the clojure-test-mode and midje-mode for nrepl.el? Will clojure-mode eventually expect nrepl instead of slime?
23:20nsxtwhen working with relational databases, is the convention to use hyphens in column names rather than underscores?
23:22nsxti think it makes more sense to dispense with underscores entirely (so as to eliminate the need to process keywords), but it seems like the sql world frowns upon hyphens in identifiers
23:51technomancygtuckerkellogg: clojure-test-mode hasn't been ported yet. clojure-mode itself won't need any changes.
23:51technomancythe stuff that clojure-mode has for slime is unnecessary for nrepl.el because it doesn't have to bootstrap the same way.