2014-05-16
| 00:09 | beamso | in https://github.com/swannodette/om/wiki/Basic-Tutorial#adding-contacts, what is going on in the let in parse-contact? |
| 00:10 | beamso | in the second line are first, last and middle essentially being reassigned based on the first line? |
| 00:11 | White_Flame | technically, they're new variables named first/last/middle, shadowing the ones of the line before |
| 00:12 | quizdr | beamso however the effect is that the first binding of first/last/middle is no longer usable due to the second "shadowing" |
| 00:12 | quizdr | the code appears to be binding them differently depending on whether the last name was provided during the first binding |
| 00:12 | beamso | okay. |
| 00:12 | beamso | i hadn't seen anyone do it like that before |
| 00:13 | quizdr | it's not uncommon. you bind something, then based on what resulted from that, you bind it again. you can iteratively affect the final binding by doing it that way |
| 00:13 | quizdr | easier than nesting a bunch of forms to do it all in a single binding |
| 00:14 | quizdr | clearer to read too |
| 00:15 | quizdr | in that code, suppose there was no middle name provided? then the last name would mistakenly get bound in the first binding as the middle name. so the second binding fixes that |
| 00:16 | White_Flame | need some good regex-like operations [first :? middle last] |
| 01:06 | cfleming | danielcompton: See https://github.com/cursiveclojure/cursive/issues/186 for some suggestions about test conventions. |
| 01:06 | cfleming | I'm not aware of any official guidelines |
| 01:09 | danielcompton | cfleming thanks!, I was meaning about naming test cases, not the files themselves. |
| 01:09 | danielcompton | ,(inc cfleming) |
| 01:09 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: cfleming in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 01:11 | cfleming | danielcompton: Ah, no, sorry - I just try to give them somewhat meaningful names. |
| 01:29 | waynr | technomancy: i have some lein release stuff done |
| 01:30 | waynr | sitting in airports for the next 12 hours, gonna try to get more done |
| 01:51 | curiousmah | can someone help me to explain the word "reify"? |
| 01:52 | waynr | curiousmah: explain it to whom? |
| 01:52 | curiousmah | to me, I don't understand it |
| 01:53 | waynr | oh |
| 01:53 | curiousmah | is it a Computer science concept? |
| 01:53 | waynr | maybe |
| 01:53 | mange | According to Google, reify means: make (something abstract) more concrete or real. |
| 01:54 | waynr | as far as clojure is concerned, it allows you to create an anonymous instance of the named protocol |
| 01:54 | waynr | at least, that's how i understand it |
| 01:54 | mange | Yeah, so in Clojure it lets you make a concrete instance of an (abstract) protocol. |
| 01:55 | waynr | curiousmah: if you do a text search for 'reify' on this page: https://github.com/clojure-cookbook/clojure-cookbook/blob/first-edition/03_general-computing/3-09_polymorphism-with-protocols.asciidoc |
| 01:55 | waynr | there is a pretty easy to understand example of reify |
| 01:56 | curiousmah | waynr, well I got several examples of reify myself |
| 01:56 | curiousmah | but I just feel not so sure about the concept |
| 01:56 | waynr | curiousmah: are you familiar with creating an unnamed function |
| 01:57 | curiousmah | waynr, yes |
| 01:58 | waynr | then think of reify as being analogous to creating unnamed function, only instead of unnamed function you are creating an unnamed instance of a protocol |
| 01:58 | curiousmah | I meant the concept in CS, not just in Clojure |
| 01:59 | waynr | i don't know if it's useful as a concept in and of itself, but think of the factory pattern where you want to be able to create instances of some kind of class (only instead of class let's think about protocol) |
| 01:59 | curiousmah | sorry about such an unclear question |
| 02:00 | waynr | suppose you have the "Shape" protocol and you want to be able to programmatically generate new kinds of shapes, reify might be used in that situation |
| 02:01 | curiousmah | waynr, thanks for your time. I did create several reify instances myself when working with some Java libs |
| 02:01 | ddellacosta | curiousmah: I'm not sure if this will help but check out a post I wrote on protocols: http://davedellacosta.com/cljs-protocols |
| 02:02 | ddellacosta | curiousmah: it's ostensibly CLJS specific but is mostly quite general |
| 02:02 | mange | curiousmah: reification is just the idea of taking something abstract and making it real. For instance, Java generics have abstract type parameters (<X>, or whatever), if they were reified then you would be able to, at runtime in the class, use that X to check the generic type of your class. (Java generics aren't reified, though, so you don't have access to your generic parameters: they remain abstract.) |
| 02:03 | curiousmah | mange, so reification is just a not-so-serious idea, right? |
| 02:04 | mange | What do you mean "not-so-serious"? |
| 02:04 | curiousmah | I mean understanding it as in a Clojure function is enough? |
| 02:04 | mange | Also worth a look: https://en.wikipedia.org/wiki/Reification_(computer_science) |
| 02:05 | mange | curiousmah: The concept of reification is bigger than the Clojure reify function, but what the reify function does could be referred to as reification. |
| 02:05 | ddellacosta | curiousmah: it's definitely "serious," in the sense that it is used generally and outside of Clojure |
| 02:05 | mange | You certainly don't need to understand what exactly reification is to use the reify function effectively. |
| 02:06 | srruby | core.logic: |
| 02:06 | curiousmah | mange, I hope so |
| 02:06 | curiousmah | Thanks for all, you guys |
| 02:06 | ddellacosta | curiousmah: I would let it sit, don't worry too much about getting it too deeply at first--use it in Clojure and read more about it and eventually it'll click. That's how it did for me at least. |
| 02:06 | mange | curiousmah: I've never once thought about refication when using reify. I just think of it as an anonymous function which can be called in a bunch of different ways (each method being a different way). |
| 02:10 | curiousmah | ddellacosta, well, this question came to my mind after I'm quite fluent in Clojure ;) |
| 02:11 | ddellacosta | curiousmah: there is always more to learn, huh? ;-) |
| 02:11 | curiousmah | ;-) |
| 06:14 | noncom | hi, i am interested in better defaults for emacs, but on its github page, there is no apparent installable content https://github.com/technomancy/better-defaults where do i find the installation instructions? |
| 06:19 | noncom | ok, well, maybe anyone here who can asnwer some questions regarding installing CIDER? |
| 06:24 | CookedGryphon | general advice, have a look at emacs live or prelude |
| 06:24 | CookedGryphon | both simple to set up opinionated defaults |
| 06:24 | CookedGryphon | with decent readmes telling you how to customise basic stuff |
| 06:25 | CookedGryphon | (you'll probably want to turn off guru mode in prelude for example, but other than that the defaults are pretty good) |
| 06:28 | noncom | oh, i thought that CIDER is the most recent one.. ? you mean that live and prelude are simpler for newbs? |
| 06:29 | CookedGryphon | emacs-live and prelude are sets of emacs defaults, cider is included |
| 06:29 | clgv | noncom: I think these are just emacs setuops no nrepl frontend alternatives ;) |
| 06:30 | noncom | oh its even that cider is included, well fine :) whats the difference between live and prelude? |
| 06:32 | CookedGryphon | live has brighter colours and random flashy features, prelude is more sensible |
| 06:33 | noncom | uh, can't make a meaningful choice from this place ... |
| 06:36 | CookedGryphon | noncom: I personally use prelude |
| 06:36 | CookedGryphon | having used live before |
| 06:36 | CookedGryphon | I think it's a bit more stable and solid, and has a better system for applying your own changes on top |
| 06:37 | clgv | noncom: if both are ready to go for clojure dev. just try both for several hours ;) |
| 06:41 | noncom | yeah, guess i'll have to try.. |
| 10:06 | ampharmex | j #matlab |
| 10:41 | trap_exit | in clojurescript, is there a way to test if a varaible is a function? |
| 10:41 | trap_exit | in clojurescript, is there a way to test if a varaible is a function? |
| 10:41 | trap_exit | (def x 20) (def y (fn [])) ==> (function? x ) = false, (function? y) = true |
| 10:42 | teslanick | It would be either (fn? x) or (ifn? x)? |
| 10:44 | trap_exit | fn? appears to ahve worked |
| 10:45 | master_op | is the "?" symbol mean that argument is optional |
| 10:46 | trap_exit | no |
| 10:46 | trap_exit | it means it returns true/false |
| 10:46 | trap_exit | thsi is not compiler enforced |
| 10:46 | trap_exit | it's just convention |
| 10:46 | trap_exit | cat? <== is this object a cat? |
| 10:46 | trap_exit | dog? <== is this object a dog? |
| 10:46 | trap_exit | shibe? <== does this dog use dogecoins ? |
| 10:46 | master_op | ok |
| 10:46 | master_op | it's clear, thank you |
| 10:46 | teslanick | Yeah, question marks indicate simple predicates. |
| 10:47 | trap_exit | teslanick: let's build a fucking tesla museum |
| 10:47 | teslanick | Agred. |
| 10:47 | teslanick | *agreed |
| 10:47 | teslanick | Also, it appears that clojurescript's fn? function delegates to goog.isFunction |
| 10:47 | teslanick | Which is defined as http://docs.closure-library.googlecode.com/git/local_closure_goog_base.js.source.html#line985 |
| 10:49 | teslanick | While ifn? does some in-clojure checking of protocols. So it checks if the thing you hand it implements the IFn protocol. (e.g. keywords, maps, vecs, etc) |
| 11:04 | bltavares | hi there folks. is there a reason for not having a `flip` function on core? I notice a PR on github proposing the addition but no relative card on the jira board. I am not aware if this have been discussed before as well, sorry if there was a discussion aready (searching for flip on the group yields lots of result) |
| 11:05 | cbp | what is a flip function? |
| 11:07 | bltavares | takes a function and flips the argument order |
| 11:08 | bltavares | cbp: from haskell documentation http://hackage.haskell.org/package/base-4.7.0.0/docs/Prelude.html#v:flip |
| 11:09 | bltavares | (defn flip [f] (fn [a b] (f b a))) |
| 11:09 | gfredericks | (defn flip [f] (fn [a b & args] (apply f b a args))) ; better? |
| 11:09 | cbp | it says it just changes the first two arguments |
| 11:09 | bltavares | gfredericks: yup |
| 11:10 | dkinzer | ooh, that's kind of neat. So you can build inverse objects really intuitively. |
| 11:10 | stuartsierra | That would probably be more useful in Haskell with its automatic function currying. |
| 11:10 | gfredericks | to do it really clojure-style, make 5 different arity clauses |
| 11:10 | cbp | :-P |
| 11:10 | stuartsierra | #(some-fn %2 %1) |
| 11:11 | bltavares | there was a PR https://github.com/clojure/clojure/pull/32 without a ralated jira card |
| 11:11 | bltavares | stuartsierra: I was wondering if that is the alternative that the community usually goes for |
| 11:11 | gfredericks | stuartsierra: I lean toward functions like flip because they state what I'm trying to do instead of incidentally doing it, perhaps by accident |
| 11:11 | cbp | I'm not entirely sure what's the usefulness of flip besides making things harder to read |
| 11:12 | gfredericks | but doing that everywhere leads to obnoxious point-free style |
| 11:12 | stuartsierra | I usually prefer `let` bindings and explicit arguments over point-free styles like `comp` and `partial`. |
| 11:12 | gfredericks | readability; why don't we have an objective way to measure it :( |
| 11:13 | bltavares | I agree with gfredericks, flip gives intention. I was more curious if there was a strong reason against it, or if it was ever discussed |
| 11:17 | stuartsierra | I do not recall any mailing list discussions on it. |
| 11:17 | whodidthis | hit me up with a cool way to check that a vector does not contain nils, like [1 2 nil 3] => false |
| 11:18 | pdk | ,(every identity [1 2 nil 3]) |
| 11:18 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: every in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 11:18 | pdk | ,(every? identity [1 2 nil 3]) |
| 11:18 | clojurebot | false |
| 11:18 | pdk | ,(every? identity [1 2 3 4]) |
| 11:18 | clojurebot | true |
| 11:18 | pdk | enjoy |
| 11:19 | cbp | ,(every? identity [false]) |
| 11:19 | clojurebot | false |
| 11:19 | pdk | welp |
| 11:20 | pdk | ,(every? #(not (null %)) [1 false 2]) |
| 11:20 | whodidthis | cools, yeah i dont mind false values |
| 11:20 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: null in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 11:20 | pdk | ,(every? #(not (null? %)) [1 false 2]) |
| 11:20 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: null? in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 11:20 | pdk | man im rusty apparently |
| 11:20 | bltavares | ,(every? (complement nil?) [false]) |
| 11:20 | clojurebot | true |
| 11:20 | llasram | (doc some?) |
| 11:20 | clojurebot | "([x]); Returns true if x is not nil, false otherwise." |
| 11:21 | bltavares | ,(every? (complement nil?) [1 nil 2]) |
| 11:21 | clojurebot | false |
| 11:21 | bltavares | ,(every? (complement nil?) [1 3 2]) |
| 11:21 | clojurebot | true |
| 11:21 | cbp | ,(some some? [1 2 3 nil]) ;lol everytime |
| 11:21 | clojurebot | true |
| 11:21 | cbp | wait thats wrong |
| 11:22 | cbp | every |
| 11:46 | akazlou | what is the easiest way to get char from the int (i.e. 2 => \2), so far I came with this (first (str 2)) |
| 11:46 | akazlou | is there better way to do it? |
| 11:47 | mpenet | ,(char 2) |
| 11:47 | clojurebot | \ |
| 11:47 | mpenet | ah no, not the same |
| 11:48 | akazlou | yes, not the same :) |
| 11:48 | akazlou | was mine first attempt |
| 11:59 | CookedGryphon | ,(char (+ (int \0) 2)) |
| 11:59 | clojurebot | \2 |
| 12:00 | stuartsierra | ,(Character/forDigit 2 10) |
| 12:00 | clojurebot | \2 |
| 12:01 | CookedGryphon | that's better :P |
| 12:02 | akazlou | thanks stuartsierra |
| 12:02 | stuartsierra | 'welcome |
| 12:12 | CookedGryphon | I'm having real trouble getting cider-jack-in to work with my custom profiles |
| 12:12 | CookedGryphon | I keep gettging oculd not find or load main class clojure.main |
| 12:12 | CookedGryphon | but if i do exactly the same at the command line, the repl starts no problem and I can cider connect to it |
| 12:13 | johnwalker | why does (map Integer/parseInt ["1" "2" "3" "4"]) give a runtime error? |
| 12:13 | johnwalker | wrapping like #(Integer/parseInt %) causes the same expression to succeed |
| 12:13 | cbp | you cant use static methods as functions |
| 12:14 | technomancy | you can't use any methods as first-class functions |
| 12:14 | johnwalker | aha |
| 12:15 | johnwalker | cool, thanks |
| 12:46 | akazlou | I usually find that I create a helper functions, for example, ranks, or similar, and call them inside (let) form, and I would like to assign the execution of this func into let binding, and ranks is a good binding name for this, so is it too common in Clojure: |
| 12:46 | akazlou | (let [ranks (ranks <some collection>)]), it seems it works, I just don't like it too much, but on the other hand I don't lose nice binding name |
| 12:47 | akazlou | don't like to lose |
| 12:47 | akazlou | of course I can write (let [r (ranks <some collection>)]) instead, but one letter binding is also not possible in every case |
| 12:50 | cbp | (let [rs (ranks)]) :-P |
| 12:51 | akazlou | or rnks :) I'm just wondering does anyone else have the same problem/concern? |
| 12:53 | noncom | what is the easiest way to tug a library from clojars without creating any lein project? |
| 12:54 | akazlou | ok, so something to think about :) |
| 12:54 | technomancy | noncom: there's a lein-try plugin that iirc does that |
| 12:56 | noncom | akazlou: imho this is a code style question. clojure uses the same namespace for functions and variables, so there is no definitive answer to your question |
| 12:57 | noncom | akazlou: you could try an "m" prefix for your var names ahahah :) |
| 12:57 | noncom | or _ |
| 12:58 | llasram | akazlou: I generally solve that by making identifiers for functions verbs and for values nouns. You still get some collisions, but not many |
| 13:01 | technomancy | straw poll: scm or vcs? |
| 13:01 | technomancy | for the name of the lein task to interact with git, hg, etc |
| 13:02 | mdeboard | vcs |
| 13:02 | llasram | scm; then vcs will be the command for interacting with an Atari 2600 |
| 13:02 | hiredman | place for files so when you change them you know it or pffswyctyki |
| 13:02 | Frozenlock | technomancy: Wells |
| 13:02 | mdeboard | then you could add vcr for interacting with your clojure programs on videocassette |
| 13:03 | mdeboard | lein vcr play |
| 13:03 | mdeboard | something something play framework |
| 13:03 | cbp | lein fix-my-maven |
| 13:03 | technomancy | need a tie-breaker |
| 13:05 | devn | technomancy: you around? |
| 13:05 | llasram | If it matters, both git and hg seem to refer to themselves as SCMs and not VCSs |
| 13:06 | technomancy | devn: yeah |
| 13:06 | technomancy | llasram: I like SCM better as an acronym, but saying "source code management" sounds super weird compared to "version control system" |
| 13:06 | technomancy | "source code management" isn't even accurate |
| 13:07 | llasram | I'd thought it stood for "software configuration management", which is nice and vague |
| 13:07 | technomancy | it's not about config though |
| 13:08 | technomancy | except in some super-abstract sense |
| 13:08 | devn | technomancy: PM? |
| 13:08 | technomancy | well if we can't even figure out what it stands for I'm inclined not to use it |
| 13:08 | technomancy | devn: sure |
| 13:08 | gtrak | technomancy: but.. but.. the enterprise! |
| 13:08 | technomancy | gtrak: talk to the spock |
| 13:09 | gtrak | Vacuum Motion Management |
| 13:09 | sdegutis | Is there a Clojure tool that lets you dispatch a method based on a non-argument (external) value? |
| 13:10 | technomancy | sdegutis: defmulti can dispatch on anything |
| 13:10 | technomancy | random numbers, environment vars, phase of the moon |
| 13:10 | mdrogalis | technomancy: Oh my God. It is an anagram of High Perl Bagel! |
| 13:10 | technomancy | mdrogalis: kinda spooked about that tbh |
| 13:10 | Frozenlock | M-x phases-of-moon |
| 13:10 | mdrogalis | technomancy: :) |
| 13:12 | mdrogalis | technomancy: Looks like you also match "Higgle Help Bar" |
| 13:12 | mdrogalis | Get a tattoo of that. |
| 13:13 | technomancy | at least it doesn't mention perl |
| 13:13 | mdrogalis | Haha. |
| 13:15 | sdegutis | mdrogalis: I never understood how people can come up with anagrams. It requires holding so much information in your head all at once. |
| 13:16 | sdegutis | technomancy: Oh. It did not look like it. It looked like you give it a function that only takes parameters as argument.s |
| 13:16 | technomancy | sdegutis: yes, but it doesn't have to be a pure function |
| 13:16 | mdrogalis | http://www.anagrammer.com/anagrammer/ |
| 13:16 | sdegutis | C-b C-t C-c C-c |
| 13:16 | mdrogalis | *Shrug* |
| 13:16 | sdegutis | technomancy: Oh so it can be a function that ignores its arguments and then observes other third party values? |
| 13:16 | technomancy | sdegutis: ayup |
| 13:17 | sdegutis | That sounds awful. |
| 13:17 | technomancy | sdegutis: I actually have an example I just wrote, haha |
| 13:17 | sdegutis | I'm surely doing everything wrong if this is the best solution for me. |
| 13:17 | llasram | sdegutis: Isn't that exactly what you're asking for though? |
| 13:17 | sdegutis | Yes but it doesn't fit in cleanly to what Clojure provides, thus I have the wrong problem. |
| 13:18 | llasram | *shrugh* |
| 13:18 | technomancy | sdegutis: https://github.com/technomancy/leiningen/commit/051ec98f10b3bcd956e5d9f3e4aa10d9d73dc068#diff-a3ef52c31fdf9c0a4a7ba85b7e4ff1e6R8 |
| 13:18 | llasram | IMHO fits pretty cleanly into what multimethods doo |
| 13:18 | llasram | do even |
| 13:18 | llasram | Not drunk, I swear |
| 13:19 | technomancy | it's based on files on disk that are pointed to by the arg, but not the value of the arg itself |
| 13:19 | technomancy | so sorta similar |
| 13:28 | gfredericks | www.clojureql.org |
| 13:28 | gfredericks | ^ this is apparently what happens when people don't like a library |
| 13:29 | sdegutis | Thank you. |
| 13:38 | noncom | gfredericks: clojureql is awsome! |
| 13:45 | {blake} | Random text generator? |
| 13:47 | gfredericks | noncom: I liked using it back in the day |
| 13:47 | gfredericks | everybody else poo'd on it and shouted about korma |
| 13:53 | cbp | that is scummy |
| 14:19 | bltavares | is there a project similar to om but for swing applications? |
| 14:27 | llasram | I think seesaw is the closest you get, which I guess means "no" |
| 14:28 | egghead | clojurians, I'm trying to implement a persistent map and getting a null pointer exception from clojure.lang, no clue how to debug :/ |
| 14:28 | egghead | NullPointerException clojure.lang.APersistentMap$KeySeq.first (APersistentMap.java:154) |
| 14:28 | egghead | https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentMap.java#L154 |
| 14:29 | egghead | anyone have *any* clue what might cause that in my weird map impl? I've tried putting printlns everywhere and it always blows up before it gets to them |
| 14:31 | bltavares | llasram: I gave it a try. I believe it could be used in a simmilar sense. It allows you to re-render everything. seems like an interesting idea |
| 14:43 | waynr | technomancy: so in your email when you refer to prep-tasks and release-tasks are you thinking of having release subtasks that can be selected/reordered with :release-tasks in a project's project.clj |
| 15:02 | technomancy | waynr: :release-tasks should just be a vector of task invocations; probably defaulting to [["release" "bump"] ["scm" "tag"] ["deploy" "clojars"] ["release" "bump" "snapshot"] ["scm" "push"]] or something |
| 15:06 | szymanowski | hello! How can I turn a collection of channels into a channel containing a collection of corresponding values ? |
| 15:09 | arrdem | $seen tim___ |
| 15:09 | lazybot | tim___ was last seen quitting 22 hours and 1 minute ago. |
| 15:10 | arrdem | roight |
| 15:10 | dbasch | szymanowski: conceptually that’s what alts does |
| 15:12 | bendlas | dbasch: how so? |
| 15:12 | dbasch | bendlas: http://clojure.github.io/core.async/#clojure.core.async/alts! |
| 15:12 | szymanowski | mmm... I will try that |
| 15:13 | bendlas | dbasch: I know what alts does, but if I'm not mistaken, it doesn't maintain any correspondence |
| 15:14 | bendlas | quite contrary |
| 15:14 | dbasch | bendlas: nobody mentioned correspondence |
| 15:15 | bendlas | to me, what szymanowski is looking for would be taking values from a collection of channels round-robin, such that first messages, second messages a.s.o stay together |
| 15:15 | bendlas | akin to juxt |
| 15:15 | dbasch | bendlas: in a way that would defeat the purpose of having multiple channels |
| 15:16 | bendlas | dbasch: szymanowski did "... into a channel containing a collection of corresponding values ..." |
| 15:16 | bendlas | yes, it defeats the purpose of channels |
| 15:16 | dbasch | bendlas: my interpretation was: get messages from multiple channels into one |
| 15:16 | bendlas | yeah, that would be merge |
| 15:17 | dbasch | bendlas: yeah, you could merge and then take from that channel |
| 15:18 | dbasch | hard to know what’s the right thing without a more specific use case |
| 15:18 | szymanowski | sorry i'm still a bit confused about async |
| 15:19 | szymanowski | the result of merge is a channel containing a collection of channels? |
| 15:21 | bendlas | dbasch: right, and alts is merge + tag, but there is no generic take from multiple channels simultanously, because it poses inherent synchronization problems that always need to be dealt with otherwise |
| 15:21 | bendlas | szymanowski: no, plz describe your use case |
| 15:22 | bendlas | merge creates a channel containing messages from source channels |
| 15:26 | szymanowski | ok thank you very much |
| 15:31 | ghadishayban | yeah there's not really a notion of "simultaneously" take, but there is async/map, which will grab an item from each of a list of channels, and then apply f to the result |
| 15:31 | ghadishayban | which is a sort of barrier |
| 15:32 | ghadishayban | but just like core/map, will not apply f if any source stops short |
| 15:36 | johncash | are records recommended outside of code dealing with java interop? |
| 15:37 | johncash | they seem pretty OO to me |
| 15:46 | llasram | johncash: You can sometimes get a speed boost from using them, if you have actually performance-sensitive code |
| 15:47 | llasram | And frequently switch to them as a drop-in replacement for maps w/ the same keyword keys |
| 15:47 | llasram | They can also participate directly in protocols |
| 15:47 | llasram | OTOH, I'd be hard-pressed to recall a time I've used them myself :-) |
| 15:50 | johncash | the thing about using them as map is they don't implement IFn |
| 15:52 | pjstadig | johncash: i use keywords as functions to get stuff out of maps way more often than i use maps as functions to get stuff out of maps |
| 15:53 | pjstadig | but of course when you have non-keyword keys, then the fact that records don't implement IFn can be a drag |
| 15:53 | arrdem | so what's the historical rationale for always loading "user.clj"? |
| 15:54 | sdegutis | I don't understand. |
| 15:54 | technomancy | arrdem: "hey, we can do weird things as long as they're not documented" |
| 15:54 | sdegutis | How do you call a defmethod with no args? |
| 15:54 | arrdem | technomancy: I need a good "it's a feature" reaction. |
| 15:55 | technomancy | arrdem: same justification as *read-eval* originally |
| 15:55 | technomancy | then it was like "oh crap security hole; better document this" |
| 15:56 | arrdem | grrrrr ok. |
| 15:56 | bendlas | arrdem, technomancy: something to point to, when somebody asks "why always use at least 2-segmented namespaces"? |
| 15:56 | arrdem | bendlas: wha... oh that "foo" can't be a symbol but "foo/bar" can be? |
| 15:57 | pjstadig | arrdem, technomancy, bendlas: because users like to use things... otherwise why would it be called user.clj. QED |
| 15:57 | technomancy | bendlas: because reasons! |
| 15:58 | arrdem | pjstadig: your rationale for compiling arbitrary code at boot time is compelling and by compelling I mean something I intend not to support. |
| 15:58 | bendlas | Hey, I've got an idea, let's compile a list of stupid, inconsistent things about clojure, that should change and create tickets for them ... |
| 15:59 | arrdem | I'll get the pitchforks and torches... |
| 15:59 | cbp | ill get the chips |
| 15:59 | pjstadig | bendlas: it's a flawless plan |
| 16:00 | technomancy | just write a linter that yells at you |
| 16:00 | arrdem | in fairness, I'm reading into the clojure boot sequence and I'm impressed for the most part |
| 16:01 | bendlas | technomancy: omg, almost got me with that one |
| 16:01 | arrdem | besides weirdness for user.clj, user defined reader literals and the total lack of whitespace or indentation control in clojure.lang.RT it's very nice. |
| 16:02 | bendlas | btw, have you thought about alleviating data_reader.clj stupidity in lein? |
| 16:02 | technomancy | (when (bad-stuff?) (clojure.java.shell/sh "mplayer" "old-guy-yelling.mp3")) |
| 16:02 | technomancy | bendlas: the java.util.Date stuff specifically? |
| 16:02 | johncash | -bash: mplayer: command not found |
| 16:03 | bendlas | technomancy: more like library composability |
| 16:03 | arrdem | pacman -S mplayer |
| 16:03 | johncash | -bash: pacman: command not found |
| 16:03 | bendlas | data_readers interacts really badly with source distribution |
| 16:03 | technomancy | bendlas: we have special handling for that during uberjar |
| 16:04 | technomancy | not sure what you mean about source distribution though |
| 16:04 | arrdem | technomancy: hints on where to start reading into the uberjar process? |
| 16:05 | bendlas | technomancy: distributing .clj files in jars, that end up used with completely different data_readers |
| 16:05 | michaniskin | technomancy: does lein do anything special with respect to fetching maven snapshot deps on windows? i'm using pomegranate directly and see weird issues (like a workaround for windows8 seems to be downcasing "snapshot" in the version string) and was wondering if this is known and dealt with in lein? |
| 16:07 | bendlas | core understandably advises against distributing data_readers in jars (even though datomic does it), so end user needs to recreate a proper data_readers env |
| 16:07 | bendlas | got to look at uberjar support though |
| 16:08 | michaniskin | bendlas: where did you find the data_readers best practices recommendations? are they online? |
| 16:08 | bendlas | michaniskin: an ML post by stuart sierra |
| 16:09 | stuartsierra | data_readers has been a learning experience for everyone. My current view is that there's almost no reason to use them in *code*, only in EDN data. |
| 16:09 | bendlas | https://groups.google.com/forum/#!topic/clojure/B4_uGy1VhnA |
| 16:09 | michaniskin | bendlas: thanks! |
| 16:09 | technomancy | arrdem: hopefully uberjar isn't too complicated; it's only 150 lines |
| 16:09 | technomancy | but if you have questions let me know |
| 16:10 | bendlas | stuartsierra: true, but that's also self affirming, given the current state of affairs |
| 16:10 | arrdem | technomancy: kk. |
| 16:10 | bendlas | also see datomic |
| 16:10 | arrdem | stuartsierra: idk... I've liked having custom reader literals for my units library... |
| 16:10 | llasram | arrdem: and/or me too, as IIRC refuctored it most recently |
| 16:10 | stuartsierra | data_reader tags are really only half-finished since there's no built-in way to print them. |
| 16:11 | arrdem | llasram: dvorak user? |
| 16:11 | arrdem | stuartsierra: eh you can define a print-method to generate the same format, but sure you don't get it for free. |
| 16:11 | llasram | stuartsierra: Or introspect on them. Mirroring EDN in e.g. Avro would be way easier if you could get (tag, literal) tuples instead of just the already-EDN-printed representation of the same |
| 16:11 | llasram | arrdem: Yes, but also intentional :-) |
| 16:11 | arrdem | llasram: :D |
| 16:12 | stuartsierra | llasram: Yes, Fressian does better at that. |
| 16:12 | technomancy | bendlas: that sounds annoying, but I don't know much about the problem other than that lein tries to merge things during the uberjar process. |
| 16:12 | technomancy | michaniskin: I'm not aware of any windows-specific issues around snapshots |
| 16:13 | llasram | bendlas: Oh yeah, that's no longer a problem, at least if you're using Leiningen and a new-enough version |
| 16:13 | llasram | bendlas: Well, and people use reasonable namespaces for their tags |
| 16:13 | llasram | bendlas: The basic support finds all the data_readers.clj instances on the classpath |
| 16:13 | michaniskin | technomancy: thanks |
| 16:13 | llasram | bendlas: And lein uberjar merges them for the one copy in the uberjar |
| 16:14 | technomancy | oh yeah, I think llasram was the one who wrote that =) |
| 16:14 | bendlas | llasram: that's exactly the problem, libs shouldn't dictate data_reader bindings |
| 16:14 | llasram | bendlas: I heartily disagree |
| 16:14 | pjstadig | if people namespace them, there shouldn't be a problem |
| 16:14 | llasram | technomancy: si :-) |
| 16:14 | mikerod | I'm getting a "java.lang.UnsupportedOperationException: Unknown Collection type" when trying to compile/emit bytecode for a form like: (eval `(new java.util.ArrayList '~(lazy-seq []))) or (eval `(MyDefType. '~(lazy-seq []))) In both cases it comes down to the clojure.lang.Compiler$EmptyExpr, but 2 separate methods both doing the same logical if-else-if flow. |
| 16:14 | llasram | pjstadig: exactly |
| 16:14 | mikerod | let's try that again: |
| 16:15 | mikerod | I'm getting a "java.lang.UnsupportedOperationException: Unknown Collection type" when trying to compile/emit bytecode for a form like: (eval `(new java.util.ArrayList '~(lazy-seq []))) |
| 16:15 | pjstadig | "monkeypatching" your way into a reader literal tag that someone else wants is bad form |
| 16:15 | mikerod | or (eval `(MyDefType. '~(lazy-seq []))) |
| 16:15 | mikerod | In both cases it comes down to the clojure.lang.Compiler$EmptyExpr, but 2 separate methods both doing the same logical if-else-if flow. |
| 16:15 | amalloy | mikerod: what. why would you attempt to eval an arraylist or a deftype? |
| 16:15 | mikerod | amalloy: it is contrived as a simplified example |
| 16:15 | pjstadig | i thought there was some guidance somewhere that basically said unnamespaced reader tags are reserved |
| 16:15 | mikerod | what I really had was a macro |
| 16:15 | amalloy | okay, macros shouldn't emit those things either |
| 16:15 | mikerod | that built a constructor call |
| 16:15 | mikerod | ? |
| 16:16 | amalloy | you didn't build a constructor call; you constructed the object at macro time |
| 16:16 | technomancy | pjstadig: in elisp "namespaces" are done with prefixing function names with the lib name, and recently people started releasing a bunch of one-letter libraries because of how annoying that gets |
| 16:16 | llasram | pjstadig: I believe so, but there's also "generic" namespaces, like e.g. "dn" |
| 16:16 | mikerod | `(def ~'sym (new MyType '~(map identity ~some-arg)) |
| 16:16 | amalloy | ie, your macro should look like (defmacro foo [] `(MyDefType.)), not (defmacro foo [] (MyDefType.)) |
| 16:16 | mikerod | amalloy: it does |
| 16:16 | mikerod | all syntax quoted |
| 16:16 | llasram | s,"dn","db", |
| 16:16 | mikerod | AOT-compile breaks on the LazySeq being thought to be an EmptyExpr |
| 16:17 | mikerod | since LazySeq does not fit the if-else-if type checks |
| 16:17 | bendlas | llasram: idk about whether anybody can see it happen in practice, saying that is like saying "dynamic scope shouldn't be a problem, as long as people prefix their variables" |
| 16:17 | bendlas | it's just awkward, conceptually |
| 16:17 | pjstadig | technomancy: so because elisp is a terrible language, therefore no languages should have namespaces? |
| 16:17 | amalloy | mikerod: do you have an actual example? i think the snippet you actually pasted should work fine |
| 16:17 | amalloy | but i'm not entirely sure, in the presence of AOT |
| 16:17 | mikerod | In both the #emit method and the #getJavaClass method of teh clojure.lang.Compiler$EmptyExpr |
| 16:18 | mikerod | the eval I posted breaks if you do (binding [*compile-files* true] <form>) |
| 16:18 | llasram | bendlas: I guess I don't see how using a bad/generic data-reader literal namespace is any different from using a generic code namespace |
| 16:18 | michaniskin | bendlas: this is, in fact how dynamic vars work in clojure, lol |
| 16:18 | technomancy | pjstadig: no, it's more "be thankful for what you have" |
| 16:18 | pjstadig | hehe |
| 16:18 | technomancy | "there are starving children in elisplandia" etc |
| 16:18 | mikerod | amalloy: it has to be compiled, I suppose "AOT" style |
| 16:19 | bendlas | llasram: it isn't. and core is right to do nothing about it, because it's a packaging problem |
| 16:19 | amalloy | mikerod: so it sounds like in that case (def x (eval (lazy-seq []))) would break too |
| 16:19 | llasram | bendlas: k |
| 16:19 | bendlas | that still doesn't help us |
| 16:19 | pjstadig | EVERYTHING IS TERRIBLE |
| 16:19 | stuartsierra | haha |
| 16:19 | arrdem | pjstadig: whelp, better become a hermit then. |
| 16:19 | llasram | My cat has similar opinions, frequently at 3am |
| 16:20 | mikerod | amalloy: that works for me when I test it |
| 16:20 | llasram | Mmmm.... hermit cat.... |
| 16:20 | pjstadig | arrdem: i'm already basically a hermit. (work from home) :) |
| 16:20 | arrdem | pjstadig: were you the JPL guy too or is that another lurker... |
| 16:20 | pjstadig | llasram: does it move into a new shell every few years? |
| 16:20 | llasram | I'm going to say yes, because that is adorable to contemplate |
| 16:20 | pjstadig | arrdem: i'm no lurker! |
| 16:20 | mikerod | amalloy: It seems to have to go through this flow -> clojure.lang.Compiler$NewExpr -> clojure.lang.Compiler$MethodExpr -> clojure.lang.Compiler$EmptyExpr |
| 16:21 | pjstadig | no JPL |
| 16:21 | amalloy | mikerod: (binding [*compile-files* true] (eval `(def ~'x (Foo. ~(lazy-seq []))))) works fine for me |
| 16:21 | arrdem | pjstadig: a thousand pardons saiib |
| 16:21 | amalloy | as does (binding [*compile-files* true] (eval `(def ~'x (Foo. '~(lazy-seq []))))) |
| 16:22 | pjstadig | ~suddenly |
| 16:22 | clojurebot | suddenly is ! |
| 16:22 | mikerod | (binding [*compile-files* true] (eval `(new java.util.ArrayList '~(lazy-seq [])))) ; throws the exception for me |
| 16:22 | pjstadig | ಠ_ಠ |
| 16:22 | mikerod | {:major 1, :minor 5, :incremental 1, :qualifier nil} though, perhaps its the clj version |
| 16:23 | amalloy | mikerod: that fails for me too, but it's nothing to do with AOT |
| 16:23 | bendlas | llasram, michaniskin still, the correct solution IMO would be to implement lexical scope and give every .jar its separate data_readers binding |
| 16:23 | johncash | would it be bad to overload class on a protocol |
| 16:23 | amalloy | (defmacro foo [] `(java.util.ArrayList. '~(lazy-seq []))) (foo) fails the same way |
| 16:23 | johncash | so (class weapon) == "mighty" |
| 16:23 | mikerod | b |
| 16:23 | bendlas | hard to do with classloader badness java |
| 16:24 | bendlas | and I'm not sure whether core could do anything to support that |
| 16:24 | mikerod | amalloy: yes, good simplification |
| 16:24 | technomancy | bendlas: during uberjarring you'd have to map namespaces back to the jar from whence they came |
| 16:24 | mikerod | I'm not sure what is making the type be LazySeq |
| 16:24 | mikerod | but go through the Compiler$EmptyExpr flow |
| 16:25 | amalloy | so the problem is when you quote an empty collection, and then attempt to eval/compile that |
| 16:25 | arrdem | so.... how does clojure.core define clojure.core/ns on line 5305 and use it on like line 5... |
| 16:25 | amalloy | because the compiler believes it knows how to produce an instance of an empty collection, but doesn't cover all possible types |
| 16:25 | gfredericks | it redefines things sometimes |
| 16:25 | bendlas | technomancy: yes, and to be correct, that would also need to happen during regular load |
| 16:25 | pjstadig | i thought ns was sort of a special form, too |
| 16:26 | mikerod | amalloy: (eval `'~(lazy-seq '())) |
| 16:26 | Bronsa | arrdem: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/RT.java#L307 |
| 16:26 | technomancy | pjstadig: it's hard-coded in weird ways but not like other special forms |
| 16:26 | amalloy | (defmacro foo [] `'~(lazy-seq [])) |
| 16:26 | amalloy | yeah |
| 16:26 | arrdem | Bronsa: cheers |
| 16:26 | mikerod | hmm |
| 16:26 | pjstadig | technomancy: right maybe I mean a first among macros or something |
| 16:26 | mikerod | My workaround where it occurred for me was to just not put a LazySeq there |
| 16:26 | amalloy | well, of course |
| 16:26 | mikerod | but it is sneaky. I was trying to see if I could find a related defect somewhere |
| 16:27 | amalloy | there have been issues with emptyexpr somewhere before |
| 16:27 | technomancy | pjstadig: sounds about right |
| 16:28 | arrdem | Bronsa: AH. Cute! thanks, that block wasn't clear to me initially. |
| 16:28 | johncash | is there a way to see if a record implements a protocol? |
| 16:28 | bendlas | johncash: satisfies? |
| 16:28 | amalloy | &(doc satisfies?) |
| 16:28 | lazybot | ⇒ "([protocol x]); Returns true if x satisfies the protocol" |
| 16:29 | johncash | (inc bendlas) |
| 16:29 | lazybot | ⇒ 1 |
| 16:29 | johncash | (inc amalloy) |
| 16:29 | lazybot | ⇒ 107 |
| 16:29 | bendlas | ... it's a start anyway ... |
| 16:29 | arrdem | (inc bendlas) ;; welcome to #clojure, have some karma |
| 16:29 | lazybot | ⇒ 2 |
| 16:29 | Bronsa | amalloy: mikerod I have a patch in a jira ticket that fixes that issue btw |
| 16:30 | bendlas | ^^ thx |
| 16:30 | amalloy | oh, that's nice, Bronsa. i couldn't find it from google |
| 16:30 | mikerod | Bronsa: well, that's good to hear |
| 16:30 | mikerod | I searched around the Jira, had no luck |
| 16:30 | Bronsa | http://dev.clojure.org/jira/browse/CLJ-1093 |
| 16:31 | mikerod | best I found was http://dev.clojure.org/jira/browse/CLJ-62 ; and that's not it |
| 16:31 | Bronsa | I don't really like my patch and I'll try to find a better solution in the next days btw. |
| 16:32 | Bronsa | ,(print-dup (subvec [1 2] 1) *out*) |
| 16:32 | clojurebot | #=(clojure.lang.APersistentVector$SubVector/create [2]) |
| 16:33 | mikerod | Bronsa: I saw this Jira recently actually. I didn't connect the dots that it was related to the issue I just found. |
| 16:34 | Bronsa | mikerod: the first half of the patch deals with your issue. instead of analyzing (lazy-seq []) in an EmptyExpr it leaves it as a ConstExpr and compiles it as a print-dup+read-string |
| 16:34 | amalloy | oh, i did find that one, Bronsa, but the title didn't look related to mikerod's issue |
| 16:34 | mikerod | Yeah, I can see how it is connected now. |
| 16:35 | Bronsa | amalloy: mikerod essentially EmptyExpr can only compile PersistentList/Vector/Map/Set but will match any IPersistentCollection |
| 16:35 | amalloy | yes, i noticed that in the compiler |
| 16:43 | mikerod | makes sense. |
| 16:48 | noncom|2 | when using RT or Compiler from Java (note: I'm currently restricted to the old 1.5.1 way), is there any notion of Clojure environment, which persists between the evaluation calls, i.e. the same persistance as in a repl? |
| 16:50 | amalloy | noncom: the entire runtime persists |
| 16:50 | justin_smith | noncom|2: isn't that persistence just based on the current namespace? |
| 16:50 | amalloy | it doesn't know whether you're calling it from java, or from a repl (which is, after all, java) |
| 16:51 | arrdem | Bronsa: how is import bound? I'm not seeing it defined in RT.java, but it's used in core.clj prior to being rebound so I must be missing something. |
| 16:51 | noncom|2 | justin_smith: but repl also persists in multiple nss |
| 16:51 | noncom|2 | amalloy: that's very cool, so it will work for me then! |
| 16:51 | gfredericks | does it bother anybody else that C-u C-x C-e doesn't print stdout to the repl buffer? |
| 16:52 | Bronsa | arrdem: clojure.core/import* is a special form |
| 16:52 | justin_smith | what I am saying is def is a thing that stores a value to a symbol in a namespace, that's how things persist - if RT did not persist things, you would need to reload clojure between each call, and you would notice, because that takes a while |
| 16:52 | nullptr | gfredericks: yes! |
| 16:52 | Bronsa | arrdem: look for ImportExpr in Compiler.java |
| 16:53 | arrdem | Bronsa: Ah. yeah it's import* I'm seeing used. osum. |
| 16:53 | amalloy | gfredericks: what *does* it do, in cider or nrepl or whatever the cool kids are using now? |
| 16:53 | gfredericks | amalloy ignores stdout |
| 16:53 | gfredericks | prints result to the current buffer |
| 16:53 | noncom|2 | justin_smith: oh that's true! i think me just wanted to be sure that using the internals from java code will behave the same way as from the repl |
| 16:53 | amalloy | in slime, it writes stdout and the return value both to the current buffer |
| 16:54 | gfredericks | I'm not sure I'd like that |
| 16:54 | amalloy | no, it sounds awful |
| 16:54 | amalloy | i never use C-u eval-stuff, myself |
| 16:54 | amalloy | i don't really get the use-case |
| 16:54 | gfredericks | I use scratch buffers a lot |
| 16:54 | gfredericks | for clojure |
| 16:54 | gfredericks | and C-u is a nice way to have a record of what I was doing |
| 16:55 | amalloy | interesting |
| 16:55 | gfredericks | by "scratch buffer" I mean an actual file that I keep uncommitted |
| 16:55 | gfredericks | so I'll have stuff lying around for weeks |
| 16:55 | gfredericks | feels less transient than a repl |
| 16:56 | amalloy | gfredericks: does cider remember your repl history yet? |
| 16:56 | nullptr | my case: kicking off some api stuff that might take a few minutes to run, and not wanting to hunt around the *Messages* buffer for the result |
| 16:56 | gfredericks | amalloy: um; M-p works but I thought that was because of generic emacs |
| 16:56 | amalloy | gfredericks: i mean across repl restarts |
| 16:56 | gfredericks | nullptr: I have a nice bg macro for backgrounding stuff, and would like the updat messages it prints to be in the repl buffer |
| 16:57 | gfredericks | amalloy: prollably not |
| 16:57 | lemonodor | i do wish cider didn’t kill my repl buffers so eagerly. |
| 16:57 | nullptr | gfredericks: yes, it's annoying that the prefix arg changes that |
| 16:57 | lemonodor | persistent repl history would be nice, but even just keeping my buffer around until i kill it would be cool. |
| 16:57 | gfredericks | nullptr: maybe I'll make a PR then |
| 16:57 | technomancy | persistent history is a thing |
| 16:57 | gfredericks | it feels more likely to be annoyed that the *out* is lost than that it's kept |
| 16:58 | technomancy | I don't know why it's not on by default |
| 16:58 | amalloy | i have stuff in my *slime-repl clojure* buffer that's about a week old, which i guess is the last time i closed/opened emacs? my input history goes back for a month or two, but i can see how it would be useful to use this C-u stuff to have the outputs associated with those inputs |
| 16:58 | gfredericks | I feel like scratch files are more flexible than a repl buffer |
| 16:59 | arrdem | gfredericks: here here... I like being able to save my scratch work. |
| 17:00 | arrdem | I actually have a ~/scratch project that's just bits and bats with a project dependency list as long as your arm where I prototype stuff before promoting it to a real project. |
| 17:00 | pjstadig | gfredericks: sounds like you want something more like session |
| 17:01 | pjstadig | https://github.com/kovasb/session |
| 17:01 | gfredericks | yes but without a web browser :P |
| 17:01 | pjstadig | right :) |
| 17:01 | gfredericks | I'm not sure what features I'm missing though? |
| 17:03 | arrdem | so what was the rational for data_readers.clj rather than having a (define-syntax)? |
| 17:04 | tudd | interop ? : does :exposes-methods param in gen-class only expose a protected SuperClass method? |
| 17:04 | gtrak | arrdem: the reader needs to be bootstrapped before anything else runs, and you can traverse classpath-resources recursively to assemble everything. |
| 17:04 | gtrak | arrdem: you need some kind of entry-point. |
| 17:05 | tudd | can't seem to have clojure find protected methods. not sure why.. |
| 17:05 | gfredericks | PR for cider & *out*: https://github.com/clojure-emacs/cider/pull/571 |
| 17:05 | gtrak | arrdem: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6989 |
| 17:06 | arrdem | gtrak: yeah I'm already looking at ti. |
| 17:06 | gtrak | notice it all runs at the end of core.clj |
| 17:06 | gtrak | so, before anything else. |
| 17:06 | nullptr | (inc gfredericks) |
| 17:06 | lazybot | ⇒ 55 |
| 17:07 | arrdem | hum.... close enought. |
| 17:07 | arrdem | (inc gtrak) |
| 17:07 | lazybot | ⇒ 11 |
| 17:10 | arrdem | (doc ..) |
| 17:10 | clojurebot | "([x form] [x form & more]); form => fieldName-symbol or (instanceMethodName-symbol args*) Expands into a member access (.) of the first member on the first argument, followed by the next member on the result, etc. For instance: (.. System (getProperties) (get \"os.name\")) expands to: (. (. System (getProperties)) (get \"os.name\")) but is easier to write, read, and understand." |
| 17:10 | arrdem | oops. thanks clojurebot |
| 17:11 | liflash | hi everyone |
| 17:12 | liflash | i've got a problem starting a repl |
| 17:12 | liflash | i have a dev namespace that contains stuff for an austin repl |
| 17:14 | liflash | when starting a repl with the project.clj containing an init-ns with the dev namespace i always get the classnotfound exception for cemerick.austin.repls |
| 17:14 | liflash | when starting the repl without the init-ns in the dev namespace and requiring it in the repl everything works fine |
| 17:14 | liflash | any ideas |
| 17:14 | liflash | ? |
| 17:21 | kenrestivo | (inc nobody-in-particular) |
| 17:21 | lazybot | ⇒ 1 |
| 17:22 | kenrestivo | also, i thought .. was deprecated in favor of The Pointy Stuff, ie. -> and ->> |
| 17:25 | amalloy | kenrestivo: not deprecated. just discouraged/displaced |
| 17:26 | dgleeson | does anyone know if there is a plugin for lein or something to produce a dependency report? |
| 17:27 | technomancy | dgleeson: like `lein deps :tree`? |
| 17:27 | technomancy | or maybe https://github.com/technomancy/lein-licenses |
| 17:27 | dgleeson | oh perfect |
| 17:27 | dgleeson | thanks! |
| 17:27 | technomancy | np |
| 17:28 | dgleeson | oh your plugin is even better, awesome, I'm trying to get all the libraries and stuff I'm using approved by legal at my work. |
| 17:29 | liflash | nobody any idea why a namespace wouldn't be found when starting a repl compared to being already in a repl? |
| 17:33 | lemonodor | eek. fear the number of “Unknown” licenses I’m seeing reported by lein licenses. |
| 17:33 | technomancy | sadface |
| 17:33 | technomancy | lemonodor: open issue reports if you can |
| 17:33 | lemonodor | already in progress |
| 17:33 | technomancy | invaluable man |
| 17:34 | technomancy | though don't trust the plugin's heuristic 100% either |
| 17:34 | technomancy | there could be a license that just isn't declared in a way that's easy to guess programmatically |
| 17:34 | technomancy | though it never hurts |
| 17:34 | arrdem | technomancy: don't you have a license as part of the project.clj? |
| 17:35 | arrdem | or are people silly and don't provide that.. |
| 17:35 | technomancy | it's not required |
| 17:35 | technomancy | though lein yells at you during deploy if you omit it |
| 17:36 | technomancy | and you get it if you use lein new |
| 17:38 | arrdem | λα |
| 17:40 | johncash | so i have a record in an atom. im calling a function in that record that returns a new record. whats the idomatic way to update the atom? (reset! foo (func @foo "thing)) ? |
| 17:40 | johncash | idiomatic |
| 17:41 | gfredericks | nope |
| 17:41 | gfredericks | (swap! foo func "thing") |
| 17:41 | johncash | ah |
| 17:41 | johncash | brilliant |
| 17:41 | johncash | this immutable stuff takes some getting used to |
| 17:41 | tolstoy | Anyone know if something changed in the latest OM such that "set-state!" no longer triggers an om render? |
| 17:41 | gfredericks | yep |
| 17:41 | johncash | (inc gfredericks) |
| 17:41 | lazybot | ⇒ 56 |
| 17:43 | amalloy | johncash: it's not really immutable stuff if you're just shoving it all into an atom, eh? |
| 17:43 | clojurebot | Gabh mo leithscéal? |
| 17:46 | gfredericks | amalloy: depends on how you interact with it; you still get snapshots |
| 17:46 | johncash | amalloy: isn't it still immutable, the pointer is just different ? |
| 17:46 | sdegutis | johncash: swap requires pure function though |
| 17:46 | amalloy | yeah, what i said isn't really useful this time |
| 17:46 | amalloy | (dec amalloy) |
| 17:46 | lazybot | You can't adjust your own karma. |
| 17:46 | gfredericks | (dec amalloy) |
| 17:46 | lazybot | ⇒ 106 |
| 17:47 | amalloy | gfredericks: i know you've been fantasizing about doing that, so i thought i'd show you it was okay |
| 17:47 | gfredericks | amalloy: ...thanks man. I needed that. |
| 17:47 | gfredericks | I think I'm going to be okay now. |
| 17:50 | gfredericks | when are we going to upgrade this karma to LazyCoin? |
| 17:50 | gfredericks | we just have to figure out how to enforce that mining for LazyCoin can only be done by helping people with clojure |
| 17:52 | lemonodor | there, now everyone just has to accept my pull requests and then the whole world needs to update all their dependencies to the latest version, and lein licenses will give me a clean report. i do it not for myself, but for the clojurians of the far future. |
| 17:53 | liflash | 2nd try: any idea why a class is not found on repl startup, but using it in a running repl is ok? |
| 17:57 | johncash | race condition? |
| 17:59 | liflash | hmmm, i also thought about that... but it did work in the past and why would the repl init a ns without loading the classpath? |
| 18:08 | arrdem | liflash: some clojure code you load explicitly mutates the load path would be my bet. |
| 18:10 | stuartsierra | liflash: anything AOT-compiled? Try `lein clean` |
| 18:11 | liflash | you're right, that's a possibility... it's the austin plugin and i think it does some stuff with the paths |
| 18:12 | liflash | thanks for the hint, stuartsierra, but that doesn't seem to do the trick |
| 18:13 | liflash | is someone able to reproduce this? maybe my project setup is kind of messed up |
| 18:13 | liflash | here's my setting |
| 18:15 | liflash | project.clj: :repl-options {:init-ns tools} :profiles {:dev {:plugins [[com.cemerick/austin "0.1.4"]]}} |
| 18:15 | liflash | in the tools ns i got the code from the sample project: |
| 18:15 | liflash | (def repl-env (reset! cemerick.austin.repls/browser-repl-env |
| 18:15 | liflash | (cemerick.austin/repl-env))) |
| 18:15 | liflash | |
| 18:15 | liflash | (defn browser-connected-repl [] |
| 18:15 | liflash | (cemerick.austin.repls/cljs-repl repl-env)) |
| 18:15 | liflash | |
| 18:19 | liflash | oh, and i get the classnotfoundexception for the cemerick.austin.repls |
| 18:20 | stuartsierra | liflash: Did you `require` the cemerick.austin.repls namespace before using it? |
| 18:20 | liflash | not in the tools ns |
| 18:21 | stuartsierra | There's your problem, then. :) |
| 18:21 | streblo | what did people here do to learn clojure? |
| 18:21 | liflash | i thought it should work when referencing the whole classpath and name |
| 18:21 | liflash | because this works in the repl, too |
| 18:22 | liflash | and it did work in the past, already.... |
| 18:22 | stuartsierra | liflash: No, Clojure namespaces are not loaded automatically, even when you refer to them by their full name, unlike Java classes. |
| 18:22 | liflash | hmmm, ok |
| 18:22 | liflash | let me have a try |
| 18:28 | liflash | oh man..... this realy does the trick |
| 18:29 | liflash | thank you very much!! |
| 18:29 | stuartsierra | You're welcome! |
| 18:31 | liflash | streblo: i started with 4clojure |
| 18:31 | liflash | read a book |
| 18:31 | liflash | and started a small project to try out things |
| 18:39 | noncom|2 | is there any example of using Var.alterRoot() from ajva? |
| 18:39 | noncom|2 | *java |
| 18:57 | gtrak | noncom|2: you've gotta get the var instance, same as invoking a function. |
| 18:58 | noncom|2 | gtrak: yeah, got success with it :) |
| 18:58 | noncom|2 | too much boilerplate though |
| 19:51 | hiredman | why would you use alterRoot from java? |
| 19:52 | hiredman | I would hate to use it in clojure |
| 20:02 | lemonodor | technomancy: thanks for the edn.all. i may also take a look at handling parent poms. |
| 20:03 | technomancy | lemonodor: that would be sweet |
| 20:03 | technomancy | lemonodor: unfortunately clojars has been a bit neglected recently |
| 20:04 | technomancy | good to get some fresh blood in |
| 20:04 | lemonodor | it’s an important resource! |
| 20:05 | technomancy | yeah, it has been working remarkably good for all the neglect it gets |
| 20:05 | technomancy | *well |
| 21:32 | eflynn | hi |
| 21:46 | gfredericks | holy crap rich likes clojure.core/update |
| 21:46 | gfredericks | somehow I assumed that was impossible |
| 22:12 | muhuk | Is there a more idiomatic way to do this? https://gist.github.com/muhuk/08bc80611590f2fe79b1 |
| 22:13 | muhuk | Assuming I idempotent-fn is a 3rd party function. And assuming I'm trying to avoid memoizing a local copy of it. |
| 22:22 | gfredericks | muhuk: 3rd-party meaning a library or an external service-or-something? |
| 22:24 | muhuk | gfredericks: no, 3rd party package, a lein dependency. |
| 22:25 | gfredericks | as long as it doesn't constitute a top-level side effect, it's fine |
| 22:25 | gfredericks | so looks good to me |
| 22:25 | muhuk | gfredericks: let me ask you something else; does that form, fn inside a let seem ugly to you as well? |
| 22:25 | muhuk | gfredericks: so, I guess no |
| 22:25 | gfredericks | you could def the two results if you liked that better |
| 22:25 | gfredericks | then you could keep a defn |
| 22:26 | muhuk | gfredericks: right, but I was kinda trying to omit that |
| 22:26 | muhuk | gfredericks: I wanted to somehow keep those 2 calls within my function definition (def or defn or whatever) |
| 22:26 | gfredericks | decide what you hate more I guess :) |
| 22:26 | muhuk | gfredericks: right. |
| 22:27 | muhuk | gfredericks: thanks. |
| 22:27 | gfredericks | np |
| 22:36 | lemonodor | technomancy: i went with a really simple fix, but it seems to give much better clojars search results: https://github.com/ato/clojars-web/pull/210 |
| 22:38 | SegFaultAX | If I wanted to build my own http reverse proxy, what are some Clojure/Java libraries that I should start with? |
| 22:40 | gfredericks | I think I made quarter-assed one a couple years ago |
| 22:42 | lemonodor | the world of pom parent resolution looks kind of nasty. |
| 22:42 | gfredericks | https://github.com/fredericksgary/lib-5141 |
| 22:42 | gfredericks | SegFaultAX: ^ I'll bet you five bucks that isn't helpful |
| 22:42 | SegFaultAX | gfredericks: Actually that |
| 22:42 | SegFaultAX | 's pretty helpful. |
| 22:43 | gfredericks | crap |
| 22:43 | SegFaultAX | Cought it up. |
| 22:43 | SegFaultAX | And your lunch money too. |
| 23:13 | arrdem | gfredericks: I can loan you a couple KƉ if you need it :P |