2012-11-01
| 00:52 | brainproxy | &(clojure.set/union [1] '(2)) |
| 00:52 | lazybot | ⇒ [1 2] |
| 00:52 | brainproxy | dynamic typing ftw! |
| 00:52 | brainproxy | :p |
| 00:58 | devn | zwat |
| 01:08 | Frozenlo` | Oh wow... I just discovered the function 'bean' |
| 01:10 | Frozenlo` | Is there a function to stringify every keyword in a map? |
| 01:18 | Frozenlo` | clojure.walk/stringify-keys |
| 02:03 | Gmind | #join #ruby |
| 02:04 | mrowe | lol |
| 02:04 | Gmind | Oops.. |
| 02:14 | hughfdjackson | I love that lein creates a test folder by default |
| 02:14 | hughfdjackson | it's refreshing to have the defacto tool hint that that's just the right thing to do |
| 02:29 | Gmind | Oh, this channel is so crowd |
| 03:15 | wastrel | :[ |
| 03:28 | jyu | hello I have a little question, how can i give the parameter a name when calling a function. |
| 03:32 | foodoo | jyu: 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:33 | jyu | foodoo: thanks |
| 03:42 | foodoo | jyu: (defn foo [ & args ] (let [{:keys [a b c]} (apply hash-map args)] (list a b c))) |
| 03:42 | foodoo | jyu: usage example: (foo :b 2 :c 3 :a 1) |
| 03:43 | _ulises | foodoo: 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:44 | clojurebot | #<Exception java.lang.Exception: SANBOX DENIED> |
| 03:47 | _ulises | actually it'd be (defn f [& {:keys [a b c]}] (+ a b c)) |
| 03:48 | _ulises | you can even then add an :or { ... } bit to it |
| 03:49 | jyu | _ulises: :) thanks got it |
| 03:57 | foodoo | _ulises: oh, cool. Thanks |
| 04:12 | dspp | i'm using enlive to do some scraping, im ending up with \ characters in the resulting strings |
| 04:12 | dspp | can't strip this out with trim, its just a slash \ |
| 04:12 | dspp | why is this, how can i strip these out? |
| 04:23 | dspp | Apage43, thanks for the tip |
| 04:24 | dspp | I'd still like to know what this weird \ character is though |
| 05:34 | luxbock | using Emacs with paredit, is there a shortcut for changing parenthesis into square-brackets? |
| 05:35 | ejackson | luxbock: don't think so just splice and then slurp |
| 05:35 | luxbock | I typed my function call with [ ] by accident |
| 05:35 | luxbock | alright |
| 05:52 | ejackson | luxbock: i guess doing it the other way around would be faster and less error prone |
| 06:13 | wei_ | 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:13 | wei_ | is there any way to also get the "not found" result in clojurescript for nil reference into a vector? |
| 06:19 | wei_ | ok, my workaround is (if (nil? index) "not found" (get-in [1 2 3] [index] "not found")) |
| 07:56 | mpan | Is 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:57 | mpan | Would require do it? That seems confusing because the usual usage of require is to cause loading, right? |
| 08:57 | xeqi | &(doc alias) |
| 08:57 | lazybot | ⇒ ------------------------- 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:04 | XOXO1 | hey, 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:30 | S11001001 | lazybot: 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:30 | lazybot | Message saved. |
| 09:30 | pandeiro | does 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:49 | ambrosebs | Who would be pleased if my Conj talk was 40 minutes of demoing Typed Clojure at the REPL? |
| 09:50 | ambrosebs | I was thinking of putting some theory in there, but it seems secondary. |
| 09:52 | mpan | Is there a way to get filter and reduce of the same predicate in one pass? |
| 09:52 | S11001001 | ambrosebs: theoretically, I'd like to hear about the limitations of the type system and ways to deal with them when ann-ing code |
| 09:54 | ambrosebs | S11001001: right, I think I can convey that without particularly going into the theory. |
| 09:54 | S11001001 | not knowing the theory might lead to cargo-cult typing |
| 09:56 | ambrosebs | good point, I'll have to find a good balance. |
| 09:56 | ambrosebs | Thankfully I do have a dissertation I can point to for the more curious |
| 09:59 | ambrosebs | I'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:03 | AntelopeSalad_ | 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:03 | AntelopeSalad_ | the instructions do not make it clear |
| 10:03 | AntelopeSalad_ | i tried about 10 different things |
| 10:05 | ejackson | ambrosebs: yeah, too much theory is hard to absorb in a talk |
| 10:05 | ejackson | better to show how and why with pointers to the deep stuff to be considered offline with time |
| 10:06 | S11001001 | all the why is theory, though, ejackson |
| 10:06 | ejackson | yeah, but its too hard to grok in a 40 min talk |
| 10:06 | ejackson | better get some concrete examples of what can be done |
| 10:06 | ejackson | so that you're motivated to figure out the theory, as well as have some concrete notions to tie the theory onto |
| 10:08 | ejackson | imho, anyway. i am quite slow to understand though |
| 10:12 | jimduey | ambrosebs: looking forward to your conj talk and unsession. |
| 10:12 | ambrosebs | jimduey: awesome :) |
| 10:14 | ambrosebs | jimduey: I'll walk you through the work so far on typing conduits |
| 10:15 | ejackson | i really liked conduits when I played with them |
| 10:15 | ejackson | typing them sounds insanely hard |
| 10:16 | ambrosebs | I don't know how jimduey implementing in Clojure TBH, amazing feat |
| 10:17 | ambrosebs | ejackson: 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:17 | ambrosebs | well, aside from the really hard bits :D |
| 10:17 | ejackson | :) |
| 10:19 | ticking | Hm I'm curious what would be the most idiomatic way to share method implementations between records? |
| 10:20 | hyPiRion | ticking: Make the implementations functions, and just use the function. |
| 10:22 | ticking | hyPiRion, hm k ^^ thanks ^^ |
| 10:26 | ticking | hm btw is there a way to do it the other way around ^^? Having the same implementation for two protocol methods? |
| 10:27 | mpan | ticking: 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:29 | ejackson | exactly: just call the same function for both extensions of the Protocol |
| 10:29 | S11001001 | ticking: Clojure isn't OOA&D friendly |
| 10:30 | S11001001 | ticking: and Clojure *hates* implementation inheritance. *Hates.* |
| 10:30 | ticking | mpan 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:31 | ticking | S11001001 yeah I noticed that sucks because I *hate* ;) code dublication ^^ |
| 10:31 | mpan | but you're only duplicating the names |
| 10:31 | mpan | the definition happens only once |
| 10:31 | S11001001 | ticking: we don't have duplication problem because we just write functions to operate on our data structures |
| 10:32 | S11001001 | ticking: 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:33 | hyPiRion | ticking: I don't think you would (nor should) extend protocols so often that same names becomes an issue. |
| 10:33 | mpan | but yea, as others have said, you don't usually want a huge tree of relationships as Java would have you make |
| 10:34 | hyPiRion | So actually, having [A B] would make stuff more complicated in general. |
| 10:35 | ticking | S11001001 right, mutlimethods seem to be the way to go, sucks a bit because speed is a concern too ^^ |
| 10:35 | S11001001 | ticking: again, it's transitional; the clojure way is really just to write ordinary functions |
| 10:36 | S11001001 | ticking: and you know what they say about premature optimization |
| 10:36 | ticking | S11001001 yeah totally agree on that ^^ but grinding through TBs of data is not fun :D |
| 10:37 | mpan | sounds interesting, though... where did you get TBs of data to begin with? |
| 10:38 | ticking | hyPiRion 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:38 | ticking | mpan ocr_ed books |
| 10:38 | ticking | with a ton of metadata ^^ |
| 10:38 | mpan | sounds cool |
| 10:39 | hyPiRion | ticking: Ah, gotcha |
| 10:39 | hyPiRion | Not saying it's always bad, but it's sometimes a bit dangerous |
| 10:39 | dnolen | ticking: I would follow ejackson's advice if you want to share implementations - create a shared function that protocol implementations call. |
| 10:40 | jimduey | ambrosebs: 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:40 | ticking | dnolen 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:42 | dnolen | ticking: 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:42 | ejackson | well if the function is different for different types... |
| 10:42 | ticking | ejackson yeah true, just feels like the langauges job to me ;D |
| 10:42 | dnolen | ticking: delegation is possibility as well if your protocol design isn't overly complex |
| 10:43 | dnolen | which it shouldn't be |
| 10:43 | ticking | dnolen 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:44 | ticking | but thanks a lot everybody :D |
| 10:46 | mpan | ticking: which video was that? I think I'd be interested in watching it |
| 10:47 | ticking | mpan, http://vimeo.com/11236603 there you go ^^ |
| 10:47 | mpan | thanks! |
| 10:59 | ambrosebs | jimduey: sounds great, can't wait! |
| 11:12 | Cubic | Maybe 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:12 | gfredericks | Cubic: that sounds plausible; changing local state doesn't sound promising. |
| 11:15 | Cubic | gfredericks: 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:19 | jkkramer | Cubic: most repl development involves redefinition of functions and constants, and running functions, rather than mutating app data |
| 11:20 | jkkramer | mutating app data is ok during development, if your state is stored in refs of some kind |
| 11:24 | Cubic | jkkramer: 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:26 | jkkramer | Cubic: 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:28 | mpan | Is 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:30 | mpan | I 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:30 | Cubic | Yep. 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:32 | mpan | The source seems like it might be safe but I'm not sure I'm understanding it correctly. |
| 11:32 | Cubic | mpan: 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:33 | mpan | p is monotonic over s |
| 11:33 | mpan | map p s would look like ... T T T T F F F F ... |
| 11:33 | mpan | I want the first F there |
| 11:34 | mpan | trying to evaluate anything after the first F is... I don't know, but ideally I don't want to try |
| 11:34 | dnolen | mpan: aren't you in control of the sequences? |
| 11:34 | dnolen | er sequence |
| 11:34 | mpan | I wrote it rather poorly for anything beyond the standard case |
| 11:35 | mpan | and the standard case is to stop trying to ask for elements after seeing an F |
| 11:35 | Cubic | mpan: 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:35 | TimMc | mpan: There is unchunk in amalloy's useful. |
| 11:35 | mpan | as in, I got the sequence from calling iterate |
| 11:35 | TimMc | Oh, it won't be chunked, then. |
| 11:35 | mpan | oh awesome! |
| 11:35 | mpan | Thanks guys! |
| 11:38 | TimMc | mpan: chunking is an opt-in behavior -- map, for instance, checks whether the incoming seq is chunked, and if so, produces a chunked output. |
| 11:38 | TimMc | I'd be really surprised if drop-while preserved chunking. |
| 11:55 | dnolen | TimMc: drop-while doesn't change chunking |
| 11:56 | dnolen | TimMc: I don't think any of the core seq ops defeat chunking - which is the correct behavior |
| 11:58 | TimMc | &(dorun (take 5 (map #(println %) (range 100)))) |
| 11:58 | lazybot | ⇒ 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:58 | TimMc | &(dorun (drop-while #(println %) (range 100))) |
| 11:58 | lazybot | ⇒ 0 nil |
| 11:58 | TimMc | It looks like drop-while doesn't apply that predicate to anything beyond the first false result. |
| 11:59 | S11001001 | dnolen: map on 2 or more seqs |
| 12:07 | uroborus_labs | idbknox: What are your thoughts on the pull request I sent you the other day for waltz? |
| 12:13 | dnolen | TimMc: 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:13 | dnolen | ,(type (seq (drop-while (fn [n] (< n 5)) (range 100)))) |
| 12:13 | clojurebot | clojure.lang.ChunkedCons |
| 12:22 | Cubic | I thought the question was about whether or not the predicate was applied, not about it's chunkiness. |
| 12:26 | duck1123 | uroborus_labs: Have you tried superbobry's fork of waltz? (or my fork of his) Some of his changes are pretty nice |
| 12:26 | uroborus_labs | duck1123: No i have not but I will check it out. |
| 12:27 | uroborus_labs | I was just going to fork it and upload to clojars because git-deps is mucking things. |
| 12:28 | duck1123 | I ended up fixing that same issue because those warnings were driving me nuts |
| 12:28 | uroborus_labs | duck1123: Yeah, agreed |
| 12:29 | uroborus_labs | duck1123: Looking at superobry's now |
| 12:29 | uroborus_labs | What is different? |
| 12:30 | duck1123 | some of the function names are different, he rewrote a big part of it. Saner execution |
| 12:30 | duck1123 | He 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:31 | duck1123 | My 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:37 | Cubic | Is 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:39 | uroborus_labs | Is there a better way to include other repos and libs than using lein git-deps? |
| 12:40 | technomancy | uroborus_labs: yes, real deps are always preferable to git-deps |
| 12:41 | uroborus_labs | technomancy: Agreed, but what is the best way then to use another repo, particularly a forked one? Upload it to clojars yourself? |
| 12:42 | technomancy | uroborus_labs: if the upstream maintainer has abandoned it, sure |
| 12:42 | uroborus_labs | technomancy: Ok cool |
| 12:42 | duck1123 | What if they've just forked it but not provided a release |
| 12:43 | technomancy | if they've forked it then they're not the upstream maintainer |
| 12:43 | uroborus_labs | Hmm |
| 12:43 | technomancy | seeing 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:44 | dnolen | Cubic: 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:45 | TimMc | "Preserve" is ambiguous there. |
| 12:46 | TimMc | As long as drop-while doesn't clojure.core/map the predicate across the input and then check the outputs, it's fine. :-) |
| 12:46 | clerksy | technomancy: Been trying to contact ibdknox through twitter/github/irc. No response. |
| 12:46 | dnolen | ,(take 1 (map #(do (println %) %) (drop-while (fn [n] (< n 5)) (range 100))))) |
| 12:46 | clojurebot | (5 |
| 12:46 | clojurebot | 6 |
| 12:46 | clojurebot | 7 |
| 12:46 | clojurebot | 8 |
| 12:46 | clojurebot | 9 |
| 12:46 | TimMc | oh no |
| 12:46 | clojurebot | 10 |
| 12:46 | clojurebot | 11 |
| 12:46 | clojurebot | 12 |
| 12:46 | clojurebot | 13 |
| 12:46 | clojurebot | 14 |
| 12:46 | clojurebot | 15 |
| 12:46 | clojurebot | 16 |
| 12:46 | clojurebot | 17 |
| 12:46 | clojurebot | 18 |
| 12:47 | clojurebot | 19 |
| 12:47 | clojurebot | 20 |
| 12:47 | clojurebot | 21 |
| 12:47 | clojurebot | 22 |
| 12:47 | clojurebot | 23 |
| 12:47 | clojurebot | 24 |
| 12:47 | clojurebot | 25 |
| 12:47 | clojurebot | 26 |
| 12:47 | technomancy | quick, someone figure out how to crash clojurebot |
| 12:47 | llasram | whelp |
| 12:47 | clojurebot | 27 |
| 12:47 | clojurebot | 28 |
| 12:47 | clojurebot | 29 |
| 12:47 | clojurebot | 30 |
| 12:47 | Fossi | -_- |
| 12:47 | dnolen | ha |
| 12:47 | clojurebot | 31 |
| 12:47 | clojurebot | 5) |
| 12:47 | technomancy | clerksy: sounds like uploading a fork could be justified then, but it's a shame |
| 12:47 | TimMc | I specifically used lazybot for my demo earlier. :-) |
| 12:48 | clerksy | technomancy: Agreed, but he could just be really busy with lighttable :) |
| 12:48 | technomancy | if someone's volunteering to take over maintenance of a library you should always be able to find time to make that happen |
| 12:50 | mpenet | clerksy: what library are you thinking of? |
| 12:51 | clerksy | mpenet: waltz |
| 12:51 | clerksy | https://github.com/ibdknox/waltz/blob/master/src/waltz/state.cljs on line 30 get-in-sm is called before it is defined |
| 12:52 | clerksy | Throws compilation errors |
| 12:52 | mpenet | clerksy: 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:52 | clerksy | mpenet: What was the response? |
| 12:52 | mpenet | clerksy: still waiting, I /msg him this time, we'll see. But as you said he must be really busy |
| 12:54 | TimMc | technomancy: DoS via bot amplification. |
| 12:55 | mpenet | clerksy: fork+publish under your own group-id is fine for a temp solution though |
| 12:56 | TimMc | lazybot should probably be set to ignore clojurebot. |
| 12:56 | clerksy | mpenet: ok cool |
| 13:32 | ibdknox | clerksy: 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:32 | ibdknox | I'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:33 | clerksy | ibdknox: That sounds like a great idea |
| 13:34 | ibdknox | clerksy: btw, fwiw, those are just warnings - CLJS doesn't suffer from the same limitations that CLJ does :) |
| 13:35 | ibdknox | clerksy: should be fixed, no question. But they're not functional issues |
| 13:35 | clerksy | ibdknox: I know, but I like not having the warnings ;) |
| 13:35 | mpenet | ibdknox: That would be great. |
| 13:36 | ibdknox | let me get through this release (early next week) and we can figure that out |
| 13:36 | ibdknox | mpenet: clerksy: sound good? |
| 13:37 | mpenet | ibdknox: yup, sounds good |
| 13:37 | clerksy | ibdknox: Sounds good to me |
| 13:37 | ibdknox | great :) |
| 13:38 | Cubic | TimMc: He doesn't already do that? So if anyone feels like it they can deadlock clojurebot and lazybot? |
| 13:38 | mpenet | ibdknox: btw, maybe an organisation is not necessary, you can just add collaborators, but that is your call. |
| 13:39 | TimMc | ,(println "&(println \"Cubic: Well, they can do this.\")") |
| 13:39 | clojurebot | &(println "Cubic: Well, they can do this.") |
| 13:39 | lazybot | ⇒ Cubic: Well, they can do this. nil |
| 13:39 | mpenet | Cubic: worst, flood the channel until one of them is killed |
| 13:39 | duck1123 | lazybot prefixes it's output so it won't be picked up by clojurebot |
| 13:40 | TimMc | I haven't figured out how to get a reflective bot-quine going, but it can be used to aplify the attack. |
| 13:40 | TimMc | *amplify |
| 13:40 | mpenet | aww, no infinite ping pong session then |
| 13:41 | TimMc | I've privately tested a command that would eat up about 300 lines of of 80-column scrollback. |
| 13:41 | ibdknox | clerksy: 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:42 | mpenet | ibdknox: same nick on github |
| 13:43 | ibdknox | mpenet: added you to jayq, anything else? |
| 13:43 | mpenet | ibdknox: thanks, no that's good |
| 13:44 | ibdknox | you should be able to push to clojars as well |
| 13:44 | mpenet | great |
| 13:54 | msamiry | I'm interested in finding clojurians in Cairo - Egypt, is there any? |
| 14:11 | technomancy | interesting effort for webby folks building on existing js libs: http://www.webjars.org/ |
| 14:13 | hiredman | technomancy: slick |
| 14:15 | technomancy | except it doesn't mention the :repositories entry to add? |
| 14:15 | technomancy | oh, they're all in central. that's interesting. |
| 14:15 | xeqi | neat, too bad they're not sorted |
| 14:16 | duck1123 | hmm... If i add these, will cljsbuild pick them up? Anyone try? |
| 14:17 | hiredman | duck1123: "pick them up" in what way? |
| 14:18 | hiredman | the common case I imagine would be to just serve them as resources out of the jars |
| 14:20 | mpenet | ibdknox: 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:20 | duck1123 | I was thinking about external libs like how cljs libs work, but I realize it's not that easy |
| 14:21 | hiredman | you would want an extern file for the libraries |
| 14:21 | hiredman | which, I still have no idea how to do |
| 14:22 | hiredman | there is some website where which supposedly has some code to auto generate them |
| 14:22 | hiredman | http://www.dotnetwise.com/Code/Externs/ |
| 14:22 | hiredman | dunno if it works |
| 14:25 | zackzackzack | Is there a way to make functions available in a namespace that were defined outside of the namespace originally? |
| 14:26 | S11001001 | zackzackzack: do you mean s,available in,be exported from,? |
| 14:27 | zackzackzack | Sort of. So the context is that I am writing a library. |
| 14:27 | S11001001 | zackzackzack: and you want a "export commonly used stuff" facade over the more specific modules |
| 14:27 | zackzackzack | I think so |
| 14:28 | mpenet | zackzackzack: useful has a alias-ns fn for that |
| 14:29 | mpenet | zackzackzack: an example here: https://github.com/flatland/useful/blob/develop/src/useful/core.clj |
| 14:29 | dnolen | ibdknox: ping |
| 14:29 | S11001001 | zackzackzack: 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:29 | mpenet | it will alias the entire ns, but there is alias-var also I think |
| 14:30 | zackzackzack | Yeah! https://groups.google.com/forum/?fromgroups=#!topic/clojure/GAGF38uI1-o |
| 14:30 | zackzackzack | Great, thank you S11001001 and mpenet |
| 14:52 | clerksy | idbknox: 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:57 | TylerGillies | what does in means in "contains?" where its constant or logarithmic time? |
| 14:57 | nDuff | TylerGillies: What part of that isn't clear? |
| 14:58 | nDuff | TylerGillies: it's a promise that it'll be faster than O(n). |
| 14:58 | TylerGillies | nDuff: oh gotcha |
| 14:58 | TylerGillies | thanks |
| 15:05 | mklappstuhl | I have a funtction that works when retyped at the repl but doesnt when I define it in the a file ... |
| 15:05 | mklappstuhl | https://www.refheap.com/paste/6325 |
| 15:05 | TimMc | mklappstuhl: Does it depend on something defined earlier in the REPL? |
| 15:05 | mklappstuhl | ArityException Wrong number of args (0) passed to: PersistentArrayMap clojure.lang.AFn.throwArity (AFn.java:437) |
| 15:06 | hiredman | mklappstuhl: testfund is not a function |
| 15:06 | TimMc | mklappstuhl: Oh, that's because you're trying to call {name trades} as a fn with no args. |
| 15:08 | mklappstuhl | TimMc, ahhh |
| 15:08 | TimMc | Also, what's with fund's arity? It takes two args yet you're calling it with 3 or 5. |
| 15:09 | tgoossens | Hi |
| 15:09 | mklappstuhl | TimMc, I had [name & trades] earlier and changed it trying to debug the isue |
| 15:10 | tgoossens | What would be an efficient way to parse this? |
| 15:10 | tgoossens | http://pastebin.com/1WwKD3Yb |
| 15:10 | TimMc | mklappstuhl: If that had been the issue it would have made helping very, very difficult. |
| 15:10 | tgoossens | it is a syntax for encoding a maze |
| 15:10 | tgoossens | first two numbers are dimensions |
| 15:10 | clerksy | ibdknox: My new github is "clerksy" and my new clojars is "clerksy" |
| 15:10 | clerksy | ibdknox: Thanks |
| 15:10 | tgoossens | For simplicity lets say that every token must be matched on a number |
| 15:12 | tgoossens | You don't have to make an actual algorithm (however that would always be nice :D) . just giving suggestions is fine :) |
| 15:12 | mklappstuhl | TimMc, sorry then. how would I have to change the testfund method? |
| 15:13 | TimMc | mklappstuhl: (defn testfund [] ...) |
| 15:13 | hiredman | function, not a method |
| 15:21 | TimMc | tgoossens: You haven't provided enough info about the format. |
| 15:22 | tgoossens | Ok |
| 15:22 | tgoossens | what info are you missing? |
| 15:22 | tgoossens | Is it clearer if i just say |
| 15:22 | tgoossens | that the all the commands could just as well be A B C D E ... |
| 15:24 | TimMc | Are newlines significant? |
| 15:24 | TimMc | Is that a comment? |
| 15:25 | TimMc | If so, can comments occur anywhere, or just at the beginning of a line? What if there is just some whitespace before the comment? |
| 15:28 | tgoossens | # is a comment line |
| 15:32 | tgoossens | but nvm. I think i got it :) |
| 15:36 | tgoossens | Anyone here a regex expert? |
| 15:37 | gfredericks | ~anyone |
| 15:37 | clojurebot | Just 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:38 | tgoossens | Ok thanks for the tip |
| 15:38 | tgoossens | kinda new here ;) |
| 15:39 | uvtc | tgoossens: what are you trying to match? |
| 15:39 | tgoossens | How 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:39 | bbloom | tgoossens: regexes are just one of many tools to use for this sort of stuff |
| 15:40 | bbloom | tgoossens: why not filter blank and comment lines first? |
| 15:40 | tgoossens | mmyes :D |
| 15:41 | tgoossens | I'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:41 | tgoossens | :D |
| 15:41 | dakrone | anyone 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:41 | tgoossens | (some project of last year, not a public lib or something) |
| 15:42 | Cubic | I suppose it could be done, but it's really much easier when you do it like bbloom said. |
| 15:43 | gfredericks | regexes aren't very good at negating things |
| 15:43 | gfredericks | though technically they can :) |
| 15:43 | hiredman | dakrone: put a nil at the end |
| 15:43 | tgoossens | mm ok |
| 15:43 | tgoossens | i'll filter out the comments |
| 15:43 | dakrone | hiredman: doesn't work, same error |
| 15:43 | tgoossens | that solves that |
| 15:43 | hiredman | dakrone: or maybe ^void before the name of the method |
| 15:44 | Cubic | #"^[^#]*(Straight\.S\.55|DeadEnd\.N)"? |
| 15:44 | gfredericks | :) |
| 15:44 | tgoossens | ow |
| 15:45 | tgoossens | i wasn't clear enough |
| 15:45 | Cubic | I think you might need another 2 pairs of parantheseses, but other than that I think this works |
| 15:45 | amalloy | &(reify java.util.Collection (add [this x] nil)) |
| 15:45 | amalloy | oops, that's boolean |
| 15:45 | lazybot | ⇒ #<sandbox7657$eval421852$reify__421853 sandbox7657$eval421852$reify__421853@1dd105e> |
| 15:45 | mpenet | Should 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:45 | tgoossens | I just gave those two as example |
| 15:45 | amalloy | &(reify java.util.Collection (clear [this] nil)) |
| 15:45 | lazybot | ⇒ #<sandbox7657$eval421864$reify__421865 sandbox7657$eval421864$reify__421865@f2d92c> |
| 15:45 | mpenet | or maybe I am missing something |
| 15:45 | amalloy | dakrone: ie, in general reify works out of the box for void methods. more detail is needed to solve your problem |
| 15:45 | tgoossens | i need to be able to match any command in the form xx.yy.zz or xx.yy |
| 15:45 | Cubic | Then insert there the regex for your token :O |
| 15:45 | dnolen | mpenet: it probably easily could |
| 15:45 | mpenet | I am asking here because my CA is still in the middle of the Atlantic I guess. No access to clj-dev |
| 15:46 | tgoossens | i'll google a bit more |
| 15:46 | tgoossens | haven't got much experience with regex |
| 15:46 | Cubic | xx and yy can be what? Digits, letters? |
| 15:46 | dakrone | amalloy: hiredman: this is what it looks like: http://p.draines.com/1351799152559b274549e.txt |
| 15:46 | mpenet | dnolen: Should I fill a ticket for that? |
| 15:46 | tgoossens | xx and yy strings. zz numbers |
| 15:46 | tgoossens | *digits |
| 15:46 | tgoossens | *chars |
| 15:47 | Cubic | what kind of strings? |
| 15:47 | dnolen | mpenet: it's up to you, but it sounds like a good idea. libs that "just work" w/ CLJS are always nice. |
| 15:47 | clojurebot | kind of interesting if unfold is the intermediate steps of a fold |
| 15:47 | mpenet | dnolen: will do then |
| 15:47 | tgoossens | nvm |
| 15:47 | tgoossens | i think i found it :) |
| 15:48 | tgoossens | oh |
| 15:48 | mpenet | dnolen: it is on the CLJ jira, or is there a separate one for these sub projects |
| 15:48 | tgoossens | all the examples are given in the link |
| 15:48 | dnolen | mpenet: all contrib projects have their own JIRA |
| 15:48 | mpenet | nevermind found it |
| 15:48 | tgoossens | i'm almost there |
| 15:48 | tgoossens | [^\s"']+|"([^"]*)"|'([^']*)' |
| 15:49 | tgoossens | but i'll stop asking half-complete questions |
| 15:49 | tgoossens | so nevermind :) |
| 15:52 | TimMc | tgoossens: 1) Filter blank and comment lines, 2) remove that initial line, 3) split on whitespace, 4) split each element on \. |
| 15:53 | TimMc | No regex involved, except maybe for step 1. |
| 15:59 | dakrone | gah, I can never remember what the type hint for an array of strings is |
| 16:01 | dnolen | dakrone: who can? |
| 16:02 | hiredman | people who know the syntax for jvm type descriptors |
| 16:02 | gfredericks | that sounds almost tautological |
| 16:02 | dakrone | does anybody know what it is?? |
| 16:02 | lazybot | dakrone: Definitely not. |
| 16:03 | dnolen | ,(class (make-array String 0)) |
| 16:03 | clojurebot | [Ljava.lang.String; |
| 16:03 | dakrone | there it is |
| 16:04 | gfredericks | but that's not readable; do you embed that in a string to do the type hint? |
| 16:04 | SegFaultAX | I 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:04 | mpenet | woa, no project.clj file :( it's going to take more time to test than to patch |
| 16:04 | SegFaultAX | Like 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:05 | gfredericks | SegFaultAX: I can't tell if that implied too hard or too easy |
| 16:05 | SegFaultAX | gfredericks: Sorry, it was too hard. |
| 16:06 | gfredericks | well at least he didn't waste your time any further |
| 16:06 | SegFaultAX | gfredericks: That's true. But the manner in which he did it was so bizarre. |
| 16:07 | SegFaultAX | gfredericks: Maybe I need to find even easier questions :( |
| 16:08 | dnolen | gfredericks: yes put it in a string |
| 16:10 | hyPiRion | SegFaultAX: On what scale would you rate the problem, based on difficulty? |
| 16:10 | hyPiRion | Is it like the medium questions on 4clojure, the hard ones, or is it like Project Euler hard? |
| 16:10 | SegFaultAX | hyPiRion: 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:11 | hyPiRion | Oh, okay. |
| 16:11 | gfredericks | reversing a string by calling its #reverse method? |
| 16:11 | SegFaultAX | hyPiRion: 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:11 | SegFaultAX | hyPiRion: If the entire word is in the dictionary, you can return true immediately. |
| 16:12 | SegFaultAX | hyPiRion: The examples I offer are "helloworld" should return true, "lkajgh" should return false, and "hello" should return true. |
| 16:12 | hyPiRion | SegFaultAX: Well, yeah, that's pretty easy. I guess only one split. |
| 16:12 | SegFaultAX | hyPiRion: 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:13 | SegFaultAX | This was just, given a string and a dictionary of some kind, determine if it's splittable. |
| 16:13 | Cheiron | Hi, I set :java-source-paths ["src/main/java"] in project.clj then lein javac why my Java class isn't compiled? |
| 16:14 | hyPiRion | SegFaultAX: Yeah, but I'd assume most people with at least two year of programming experience would figure our a solution |
| 16:14 | SegFaultAX | hyPiRion: This guy had 8 - 10 years. At least that's what he said. |
| 16:14 | hyPiRion | Maybe you dodged a bullet, or maybe my view on the world is strange. |
| 16:16 | duck1123 | SegFaultAX: so should "hellolkajgh" return false? |
| 16:17 | gfredericks | (fn [dict word] (or (dict word) (some (fn [i] (and (dict (subs word 0 i)) (dict (subs word i)))) (range 1 (count word))))) |
| 16:18 | ytnnoj | hey, 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:18 | ytnnoj | is there an inbuilt macro that would do something like that |
| 16:18 | hammer | &(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:18 | lazybot | java.lang.IllegalArgumentException: let requires a vector for its binding in clojure.core:1 |
| 16:18 | dnolen | ytnnoj: you want reduce |
| 16:19 | duck1123 | (doc reduce) |
| 16:19 | clojurebot | "([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:19 | ytnnoj | for arbritatry values of args, of course |
| 16:19 | hammer | &(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:19 | lazybot | java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn |
| 16:19 | hammer | okay i give up |
| 16:19 | hammer | i just wanted to see if it worked |
| 16:19 | dnolen | ,(reduce str "foo" ["a" "b" "c"]) |
| 16:19 | clojurebot | "fooabc" |
| 16:19 | ytnnoj | oh of course i do dnolen, cheers. |
| 16:20 | jasonjckn | How does :state work in gen-class, my state method isn't being executed https://www.refheap.com/paste/6328 |
| 16:23 | Apage43 | ,(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:23 | clojurebot | (["ham" "star"]) |
| 16:24 | jasonjckn | nvm |
| 16:25 | duck1123 | You probably want to start at the end of the input, that way if the word matches the dict it'll finish quickly |
| 16:26 | amalloy | duck1123: or start at 0 instead of at 1 :P |
| 16:27 | hyPiRion | Now let's do it for n splits. |
| 16:28 | Apage43 | (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:28 | Apage43 | er, rather, nil? |
| 16:28 | Apage43 | er, rather, just (first |
| 16:28 | Apage43 | bleh |
| 16:28 | duck1123 | It 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:29 | duck1123 | walking out is not the right way to handle the challenge |
| 16:30 | hyPiRion | duck1123: Walking out is not the right way to handle any challenge, I believe |
| 16:30 | hyPiRion | Except maybe if the challenge is to walk out. |
| 16:36 | TimMc | SegFaultAX: Maybe a dictionary killed his mother. |
| 16:37 | gfredericks | q |
| 16:37 | duck1123 | Is that what they mean by dictionary attack? |
| 16:39 | mabes | ,(name :foo/bar) |
| 16:39 | clojurebot | "bar" |
| 16:40 | mabes | I take it that the above is relating to namespace considerations? I was expecting "foo/bar" |
| 16:41 | TimMc | Yes, a symbol is a local part with an optional namespace part. |
| 16:41 | TimMc | err, that's a keyword, sorry |
| 16:42 | mabes | yeah, I get it.. it helps in cases where you have: |
| 16:42 | mabes | ,(name ::foo) |
| 16:42 | clojurebot | "foo" |
| 16:42 | mabes | ,::foo |
| 16:42 | clojurebot | :sandbox/foo |
| 16:42 | TimMc | Fun fact: A keyword has a symbol under the surface. |
| 16:43 | TimMc | &(.sym :foo/bar) |
| 16:43 | lazybot | ⇒ foo/bar |
| 16:43 | mabes | ahh, that will do the trick |
| 16:43 | mpenet | dnolen: 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:43 | mabes | ,(str (.sym :foo/bar)) |
| 16:43 | clojurebot | "foo/bar" |
| 16:44 | mabes | TimMc: thanks for that fun fact :) |
| 16:46 | SegFaultAX | duck1123: Yes, that's correct. |
| 16:47 | SegFaultAX | duck1123: There isn't anything tricky going on with the problem. It's really as simple as it sounds. |
| 16:47 | luxbock | I'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:48 | luxbock | I 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:48 | TimMc | SegFaultAX: That's a fun question, I'm stealing it. |
| 16:49 | SegFaultAX | TimMc: It's really fun when you ramp up the difficulty. |
| 16:49 | luxbock | but I when I run the code I get CompilerException java.lang.ClassNotFoundException: jawa.awt.Frame |
| 16:49 | luxbock | here's what I have in my .clj file: http://pastebin.com/5Jkpgezu |
| 16:49 | luxbock | is it an issue with namespace? |
| 16:50 | raek | luxbock: you got cut off at "...I Was trying out some other stuff with" |
| 16:50 | TimMc | Yes, you need an :import. |
| 16:50 | luxbock | oh |
| 16:50 | TimMc | and a ns statement at the top, for that matter |
| 16:50 | raek | luxbock: no, you have a typo in "java" :) |
| 16:50 | raek | line 5 |
| 16:50 | raek | it says "jawa" |
| 16:51 | luxbock | oh god damnit |
| 16:51 | TimMc | Oh hah! That too. |
| 16:51 | luxbock | I went through that file more than a few times |
| 16:51 | TimMc | That's right, if it's package-qualified, it doesn't need an import. |
| 16:51 | technomancy | "jawa" is javanese |
| 16:52 | luxbock | I figured that since the line got a proper syntax highlight that it must be correct, so didn't realize to look more carefully |
| 16:53 | SegFaultAX | luxbock: That'll teach ya that (not= syntactic-correctness logical-correctness) |
| 16:54 | nbeloglazov | Hi. Is there way to force printing from separate thread go to visible buffer, so I can see output? |
| 16:54 | luxbock | yeah, 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:54 | amalloy | i 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:54 | SegFaultAX | amalloy: Magical fingers, I guess? |
| 16:55 | technomancy | amalloy: you forgot to say "...in haskell" |
| 16:55 | amalloy | haha, i was thinking that technomancy |
| 16:55 | amalloy | SegFaultAX: more like selective memory |
| 16:55 | raek | nbeloglazov: you could try (alter-var-root #'*out* (constantly *out*)) in your repl |
| 16:55 | nbeloglazov | raek: does it have same effect if I create bound function via bound-fn? |
| 16:56 | nbeloglazov | from repl |
| 16:56 | raek | nbeloglazov: that should work too |
| 16:57 | nbeloglazov | raek: no, it doesn't help :( |
| 16:57 | luxbock | also, 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:57 | nbeloglazov | I think it's more complicated than just repl |
| 16:57 | raek | nbeloglazov: what repl are you using? swank? nrepl? |
| 16:57 | nbeloglazov | lightable :) |
| 16:58 | raek | oh, is this printing via clojure functions or direct cals to System.out? |
| 16:58 | nbeloglazov | via println |
| 16:59 | nbeloglazov | clojure functions |
| 16:59 | TimMc | amalloy: Really? You've never wanted to solve any problem? |
| 17:00 | amalloy | TimMc: yeah, i just like adding features |
| 17:00 | raek | do *out* and @(future *out*) return the same thing? |
| 17:00 | TimMc | Or you've never written code? :-P |
| 17:00 | TimMc | raek: I guess you're asking whether dynamic bindings are conveyed? |
| 17:01 | raek | hrm. right. forgot that 'future' does that now... |
| 17:08 | nbeloglazov | Cool. 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:08 | nbeloglazov | (.write out "Helll") in last command |
| 17:11 | technomancy | sounds like the repl is assuming disposable streams on a per-entry basis |
| 17:11 | technomancy | early versions of nrepl.el had that bug |
| 17:15 | nbeloglazov | techmonancy: When I do (def out *out*) and (= out *out*) immediately after that. It returns false. How it is possible? |
| 17:15 | nbeloglazov | technomancy* |
| 17:16 | TimMc | nbeloglazov: What he's saying is that a new output stream is being created for each execution. |
| 17:16 | TimMc | *evaluation |
| 17:16 | technomancy | yeah, it's a bug |
| 17:16 | reque | hey |
| 17:16 | technomancy | head to the issue tracker I guess? |
| 17:16 | technomancy | since apparently you aren't allowed to fix it yourself |
| 17:18 | reque | i'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:29 | nbeloglazov | I'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:05 | luxbock | when 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:05 | luxbock | with nrepl that is |
| 19:20 | brainproxy | how can I test the relationship between (class '()) and (class '(1)) |
| 19:22 | hiredman | ,(empty? (clojure.set/intersection (supers (class '())) (supers (class '(1))))) |
| 19:22 | clojurebot | false |
| 19:23 | hiredman | ,(contains? (clojure.set/intersection (supers (class '())) (supers (class '(1)))) java.util.List) |
| 19:23 | clojurebot | true |
| 20:27 | mklappstuhl | Is there a way to start a repl in function so that I can inspect stuff inside the execution scope? |
| 20:27 | frenchyp | hello |
| 20:28 | frenchyp | can I use leiningen checkout dependencies to include 1 lein project into a 2nd one? |
| 20:29 | mklappstuhl | frenchyp, why not? |
| 20:29 | ivan | mklappstuhl: there's a macro for that |
| 20:29 | mklappstuhl | you have to have it on clojars or somewhere of course |
| 20:29 | mklappstuhl | ivan, does this macro have a name? :) |
| 20:29 | frenchyp | mklappstuhl: oh, I am working on both at the same time |
| 20:29 | ivan | ; local-bindings and eval-with-locals are from http://gist.github.com/252421 |
| 20:29 | ivan | ; Inspired by George Jahad's version: http://georgejahad.com/clojure/debug-repl.html |
| 20:30 | frenchyp | 1 is the lib i m working on, the other is wrappnig code to interact with it |
| 20:30 | frenchyp | so pushing to clojars each time will get tiresome :) |
| 20:34 | tmciver | frenchyp: 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:44 | frenchyp | tmciver: can't get the checkout deps to work, i'll try the other one |
| 20:46 | tmciver | frenchyp: are you using 'checkout-deps-share' as shown in this sample project.clj: https://github.com/technomancy/leiningen/blob/preview/sample.project.clj? |
| 20:46 | tmciver | frenchyp: I think checkout deps would make your life easier. |
| 20:51 | frenchyp | i'll test as soon as I can (upgrading to latest lein 2 now , and tethering thru my phone so it takes for ever) |
| 20:51 | frenchyp | but , if i'm reading the default values properly , it should be setup alreeady |
| 21:04 | frenchyp | doesn't work |
| 21:13 | frenchyp | ah, got it |
| 21:13 | frenchyp | the project I was linking to in checkouts had a '-' in its name. somewhow it didn't like it |
| 21:14 | frenchyp | hmm, spoke too fast, wrong dir |
| 21:53 | devn | How is it true that compojure still depends on 1.2.1? |
| 21:55 | devn | *shrug* |
| 21:58 | gfredericks | switch it to 1.5 and run the tests? |
| 22:08 | xeqi | it doesn't use anything thats changed or new past 1.2.1 |
| 22:46 | myguidingstar | Hi. Anyone can tell me how to write a handler (with custom evaluator) for nrepl server? |
| 23:09 | xeqi | myguidingstar: are you wanting to make a middleware that handles a custon op? |
| 23:11 | myguidingstar | well, I'm not sure what op is |
| 23:12 | myguidingstar | All I want is to change the evaluator with my custom one |
| 23:12 | myguidingstar | Anything else should be kept |
| 23:18 | xeqi | sounds 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:19 | myguidingstar | Thanks for your help, I'm reading it, too |
| 23:21 | xeqi | if you're able to rewrite the :code form then just delegating to the eval op might be easier, like how load-file works |
| 23:27 | myguidingstar | xeqi: I don't understand, or maybe I didn't read enough. Where is :code form or load-file? |
| 23:27 | xeqi | https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/load_file.clj#L61 |
| 23:28 | xeqi | that one is a nrepl middleware that implements a new :op |
| 23:28 | xeqi | "load-file", and rewrites the :code to use the eval :op |
| 23:29 | xeqi | well, really just creates the :code form from the stuff it wants from its custom op arguments |
| 23:30 | xeqi | but 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:32 | myguidingstar | I'd try it now |
| 23:34 | xeqi | heh, I think thats what piggieback does |
| 23:34 | xeqi | though it gets pretty complex since it sets up a cljs environment |
| 23:34 | xeqi | https://github.com/cemerick/piggieback/blob/master/src/cemerick/piggieback.clj#L182 |
| 23:35 | frenchyp | tmciver so the pb is when I add the checkout dep to :dependencies. If I don't do that it works... |
| 23:38 | myguidingstar | omg I didn't know piggieback existed |
| 23:38 | myguidingstar | thanks a lot, xeqi |
| 23:38 | xeqi | myguidingstar: was that what you wanted to do? |
| 23:39 | xeqi | run a cljs repl through nrepl |
| 23:39 | myguidingstar | No, but that will help a lot. In fact I'm writing a repl for clojurejs |
| 23:42 | myguidingstar | I guest I will just have to make a clone of `cljs-eval` |
| 23:42 | xeqi | frenchyp: what kind of error are you having with checkouts? |
| 23:44 | frenchyp | xeqi: 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:45 | frenchyp | it doesn't work = could not resolve dependencies when running lein repl |
| 23:46 | xeqi | frenchyp: 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:47 | xeqi | so it expects the sub-project to be in a repo somewhere for finding out sub-sub-deps and such |
| 23:50 | frenchyp | xeqi: hmm, ok. Am I reading the lein tuto wrong? |
| 23:50 | frenchyp | in 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:50 | frenchyp | " |
| 23:55 | xeqi | frenchyp: 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 |