#clojure logs

2012-11-01

00:52brainproxy&(clojure.set/union [1] '(2))
00:52lazybot⇒ [1 2]
00:52brainproxydynamic typing ftw!
00:52brainproxy:p
00:58devnzwat
01:08Frozenlo`Oh wow... I just discovered the function 'bean'
01:10Frozenlo`Is there a function to stringify every keyword in a map?
01:18Frozenlo`clojure.walk/stringify-keys
02:03Gmind#join #ruby
02:04mrowelol
02:04GmindOops..
02:14hughfdjacksonI love that lein creates a test folder by default
02:14hughfdjacksonit's refreshing to have the defacto tool hint that that's just the right thing to do
02:29GmindOh, this channel is so crowd
03:15wastrel:[
03:28jyuhello I have a little question, how can i give the parameter a name when calling a function.
03:32foodoojyu: Clojure doesn't support keyword arguments in general. But you can use destructuring with a hash-map for your own functions to support it
03:33jyufoodoo: thanks
03:42foodoojyu: (defn foo [ & args ] (let [{:keys [a b c]} (apply hash-map args)] (list a b c)))
03:42foodoojyu: usage example: (foo :b 2 :c 3 :a 1)
03:43_ulisesfoodoo: you can even (defn f [{:keys [a b c] }] (+ a b c))
03:43_ulises(if I recall correctly)
03:44_ulises,(defn f [{:keys [a b c] }] (+ a b c))
03:44clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
03:47_ulisesactually it'd be (defn f [& {:keys [a b c]}] (+ a b c))
03:48_ulisesyou can even then add an :or { ... } bit to it
03:49jyu_ulises: :) thanks got it
03:57foodoo_ulises: oh, cool. Thanks
04:12dsppi'm using enlive to do some scraping, im ending up with \ characters in the resulting strings
04:12dsppcan't strip this out with trim, its just a slash \
04:12dsppwhy is this, how can i strip these out?
04:23dsppApage43, thanks for the tip
04:24dsppI'd still like to know what this weird \ character is though
05:34luxbockusing Emacs with paredit, is there a shortcut for changing parenthesis into square-brackets?
05:35ejacksonluxbock: don't think so just splice and then slurp
05:35luxbockI typed my function call with [ ] by accident
05:35luxbockalright
05:52ejacksonluxbock: i guess doing it the other way around would be faster and less error prone
06:13wei_get-in seems to have different behavior for clojure and clojurescript: (get-in [1 2 3] [nil] "not found") yields "not found" in clojure but "1" in clojurescript
06:13wei_is there any way to also get the "not found" result in clojurescript for nil reference into a vector?
06:19wei_ok, my workaround is (if (nil? index) "not found" (get-in [1 2 3] [index] "not found"))
07:56mpanIs there something which brings in another ns under a new name, similar to refer? The ns already exists and I wouldn't want to try loading it, because it was created in a different way.
07:57mpanWould require do it? That seems confusing because the usual usage of require is to cause loading, right?
08:57xeqi&(doc alias)
08:57lazybot⇒ ------------------------- clojure.core/alias ([alias namespace-sym]) Add an alias in the current namespace to another namespace. Arguments are two symbols: the alias to be used, and the symbolic name of the target namespace. Use :as in the ns macro in preference to calling this directly. nil
09:04XOXO1hey, I need some kind of basic web server in clojure (using noir?) which would accept POST requests with file uploads and it just needs to response that okay, file was uploaded
09:30S11001001lazybot: mail XOXO1 if all you're doing is accepting multipart/form-data, that doesn't really demand more than basic https://github.com/ring-clojure/ring capabilities
09:30lazybotMessage saved.
09:30pandeirodoes anyone else have problems when killing an nrepl server/client in emacs and then trying to restart? i get error in process filter: error during connect: connection refused
09:49ambrosebsWho would be pleased if my Conj talk was 40 minutes of demoing Typed Clojure at the REPL?
09:50ambrosebsI was thinking of putting some theory in there, but it seems secondary.
09:52mpanIs there a way to get filter and reduce of the same predicate in one pass?
09:52S11001001ambrosebs: theoretically, I'd like to hear about the limitations of the type system and ways to deal with them when ann-ing code
09:54ambrosebsS11001001: right, I think I can convey that without particularly going into the theory.
09:54S11001001not knowing the theory might lead to cargo-cult typing
09:56ambrosebsgood point, I'll have to find a good balance.
09:56ambrosebsThankfully I do have a dissertation I can point to for the more curious
09:59ambrosebsI'll definitely be using the live demos as vehicle to the theory, but it's probably not a good idea to go into much detail.
10:03AntelopeSalad_what would i have to type in the repl to start a server using this ring lib? https://github.com/aesterline/netty-ring-adapter
10:03AntelopeSalad_the instructions do not make it clear
10:03AntelopeSalad_i tried about 10 different things
10:05ejacksonambrosebs: yeah, too much theory is hard to absorb in a talk
10:05ejacksonbetter to show how and why with pointers to the deep stuff to be considered offline with time
10:06S11001001all the why is theory, though, ejackson
10:06ejacksonyeah, but its too hard to grok in a 40 min talk
10:06ejacksonbetter get some concrete examples of what can be done
10:06ejacksonso that you're motivated to figure out the theory, as well as have some concrete notions to tie the theory onto
10:08ejacksonimho, anyway. i am quite slow to understand though
10:12jimdueyambrosebs: looking forward to your conj talk and unsession.
10:12ambrosebsjimduey: awesome :)
10:14ambrosebsjimduey: I'll walk you through the work so far on typing conduits
10:15ejacksoni really liked conduits when I played with them
10:15ejacksontyping them sounds insanely hard
10:16ambrosebsI don't know how jimduey implementing in Clojure TBH, amazing feat
10:17ambrosebsejackson: It's fascinating stuff, and I have a pretty good idea what needs to be done in order to type the full conduit library
10:17ambrosebswell, aside from the really hard bits :D
10:17ejackson:)
10:19tickingHm I'm curious what would be the most idiomatic way to share method implementations between records?
10:20hyPiRionticking: Make the implementations functions, and just use the function.
10:22tickinghyPiRion, hm k ^^ thanks ^^
10:26tickinghm btw is there a way to do it the other way around ^^? Having the same implementation for two protocol methods?
10:27mpanticking: taking advantage of functions-as-values, defining the function, and then just sticking it as a value where you please... so really the same idea as the other case
10:29ejacksonexactly: just call the same function for both extensions of the Protocol
10:29S11001001ticking: Clojure isn't OOA&D friendly
10:30S11001001ticking: and Clojure *hates* implementation inheritance. *Hates.*
10:30tickingmpan I was thinking of something among the line of (defprotocol A (foo [this])) (defprotocol B (foo [this])) (defrecord Fool [] [A B] (foo [this] "bar))
10:31tickingS11001001 yeah I noticed that sucks because I *hate* ;) code dublication ^^
10:31mpanbut you're only duplicating the names
10:31mpanthe definition happens only once
10:31S11001001ticking: we don't have duplication problem because we just write functions to operate on our data structures
10:32S11001001ticking: as a sort of transition to this style, I strongly suggest organizing your methods around the multimethod system instead of protocols/records. You'll get controlled implementation inheritance that way.
10:33hyPiRionticking: I don't think you would (nor should) extend protocols so often that same names becomes an issue.
10:33mpanbut yea, as others have said, you don't usually want a huge tree of relationships as Java would have you make
10:34hyPiRionSo actually, having [A B] would make stuff more complicated in general.
10:35tickingS11001001 right, mutlimethods seem to be the way to go, sucks a bit because speed is a concern too ^^
10:35S11001001ticking: again, it's transitional; the clojure way is really just to write ordinary functions
10:36S11001001ticking: and you know what they say about premature optimization
10:36tickingS11001001 yeah totally agree on that ^^ but grinding through TBs of data is not fun :D
10:37mpansounds interesting, though... where did you get TBs of data to begin with?
10:38tickinghyPiRion it's not by massive extension this occurs, I have two protocols which have their own records (scanned page data, only images, and only xml metadata) and one record which needs both (combined scanned images and metadata)
10:38tickingmpan ocr_ed books
10:38tickingwith a ton of metadata ^^
10:38mpansounds cool
10:39hyPiRionticking: Ah, gotcha
10:39hyPiRionNot saying it's always bad, but it's sometimes a bit dangerous
10:39dnolenticking: I would follow ejackson's advice if you want to share implementations - create a shared function that protocol implementations call.
10:40jimdueyambrosebs: would really like to see your ideas on typing conduit. At some point I'm going to get around to rewriting it using a protocol arrows library.
10:40tickingdnolen yeah but if an implementation is not shared between all records I probably end with function-sharedA function-sharedB e.t.c. seems kinda nasty^^
10:42dnolenticking: without knowing more details about what design you have in mind - can't really tell. core.logic is pretty complicated tho and sharing implementations works fine for me.
10:42ejacksonwell if the function is different for different types...
10:42tickingejackson yeah true, just feels like the langauges job to me ;D
10:42dnolenticking: delegation is possibility as well if your protocol design isn't overly complex
10:43dnolenwhich it shouldn't be
10:43tickingdnolen yeah delegation is probably what I'm ending up with, the protocols introduction video just bashed them so hard that I had hoped there was another way :D
10:44tickingbut thanks a lot everybody :D
10:46mpanticking: which video was that? I think I'd be interested in watching it
10:47tickingmpan, http://vimeo.com/11236603 there you go ^^
10:47mpanthanks!
10:59ambrosebsjimduey: sounds great, can't wait!
11:12CubicMaybe I have a thinking problem here, but is there any other way for a REPL to interact with a running program except by changing global state?
11:12gfredericksCubic: that sounds plausible; changing local state doesn't sound promising.
11:15Cubicgfredericks: I mean I've been "trained" to understand globals as a Bad Thing, but I really want to develop/debug with a REPL. Would it make sense to expose some essentially local refs/atoms as globals in a sort of (by convention) repl only namespace?
11:19jkkramerCubic: most repl development involves redefinition of functions and constants, and running functions, rather than mutating app data
11:20jkkramermutating app data is ok during development, if your state is stored in refs of some kind
11:24Cubicjkkramer: I guess redefining functions and constants is easier, but I wanted to do things like add and edit entities to/in my world from the REPL to see how it works out
11:26jkkramerCubic: then presumably your entities are stored in ref/atom/agent, so you are free to do that, sure. it can be fun, especially if your app keeps running
11:28mpanIs it safe to drop-while a lazy seq on a pred such that the evaluation may start causing exceptions after pred starts becoming false? Will chunking cause me problems here?
11:30mpanI am looking for "the first x in s such that not p(x)" but evaluating p on anything after x is likely to crash
11:30CubicYep. The way I was thinking was storing the relevant world state in a map ref, doing all the IO in one thread and the rest in one or more other thread(s). I'm still not sure if that's a good idea, but I'll see how it works out. Thanks either way
11:32mpanThe source seems like it might be safe but I'm not sure I'm understanding it correctly.
11:32Cubicmpan: If there are any x for which p(x) is false you will evaluate p at least for one of them with drop-while. Or am I misunderstanding you?
11:33mpanp is monotonic over s
11:33mpanmap p s would look like ... T T T T F F F F ...
11:33mpanI want the first F there
11:34mpantrying to evaluate anything after the first F is... I don't know, but ideally I don't want to try
11:34dnolenmpan: aren't you in control of the sequences?
11:34dnolener sequence
11:34mpanI wrote it rather poorly for anything beyond the standard case
11:35mpanand the standard case is to stop trying to ask for elements after seeing an F
11:35Cubicmpan: I don't know how drop-while is implemented, but if it would keep evaluating after the first F I'd count that as a bug.
11:35TimMcmpan: There is unchunk in amalloy's useful.
11:35mpanas in, I got the sequence from calling iterate
11:35TimMcOh, it won't be chunked, then.
11:35mpanoh awesome!
11:35mpanThanks guys!
11:38TimMcmpan: chunking is an opt-in behavior -- map, for instance, checks whether the incoming seq is chunked, and if so, produces a chunked output.
11:38TimMcI'd be really surprised if drop-while preserved chunking.
11:55dnolenTimMc: drop-while doesn't change chunking
11:56dnolenTimMc: I don't think any of the core seq ops defeat chunking - which is the correct behavior
11:58TimMc&(dorun (take 5 (map #(println %) (range 100))))
11:58lazybot⇒ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 nil
11:58TimMc&(dorun (drop-while #(println %) (range 100)))
11:58lazybot⇒ 0 nil
11:58TimMcIt looks like drop-while doesn't apply that predicate to anything beyond the first false result.
11:59S11001001dnolen: map on 2 or more seqs
12:07uroborus_labsidbknox: What are your thoughts on the pull request I sent you the other day for waltz?
12:13dnolenTimMc: oh right, because the function application for drop-while happens in step - still if you have a chunked seq underneath rest will actually load the next 32 items if it needs too. it doesn't make it go away.
12:13dnolen,(type (seq (drop-while (fn [n] (< n 5)) (range 100))))
12:13clojurebotclojure.lang.ChunkedCons
12:22CubicI thought the question was about whether or not the predicate was applied, not about it's chunkiness.
12:26duck1123uroborus_labs: Have you tried superbobry's fork of waltz? (or my fork of his) Some of his changes are pretty nice
12:26uroborus_labsduck1123: No i have not but I will check it out.
12:27uroborus_labsI was just going to fork it and upload to clojars because git-deps is mucking things.
12:28duck1123I ended up fixing that same issue because those warnings were driving me nuts
12:28uroborus_labsduck1123: Yeah, agreed
12:29uroborus_labsduck1123: Looking at superobry's now
12:29uroborus_labsWhat is different?
12:30duck1123some of the function names are different, he rewrote a big part of it. Saner execution
12:30duck1123He also changed the logging. At one point I was on the fence about that, but I've come around to using his logging system
12:31duck1123My only gripe is it adds a newline at the end of the logs. My attempts to track it down and fix it have failed.
12:37CubicIs it normal that clojure.math.numeric-tower throws out a ton of reflection warnings? I'd think that a numeric library would be better off avoiding reflection
12:39uroborus_labsIs there a better way to include other repos and libs than using lein git-deps?
12:40technomancyuroborus_labs: yes, real deps are always preferable to git-deps
12:41uroborus_labstechnomancy: Agreed, but what is the best way then to use another repo, particularly a forked one? Upload it to clojars yourself?
12:42technomancyuroborus_labs: if the upstream maintainer has abandoned it, sure
12:42uroborus_labstechnomancy: Ok cool
12:42duck1123What if they've just forked it but not provided a release
12:43technomancyif they've forked it then they're not the upstream maintainer
12:43uroborus_labsHmm
12:43technomancyseeing a lot of unofficial forks on clojars is usually a sign that either the maintainer is doing a bad job, or the users of the lib aren't good at communicating
12:44dnolenCubic: TimMc said drop-while doesn't preserve chunking - I was just pointing out that's not true. You could easily see multiple side effects fire off unexpectedly at some future point because the seq fns don't mess w/ chunking.
12:45TimMc"Preserve" is ambiguous there.
12:46TimMcAs long as drop-while doesn't clojure.core/map the predicate across the input and then check the outputs, it's fine. :-)
12:46clerksytechnomancy: Been trying to contact ibdknox through twitter/github/irc. No response.
12:46dnolen,(take 1 (map #(do (println %) %) (drop-while (fn [n] (< n 5)) (range 100)))))
12:46clojurebot(5
12:46clojurebot6
12:46clojurebot7
12:46clojurebot8
12:46clojurebot9
12:46TimMcoh no
12:46clojurebot10
12:46clojurebot11
12:46clojurebot12
12:46clojurebot13
12:46clojurebot14
12:46clojurebot15
12:46clojurebot16
12:46clojurebot17
12:46clojurebot18
12:47clojurebot19
12:47clojurebot20
12:47clojurebot21
12:47clojurebot22
12:47clojurebot23
12:47clojurebot24
12:47clojurebot25
12:47clojurebot26
12:47technomancyquick, someone figure out how to crash clojurebot
12:47llasramwhelp
12:47clojurebot27
12:47clojurebot28
12:47clojurebot29
12:47clojurebot30
12:47Fossi-_-
12:47dnolenha
12:47clojurebot31
12:47clojurebot5)
12:47technomancyclerksy: sounds like uploading a fork could be justified then, but it's a shame
12:47TimMcI specifically used lazybot for my demo earlier. :-)
12:48clerksytechnomancy: Agreed, but he could just be really busy with lighttable :)
12:48technomancyif someone's volunteering to take over maintenance of a library you should always be able to find time to make that happen
12:50mpenetclerksy: what library are you thinking of?
12:51clerksympenet: waltz
12:51clerksyhttps://github.com/ibdknox/waltz/blob/master/src/waltz/state.cljs on line 30 get-in-sm is called before it is defined
12:52clerksyThrows compilation errors
12:52mpenetclerksy: same issue for me with jayq, I asked him earlier if he wanted help with this, as I have a fork with bugfixes & features
12:52clerksympenet: What was the response?
12:52mpenetclerksy: still waiting, I /msg him this time, we'll see. But as you said he must be really busy
12:54TimMctechnomancy: DoS via bot amplification.
12:55mpenetclerksy: fork+publish under your own group-id is fine for a temp solution though
12:56TimMclazybot should probably be set to ignore clojurebot.
12:56clerksympenet: ok cool
13:32ibdknoxclerksy: mpenet: I'm happy to push some of my repos into organizations so that they can be better cared by others :) My time is extremely limited
13:32ibdknoxI've been trying to find someone to really help with korma, as I think it's the one that needs the most work and I *really* don't have time to work on that one
13:33clerksyibdknox: That sounds like a great idea
13:34ibdknoxclerksy: btw, fwiw, those are just warnings - CLJS doesn't suffer from the same limitations that CLJ does :)
13:35ibdknoxclerksy: should be fixed, no question. But they're not functional issues
13:35clerksyibdknox: I know, but I like not having the warnings ;)
13:35mpenetibdknox: That would be great.
13:36ibdknoxlet me get through this release (early next week) and we can figure that out
13:36ibdknoxmpenet: clerksy: sound good?
13:37mpenetibdknox: yup, sounds good
13:37clerksyibdknox: Sounds good to me
13:37ibdknoxgreat :)
13:38CubicTimMc: He doesn't already do that? So if anyone feels like it they can deadlock clojurebot and lazybot?
13:38mpenetibdknox: btw, maybe an organisation is not necessary, you can just add collaborators, but that is your call.
13:39TimMc,(println "&(println \"Cubic: Well, they can do this.\")")
13:39clojurebot&(println "Cubic: Well, they can do this.")
13:39lazybot⇒ Cubic: Well, they can do this. nil
13:39mpenetCubic: worst, flood the channel until one of them is killed
13:39duck1123lazybot prefixes it's output so it won't be picked up by clojurebot
13:40TimMcI haven't figured out how to get a reflective bot-quine going, but it can be used to aplify the attack.
13:40TimMc*amplify
13:40mpenetaww, no infinite ping pong session then
13:41TimMcI've privately tested a command that would eat up about 300 lines of of 80-column scrollback.
13:41ibdknoxclerksy: mpenet: what are your clojars names - mpenet is right for now, I'll add you as collaborators to let you guys keep moving on this
13:42mpenetibdknox: same nick on github
13:43ibdknoxmpenet: added you to jayq, anything else?
13:43mpenetibdknox: thanks, no that's good
13:44ibdknoxyou should be able to push to clojars as well
13:44mpenetgreat
13:54msamiryI'm interested in finding clojurians in Cairo - Egypt, is there any?
14:11technomancyinteresting effort for webby folks building on existing js libs: http://www.webjars.org/
14:13hiredmantechnomancy: slick
14:15technomancyexcept it doesn't mention the :repositories entry to add?
14:15technomancyoh, they're all in central. that's interesting.
14:15xeqineat, too bad they're not sorted
14:16duck1123hmm... If i add these, will cljsbuild pick them up? Anyone try?
14:17hiredmanduck1123: "pick them up" in what way?
14:18hiredmanthe common case I imagine would be to just serve them as resources out of the jars
14:20mpenetibdknox: all cleaneded, I released under 0.2.0 since there is a possible breaking change for people using it ($.ajax feature for guessing decoder from mimetypes)
14:20duck1123I was thinking about external libs like how cljs libs work, but I realize it's not that easy
14:21hiredmanyou would want an extern file for the libraries
14:21hiredmanwhich, I still have no idea how to do
14:22hiredmanthere is some website where which supposedly has some code to auto generate them
14:22hiredmanhttp://www.dotnetwise.com/Code/Externs/
14:22hiredmandunno if it works
14:25zackzackzackIs there a way to make functions available in a namespace that were defined outside of the namespace originally?
14:26S11001001zackzackzack: do you mean s,available in,be exported from,?
14:27zackzackzackSort of. So the context is that I am writing a library.
14:27S11001001zackzackzack: and you want a "export commonly used stuff" facade over the more specific modules
14:27zackzackzackI think so
14:28mpenetzackzackzack: useful has a alias-ns fn for that
14:29mpenetzackzackzack: an example here: https://github.com/flatland/useful/blob/develop/src/useful/core.clj
14:29dnolenibdknox: ping
14:29S11001001zackzackzack: there's no built-in facility for that. But namespaces are mutable and first-class, so you can iterate over ns-publics of a space, interning each. compojure had immigrate, and I guess what mpenet said is that in a box.
14:29mpenetit will alias the entire ns, but there is alias-var also I think
14:30zackzackzackYeah! https://groups.google.com/forum/?fromgroups=#!topic/clojure/GAGF38uI1-o
14:30zackzackzackGreat, thank you S11001001 and mpenet
14:52clerksyidbknox: I am in the middle of setting up a new github and clojars account. My current one is for a psuedonym while this is not.
14:57TylerGillieswhat does in means in "contains?" where its constant or logarithmic time?
14:57nDuffTylerGillies: What part of that isn't clear?
14:58nDuffTylerGillies: it's a promise that it'll be faster than O(n).
14:58TylerGilliesnDuff: oh gotcha
14:58TylerGilliesthanks
15:05mklappstuhlI have a funtction that works when retyped at the repl but doesnt when I define it in the a file ...
15:05mklappstuhlhttps://www.refheap.com/paste/6325
15:05TimMcmklappstuhl: Does it depend on something defined earlier in the REPL?
15:05mklappstuhlArityException Wrong number of args (0) passed to: PersistentArrayMap clojure.lang.AFn.throwArity (AFn.java:437)
15:06hiredmanmklappstuhl: testfund is not a function
15:06TimMcmklappstuhl: Oh, that's because you're trying to call {name trades} as a fn with no args.
15:08mklappstuhlTimMc, ahhh
15:08TimMcAlso, what's with fund's arity? It takes two args yet you're calling it with 3 or 5.
15:09tgoossensHi
15:09mklappstuhlTimMc, I had [name & trades] earlier and changed it trying to debug the isue
15:10tgoossensWhat would be an efficient way to parse this?
15:10tgoossenshttp://pastebin.com/1WwKD3Yb
15:10TimMcmklappstuhl: If that had been the issue it would have made helping very, very difficult.
15:10tgoossensit is a syntax for encoding a maze
15:10tgoossensfirst two numbers are dimensions
15:10clerksyibdknox: My new github is "clerksy" and my new clojars is "clerksy"
15:10clerksyibdknox: Thanks
15:10tgoossensFor simplicity lets say that every token must be matched on a number
15:12tgoossensYou don't have to make an actual algorithm (however that would always be nice :D) . just giving suggestions is fine :)
15:12mklappstuhlTimMc, sorry then. how would I have to change the testfund method?
15:13TimMcmklappstuhl: (defn testfund [] ...)
15:13hiredmanfunction, not a method
15:21TimMctgoossens: You haven't provided enough info about the format.
15:22tgoossensOk
15:22tgoossenswhat info are you missing?
15:22tgoossensIs it clearer if i just say
15:22tgoossensthat the all the commands could just as well be A B C D E ...
15:24TimMcAre newlines significant?
15:24TimMcIs that a comment?
15:25TimMcIf so, can comments occur anywhere, or just at the beginning of a line? What if there is just some whitespace before the comment?
15:28tgoossens# is a comment line
15:32tgoossensbut nvm. I think i got it :)
15:36tgoossensAnyone here a regex expert?
15:37gfredericks~anyone
15:37clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
15:38tgoossensOk thanks for the tip
15:38tgoossenskinda new here ;)
15:39uvtctgoossens: what are you trying to match?
15:39tgoossensHow can I in regex match the tokens "Straight.S.55" and "DeadEnd.N" in http://pastebin.com/1WwKD3Yb . While ignoring the lines with # (comment lines)
15:39bbloomtgoossens: regexes are just one of many tools to use for this sort of stuff
15:40bbloomtgoossens: why not filter blank and comment lines first?
15:40tgoossensmmyes :D
15:41tgoossensI'm using a library that makes it very easy to do what i want to do. All i need is a way to regexmatch that token /D
15:41tgoossens:D
15:41dakroneanyone have an idea how to get around "java.lang.IllegalArgumentException: Mismatched return type: verify, expected: void, had: java.lang.Object" when reifying a method that has a return type of void?
15:41tgoossens(some project of last year, not a public lib or something)
15:42CubicI suppose it could be done, but it's really much easier when you do it like bbloom said.
15:43gfredericksregexes aren't very good at negating things
15:43gfredericksthough technically they can :)
15:43hiredmandakrone: put a nil at the end
15:43tgoossensmm ok
15:43tgoossensi'll filter out the comments
15:43dakronehiredman: doesn't work, same error
15:43tgoossensthat solves that
15:43hiredmandakrone: or maybe ^void before the name of the method
15:44Cubic#"^[^#]*(Straight\.S\.55|DeadEnd\.N)"?
15:44gfredericks:)
15:44tgoossensow
15:45tgoossensi wasn't clear enough
15:45CubicI think you might need another 2 pairs of parantheseses, but other than that I think this works
15:45amalloy&(reify java.util.Collection (add [this x] nil))
15:45amalloyoops, that's boolean
15:45lazybot⇒ #<sandbox7657$eval421852$reify__421853 sandbox7657$eval421852$reify__421853@1dd105e>
15:45mpenetShould tools.namespace work on cljs files? It seems to be a trival modification. This would allow libs like codox to work on cljs without modifications (or reinventing the wheel). https://github.com/clojure/tools.namespace/blob/master/src/main/clojure/clojure/tools/namespace/file.clj#L30
15:45tgoossensI just gave those two as example
15:45amalloy&(reify java.util.Collection (clear [this] nil))
15:45lazybot⇒ #<sandbox7657$eval421864$reify__421865 sandbox7657$eval421864$reify__421865@f2d92c>
15:45mpenetor maybe I am missing something
15:45amalloydakrone: ie, in general reify works out of the box for void methods. more detail is needed to solve your problem
15:45tgoossensi need to be able to match any command in the form xx.yy.zz or xx.yy
15:45CubicThen insert there the regex for your token :O
15:45dnolenmpenet: it probably easily could
15:45mpenetI am asking here because my CA is still in the middle of the Atlantic I guess. No access to clj-dev
15:46tgoossensi'll google a bit more
15:46tgoossenshaven't got much experience with regex
15:46Cubicxx and yy can be what? Digits, letters?
15:46dakroneamalloy: hiredman: this is what it looks like: http://p.draines.com/1351799152559b274549e.txt
15:46mpenetdnolen: Should I fill a ticket for that?
15:46tgoossensxx and yy strings. zz numbers
15:46tgoossens*digits
15:46tgoossens*chars
15:47Cubicwhat kind of strings?
15:47dnolenmpenet: it's up to you, but it sounds like a good idea. libs that "just work" w/ CLJS are always nice.
15:47clojurebotkind of interesting if unfold is the intermediate steps of a fold
15:47mpenetdnolen: will do then
15:47tgoossensnvm
15:47tgoossensi think i found it :)
15:48tgoossensoh
15:48mpenetdnolen: it is on the CLJ jira, or is there a separate one for these sub projects
15:48tgoossensall the examples are given in the link
15:48dnolenmpenet: all contrib projects have their own JIRA
15:48mpenetnevermind found it
15:48tgoossensi'm almost there
15:48tgoossens[^\s"']+|"([^"]*)"|'([^']*)'
15:49tgoossensbut i'll stop asking half-complete questions
15:49tgoossensso nevermind :)
15:52TimMctgoossens: 1) Filter blank and comment lines, 2) remove that initial line, 3) split on whitespace, 4) split each element on \.
15:53TimMcNo regex involved, except maybe for step 1.
15:59dakronegah, I can never remember what the type hint for an array of strings is
16:01dnolendakrone: who can?
16:02hiredmanpeople who know the syntax for jvm type descriptors
16:02gfredericksthat sounds almost tautological
16:02dakronedoes anybody know what it is??
16:02lazybotdakrone: Definitely not.
16:03dnolen,(class (make-array String 0))
16:03clojurebot[Ljava.lang.String;
16:03dakronethere it is
16:04gfredericksbut that's not readable; do you embed that in a string to do the type hint?
16:04SegFaultAXI just had the weirdest interview of my life. The candidate literally sprinted out of our office after I asked him the most basic technical question ever.
16:04mpenetwoa, no project.clj file :( it's going to take more time to test than to patch
16:04SegFaultAXLike literally stood up, told me "if this is part of the qualification, I think we're done here" and ran out of our office.
16:05gfredericksSegFaultAX: I can't tell if that implied too hard or too easy
16:05SegFaultAXgfredericks: Sorry, it was too hard.
16:06gfrederickswell at least he didn't waste your time any further
16:06SegFaultAXgfredericks: That's true. But the manner in which he did it was so bizarre.
16:07SegFaultAXgfredericks: Maybe I need to find even easier questions :(
16:08dnolengfredericks: yes put it in a string
16:10hyPiRionSegFaultAX: On what scale would you rate the problem, based on difficulty?
16:10hyPiRionIs it like the medium questions on 4clojure, the hard ones, or is it like Project Euler hard?
16:10SegFaultAXhyPiRion: For someone who's been writing code for a couple weeks, maybe a 4 out of 10. For someone with years of experience, maybe a 1.
16:11hyPiRionOh, okay.
16:11gfredericksreversing a string by calling its #reverse method?
16:11SegFaultAXhyPiRion: Let me tell you the exact question: given a dictionary/set/list/whatever you want of english words, write for me an algorithm "splittable?" that can determine whether the string can be split at any place such that the left and right sides are both in the dictionary.
16:11SegFaultAXhyPiRion: If the entire word is in the dictionary, you can return true immediately.
16:12SegFaultAXhyPiRion: The examples I offer are "helloworld" should return true, "lkajgh" should return false, and "hello" should return true.
16:12hyPiRionSegFaultAX: Well, yeah, that's pretty easy. I guess only one split.
16:12SegFaultAXhyPiRion: There are obvious ways to make it harder, but we didn't even get to that. Like how do you handle n-splits? What if you have a pathological dictionary and input string, etc.
16:13SegFaultAXThis was just, given a string and a dictionary of some kind, determine if it's splittable.
16:13CheironHi, I set :java-source-paths ["src/main/java"] in project.clj then lein javac why my Java class isn't compiled?
16:14hyPiRionSegFaultAX: Yeah, but I'd assume most people with at least two year of programming experience would figure our a solution
16:14SegFaultAXhyPiRion: This guy had 8 - 10 years. At least that's what he said.
16:14hyPiRionMaybe you dodged a bullet, or maybe my view on the world is strange.
16:16duck1123SegFaultAX: so should "hellolkajgh" return false?
16:17gfredericks(fn [dict word] (or (dict word) (some (fn [i] (and (dict (subs word 0 i)) (dict (subs word i)))) (range 1 (count word)))))
16:18ytnnojhey, I'd like to take a value v, a list args = [a b c] and a function f(v, arg) and get f(f(f(v, a), b, c)
16:18ytnnojis there an inbuilt macro that would do something like that
16:18hammer&(let f [(fn [dict word] (or (dict word) (some (fn [i] (and (dict (subs word 0 i)) (dict (subs word i)))) (range 1 (count word)))))] (f '("hello" "world") "helloworld")))
16:18lazybotjava.lang.IllegalArgumentException: let requires a vector for its binding in clojure.core:1
16:18dnolenytnnoj: you want reduce
16:19duck1123(doc reduce)
16:19clojurebot"([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val is supplied, returns the resu
16:19ytnnojfor arbritatry values of args, of course
16:19hammer&(let [f (fn [dict word] (or (dict word) (some (fn [i] (and (dict (subs word 0 i)) (dict (subs word i)))) (range 1 (count word)))))] (f '("hello" "world") "helloworld")))
16:19lazybotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn
16:19hammerokay i give up
16:19hammeri just wanted to see if it worked
16:19dnolen,(reduce str "foo" ["a" "b" "c"])
16:19clojurebot"fooabc"
16:19ytnnojoh of course i do dnolen, cheers.
16:20jasonjcknHow does :state work in gen-class, my state method isn't being executed https://www.refheap.com/paste/6328
16:23Apage43,(let [word "hamstar" dict #{"ham" "star"}] (filter (partial every? dict) (for [i (range (count word))] (mapv (partial apply str) [(take i word) (drop i word)]))))
16:23clojurebot(["ham" "star"])
16:24jasonjcknnvm
16:25duck1123You probably want to start at the end of the input, that way if the word matches the dict it'll finish quickly
16:26amalloyduck1123: or start at 0 instead of at 1 :P
16:27hyPiRionNow let's do it for n splits.
16:28Apage43(take 1) in front of that one would stop at the first found split, and it tries 0 first, so, to get a short-circuiting boolean one just wrap it in (empty? (first
16:28Apage43er, rather, nil?
16:28Apage43er, rather, just (first
16:28Apage43bleh
16:28duck1123It seems like one of those questions where seeing how the person handles the challenge is more important than if they get the right answer.
16:29duck1123walking out is not the right way to handle the challenge
16:30hyPiRionduck1123: Walking out is not the right way to handle any challenge, I believe
16:30hyPiRionExcept maybe if the challenge is to walk out.
16:36TimMcSegFaultAX: Maybe a dictionary killed his mother.
16:37gfredericksq
16:37duck1123Is that what they mean by dictionary attack?
16:39mabes,(name :foo/bar)
16:39clojurebot"bar"
16:40mabesI take it that the above is relating to namespace considerations? I was expecting "foo/bar"
16:41TimMcYes, a symbol is a local part with an optional namespace part.
16:41TimMcerr, that's a keyword, sorry
16:42mabesyeah, I get it.. it helps in cases where you have:
16:42mabes,(name ::foo)
16:42clojurebot"foo"
16:42mabes,::foo
16:42clojurebot:sandbox/foo
16:42TimMcFun fact: A keyword has a symbol under the surface.
16:43TimMc&(.sym :foo/bar)
16:43lazybot⇒ foo/bar
16:43mabesahh, that will do the trick
16:43mpenetdnolen: Patch sent, I allow anything matching #"\.clj.?$", this would allow clj, cljs, cljc, cljx etc to be supported also, maybe it's overkill, we'll see what Stuart says.
16:43mabes,(str (.sym :foo/bar))
16:43clojurebot"foo/bar"
16:44mabesTimMc: thanks for that fun fact :)
16:46SegFaultAXduck1123: Yes, that's correct.
16:47SegFaultAXduck1123: There isn't anything tricky going on with the problem. It's really as simple as it sounds.
16:47luxbockI'm trying to follow along the book Joy of Clojure, chapter 3.4.2 where he talks about using java.awt.Frame to draw a xor-pattern
16:48luxbockI added up the code he talks about into a file (I didn't create a new lein project, but instead put it into the /src/ folder of an existing project that I Was trying out some other stuff with
16:48TimMcSegFaultAX: That's a fun question, I'm stealing it.
16:49SegFaultAXTimMc: It's really fun when you ramp up the difficulty.
16:49luxbockbut I when I run the code I get CompilerException java.lang.ClassNotFoundException: jawa.awt.Frame
16:49luxbockhere's what I have in my .clj file: http://pastebin.com/5Jkpgezu
16:49luxbockis it an issue with namespace?
16:50raekluxbock: you got cut off at "...I Was trying out some other stuff with"
16:50TimMcYes, you need an :import.
16:50luxbockoh
16:50TimMcand a ns statement at the top, for that matter
16:50raekluxbock: no, you have a typo in "java" :)
16:50raekline 5
16:50raekit says "jawa"
16:51luxbockoh god damnit
16:51TimMcOh hah! That too.
16:51luxbockI went through that file more than a few times
16:51TimMcThat's right, if it's package-qualified, it doesn't need an import.
16:51technomancy"jawa" is javanese
16:52luxbockI figured that since the line got a proper syntax highlight that it must be correct, so didn't realize to look more carefully
16:53SegFaultAXluxbock: That'll teach ya that (not= syntactic-correctness logical-correctness)
16:54nbeloglazovHi. Is there way to force printing from separate thread go to visible buffer, so I can see output?
16:54luxbockyeah, I'm trying to learn Emacs and Clojure at the same time, not having that much experience with programming to begin with so it's rather slow beginnings
16:54amalloyi dunno, i've never written code that made it past the reader and didn't correctly solve every present and future problem i wanted to solve
16:54SegFaultAXamalloy: Magical fingers, I guess?
16:55technomancyamalloy: you forgot to say "...in haskell"
16:55amalloyhaha, i was thinking that technomancy
16:55amalloySegFaultAX: more like selective memory
16:55raeknbeloglazov: you could try (alter-var-root #'*out* (constantly *out*)) in your repl
16:55nbeloglazovraek: does it have same effect if I create bound function via bound-fn?
16:56nbeloglazovfrom repl
16:56raeknbeloglazov: that should work too
16:57nbeloglazovraek: no, it doesn't help :(
16:57luxbockalso, now that I managed to create that java-frame, how do I kill it without messing up the process that runs nrepl inside Emacs?
16:57nbeloglazovI think it's more complicated than just repl
16:57raeknbeloglazov: what repl are you using? swank? nrepl?
16:57nbeloglazovlightable :)
16:58raekoh, is this printing via clojure functions or direct cals to System.out?
16:58nbeloglazovvia println
16:59nbeloglazovclojure functions
16:59TimMcamalloy: Really? You've never wanted to solve any problem?
17:00amalloyTimMc: yeah, i just like adding features
17:00raekdo *out* and @(future *out*) return the same thing?
17:00TimMcOr you've never written code? :-P
17:00TimMcraek: I guess you're asking whether dynamic bindings are conveyed?
17:01raekhrm. right. forgot that 'future' does that now...
17:08nbeloglazovCool. If I do (.write *out* "Hello") it is printed. If I do (def out *out*) (.write *out* "Hello") it just stored in out and not printed.
17:08nbeloglazov(.write out "Helll") in last command
17:11technomancysounds like the repl is assuming disposable streams on a per-entry basis
17:11technomancyearly versions of nrepl.el had that bug
17:15nbeloglazovtechmonancy: When I do (def out *out*) and (= out *out*) immediately after that. It returns false. How it is possible?
17:15nbeloglazovtechnomancy*
17:16TimMcnbeloglazov: What he's saying is that a new output stream is being created for each execution.
17:16TimMc*evaluation
17:16technomancyyeah, it's a bug
17:16requehey
17:16technomancyhead to the issue tracker I guess?
17:16technomancysince apparently you aren't allowed to fix it yourself
17:18requei'm trying to get a browser repl going using cljs-template, but I can't seem to figure out how to connect to the browser repl. Anyone got any experience with it or similar?
17:29nbeloglazovI've created a bug. It seems I'll need to collect all output from different threads to atom and then print it from time to time for now.
18:05luxbockwhen I use emacs and I execute a faulty command, is there a way to disable the screen from flooding with the error messages? I could do just fine with a more succinct version
18:05luxbockwith nrepl that is
19:20brainproxyhow can I test the relationship between (class '()) and (class '(1))
19:22hiredman,(empty? (clojure.set/intersection (supers (class '())) (supers (class '(1)))))
19:22clojurebotfalse
19:23hiredman,(contains? (clojure.set/intersection (supers (class '())) (supers (class '(1)))) java.util.List)
19:23clojurebottrue
20:27mklappstuhlIs there a way to start a repl in function so that I can inspect stuff inside the execution scope?
20:27frenchyphello
20:28frenchypcan I use leiningen checkout dependencies to include 1 lein project into a 2nd one?
20:29mklappstuhlfrenchyp, why not?
20:29ivanmklappstuhl: there's a macro for that
20:29mklappstuhlyou have to have it on clojars or somewhere of course
20:29mklappstuhlivan, does this macro have a name? :)
20:29frenchypmklappstuhl: oh, I am working on both at the same time
20:29ivan; local-bindings and eval-with-locals are from http://gist.github.com/252421
20:29ivan; Inspired by George Jahad's version: http://georgejahad.com/clojure/debug-repl.html
20:30frenchyp1 is the lib i m working on, the other is wrappnig code to interact with it
20:30frenchypso pushing to clojars each time will get tiresome :)
20:34tmciverfrenchyp: I don't use lein2, but I know in lein1 you could do it 2 different ways: you could 'lein install' one project jar in your local .m2 dir, or you can use a checkout deps.
20:44frenchyptmciver: can't get the checkout deps to work, i'll try the other one
20:46tmciverfrenchyp: are you using 'checkout-deps-share' as shown in this sample project.clj: https://github.com/technomancy/leiningen/blob/preview/sample.project.clj?
20:46tmciverfrenchyp: I think checkout deps would make your life easier.
20:51frenchypi'll test as soon as I can (upgrading to latest lein 2 now , and tethering thru my phone so it takes for ever)
20:51frenchypbut , if i'm reading the default values properly , it should be setup alreeady
21:04frenchypdoesn't work
21:13frenchypah, got it
21:13frenchypthe project I was linking to in checkouts had a '-' in its name. somewhow it didn't like it
21:14frenchyphmm, spoke too fast, wrong dir
21:53devnHow is it true that compojure still depends on 1.2.1?
21:55devn*shrug*
21:58gfredericksswitch it to 1.5 and run the tests?
22:08xeqiit doesn't use anything thats changed or new past 1.2.1
22:46myguidingstarHi. Anyone can tell me how to write a handler (with custom evaluator) for nrepl server?
23:09xeqimyguidingstar: are you wanting to make a middleware that handles a custon op?
23:11myguidingstarwell, I'm not sure what op is
23:12myguidingstarAll I want is to change the evaluator with my custom one
23:12myguidingstarAnything else should be kept
23:18xeqisounds like you want to write a custom middleware for the "eval" op. perhaps looking at the builtin one can help; https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/interruptible_eval.clj#L153
23:19myguidingstarThanks for your help, I'm reading it, too
23:21xeqiif you're able to rewrite the :code form then just delegating to the eval op might be easier, like how load-file works
23:27myguidingstarxeqi: I don't understand, or maybe I didn't read enough. Where is :code form or load-file?
23:27xeqihttps://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/load_file.clj#L61
23:28xeqithat one is a nrepl middleware that implements a new :op
23:28xeqi"load-file", and rewrites the :code to use the eval :op
23:29xeqiwell, really just creates the :code form from the stuff it wants from its custom op arguments
23:30xeqibut it might be possible to create a middleware that checks for :op "eval" and rewrites the :code form, depending on how custom your evaluator is
23:32myguidingstarI'd try it now
23:34xeqiheh, I think thats what piggieback does
23:34xeqithough it gets pretty complex since it sets up a cljs environment
23:34xeqihttps://github.com/cemerick/piggieback/blob/master/src/cemerick/piggieback.clj#L182
23:35frenchyptmciver so the pb is when I add the checkout dep to :dependencies. If I don't do that it works...
23:38myguidingstaromg I didn't know piggieback existed
23:38myguidingstarthanks a lot, xeqi
23:38xeqimyguidingstar: was that what you wanted to do?
23:39xeqirun a cljs repl through nrepl
23:39myguidingstarNo, but that will help a lot. In fact I'm writing a repl for clojurejs
23:42myguidingstarI guest I will just have to make a clone of `cljs-eval`
23:42xeqifrenchyp: what kind of error are you having with checkouts?
23:44frenchypxeqi: i am trying to setup a 2 projects, one a sub project of the other. I am trying with brand new empty projects. If I declare one in the :dependencies of the other, it doesn't work. If I don't add the dependency and just have the checkouts symlink, it works
23:45frenchypit doesn't work = could not resolve dependencies when running lein repl
23:46xeqifrenchyp: yeah, the checkout feature is meant to share the source from the sub-project to the parent; it doesn't change the dependency resolution in any way
23:47xeqiso it expects the sub-project to be in a repo somewhere for finding out sub-sub-deps and such
23:50frenchypxeqi: hmm, ok. Am I reading the lein tuto wrong?
23:50frenchypin the checkout section, it says "Libraries located under the checkouts directory take precedence over libraries pulled from repositories, but this is not a replacement for listing the project in your main project's :dependencies; it simply supplements that for convenience.
23:50frenchyp"
23:55xeqifrenchyp: that means it expects the sub project to be in :dependencies, and availiable in a repo. Then it lets the checkout source take precedence over the jar file it pulls down