2014-12-18
| 00:24 | bbloom | amalloy: kebab-o |
| 00:24 | abhjira | Hi! I am trying to read a file line by line in the clojure REPL, but seem to be having a little trouble. Would anyone have any guidance? Here is a gist with what's going on https://gist.github.com/anonymous/4e1feb0d1005c88c4598 |
| 00:27 | abhjira | Oh, looks like I am using the quote macro as opposed to quotes, I think I see the solution |
| 00:27 | abhjira | (line-by-line "/tmp/hi") instead of (line-by-line '/tmp/hi) or (line-by-line '/tmp/hi') |
| 00:38 | ddima | abeaumont: you are right, there's only double-quotes for strings and backslashes for characters (unlike python, which just supportes single-ticks and quotes) |
| 00:38 | ddima | -e |
| 00:38 | ddima | anyways, gn8 |
| 00:46 | FriedBob | Kinda bummed, just saw that the clojerks meetup was last week, not this week |
| 01:08 | FriedBob | Aww, gonna miss the Jan one too, as I'll be here the week after. Again. I'm going to have to have a talk with my manager I think |
| 01:11 | rhg135 | Hmm work vs clojure |
| 01:11 | FriedBob | clojure ftw win |
| 01:12 | FriedBob | I'm debating more beer + clojure, or sleep |
| 01:12 | rhg135 | Sleep is over hyped |
| 01:13 | FriedBob | Indeed |
| 01:14 | FriedBob | I'm finally adjusted to Pacific time, it doesn't feel like midnight right now. |
| 01:57 | cloudsaja | Hi all, noob question ... I see variable marked with '*' character before and after the variable name. What is the meaning of those ? |
| 02:02 | ffwacom | It's a convention for vars that can be rebound |
| 02:05 | ffwacom | Global or config values like database connection string or stdout |
| 02:05 | ffwacom | Lookup binding function |
| 02:50 | rhg135 | ffwacom: don't even joke about global mutable state |
| 03:00 | justin_smith | ,(def ^:dynamic foo "some thread local value") |
| 03:00 | clojurebot | #'sandbox/foo |
| 03:02 | justin_smith | ,(def *foo* "should be thread-local") |
| 03:02 | clojurebot | #<CompilerException java.lang.SecurityException: denied, compiling:(NO_SOURCE_PATH:0:0)> |
| 03:03 | justin_smith | mail cloudsaja see the warning you get with (def *foo* "should be thread-local") in a repl, the compiler warns if a var name with earmuffs is not a thread-local var http://clojure.org/vars |
| 03:03 | justin_smith | $mail cloudsaja see the warning you get with (def *foo* "should be thread-local") in a repl, the compiler warns if a var name with earmuffs is not a thread-local var http://clojure.org/vars |
| 03:03 | lazybot | Message saved. |
| 03:05 | justin_smith | rhg135: it's not just global mutable state (all vars are global mutable state) but the expectation of using thread-local mutation. It's baked in pretty deep (see *out* for example) |
| 03:06 | rhg135 | Lol |
| 03:06 | rhg135 | Expect nothing |
| 03:08 | justin_smith | The language has thread local mutation of global values as a fundamental mechanism. It sometimes sucks, but the language is designed around it. |
| 03:09 | justin_smith | pr, print, prn, println, clojure.pprint/pprint, with-out-str |
| 03:09 | rhg135 | Have you read the ghc source, it could be worse |
| 03:10 | justin_smith | But this isn't just clojure source, it's the clojure api. |
| 03:12 | rhg135 | I don't really use them |
| 05:02 | tangrammer | Hi folks, I’m working in customization sturtsierra component systems utility and just wanting to know if anyone is using this stuartsierra feature too |
| 05:04 | clgv | tangrammer: there are definitely some users of it, according to what one can read here and on the ML |
| 05:05 | clgv | though there are also alternative approaches that were inspired by the component library |
| 05:06 | tangrammer | clgv: Hi and thanks for answering, I’m interested in which types of customization were being used |
| 05:07 | tangrammer | clgv: due that I implemented co-dependency https://github.com/tangrammer/co-dependency and aop https://github.com/milesian/aop |
| 05:08 | tangrammer | clgv: and was trying to develop a customization pattern that decomplects component/start from others system updates https://github.com/milesian/BigBang |
| 05:08 | clgv | tangrammer: ah, you are that guy ;) |
| 05:09 | tangrammer | clgv: I suppose :) and who are you then? |
| 05:10 | clgv | tangrammer: on github you mean? since I only remembered reading the announcement of "aop" on the ML ;) |
| 05:11 | tangrammer | clgv: ok, I got it |
| 05:11 | tangrammer | clgv: btw, what do you mean with “ML”? |
| 05:11 | clgv | mailing list |
| 05:14 | tangrammer | clgv: btw again, what do you think about this milesian/aop stuff? I’m really interested on feedback |
| 05:15 | clgv | tangrammer: I didn't use the component approach, yet. just read about it several times. |
| 05:15 | TEttinger2 | Raynes, justin_smith: this is new. |
| 05:15 | TEttinger2 | $google anything |
| 05:15 | TEttinger2 | $ping |
| 05:15 | lazybot | TEttinger2: Ping completed in 0 seconds. |
| 05:16 | clgv | $google something |
| 05:16 | clgv | $google clojure |
| 05:16 | TEttinger2 | the results string refers you to https://developers.google.com/custom-search/ |
| 05:16 | TEttinger2 | because the search API is no longer supported |
| 05:16 | clgv | ah damn. plugin upgrade^^ |
| 05:16 | TEttinger2 | 100 searches a day for free, how generous of you |
| 05:17 | TEttinger2 | DDG has an API! |
| 05:17 | TEttinger2 | https://ddg.gg |
| 05:17 | TEttinger2 | short for https://duckduckgo.com/ |
| 05:19 | tangrammer | clgv: thanks, are you working with cljs maybe? |
| 05:20 | clgv | tangrammer: no. plain old clojure ;) |
| 05:21 | tangrammer | clgv: can i see your github work? just curiosity ;) |
| 05:25 | m1dnight_ | At the moment I'm using a linkedlist in java for my actor queue (it is a java class) and I pass in a clojure function to compare elements (messages) to get the right one |
| 05:26 | m1dnight_ | now I would like to use LinkedHashSet in java, but that requires the instances (object) to implement equal and hash. Would it be possible to implement an object in clojure that overrides hash and equals? |
| 05:26 | m1dnight_ | So I could just use the java LinkedHashSet |
| 05:26 | m1dnight_ | https://gist.github.com/shinmuro/9338262 I'm looking at something like this |
| 05:28 | dysfun | tangrammer: totally offtopic, but does your nick come from anywhere in particular? there's a perl module named Tangram that does an interesting attempt to introduce relational database semantics to in-process data. |
| 05:31 | justin_smith | TEttinger: yeah, it would be nice to add a $ddg plugin |
| 05:31 | tangrammer | dysfun: sounds really pretty but tangrammer mean that I like to imagine my code is like a https://www.google.co.uk/search?q=tangram&biw=1918&bih=1102&tbm=isch&tbo=u&source=univ&sa=X&ei=KKySVJOsFsPxaOnlgrgJ&ved=0CD0QsAQ |
| 05:32 | dysfun | tangrammer: i think my code looks like that rather too often :) |
| 05:32 | rhg135 | TEttinger: challange accepted |
| 05:33 | noncom|2 | m1dnight: what about using a proxy? |
| 05:36 | TEttinger2 | one of the better free APIs these days is http://www.faroo.com/hp/api/api.html |
| 05:39 | noncom|2 | m1dnight: as a side note: the "method" names like (set-name!) and (get-name) are somewhat redundant. more clojuric style would be (name!) and (name) respectively |
| 05:44 | dysfun | i suspect that's open to opinion |
| 05:44 | dysfun | though i much prefer short names |
| 05:47 | justin_smith | noncom|2: well, setters are not idiomatic period, and the usual idiom is to have a separate function that takes a place and a function for transformation, or a place and a new unconditional value as arguments |
| 05:49 | noncom|2 | justin_smith: yes, you are right.. what you say is just even more into clojuriness of things and is actually even the better way to do things |
| 05:56 | ffwacom | https://pbs.twimg.com/media/B5HA7_CCQAAz28Y.jpg:large |
| 06:14 | TEttinger2 | hm, looks like yacy returns almost entirely spam... |
| 06:15 | Empperi | is it possible to execute arbitrary code with leiningen via :injections ? |
| 06:15 | TEttinger2 | I wonder if yandex has a free API |
| 06:15 | Empperi | it seems like my code isn't executed |
| 06:15 | Empperi | it's like it wouldn't care about :uberjar profile at all |
| 06:31 | clgv | Empperi: you want injections to work in the compiled uberjar? |
| 06:32 | Empperi | I want to execute some code which generates stuff into target/classes |
| 06:32 | Empperi | before the actual uberjar is created |
| 06:32 | clgv | Empperi: write a hook for the "uberjar" task |
| 06:32 | clgv | Empperi: :injections is the wrong thing for that |
| 06:32 | Empperi | hmm |
| 06:33 | Empperi | so like :hooks [my-thing/do-the-stuff] |
| 06:33 | hyPiRion | Empperi: :injections are only used for forms evaluated in the project. Jar and uberjar does neither |
| 06:33 | hyPiRion | does not do that* |
| 06:34 | clgv | Empperi: yes |
| 06:35 | Empperi | I wonder if it would work if I just wrote :hooks [(fn activate[] #_mycode)] |
| 06:35 | Empperi | :P |
| 06:35 | clgv | Empperi: the namespace you provide there, should contain a (defn avtivate [] ...) where you use robert.hooke on the needed functions (probably "uberjar") |
| 06:35 | clgv | Empperi: you can check the leiningen source ;) |
| 06:36 | clgv | Empperi: but probably not |
| 06:40 | noncom|2 | once i get a ProcessIml class instance by doing (.exec (Runtime/getRuntime) my-command) - then how do i read its output ? |
| 06:40 | noncom|2 | *ProcessImpl |
| 06:41 | noncom|2 | i can access the stdin and stdout streams by the corresponding getters, however, i do not fully understand how to communicate with it by means of clojure.. |
| 06:42 | noncom|2 | basically i just want to get what the command returned |
| 06:42 | noncom|2 | and if it opened a prompt of some kind, write into it |
| 06:42 | noncom|2 | (like an ssh connection) |
| 06:44 | TEttinger2 | rhg135, in case you haven't noticed, DDG's API only returns instant answers, of which it frequently returns nothing |
| 06:54 | ffwacom | can I ask you guys something personal? |
| 06:55 | llasram | *snork* |
| 06:55 | llasram | dysfun: Thanks, that coffee goes down the lungs great |
| 06:56 | ffwacom | do you ever wonder if we are propelling humanity faster into a machine war with the greater expressiveness of lisp based languages and functional paradigms? |
| 06:56 | ffwacom | if we could stave off an AI escalation session by even 1 month |
| 06:56 | clgv | O_o |
| 06:56 | llasram | ffwacom: no |
| 06:56 | clgv | o_O |
| 06:56 | ffwacom | isn't it worth it to abandon clojure and go back to less expressive languages? |
| 06:56 | dysfun | llasram: you're welcome :) |
| 06:57 | clgv | :P |
| 06:57 | Empperi | clgv: had to grab a quick lunch |
| 06:57 | ffwacom | and finally, won't someone think of the children? what will be our legacy? |
| 06:57 | Empperi | so, can I write a hook without writing a separate leiningen plugin? |
| 06:57 | clgv | Empperi: uhm good question. |
| 06:57 | dysfun | me also wonders what defines 'personal' in ffwacom's world |
| 06:58 | dysfun | (with added / ) |
| 06:58 | Empperi | clgv: because that's exactly what I don't want to do |
| 06:58 | clgv | ffwacom: the promises of AI from the sixties are still unfulfilled. so no worries on that terminator scenario ;) |
| 06:58 | Empperi | since it'll make our build more complex for no reason |
| 06:58 | ffwacom | dysfun: we are all in this together |
| 06:58 | Empperi | this stuff is relevant for only this project |
| 06:58 | ffwacom | clgv: they were nieve |
| 06:59 | dysfun | clgv: i hear grey goo is what we're supposed to fear now |
| 06:59 | Empperi | if I don't get this to work pretty soon then I'll change the behavior in such a way that when ran from uberjar the code is executed on startup and the end result is spit into temporary directory |
| 06:59 | ffwacom | clgv: http://40.media.tumblr.com/dff4132c50ad8b75ba333c11c783cd78/tumblr_nf41ewhm9p1tl21beo2_1280.jpg |
| 06:59 | clgv | Empperi: so the code of the plugin must get on the classpath of leiningen. |
| 06:59 | Empperi | and write custom handling for reading from there |
| 06:59 | dysfun | ffwacom: perhaps you'd be more interested in studying the ethical implications of giving away software for free when people could abuse it, e.g. to send spam. it's a comparable issue and more real-world |
| 07:00 | clgv | Empperi: when you use :plugins that is take care of. |
| 07:00 | Empperi | also it seems like :hooks are ran before any compilation is done |
| 07:00 | ffwacom | dysfun: It helps humanities communication immune system |
| 07:00 | Empperi | thus it doesn't know anything about code written as hooks in the same project |
| 07:00 | ffwacom | dysfun: might as well have an arms race until the real threat appears |
| 07:01 | clgv | Empperi: yeah. you got to use robert.hooke or similar to hook your code to the tasks where you need it |
| 07:01 | ffwacom | which is CYBERWAR |
| 07:01 | Empperi | this is a stupid limitation I have to say |
| 07:01 | Empperi | all I want to do is execute 3 lines of code before uberjar is created |
| 07:01 | dysfun | ffwacom: i have no idea what a 'communication immune system' is. but i don't think it's that i'm short on coffee this morning |
| 07:01 | ffwacom | dysfun: yeah fair enough |
| 07:01 | Empperi | but guess I'll go with the tempdir solution |
| 07:01 | ffwacom | dysfun: didn't really make sense did it |
| 07:01 | Empperi | and forget about doing this at compile time |
| 07:02 | TEttinger | can I ask you guys something personal? |
| 07:02 | ffwacom | dysfun: tried to recover by capitalising cyberwar |
| 07:02 | TEttinger | do you think that lispers make better coffee than java programmers, making the name "java" unintended irony? |
| 07:02 | dysfun | ffwacom: best get a blog and explain it properly |
| 07:02 | ffwacom | TEttinger: this isn't your blog |
| 07:02 | Empperi | clgv: thanks for your help |
| 07:02 | dysfun | TEttinger: only if i can ask you something impersonal |
| 07:02 | clgv | TEttinger: lispers have to make their coffee themselves? O_o we got a machine for that ;) |
| 07:03 | clgv | Empperi: glad to help |
| 07:03 | kungi1 | g |
| 07:03 | dysfun | clgv: my bean to cup machine broke. we use a french press now. |
| 07:03 | TEttinger | I like my aeropress but I just take a half of a no-doz when I need caffeine these days |
| 07:03 | noncom|2 | did anyone ever use https://github.com/Raynes/conch ? |
| 07:04 | clgv | noncom|2: yeah. though it was quite a while ago |
| 07:04 | TEttinger | or 1.5 no-doz (300mg caffeine, or 2-3 cups strong coffee) right before a half-hour nap |
| 07:04 | dysfun | if aeropress satisfies you, you don't really have a coffee habit. not enough quantity |
| 07:04 | noncom|2 | clgv: so i do => (sh/let-programs [lein "c:\\Users\\user\\.lein\\bin\\lein.bat"] (lein {:in "uberjar"})) |
| 07:04 | TEttinger | dysfun, do french presses make more? |
| 07:04 | dysfun | i'm on my third litre of coffee already |
| 07:05 | dysfun | TEttinger: my french press makes a litre in one go |
| 07:05 | TEttinger | you can send coffee through an aeropress instead of water |
| 07:05 | TEttinger | making supercoffee |
| 07:05 | clgv | noncom|2: not sure about the map syntax, I used strings for the arguments back then |
| 07:05 | ffwacom | TEttinger: just buy modafinil |
| 07:05 | ffwacom | TEttinger: it's coffee without the side effects |
| 07:05 | dysfun | ffwacom: it is not without side effects here. i used to take it daily |
| 07:06 | ffwacom | dysfun: what happened? |
| 07:06 | ffwacom | what mg, your weight etc? |
| 07:06 | noncom|2 | clgv: and it prints out just the standard lein output, like i did not pass uberjar to it |
| 07:06 | noncom|2 | why? :) |
| 07:07 | dysfun | 200mg/day, weight ~100kg. positive effects: became able to tolerate anything and everything that came my way (had the most demanding job i've ever had, handled it like a breeze). but at the expense of quality of life |
| 07:07 | noncom|2 | i just want to automate my project re-compilation and deployment through ssh... so now trying with conch.. maybe someone could suggest some other options for this process ? |
| 07:07 | ffwacom | dysfun: what quality of life issues? |
| 07:07 | dysfun | became difficult to go to sleep for one, and i felt permanently stimmed up |
| 07:07 | dysfun | and i felt like i was going to have a heart attack quite frequently after about 3 months |
| 07:07 | clgv | noncom|2: what about (lein "uberjar") ? |
| 07:08 | ffwacom | dysfun: ah that sucks |
| 07:08 | noncom|2 | like, i develop my project and then just type (deploy) in the repl, and it does all |
| 07:08 | clgv | noncom|2: isn't :in for standard input the program gets? but "uberjar" needs to be a cli arg |
| 07:08 | dysfun | ffwacom: these days i tend to pop one every few weeks if i want to have a clean flat |
| 07:08 | ffwacom | armodafinil or modafinil at 200mg? |
| 07:08 | ffwacom | heh |
| 07:08 | TEttinger | I take vyvanse now, which is similar to modafinil in concept (long acting adderall substitute instead of long acting caffeine/amphetamine substitute) |
| 07:08 | dysfun | modafinil. armodafinil was weird |
| 07:09 | ffwacom | fair enough |
| 07:09 | noncom|2 | clgv: heeeey, that worked! :) |
| 07:09 | clgv | noncom|2: you could use leiningen as library though, to avoid the indirection |
| 07:09 | TEttinger | I definitely feel more clear-headed when vyvanse is in my system, which to some extent is all the time |
| 07:10 | TEttinger | it helps me focus for hours, it just sometimes makes me robotic in my work ethic |
| 07:10 | ffwacom | 120mg armodafinil @ 70kg fucks my sleep, but been on 60mg and it's ok |
| 07:10 | noncom|2 | clgv: true, i guess i will go into it after some time. now just need the basic pipeline to work |
| 07:10 | ffwacom | don't take it every day though |
| 07:11 | ffwacom | I don't take it every day* |
| 07:12 | noncom|2 | the best combo i can suggest would be piracetam or piracetam + green tea. as it is not a stimulant, it does not wear off the body and mind. good food and sleep are essential though. |
| 07:13 | ffwacom | yeah being healthy and getting a good rest makes the most difference |
| 07:13 | ffwacom | problem is it's not a silver bullet crushed into a pill |
| 07:15 | noncom|2 | i find the restructurizations of CNS caused by long-term use of stimulants to be non-profitable in the long run.. |
| 07:15 | noncom|2 | however... who knows :) |
| 07:17 | TEttinger | vyvanse apparently doesn't act like stimulants, it isn't categorized as one |
| 07:21 | noncom|2 | ummm http://en.wikipedia.org/wiki/Lisdexamfetamine |
| 07:24 | TEttinger | vyvanse was developed for the intention of creating a longer-lasting and less-easily abused version of dextroamphetamine, as the requirement of conversion into dextroamphetamine via enzymes in the red blood cells increases its duration of action, regardless of the route of ingestion |
| 07:24 | TEttinger | it's categorized as a prodrug, which is a confusing term |
| 07:25 | ffwacom | dextroamphetamine was everywhere in uni |
| 07:27 | clgv | ,(deref nil) |
| 07:27 | clojurebot | #<NullPointerException java.lang.NullPointerException> |
| 07:27 | noncom|2 | yeah, well, i know.. i have been taking similar stuff before.. it would be actually rather cool if they develop a stimulant (effectively) without the fainting side-effects |
| 07:27 | clgv | you need some for "deref" it is not nil friendly... |
| 07:27 | noncom|2 | in my country however, vyvanse is not available |
| 07:28 | clgv | *"some->" |
| 07:28 | TEttinger | I take a tiny dose and it works pretty well. I might go up to 30mg at some point since I can handle 20 well and I might benefit from more concentration |
| 07:28 | ffwacom | small doses of modafinil is the best I've found |
| 07:28 | ffwacom | non addictive, non euphoric |
| 07:29 | TEttinger | vyvanse isn't euphoric for me |
| 07:29 | TEttinger | and I may be developing a tolerance, but more likely the dose was too low to begin with |
| 07:29 | dysfun | half the reason to take modafinil is the euphoria. if you're working as hard as i was, you deserve to feel good instead of really crap |
| 07:30 | ffwacom | dysfun: nah fuck that |
| 07:30 | ffwacom | should just get you wired without the crap from coffee |
| 07:30 | ffwacom | need a goods night rest |
| 07:31 | noncom|2 | well.. still they haven't invented anything that beats meht.. |
| 07:31 | noncom|2 | but its crap, yes |
| 07:31 | ffwacom | dysfun: as a functional drug :P |
| 07:32 | noncom|2 | functional drugs for functional programmers :) let the oop-oriented crowd take the rest! |
| 07:32 | ffwacom | lel |
| 07:33 | dysfun | ffwacom: part of the whole modafinil experience is gaining energy through crushing through everything you're doing. how do you pick up energy from what you're doing without the euphoria? |
| 07:33 | ffwacom | dysfun: doesn't make me euphoric |
| 07:34 | ffwacom | just have a baseline of energy to do shit |
| 07:34 | ffwacom | that I can't drop below |
| 07:34 | dysfun | i can go for a week at a time with no energy to do anything, and then one day i can write a month's worth of useful code |
| 07:34 | noncom|2 | btw, i find that a series of 1-2 min meditations along the day make some wonderful change too |
| 07:34 | ffwacom | ¯\_(ツ)_/¯ |
| 07:35 | dysfun | so i'm probably not the best person to talk to about typical experiences |
| 07:35 | ffwacom | doesn't help with any fundamental issues anyway |
| 07:35 | ffwacom | not lifechanging by a long shot |
| 07:36 | ffwacom | nah jks |
| 07:37 | dysfun | ffwacom: clue's in the name. it's going to be silver bullet-shaped |
| 07:37 | noncom|2 | they say opiates are really life-changing if you go for that |
| 07:37 | noncom|2 | btw, a good example of when euphoria != productivity |
| 07:37 | ffwacom | healthy diet, sleep and exercise! |
| 07:38 | ffwacom | everything in moderation |
| 07:38 | noncom|2 | actually, too much euphoria will hinder any productivity. a mild euphoria from satisfaction of what youre doing is the best for work i guess |
| 07:38 | hellofunk | lol "opiates are really life-changing"... i mean, is the moon's dark side a cold place? |
| 07:39 | dysfun | we should really get a ##clojure-offtopic or something |
| 07:39 | ffwacom | heh |
| 07:39 | noncom|2 | agreed with ffwacom: balance proves to be the best (balance also implies balanced unbalancing in required times, so don't consider it too boring ) |
| 07:40 | noncom|2 | heck, everyone just does what he feels right at the moment :D |
| 07:40 | noncom|2 | anyway :) |
| 07:40 | ffwacom | best advice i've heard is to live like your grandparents did, they are too frail to fuck around so their diet and sleeping pattern is fairly spot on |
| 07:41 | clgv | there is an offtopic channel |
| 07:41 | clgv | #clojure-offtopic |
| 07:41 | dysfun | ooh |
| 07:41 | ffwacom | ^ |
| 08:02 | hellofunk | if you have multiple bindings in a when-let, i suppose it only does the when test on the first binding, ignoring the others, right? and the others would not occur should the first binding be logically false. |
| 08:03 | hellofunk | ah, i see now that only 2 forms are allowed in the bindings, thus you cannot have multiple bindings |
| 08:03 | Bronsa | hellofunk: wehn-let and if-let can only have one binding |
| 08:25 | dnolen_ | reiddraper: cljs-port-patch-2 for test.check is ready to test. mvn test works now for me. |
| 08:37 | crispin | hey peeps. |
| 08:37 | crispin | how do I do the equivalent of lein run -m using java and a jar? |
| 08:38 | crispin | like 'lein run -m myproj.server' as 'java -jar jarname.jar ...?' |
| 08:38 | crispin | java -jar uberjar.jar runs whats defined in :main in project.clj, but what about another entry point? |
| 08:48 | stuartsierra | crispin: `java -cp uberjar.jar <name-of-main-class>` or `java -cp uberjar.jar clojure.main -m <clojure-namespace-with-main>` |
| 08:53 | crispin | stuartsierra: I get Error: Could not find or load main class pyproj.server |
| 08:53 | crispin | for the first |
| 08:53 | crispin | and |
| 08:53 | crispin | Error: Could not find or load main class clojure.main |
| 08:53 | crispin | for the second |
| 08:54 | stuartsierra | for `java -cp jarfile <main-class>` you have to have an AOT-compiled Clojure namespace with :gen-class and -main. |
| 08:54 | clgv | crispin: you need to AOT compile the namespace you want to run as such |
| 08:54 | crispin | got -main |
| 08:55 | crispin | no :genclass |
| 08:55 | clgv | crispin: try something else. through the regular -main you specified in project.clj, read the first command line argument, convert it to a symbol, require the namespace belonging to the symbol. resolve the -main method in that namespace and invoke it with the remaing command line arguments |
| 08:56 | mnngfltg | If I have a form as a list and print it, I get this: (#<core$_EQ_ clojure.core$_EQ_@21d71fbe> 1 1) -- can I pretty print it like this: (= 1 1) ? |
| 08:56 | clgv | then you can just use "java -jar my.jar my.awesome.ns arg1 arg2 ..." |
| 08:56 | crispin | :profiles {:uberjar {:aot :all}} in my lein |
| 08:57 | clgv | crispin: I have been doing something similar for a jar that contains more than one tool |
| 08:57 | stuartsierra | clgv: java -cp, not java -jar |
| 08:57 | crispin | clgv Im hoping to make it self executable and the client aswell |
| 08:57 | clgv | stuartsierra: nope! java -jar when using the previous suggestion |
| 08:57 | crispin | so java -jar uberjar.jar is essestially the client |
| 08:57 | crispin | and lein server -m proj.server |
| 08:57 | crispin | is the server |
| 08:57 | stuartsierra | clgv: Oh, I see, when you're loading the namespace, sorry. |
| 08:58 | clgv | crispin: yeah, that'll call the -main in the namespace you provided leiningen |
| 08:58 | crispin | ok added gencalss, uberjared... now I get more: Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/IFn |
| 08:58 | clgv | stuartsierra: no problem ;) |
| 08:58 | clgv | crispin: did you run the uberjar? |
| 08:58 | crispin | yep |
| 09:00 | crispin | how do I make sure aot is on for both classes? |
| 09:00 | crispin | is :profile {:uberjar {:aot :all}} |
| 09:00 | crispin | enough |
| 09:00 | crispin | and genclasses of cource |
| 09:01 | clgv | crispin: with my suggestion you'd only need AOT for the one namespace containing the -main |
| 09:01 | crispin | yeah but then I cant run it as a mainline |
| 09:01 | crispin | Im using lein bin to make a self executable |
| 09:01 | crispin | I dont want to go |
| 09:01 | crispin | /bin/mytool proj.client -h |
| 09:02 | clgv | crispin: ok. is it sufficient for "lein bin" to have one AOT compile namespace? |
| 09:02 | crispin | unless I modify lein-bin and make it pass it in when evoked from commandline |
| 09:02 | clgv | crispin: so you only have one namespace that you want to use? |
| 09:03 | atankanow | hi crispin, your client and server code are in the same lein project? |
| 09:03 | crispin | atankanow: yes |
| 09:03 | crispin | they share much code |
| 09:03 | atankanow | i would extract all reusable code into a dependency and separate your client/server lein projects |
| 09:03 | crispin | i dont want to do that |
| 09:03 | crispin | cause a server is a client also |
| 09:04 | crispin | ok I looked in target/classes and its empty |
| 09:04 | atankanow | ok, but are they two separate applications? |
| 09:04 | crispin | atankanow: one app |
| 09:04 | atankanow | i see |
| 09:05 | crispin | if my target/classes is empty, does that mean no AOT happened? |
| 09:08 | crispin | found em in target/uberjar/classes |
| 09:12 | holo | hi |
| 09:12 | holo | ,(if-let [foo true] foo foo) |
| 09:12 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: foo in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 09:13 | holo | is there some rationale for not extending foo to the else form? |
| 09:14 | crack_user | what ->> and -> does mean in clojure? |
| 09:14 | clgv | holo: yeah, it is the definition of if-let, when you get no truthy value, do not bind anything |
| 09:15 | holo | crack_user: they are trush operators. i think it means thread first and thread last, respectively. think of it as pipelines |
| 09:15 | stuartsierra | holo: `if-let` is typically used to check if something is nil or empty, as in (if-let [s (seq foo)] …) so the value doesn't matter for the "else" case. |
| 09:16 | chouser | holo: Even if it was bound, it would only ever be nil or false—are you trying to distinguish between those two in the else clause? |
| 09:16 | clgv | crack_user: it allows pipelining syntax, e.g. (->> (range 100) (filter odd?) (reduce +)) instead of (reduce + (filter odd? (range 100))) |
| 09:16 | crack_user | thx |
| 09:18 | holo | stuartsierra: I understand most of the times it's not necessary, but now I 'needed' to feed the nil value to an fn, so I was curious as to understand why there is the limitation |
| 09:19 | clgv | holo: you need to feed a "nil" to a function? O_o that sounds very strange |
| 09:19 | clgv | holo: just insert a literal "nil" if the setup makes sense |
| 09:19 | holo | clgv: come on, how strange is that? :D you never feed nils? |
| 09:20 | clgv | holo: usually only in multi arity definitions as default values for "not specified" |
| 09:21 | clgv | but on the call site there is no need to pass a "nil" explicitely then |
| 09:24 | holo | clgv, now that you mention it, I could [& [may-be-nil]] on the input args. maybe i'm doing code smell with nil |
| 09:25 | clgv | holo: depends on the task whether that is a solution ;) |
| 09:26 | holo | clgv in this case it is, and it the broader context what you said is sound. I'll think about it more carefully when thinking about fn interfaces |
| 09:27 | crispin | I think whats happening is my uberjar is missing clojure.main |
| 09:27 | crispin | it has clojure/tools |
| 09:27 | crispin | it has my app generated classes |
| 09:29 | holo | (inc clgv) |
| 09:29 | lazybot | ⇒ 40 |
| 09:29 | clgv | thanks ;) |
| 09:40 | gfredericks | $mail andyf turns out that use of subseq was indeed buggy |
| 09:40 | lazybot | Message saved. |
| 09:43 | m1dnight_ | is it possible to override equals and hashcode for a deftype? |
| 09:44 | m1dnight_ | or should I use a defrecord? (/me is still reading up) |
| 09:45 | chouser | m1dnight_: defrecord defines equals and hashcode for you. deftype allows you to define your own. |
| 09:46 | m1dnight_ | yes, but i really need my won implementeation |
| 09:46 | m1dnight_ | wow, much typos :< |
| 09:47 | m1dnight_ | okay, i'll experiment a bit |
| 09:47 | chouser | so use deftype |
| 09:47 | m1dnight_ | okay, I found an example. I only found a SO question that said "use defrecord" |
| 09:47 | m1dnight_ | but I think i'm good to go now, thanks guys |
| 09:55 | crispin | clgv, atankanow: turned out to be a broken leiningen. updated to latest leiningen. 'java -cp uberjar.jar entry.point' works! |
| 09:55 | crispin | ,stuartsierra |
| 09:55 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: stuartsierra in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 09:55 | opqdonut | :D |
| 09:56 | clgv | crispin: good |
| 09:57 | clgv | m1dnight_: yeah just override both methods in your deftype |
| 09:59 | m1dnight_ | yeah I figured it out already |
| 09:59 | martinklepsch | anyone advice how to debug issues with cljx middleware? |
| 09:59 | m1dnight_ | i was just a little bit confused that you have to put "Object" as protocol/interface |
| 09:59 | m1dnight_ | since it is not an interface, but an actual class |
| 09:59 | martinklepsch | getting some wierd behaviour: https://gist.github.com/martinklepsch/7bd3cbdf810d8025c090 |
| 09:59 | m1dnight_ | but as I said, i'm still reading up so excuse if I sound stupid :p |
| 10:00 | clgv | m1dnight_: you dont even have to put it there - it is just documentation. the impl filters it out |
| 10:01 | clgv | ,(deftype Foo [] (toString [_] "awesome")) |
| 10:01 | clojurebot | #<CompilerException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol, compiling:(NO_SOURCE_FILE:0:0)> |
| 10:01 | clgv | ok damn you need at least one symbol there |
| 10:01 | clgv | ,(deftype Foo [] Object (toString [_] "awesome")) |
| 10:01 | clojurebot | sandbox.Foo |
| 10:02 | clgv | ok in that case it is needed |
| 10:02 | clgv | ,(deftype Foo [] Comparable (toString [_] "awesome")) |
| 10:02 | clojurebot | sandbox.Foo |
| 10:02 | clgv | ,(Foo.) |
| 10:02 | clojurebot | #<Foo awesome> |
| 10:03 | clgv | so you could skip it in the cases where you have another interface - but it serves as documentation |
| 10:15 | jonasen | Does Cursive work with Idea 14? It says on the website that "Cursive will work with IntelliJ versions 12.1 as well as the 13 and 13.1 versions." ? |
| 10:15 | dnolen_ | jonasen: it does |
| 10:15 | jonasen | dnolen_: good.. I will give it a try then |
| 10:18 | jonasen | dnolen_ are you using it for cljs dev? |
| 10:18 | dnolen_ | jonasen: no not at the moment though I've played around with it |
| 10:19 | dnolen_ | jonasen: it's great for regular dev, but some things in Emacs are still better (macroexpand is critical for me) |
| 10:21 | jonasen | dnolen_ Yes, I will give it a try and see if I like it. The demos from clojure/conj were really nice |
| 10:21 | jonasen | and I don't need macroexpand 9 days out of 10 :) |
| 10:21 | dnolen_ | jonasen: it's pretty awesome, stepping debugger is worth price of admission |
| 10:21 | clgv | dnolen_: you mean something like "inline macroexpand"? |
| 10:21 | dnolen_ | clgv: no macroexpand period |
| 10:22 | clgv | dnolen_: what is that? |
| 10:22 | dnolen_ | in a code formatted view |
| 10:22 | dnolen_ | clgv: Emacs Clojure integration has long support macroexpand form under cursor and opening a new buffer with pretty printed expanded source |
| 10:23 | clgv | dnolen_: ah nice |
| 10:24 | clgv | I always do that in repl via pprint which is not optimal ;) |
| 10:24 | dnolen_ | clgv: that fine for simple stuff, not fine for debugging core.match expansions |
| 10:24 | dnolen_ | or core.async |
| 10:25 | clgv | yeah, guess so. |
| 10:25 | clgv | had my own complicated macros where that approach was hard work... |
| 10:26 | tcrayford___ | dnolen_: I feel bad, but I never write complicated macros :( Prolly how it is as an application developer though |
| 10:27 | tcrayford___ | (I'm willing to bet datomic's codebase doesn't use many macros) |
| 10:27 | dnolen_ | tcrayford___: definitely don't recommend writing complicated macros - I hate macros, except the ones I like. |
| 10:27 | tcrayford___ | haha |
| 10:28 | tcrayford___ | I've found there's real issues with them exploding the JVM's inliner budget as well :/ |
| 10:28 | jonasen | so IntelliJ requires Java 1.6? |
| 10:28 | tcrayford___ | folk think "oh I can do this computation at compile time so it's fast" but then they blow past the JVM bytecode limit for inlining and it's all slow and terrible and confusing |
| 10:31 | dnolen_ | tcrayford___: oh yeah, was definitely a problem for core.match (I hear less about it now that the core.match is smarter than the earlier days). Gotta put a compiler in your macro for the compiler. |
| 10:31 | puredanger | if anyone feels like figuring out this craptastic compiler weirdness, please help :) https://groups.google.com/forum/#!msg/clojure/HK3x7cj3I1o/gy_a7G98VpQJ |
| 10:31 | tcrayford___ | haha yeah :( |
| 10:32 | puredanger | source: https://github.com/laurentpetit/ccw/blob/master/ccw.core/src/clj/ccw/eclipse.clj#L503 bytecode: https://www.google.com/url?q=https%3A%2F%2Fgist.github.com%2Fpuredanger%2F40dd3ec22fdb5836d1eb&sa=D&sntz=1&usg=AFQjCNH5DE1T02xS8UA_1qFtiyqUsZanIQ |
| 10:32 | puredanger | grr. bytecode: https://gist.github.com/puredanger/40dd3ec22fdb5836d1eb |
| 10:34 | ticking | dnolen_: btw is there a reason why core.match can't match on '() quoted lists and sets :)? |
| 10:35 | dnolen_ | ticking: because no one's filed a bug or submitted a patch? |
| 10:36 | ticking | dnolen_: ah :D, I thought maybe it was a conscious design decision so that people use ((foo :seq) :guard list?) or something |
| 10:36 | dnolen_ | ticking: :seq is slated for removal |
| 10:37 | dnolen_ | in 0.3.0 |
| 10:37 | ticking | dnolen_: After reading the nanopass compiler papers I realized that akhudek/zip-visit + core.match + prismatic/schema gives you all of the functionality described plus some flexibility and power |
| 10:38 | ticking | dnolen_: alright maybe I'll manage to write a patch for lists and sets :) |
| 10:38 | dnolen_ | ticking: at least open tickets :) |
| 10:38 | ticking | dnolen_: on my way :D |
| 10:45 | ticking | dnolen_: should lists and sets be two issues or one? "Support all edn datatypes in matches." |
| 10:45 | dnolen_ | ticking: separate tickets please |
| 10:45 | ticking | k |
| 11:11 | EvanR | is it possible to use "super" in the definition of a method of a genclass |
| 11:15 | machty | i'm new to clojure and still trying to grok "special form". Can you tell from syntax alone that something is a "special form" rather than just a "macro"? |
| 11:15 | tcrayford___ | machty: nope. There's a very limited number of special forms, and they're all special cased by the compiler |
| 11:18 | clgv | machty: for a beginner there is probably no difference between built-in macros or special forms |
| 11:18 | andyf | machty: Well, you can tell by the name of the first symbol whether it is a special form. Not sure if you are leaving that out of ?from syntax alone?, or including it. |
| 11:19 | machty | tcrayford___: so when the compiler sees `set!`, it's hooking into internal compiler logic, which is why it's smart enough not to eagerly evaluate, say (.-x point-object), and rather treat it as a java instance field set instead, a la (set! (.-x point-object) 123) |
| 11:19 | machty | andyf: how can you tell? |
| 11:19 | machty | "def", "set!", etc, both special forms |
| 11:19 | tcrayford___ | machty: you can tell special forms because they say so in the docstring ;) |
| 11:20 | andyf | ,(sort (keys clojure.lang.Compiler/specials)) |
| 11:20 | clojurebot | (& . case* catch def ...) |
| 11:20 | andyf | ,(str (sort (keys clojure.lang.Compiler/specials))) |
| 11:20 | clojurebot | "(& . case* catch def ...)" |
| 11:21 | andyf | Ah, do that in a local REPL and you will get a longer list and not the ... |
| 11:21 | andyf | If the first symbol is one of those, it is a special form. |
| 11:22 | Bronsa | ,(doc special-symbol?) |
| 11:22 | clojurebot | "([s]); Returns true if s names a special form" |
| 11:22 | andyf | You will see several names ending with * in that list. case is a macro implemented in Clojure itself, which expands to a special form beginning with case* |
| 11:23 | andyf | Bronsa! I?m almost ready to update t.a(.j) in Eastwood and find out what I need to change. You done with final exams yet? :) |
| 11:25 | andyf | Anyone know why & is on that list of specials? All the others I've seen at beginning of a parenthesized form, but not that one. |
| 11:26 | Bronsa | andyf: yeah no exams right now but I'm still busy with a swe project -- I can find time for taj/eastwood anyway :) |
| 11:26 | Bronsa | andyf: it's a hack for syntax-quote |
| 11:27 | TimMc | &:you-there? |
| 11:27 | lazybot | ⇒ :you-there? |
| 11:27 | TimMc | yay |
| 11:27 | andyf | TimMc: That wasn't confusing timing at all :) |
| 11:28 | TimMc | hah! |
| 11:28 | TimMc | andyf: I'd be tempted to remove it, recompile Clojure, and see if it breaks any projects. |
| 11:32 | ticking | dnolen_: I submitted the issue for lists, but while thinking about it I got a bit unsure about sets. Currently they are supported as literals so the situation is a bit better than for lists, additionally matching variables on them seems a bit less useful because of the undefined order. It might make sense in a compiler context to just match on a random element from a set like `[(#{x} :as s)] (foo x (dissoc s x))` but still a `[(s :guard set? |
| 11:32 | ticking | )] (foo (first s) (dissoc (first s)))`might be cleaner :/ |
| 11:43 | silasdavis | why is there no into! for transients? |
| 11:58 | clgv | silasdavis: good question. (reduce conj! coll1 coll2) will help you though |
| 11:59 | clgv | `into!` would do the same |
| 12:05 | reiddraper | dnolen_: merged :) |
| 12:11 | dnolen_ | reiddraper: sweet! |
| 12:21 | bbloom | Bronsa: andyf: in theory there could be a type for improper lists and & would be the reader form for it, like . in CL/scheme |
| 12:21 | bbloom | TimMc: i promise you that it will |
| 12:21 | bbloom | TimMc: in fact, i have projects that would break: macros that search for '& |
| 12:22 | Bronsa | it would also break any `(fn [x & foo]) code |
| 12:22 | Bronsa | there's no clojure.core/& var |
| 12:24 | brainacid | hello |
| 12:36 | brainacid | mmm...still installing |
| 12:36 | brainacid | looks full but behaves empty |
| 12:36 | brainacid | funny channel |
| 12:40 | justin_smith | brainacid: installing? |
| 12:53 | brainacid | justin_smith: yes java |
| 12:53 | brainacid | justin_smith: gonna learn clojure |
| 12:54 | justin_smith | start with lein (if you weren't planning to already) it makes a lot of things a lot easier |
| 12:54 | borkdude | is there something in clojure world that comes close to the easy of ruby on rails in terms of generating things for resources so you can quickly create, delete etc. them |
| 12:54 | justin_smith | what sort of resources? |
| 12:55 | tcrayford___ | borkdude: not exactly no. Clojure folk tend to shy away from frameworks, and "ease of getting started" in favor of long term wins :/ |
| 12:56 | justin_smith | tcrayford___: well, it isn't super popular, and has its limitations, but caribou do streamline a lot of stuff in a frameworky way |
| 12:57 | justin_smith | I'm one of the core caribou devs (I first learned clojure because I got hired to work on caribou) and I wouldn't do it all the same next time, but it does have some advantages |
| 12:57 | brainacid | justin_smith: tcrayford___ I am brand new baby into programming |
| 12:58 | borkdude | tcrayford___ yes I thought so, exactly what I was thinking, but just checking :) |
| 12:58 | brainacid | I dont know LISP but Im here to have fun |
| 12:58 | borkdude | tcrayford___ I used clojure since 2009, and only started in ruby for one month now |
| 12:58 | borkdude | tcrayford___ I like the things in a framework you get for free, but when you have problems it's harder to find out what's wrong |
| 12:58 | justin_smith | borkdude: caribou was developed to replace a ruby based system |
| 12:59 | borkdude | justin_smith is it still under development? |
| 13:00 | justin_smith | borkdude: it's no longer funded (it was an Instrument project previously) but I still use it often, and I fix bugs as they come up, and use it pretty constantly |
| 13:01 | ticking | ticking |
| 13:02 | ticking | lol, wanted to authorize my nick, sounded like a pokemon |
| 13:02 | EvanR | ... my method does not seem to be making into my gen class |
| 13:03 | EvanR | its just missing (according to reflect0 |
| 13:07 | brainacid | any tips? suggestions? |
| 13:07 | brainacid | seems like im going to have some fun |
| 13:08 | justin_smith | use lein, the clojure koans are a nice place to start |
| 13:08 | {blake} | OK, I've got a weird one: I've just gotten a new machine at work and they've put Windows on it. I'll get a dualboot into Linux going in a couple of days, but in the meantime, I've been developing under Win7 (which I do sometimes at home as well, so it's not a new thing). |
| 13:09 | {blake} | I have this web app that runs on port 3000, and it worked right up until a few hours ago. When lein tries to open port 3000 it says "Access is denied". I thought maybe the network guys had messed with something. |
| 13:10 | llasram | {blake}: boot2docker has a Windows build. Problem solved! |
| 13:10 | {blake} | But I can open port 3000 with node.js, Smalltalk, anything else. Just not lein. And lein can't open any port. "Access is denied." |
| 13:11 | justin_smith | {blake}: maybe they have some weird rules for java |
| 13:11 | {blake} | llasram:That looks pretty cool actually. But...I'm puzzling over the whole "Access is denied" thing. |
| 13:12 | {blake} | justin_smith:Yeah, maybe. I didn't know that was a thing but now that you mention it. |
| 13:12 | justin_smith | {blake}: check out jre/lib/security/java.policy |
| 13:12 | justin_smith | (also) |
| 13:12 | brainacid | justin_smith: thanks will check lein |
| 13:13 | justin_smith | {blake}: http://stackoverflow.com/questions/21154400/unable-to-start-derby-database-from-netbeans-7-4 |
| 13:13 | justin_smith | brainacid: yeah, lein is the easiest way to start clojure and manage libraries, I think everyone here uses it |
| 13:14 | brainacid | leiningen ?? justin_smith |
| 13:14 | justin_smith | yes |
| 13:14 | {blake} | justin_smith:Thanks. Lemme check it out... |
| 13:17 | brainacid | to start as in executing the compiler or start as in beginning my learning path?? sorry |
| 13:17 | brainacid | justin_smith: |
| 13:17 | justin_smith | brainacid: as the way to execute the compiler |
| 13:18 | justin_smith | but really, especially in the beginning, you should just use the repl. It compiles things as you execute them, interactively |
| 13:18 | noonian | brainacid: both; leiningen handles dependency management, can start a repl for you, build a standalone jar, its like rake + bundlers if your familiar with ruby tooling |
| 13:25 | brainacid | im not noonian sorry Im coming from C and assembly right now |
| 13:26 | brainacid | shit i use midnight commander and gdb |
| 13:26 | brainacid | lol |
| 13:26 | noonian | ah, ok. well it handles a lot of things for you, like resolving dependencies and adding them to the classpath automatically |
| 13:26 | brainacid | ok |
| 13:26 | brainacid | im excited to learn tho |
| 13:26 | brainacid | code is data |
| 13:26 | brainacid | homoicipcity |
| 13:27 | brainacid | sum shit |
| 13:27 | brainacid | lol |
| 13:27 | TimMc | You were only off by a Levenshtein distance of 3. Not bad. |
| 13:28 | TimMc | bbloom: So basically having '& as a special means it doesn't get namespaced? |
| 13:28 | noonian | http://www.braveclojure.com/ is a free online book that might be helpful for learning both tooling and the language |
| 13:30 | {blake} | justin_smith: So, how do I find out what JAVA_HOME is from lein? I mean, I can find out from NetBeans but it isn't a given that they're the same, is it? |
| 13:30 | justin_smith | it's an environment variable, and it will point to where java is installed |
| 13:31 | justin_smith | probably something in Program Files |
| 13:31 | {blake} | Huh. I don't have a JAVA_HOME environment variable. |
| 13:31 | {blake} | Or a Java anything... |
| 13:32 | justin_smith | OK, clearly java is installed, the file will be in that relative path under jre/ whereever it is installed |
| 13:32 | {blake} | Son of a bitch. It's working now. |
| 13:32 | justin_smith | haha |
| 13:32 | pmonks | Also, from a repl: (System/getProperty "java.home") |
| 13:32 | pmonks | ,(System/getProperty "java.home") |
| 13:32 | clojurebot | #<SecurityException java.lang.SecurityException: denied> |
| 13:32 | pmonks | (dec clojurebot) |
| 13:32 | lazybot | ⇒ 46 |
| 13:33 | brainacid | how do i run jar files |
| 13:33 | brainacid | lol |
| 13:33 | justin_smith | &(System/getProperty "java.home") |
| 13:33 | lazybot | java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.home" "read") |
| 13:33 | pmonks | A JAR file is usually (though not always) a library ie. like a dynamic shared library. |
| 13:33 | justin_smith | brainacid: lein will take care of that for you during dev, but if you just want to run one without lein's help "java -jar some.jar" |
| 13:33 | noonian | brainacid: java -jar the_jar.jar |
| 13:34 | noonian | which only will work for executable jars, not library jars like pmonks mentioned |
| 13:34 | justin_smith | brainacid: for example to run clojure, just run "lein repl" |
| 13:34 | pmonks | (inc noonian) |
| 13:34 | lazybot | ⇒ 10 |
| 13:35 | justin_smith | you can also use "java -cp clojure.jar:a.jar:b.jar:c.jar:src/ clojure.main" |
| 13:35 | justin_smith | that will make all those jars available, and run the clojure repl |
| 13:35 | {blake} | How freakin' weird. I was toying with staying in Windows but this is...strong incentive to get to Linux. |
| 13:35 | justin_smith | {blake}: Windows has lots of issues as a development platform |
| 13:35 | noonian | i'd just run a virtualbox linux install if you don't want to mess with dual booting right now |
| 13:35 | pmonks | brainacid: I also like the "lein-try" plugin for experimenting with different JARs: https://github.com/rkneufeld/lein-try |
| 13:36 | {blake} | justin_smith:Well, it's unthinkable for Ruby. I haven't had any trouble with Windows at home. Clojure + lein makes it so easy not to care. (Almost as good as Smalltalk. =P) |
| 13:36 | brainacid | ok |
| 13:36 | brainacid | mmm totally lost |
| 13:36 | brainacid | but im sure i have time to find myself |
| 13:36 | brainacid | got some clojure books already |
| 13:37 | brainacid | lets see if I can do anything |
| 13:37 | brainacid | nightcode? |
| 13:37 | pmonks | I just use a text editor + REPL. |
| 13:37 | pmonks | (fwiw) |
| 13:37 | pmonks | MS-DOS 2.11 edlin + REPL |
| 13:37 | {blake} | brainacid: Being where you were a scant...eight months ago...Don't put too much hope in learning Clojure from books. |
| 13:37 | brainacid | ok pmonks |
| 13:37 | Jaood | edit.exe |
| 13:38 | brainacid | so I can probably continue using the console |
| 13:38 | justin_smith | yeah, a repl is all you really need, and a repl is just "lein repl", worry about the rest later |
| 13:38 | brainacid | ok |
| 13:38 | brainacid | yeah so in other words i dont need to know java to get this one right? |
| 13:38 | brainacid | its a language on its own correct? |
| 13:38 | {blake} | brainacid:No need for Java. |
| 13:38 | brainacid | just using the extensive library and stuff from java? |
| 13:38 | justin_smith | not at all, but you'll likely learn a few things about the standard java libs eventually |
| 13:38 | brainacid | ok thanks blake |
| 13:38 | justin_smith | exactly |
| 13:39 | brainacid | i see |
| 13:39 | pmonks | Yes, but it relies heavily on the JVM, and being able to understand how typical Java libs work will help in leveraging them. |
| 13:39 | pmonks | But lein hides most of the "weird JVM shite" |
| 13:39 | pmonks | (classpaths etc._ |
| 13:39 | {blake} | brainacid:Actually, Clojure gives a great way to approach Java, which is far more complicated. |
| 13:39 | brainacid | well i just dealt with numbers so not really knowing about graphics and stuff. im just a simple dad, stay home farther...just hobby |
| 13:39 | pmonks | (inc {blake}) |
| 13:39 | lazybot | ⇒ 1 |
| 13:40 | brainacid | i just like to make utilities |
| 13:40 | brainacid | like I have this idea of a search engine for this book I have |
| 13:40 | Jaood | brainacid: later on you will feel like you are missing out if you don't get familiar with Java |
| 13:40 | pmonks | Just to set expectations... ...the JVM has a pretty crappy startup time, at least compared to C/ASM. |
| 13:40 | {blake} | whoa...I...exist, thanks, pmonks! |
| 13:41 | pmonks | It's awesome for long-running processes however. |
| 13:41 | brainacid | Oh yeah pmonks i saw that already, was looking at top resources while I was launching Nightcode using the debugger |
| 13:41 | brainacid | l0l |
| 13:41 | pmonks | Yah - sorry. :-( |
| 13:41 | pmonks | But it's worth it for the long running stuff, ime |
| 13:41 | brainacid | hey its ok |
| 13:42 | pmonks | Nice to watch code get optimised at runtime. ;-) |
| 13:42 | pmonks | Hard to do that in C/ASM! ;-) |
| 13:42 | brainacid | i dunno if i be making anything that runs more that a few minutes |
| 13:42 | pmonks | (though I think Intel had a compiler back in the day that sort of did this) |
| 13:42 | brainacid | its all nice and nifty I just excited to see a self-modifying language |
| 13:42 | tuft | what do folks like for scraping these days? enlive? |
| 13:43 | pmonks | Few minutes should be ok, as the second or two it takes the JVM to startup will be pretty well amortised. |
| 13:43 | {blake} | brainacid:The big thing Clojure will give you over C/Asm is changing your brain. |
| 13:43 | pmonks | brainacid: I still consider myself a n00b too, and all I can say is "stand by for the rush". ;-) |
| 13:44 | brainacid | ok lein repl worked |
| 13:44 | brainacid | wish there was highlighting for mc :( |
| 13:44 | brainacid | lol |
| 13:45 | brainacid | well it says Lisp program in my menu!! YAY |
| 13:46 | brainacid | pmonks: {blake} thanks for your time, i enjoy the help. i like being brain changed lol |
| 13:47 | justin_smith | tuft: yeah, I usually use enlive |
| 13:47 | chouser | tuft: I still like clojure.data.zip, but the docs are still no good. |
| 13:47 | tuft | cool thanks |
| 13:47 | brainacid | well |
| 13:47 | brainacid | ... |
| 13:47 | brainacid | off to the books |
| 13:47 | {blake} | brainacid:Good luck! |
| 13:47 | pmonks | brainacid: welcome! I hope you get the rush I'm still getting! |
| 13:52 | brainacid | thanks pmonks {blake} |
| 13:55 | dysfun | are there any useful libraries for turning maven repositories into metadata maps? |
| 14:03 | stuartsierra | dysfun: Maybe https://github.com/cemerick/pomegranate |
| 14:17 | dysfun | stuartsierra: yeah, looks like the aether stuff in pomegranate is what i need |
| 14:17 | dysfun | thanks |
| 14:20 | brainacid | later |
| 14:49 | llasram | Have I done something funky with my configuration or has the most recent version of clojure-mode done some odd things to indentation? |
| 14:50 | stuartsierra | llasram: it changed |
| 14:50 | stuartsierra | https://github.com/clojure-emacs/clojure-mode/issues/265 and https://github.com/clojure-emacs/clojure-mode/issues/266 |
| 14:50 | llasram | cooooo |
| 14:51 | llasram | wat |
| 14:57 | llasram | Whelp, easily fixed in my own config |
| 14:57 | dysfun | i'm building a leiningen plugin, but i can't seem to get hold of leiningen.core at the repl. am i being thick or is there something obvious? |
| 14:58 | dysfun | i've even tried 'lein try leiningen-core' |
| 14:58 | dysfun | presumably it explicitly strips them out |
| 14:59 | noonian | and you have it listed as a dependency? |
| 15:00 | llasram | dysfun: you need to have `:eval-in-leiningen true` in your project file, and cannot use the `trampoline` task |
| 15:00 | llasram | One of those missing? |
| 15:01 | dysfun | nope |
| 15:01 | llasram | s,:eval-in-leiningen true,:eval-in :leiningen, |
| 15:01 | llasram | (I looked at an old example) |
| 15:01 | dysfun | oh, that might be it |
| 15:03 | bbloom | TimMc: yes |
| 15:04 | llasram | dysfun: Oh, wait -- hah. There's no `leiningen.core` namespace. It's an empty point in the hierarchy |
| 15:04 | llasram | dysfun: Try (require 'leiningen.core.main) |
| 15:04 | dysfun | no dice :/ |
| 15:05 | mikeflynn | Try leiningen.core.user |
| 15:05 | dysfun | no, wait, sorry, i typed that in the wrong repl |
| 15:05 | dysfun | leiningen.core.main worked, thanks |
| 15:05 | llasram | np |
| 15:16 | dysfun | where's the best place to read what all the keywords in leiningen dependency specs mean? |
| 15:16 | dysfun | like :scope, :exclude etc. |
| 15:17 | Bronsa | dysfun: https://github.com/technomancy/leiningen/blob/master/sample.project.clj |
| 15:18 | amalloy | dysfun: see also `lein help sample`, which prints the contents of Bronsa's link to stdout |
| 15:18 | dysfun | "in addition to keywords supported by pomegranate,"... |
| 15:19 | dysfun | this is why what i'm building with all of this is needed so badly |
| 15:23 | dysfun | https://github.com/cemerick/pomegranate/blob/master/src/main/clojure/cemerick/pomegranate/aether.clj#L619 |
| 15:30 | amalloy | llasram: i just commented on https://github.com/clojure-emacs/clojure-mode/issues/265#issuecomment-67551290, by the way. i think the change to -> is awful |
| 15:34 | mmitchell | anyone using log4j2? Was using malcolmsparks/clj-logging-config but it's no longer compatible. My primary need is to be able to change log levels at runtime. |
| 15:38 | llasram | amalloy: Ah, cool. I didn't comment because I wasn't sure if discussion was taking place elsewhere |
| 15:38 | amalloy | i dunno if it is, but i'm obstreperous |
| 15:38 | machty | i'm learning about namespaces and requires, wondering why i'd use :require if i can just use fully qualified names? |
| 15:38 | machty | (clojure.string/capitalize "asd") |
| 15:39 | Bronsa | machty: how can you be sure clojure.string is loaded? |
| 15:39 | amalloy | machty: you have to require; only a few namespaces are automatically loaded |
| 15:39 | amalloy | clojure.core, clojure.string, clojure.set...one other i always forget, i think |
| 15:39 | Bronsa | and they are not guaranteed to be loaded either |
| 15:40 | machty | i see |
| 15:40 | machty | seems a little strange that clojure would leave that door for error open for you... |
| 15:40 | Bronsa | machty: also you rarely want to write the fully qualified form every time. most of the time you just alias the namespace to a shorter name or :refer the var you need |
| 15:41 | Bronsa | machty: which is convenient to do inside a :require form |
| 15:41 | machty | it doesn't require that you use :require if you wanna take the risky to use a possibly-not-loaded but fully-qualified symbol |
| 15:41 | machty | Bronsa: confirm, refer makes sense, just wanted to make sure i understood the base behavior |
| 15:42 | Bronsa | machty: that's a side-effect of how namespaces work in clojure. once you load a namespace it's loaded "globally", it's not a per-namespace thing |
| 15:42 | machty | yeah but it doesn't seem like it'd be a stretch to enforce a "strict" mode of only referencing what you require |
| 15:42 | Bronsa | machty: this is incredibly useful if you take into account macros |
| 15:43 | amalloy | (inc Bronsa) |
| 15:43 | lazybot | ⇒ 79 |
| 15:43 | Bronsa | i.e. I might have a (ns a (:require b)) (defmacro x [] `(b/y)) |
| 15:43 | machty | Bronsa: what about that example is "global"? |
| 15:43 | Bronsa | machty: if clojure enforced every namespace to require the namespaces refered, you'd have to require b from each namespace where you want to use a/x |
| 15:45 | amalloy | machty: the missing (or implied) part of that example is (ns c (:require a)) (a/x) |
| 15:45 | Bronsa | right |
| 15:45 | amalloy | (a/x) will expand to (b/y), inside the namespace c, which hasn't explicitly loaded b at all |
| 15:45 | amalloy | but it needs to still work or else the macro is stupid |
| 15:46 | machty | that doesn't sound like an argument for globals... a consumer of a/x doesn't need to know that it internally depends on b/y |
| 15:46 | Bronsa | you'd have to know the implementation of each macro you were to use to make sure you load all the necessary namespaces. Unthinkable |
| 15:46 | machty | it is entirely possible that i'm not ready to have this conversation until i fully grok macros... i'm super super n00b atm |
| 15:46 | mikerod | When in the REPL I notice that every form I evaluate results in a new level of the class loader hierarchy |
| 15:46 | joshuafcole1 | macros don't have isolated internals from the code in which they're evauluated, machty |
| 15:46 | mikerod | is this normal and doesn't that have a limitation at some point? |
| 15:47 | joshuafcole1 | macros are evaluated at compile time, not during runtime, so you're call to a/x literally becomes a call to b/y in c. |
| 15:47 | mikerod | I realize it is likely done to hold newly generated class |
| 15:48 | mikerod | actually it seems to change how deep the parent class loader stack gets sometimes - so I haven't really figured out how to follow it :P |
| 15:49 | machty | thanks errbody, i'm gonna marinate on that. loving clojure so far |
| 15:50 | Bronsa | mikerod: each compilation unit in clojure should have it's own dynamicclassloader, it might have as parent another dcl or the threaad local one but I don't think it can nest much more than that |
| 15:50 | Bronsa | mikerod: i.e. it definitely doesn't nest lineraly with each evaluated form |
| 15:50 | Bronsa | linearly* |
| 15:52 | mikerod | Bronsa: I see that they seem to clear out every so often |
| 15:52 | mikerod | but there is a period where I see nesting building up. I was just observing in the REPL though, I didnt' go through the real compiler flow for it yet. |
| 15:52 | mikerod | I just kept eval'ing a loop that walks the parent chain |
| 15:53 | mikerod | e.g. (loop [all [] c (.getContextClassLoader (Thread/currentThread)) p (.getParent c)] (if p (recur (conj all p) (.getParent p)) all)) |
| 15:54 | mikerod | woops |
| 15:54 | mikerod | e.g. (loop [all [] c (.getContextClassLoader (Thread/currentThread)) p (.getParent c)] (if p (recur (conj all p) p (.getParent p)) all)) ; fixed |
| 15:54 | machty | amalloy: so the compiler translates (a/x) to (b/y), and will eventually evaluate (b/y) within context of the "a" namespace, hence if b weren't globally loaded, things would break? |
| 15:54 | amalloy | machty: no, within the context of the c namespace |
| 15:55 | amalloy | but the rest of that is true |
| 15:55 | machty | amalloy: yes sorry that's what i meant |
| 15:55 | Bronsa | mikerod: the nested dcls you see are probably an artifact of nrepl. in a bare java -jar clojure.main repl I only see the AppClassLOader and an ExtClassLoader |
| 15:55 | machty | it is possible for that to troll you in unexpected ways if you have a `b` defn'd in your same namespace? |
| 15:56 | amalloy | machty: only if you try very hard to be trolled |
| 15:56 | amalloy | defining a function named b certainly wouldn't do it |
| 15:56 | machty | why wouldn't it? |
| 15:56 | amalloy | because b/y and b are totally unrelated thnigs |
| 15:56 | machty | (and what would?) |
| 15:56 | amalloy | the compiler won't confuse them, even if you do |
| 15:57 | Bronsa | mikerod: weird, I see what you mean now. it definitely doesn't happen in a bare clojure repl. probably a bug in nrepl/reply or some other piece of the infrastructure involved in `lein repl` |
| 15:57 | machty | but if your macro doesn't qualify w namespace? |
| 15:57 | amalloy | machty: you would have to write the macro to intentionally cause problems like this, and use some less-clever construct than syntax-quote |
| 15:58 | amalloy | no, ` makes sure the right namespace gets added in |
| 15:59 | mikerod | Bronsa: ah ok, that makes sense then. I was curious since I didn't think that was the case in the typical clj repl as you say. I just wasn't thinking about the REPL that I actually was working with was "fancier" |
| 16:00 | machty | amalloy: a HAH and if i used normal quote then it'd be the behavior i described. MAKES PERFECT SENSE. thank you |
| 16:00 | amalloy | machty: well you'd still have to do some dumb stuff for a normal quote to cause problems |
| 16:00 | amalloy | eg, (defmacro x [] '(b/y)) would be fine; it evaluates to the same thing |
| 16:01 | amalloy | (defmacro x [] '(y)) would be a problem, if c defined a different function named y |
| 16:01 | amalloy | (or didn't :refer to the y in b) |
| 16:01 | machty | exactly, unqualified normal quote in a macro seems pretty dumb |
| 16:01 | amalloy | machty: it's generally a bad idea, but of course there are exceptions |
| 16:02 | amalloy | and the problems it causes will tend to be immediate and obvious (stuff refuses to compile) rather than sinister and delayed |
| 16:05 | machty | cool |
| 16:09 | amalloy | machty: if you are interested in some more in-depth material, http://amalloy.hubpages.com/hub/Unhygenic-anaphoric-Clojure-macros-for-fun-and-profit is an old blog post of mine that talks about macro hygeine (the perils of using a normal quote) and ends with a lovely macro that uses a normal quote to great effect |
| 16:09 | machty | amalloy: very interested, will check it out |
| 16:35 | dysfun | i seem to recall a library on top of tools.analyzer that summarised the interesting things about a namespace. anyone remember what it was called? |
| 16:35 | numberten | i have an InputStream serving binary data and would like to write it to disk, is there a core function for this? |
| 16:35 | numberten | like a binary-spit or such |
| 16:36 | stuartsierra | numberten: I think clojure.java.io/copy will do that |
| 16:36 | Bronsa | dysfun: maybe https://github.com/gfredericks/clj-usage-graph ? I don't know if gfredericks fully ported it from the old j.t.a to t.a.j though |
| 16:37 | dysfun | Bronsa: sorry, i should have been more clear. i wanted a list of functions and types etc. |
| 16:37 | dysfun | programmatically |
| 16:37 | dysfun | i'm sure i've seen it before, but i can't remember what it was called |
| 16:38 | dysfun | if i were to write my own, i'm sure that'd be useful though |
| 16:40 | RasterBu_ | derp.... wifi dropped me as soon as I left my question, so I'll ask again in case it didn't get posted... |
| 16:40 | RasterBu_ | can somebody help me understand core.async.{tap,multi}? I think I fundamentally misunderstand something: https://www.refheap.com/95127 |
| 16:47 | numberten | stuartsierra: thanks :) |
| 16:47 | llasram | I just recalled that it's a bad idea to attach metadata to functions, but don't immediately remember why |
| 16:47 | llasram | Any hints? |
| 16:48 | justin_smith | RasterBu_: what if you either define a buffer for the channel or read from both taps? I am guessing you are seeing a backpressure issue |
| 16:48 | RasterBu_ | i'll try that. |
| 16:48 | RasterBu_ | thanks |
| 16:48 | stuartsierra | RasterBu_: mult blocks until *all* taps are ready to receive input. You probably want buffered channels for your taps. |
| 16:48 | amalloy | llasram: i can't think of a specific reason why it's bad, aside from "there are not many reasons it would be good" |
| 16:48 | llasram | amalloy: Heh. Fair enough. |
| 16:49 | llasram | I'm trying to better-adapt Clojure functions to the the abstract classes Mahout uses for its function classes |
| 16:50 | llasram | One of the features of their classes is that they have methods for all sorts of fun properties like `isLikeRightPlus` |
| 16:50 | stuartsierra | llasram: metadata on function objects has a mixed history. Older versions of Clojure didn't support it, and the compiler doesn't use it. Metadata on Vars is more common. |
| 16:51 | llasram | stuartsierra: Yes |
| 16:51 | amalloy | stuartsierra: really? functions haven't always been IObj? |
| 16:51 | justin_smith | llasram: how about a record that implements callable / runnable? |
| 16:51 | llasram | justin_smith: Well, abstract base classes, and I'm trying to keep everything in primitive-land |
| 16:52 | justin_smith | deftype? |
| 16:52 | clojurebot | deftype is see datatype |
| 16:52 | llasram | Metadata initially struck me as a good fit, but in practice it's probably no more awkward than splatting in a separate (optional) map of parameters |
| 16:52 | llasram | justin_smith: Nah. Tiny Java classes |
| 16:53 | llasram | stuartsierra: I didn't recall that older versions didn't support it. That's probably the reason I was half-remembering |
| 16:53 | Bronsa | I recall metadata on functions messing with primInvoke or something |
| 16:54 | liflash | hi everybody, i'm trying to write tests for my reagent application. I always get the message ReferenceError: Can't find variable: React. If i additionally require more then cemericke.cljs.test, zero tests are ran. anybody any idea? |
| 16:54 | stuartsierra | There was one version where some, but not all, Var metadata got copied to their corresponding function objects, which caused much confusion. |
| 16:55 | amalloy | Bronsa: oh sure. i imagine it still does |
| 16:55 | Bronsa | yeah |
| 16:55 | amalloy | llasram: that's a reason |
| 16:55 | llasram | There we go! |
| 16:55 | llasram | Yes, that was totally it |
| 17:00 | OscarZ | im trying the example here (under Hot code reload) http://www.http-kit.org/migration.html |
| 17:00 | OscarZ | getting Unable to resolve symbol: defroutes |
| 17:00 | OscarZ | i believe its in compojure |
| 17:01 | OscarZ | i have included that as dependency in project.clj.. any ideas ? |
| 17:02 | noonian | you would need (:require [compojure.core :refer [defroutes]]) in your ns declaration |
| 17:03 | noonian | i think their example ns declaration is wrong, :only is meant to be used with :use, you need to use :refer with :require |
| 17:03 | EvanR | blurg, #_( ... ) is not working so well as a multiline comment |
| 17:03 | EvanR | some of the words inside are "invalid tokens" |
| 17:04 | liflash | OscarZ: +1 for noonian |
| 17:06 | EvanR | and " " doesnt work since i am using " in the comment |
| 17:06 | justin_smith | EvanR: oh, that sucks |
| 17:06 | OscarZ | thank you.. it works.. now it doesnt find handler but ill find out where it is :) |
| 17:06 | EvanR | (the invalid token is OBX-1) |
| 17:06 | OscarZ | is that some old syntax or just wrong? |
| 17:06 | justin_smith | combo of #_( ... ) with ;; mixed in? still ugly |
| 17:06 | justin_smith | |
| 17:06 | llasram | EvanR: Yeaaaaah #_ isn't really meant for comments |
| 17:06 | EvanR | well that would be every line of the comment |
| 17:06 | llasram | What's wrong with just `;` ? |
| 17:07 | liflash | OscarZ: just wrong i think |
| 17:07 | EvanR | which would work, i just have to put ; on many lines |
| 17:07 | llasram | EvanR: Your editor probably will do that for you :-) |
| 17:07 | EvanR | probably |
| 17:08 | EvanR | we also dont need functional programming because editors can copy and paste large blocks of code while substituting the variables ;) |
| 17:09 | justin_smith | EvanR: literate programming? |
| 17:09 | llasram | I think there's a pretty big difference between an simplifying editing in a syntax-correct fashion vs being all-but-necessary to edit in a semantics-correct fashion |
| 17:09 | liflash | any idea why no clojurescript.test tests are ran, when i require anything else then cemerick.cljs.test in the test file? |
| 17:10 | cfleming | amalloy: Thanks for the comments on that indentation issue, I agree |
| 17:11 | amalloy | cfleming: well, bbatsov apparently doesn't. i'm not going to continue pushing, since clojure-mode circa 2012 still works great for me |
| 17:11 | amalloy | if everyone else starts indenting their code badly i guess that's just life |
| 17:12 | cfleming | amalloy: Yeah, I'd like to have the defaults aligned but as long as people are able to configure Cursive's indentation to match whatever Emacs is using that's enough - that default looks very strange to me |
| 17:13 | cfleming | amalloy: The reasoning too |
| 17:14 | amalloy | cfleming: i mean, he's right in theory that -> and doto should be treated the same |
| 17:14 | hiredman | ugh |
| 17:15 | hiredman | we have a golden clojure-mode sha at work from 2012 aswell |
| 17:15 | hiredman | stupid formatting changes |
| 17:15 | cfleming | amalloy: They pretty much are in Cursive - Cursive is aware of threading forms, so it'll indent your nesting cases correctly. |
| 17:15 | amalloy | hiredman: what sha, out of curiosity? mine is 66452816ebe11da025d9438bb9422dbf0f37d6c2 plus a few commits i've added on |
| 17:17 | amalloy | justin_smith: https://github.com/amalloy/clojure-mode/commits/master |
| 17:17 | amalloy | you don't have to save the sha by hand :P |
| 17:17 | OscarZ | some day i will learn how to use paredit :( |
| 17:17 | hiredman | oh no, it is actually from march 2013 d4d3f5e672fdf2a5e5b2cbc1287d2b923b40f346 |
| 17:17 | TimMc | How does one use this hash? |
| 17:18 | justin_smith | amalloy: I use irc in my emacs, grabbing the sha string is easy |
| 17:18 | justin_smith | TimMc: clone the repo, check out that hash |
| 17:18 | amalloy | TimMc: i run clojure-mode from a git checkout, not melpa or whatever |
| 17:18 | TimMc | Oh, the git hash, I see. |
| 17:18 | hiredman | I think, I am not 100% sure that isn't something extra (the last 10 or more commits are all from people who were working here at the time) |
| 17:19 | TimMc | I'm on 2.1.0 from elpa or whatever. |
| 17:19 | Bronsa | I froze it at 201ed7dc9b615cf8803acbc48711caa19156e6c0 from May 2014 |
| 17:20 | Bronsa | after that font-lock started changing |
| 17:20 | amalloy | cfleming: https://github.com/clojure-emacs/clojure-mode/commit/ed533c94183319c9c332f240f2cf7c50045c0293 is funny, because i think that's actually the same "always 2 spaces" mode as cursive supports |
| 17:20 | Bronsa | and I couldn't read clojure code anymore |
| 17:20 | amalloy | emacs supports it but apparently discourages it |
| 17:21 | justin_smith | Bronsa: when I was young and foolish I worked on an elisp varient with syntactically significant highlighting (the elisp that colored things also preprocessed the code before a scheme compiler hit it) |
| 17:21 | justin_smith | it was a "cool" idea, but a bad one |
| 17:21 | TimMc | D: |
| 17:21 | justin_smith | I mean python did significant whitespace, so why not significant hightlighting, right? |
| 17:22 | hiredman | the continual churn fest emacs clojure tooling has been since things changed fills me rage |
| 17:22 | llasram | justin_smith: inspired by Color Forth? |
| 17:22 | justin_smith | llasram: partially, yeah |
| 17:22 | turbofail | hm. what other things can we make significant? |
| 17:22 | justin_smith | that plus a youthful love of novelty |
| 17:23 | justin_smith | (inc TimMc) |
| 17:23 | lazybot | ⇒ 84 |
| 17:23 | amalloy | hiredman: "since things changed"? |
| 17:23 | justin_smith | TimMc: turbofail: a language where the semantics change based on the sha sig of your file |
| 17:23 | amalloy | turbofail: significant glances. emotion-sensitive indentation |
| 17:23 | llasram | *shrug* |
| 17:24 | dysfun | justin_smith: you haven't discovered malbolge then? |
| 17:24 | llasram | I'm on the melpa-stable versions and they're pretty good |
| 17:24 | justin_smith | (inc amalloy) |
| 17:24 | lazybot | ⇒ 207 |
| 17:24 | turbofail | how about compilation dependent on current gps-coordinates? |
| 17:24 | TimMc | oooh |
| 17:24 | TimMc | (inc justin_smith) |
| 17:24 | lazybot | ⇒ 161 |
| 17:24 | turbofail | it's location aware! |
| 17:24 | TimMc | Sounds a little malbolge-like. :-) |
| 17:24 | justin_smith | dysfun: similar concept yes. I love that malbolge was cracked by an evo-algo coded in lisp) |
| 17:24 | llasram | The switch to push all the hairy code into nREPL middleware was painful, but most of those bugs are gone |
| 17:24 | TimMc | turbofail: You can already do that in Clojure. |
| 17:24 | dysfun | "Weaknesses in the design have been found that make it possible (though still very difficult) to write useful Malbolge programs. |
| 17:24 | turbofail | TimMc: well you could do all of things things in clojure |
| 17:25 | turbofail | well maybe not the significant glances part |
| 17:25 | dysfun | justin_smith: a beam search :) |
| 17:25 | justin_smith | significant keypress timing - things you type faster are interpreted differently compared to things typed slower |
| 17:25 | TimMc | It would not be hard to have a macro call out to the maxmind website or whatever and rearrange some stuff based on the response. |
| 17:26 | hiredman | amalloy: since the revolution? I dunno, I don't feel entirely comfortable vilifying a person, and laying everything on a particular door (but I don't have other narratives to explain why everything is terrible now) |
| 17:26 | justin_smith | and things edited via search/replace or copy/paste would have yet another rule, of course |
| 17:26 | amalloy | fair enough |
| 17:26 | dysfun | i think we should just get over the idea that programming should ever be deterministic |
| 17:27 | dysfun | although i hear php's trying quite hard for that one |
| 17:28 | turbofail | significant key impact force. angrier typing causes more aggressive optimizations |
| 17:28 | TimMc | goto rand() |
| 17:28 | turbofail | even better if the aggressive optimizations aren't always correct, thus causing a feedback loop |
| 17:29 | TimMc | rage overflow error |
| 17:30 | dysfun | i presume we've all seen colorforth? |
| 17:30 | dysfun | https://en.wikipedia.org/wiki/ColorForth |
| 17:31 | justin_smith | dysfun: yupyup |
| 17:31 | dysfun | "the colors simplify forth's semantics" <-- lies |
| 17:31 | dysfun | not that forth really has any semantics as such |
| 17:31 | justin_smith | dysfun: a friend of mine even got a chance to work with those crazy CPU matrix things Chuck makes these days |
| 17:31 | dysfun | guy's a nut |
| 17:31 | justin_smith | still no C compiler, but it runs forth like a charm |
| 17:32 | justin_smith | guy is a nut that made a fun toy :) |
| 17:32 | dysfun | guess that's what reverse polish thinking does to you |
| 17:33 | dysfun | forth has some really interesting qualities though |
| 17:34 | dysfun | it's a complete nightmare to 'statically analyze' <-- haha, on forth! |
| 17:34 | dysfun | nothing so formalised as a function definition |
| 17:51 | cfleming | amalloy: Yeah, that looks like it |
| 17:54 | ticking | dysfun: Is forth really that hard to analyze, I would think that composition over pure functions that are of type Stack -> Stack as in joy would be quite formalizable |
| 17:56 | mikerod | I'm guessing leiningen cannot handle importing poms that manage dependencies? |
| 18:04 | justin_smith | mikerod: wait, so a pom can manage dependencies, as something separate from declaring them? |
| 18:14 | mikerod | justin_smith: yes, a pom that's sole purpose is to have a dependencyManagement section that other poms can import in |
| 18:14 | mikerod | but not directly inherit from |
| 18:14 | mikerod | - they have their own parent pom's etc |
| 18:15 | mikerod | it is for a specific set of dependencies that you want to have the same management for across modules - such as hadoop deps |
| 18:24 | arrdem | Last call for Grimoire complaints/requests sitting down on 0.4 now. |
| 18:31 | romanandreg | question: is there any set datastructure that keeps items ordered by insertion? |
| 18:32 | amalloy | $google amalloy ordered set |
| 18:32 | amalloy | oh right, is google broken now? |
| 18:32 | amalloy | that stinks |
| 18:33 | romanandreg | amalloy: I googled insertion order set clojure |
| 18:33 | romanandreg | but didn’t find anything useful (one library 2 years old, depending on clojure 1.4) :-/ |
| 18:33 | amalloy | https://github.com/amalloy/ordered |
| 18:33 | amalloy | should work fine on newer versions of clojure |
| 18:35 | romanandreg | ok… was hessitant to try it, but going to because you are here hehe |
| 19:00 | brainacid | hey all |
| 19:00 | brainacid | im totally lost |
| 19:01 | brainacid | very |
| 19:01 | brainacid | r u telling me that I cant use lein or cojure without an internet connection? please clarify this doubt for me |
| 19:02 | amalloy | brainacid: lein has an offline mode |
| 19:02 | mikeflynn | Well lein will try to download any dependencies you need and it will need the internet for that. |
| 19:02 | amalloy | but you won't be able to download dependencies while offline |
| 19:04 | brainacid | I see |
| 19:04 | brainacid | so there is no base pkg for my hard drive? |
| 19:04 | brainacid | amalloy: oh thanks where can i find more info |
| 19:04 | brainacid | its been a little hard for me to find clear info, the raving about it is over the top |
| 19:05 | brainacid | I understand its an infant language but I aint no true l33t programmer so i need basic language lol |
| 19:05 | amalloy | https://github.com/technomancy/leiningen/issues/961 |
| 19:06 | brainacid | any thoughts about Nightcode? |
| 19:07 | amalloy | sounds like two words mashed together. pretty sure it's something to do with programming |
| 19:07 | amalloy | other than that, question is too vague to do anything with |
| 19:07 | noonian | brainacid: the sample project.clj in the leiningen git repo has examples of most of leinigens options; as for nightcode i haven't really used it but its supposed to be an ide for beginners so definitely worth a shot |
| 19:09 | brainacid | help |
| 19:09 | brainacid | oops |
| 19:11 | {blake} | brainacid:Nightcode's okay but it lacks a lot of things you're gonna want. Its code completion isn't great. |
| 19:12 | {blake} | Aaand he's gone. |
| 19:12 | brainproxy | he'll be back |
| 19:12 | brainproxy | needs to become l33t |
| 19:12 | {blake} | Anyway, LightTable is probably a better bet. |
| 19:26 | brainacid | im still confused tho |
| 19:26 | brainacid | u mean i cant use a basic editor like nano and compile it to run? |
| 19:26 | brainacid | is this a language for gui applications |
| 19:27 | brainacid | i just cant seem to comprehend forgive me |
| 19:27 | mikeflynn | You can use anything. I use Sublime Text for example and just compile with lein. |
| 19:27 | brainacid | but if i do something i need a dependency for i need the net |
| 19:27 | brainacid | see i dont have internet at home |
| 19:28 | brainacid | im at McDonalds right now on a shitty connection |
| 19:28 | mikeflynn | If you declare a dependency in your project.clj file and you don't have locally, lein will go and get it for you. |
| 19:28 | brainacid | i see |
| 19:28 | brainacid | i have just heard that Clojure is great for women |
| 19:28 | brainacid | so im eager to see what its all about |
| 19:29 | brainacid | i have nightcode and lein |
| 19:29 | brainproxy | brainacid: might be a good idea to start w/ a solid book like Clojure Programming: http://www.clojurebook.com/ |
| 19:29 | mikeflynn | The best way to play with it is to simply play with the repl: lein repl |
| 19:29 | brainacid | i see |
| 19:30 | brainacid | well lets see |
| 19:30 | brainacid | i have several books already |
| 19:30 | brainacid | it just doesnt seem quick in executing the program |
| 19:31 | brainacid | lol im so use to scripting python, perl and compiling C or running assembly |
| 19:31 | brainacid | this is so bizarre to me |
| 19:32 | brainacid | i have the slightest clue about jvm |
| 19:32 | brainproxy | brainacid: so, it will be fast (probably) once it's up and running, but invoking lein and firing up a Clojure REPL does take a few seconds |
| 19:33 | brainproxy | the dev workflow for Clojure typically involves having an editor and REPL work hand-in-hand |
| 19:33 | brainacid | well i mean my standalone jar file that Nightcode IDE just made for Hello World |
| 19:33 | brainacid | brainproxy, so say im the editor in one terminal and lein repl in another? |
| 19:34 | brainproxy | brainacid: well you probably want an editor that can hook to the repl |
| 19:34 | justin_smith | yeah, clojure is not good for short lived programs. Just leave the repl running, reload you code, then run your main from the repl. |
| 19:34 | brainproxy | vim and emacs can do that, IntelliJ and others as well |
| 19:34 | justin_smith | you can do that without editor integration |
| 19:35 | brainacid | justin_smith, oh yes im just making some calculators and im not sure if a search utility can be done using this language |
| 19:35 | brainproxy | true, editor integration isn't required, but it's a probably a good hurdle to go ahead and jump if one is serious about learning Clojure |
| 19:35 | brainacid | i was just attracted by self-modification and code as data |
| 19:35 | brainacid | still dont know what that means |
| 19:36 | brainproxy | code as data -- your clojure programs are a bunch of s-expressions, which are basically lists of symbols |
| 19:36 | brainacid | mmm interesting |
| 19:36 | brainacid | brainproxy, whats a good editor integrated with repl? |
| 19:36 | brainproxy | but data in your programs is also typically represented with s-expressions |
| 19:36 | brainacid | i run console linux |
| 19:37 | justin_smith | brainacid: self modification is the fact that the compiler is part of your program - that's why you can reload everything in the repl and execute again without restarting |
| 19:37 | brainproxy | hence, code is data is code |
| 19:37 | brainacid | really try to stay away for X windows |
| 19:37 | crispin | emacs runs in terminal |
| 19:37 | brainacid | justin_smith, so interesting |
| 19:37 | crispin | bit of a learning curve, but worth it in the end |
| 19:37 | brainacid | crispin, can clojure be intergrated into emacs? |
| 19:37 | {blake} | heh |
| 19:37 | justin_smith | brainacid: so we typically just leave things running and redefine parts of the code instead of restarting |
| 19:38 | justin_smith | which is part of why startup takes so long too - you are loading up the whole compiler, and even compiling parts of it, on each startup |
| 19:38 | brainacid | mmm...this is beyond me |
| 19:38 | brainacid | and I though assembly was hard lol |
| 19:38 | crispin | brainacid: yep. emacs internally uses elisp, but you dont need to expose yourself to that |
| 19:38 | brainacid | so after all this im still lost, so please forgive me |
| 19:38 | {blake} | Assembler is easy, just slow. Clojure is hard--but fast. |
| 19:38 | brainacid | ok crispin |
| 19:39 | crispin | just install clojure-mode and cider |
| 19:39 | brainacid | {blake}, hi again |
| 19:39 | brainacid | ok |
| 19:39 | justin_smith | brainacid: the concepts may seem esoteric, but in practice the workflow is pretty simple- you reload some definitions, run a function, redefine things, run it again, interactively like in the shell |
| 19:39 | crispin | cider is the interactive debugger thing |
| 19:39 | brainacid | once i get good bandwidth i will get clojure-mode cider and emacs |
| 19:39 | brainacid | justin_smith, ahh |
| 19:39 | brainacid | so all i need is a basic editor to type some code then paste into repl? |
| 19:40 | brainacid | or type into repl as well |
| 19:40 | crispin | there is a series of posts online that take you through emacs and clojure |
| 19:40 | crispin | "clojure for the brave and true" |
| 19:40 | brainacid | crispin, sweet, thats for tomorrow since i cant get it now |
| 19:40 | {blake} | brainacid: Yep. Generally you'll go back and forth between editor and REPL. |
| 19:40 | justin_smith | right, or you can skip the editor integration and just use paste - sometimes that is actually simpler |
| 19:40 | brainacid | so can I run the clojure jar file directly |
| 19:40 | crispin | except you will launch emacs as "emacs -nw" (nw = no window. ie. terminal mode) |
| 19:41 | crispin | brainacid: yep |
| 19:41 | brainacid | jar -jar clojure1.6.jar |
| 19:41 | brainacid | crispin, good deal |
| 19:41 | justin_smith | crispin: I am hesitant to recommend cider to newcomers, it breaks a lot |
| 19:41 | crispin | theres also a cool lein plugin lein-bin that will make a self executing binary |
| 19:41 | crispin | justin_smith: what does it break? |
| 19:41 | justin_smith | cider itself breaks frequently |
| 19:41 | brainacid | my apps are probably 30 lines in C and maybe 75-100 in assembly so im sure Clojure it would be one function |
| 19:42 | brainacid | lol |
| 19:42 | crispin | "binary". actually a self running jar. so you can go ./my_prog |
| 19:42 | crispin | cider only was a problem for me when Id also installed the old nrepl |
| 19:42 | crispin | once I only installed cider, there was no problem |
| 19:42 | justin_smith | crispin: do you ever update cider? |
| 19:42 | crispin | I mean you can always not use cider if its a problem, and just use a compile loop |
| 19:43 | crispin | havent updated in a while |
| 19:43 | crispin | the hard thing about emacs is not cider so much, its the non standard key bindings |
| 19:44 | crispin | but once youve got over the hump... its ok |
| 19:44 | brainacid | well |
| 19:44 | brainacid | im running repl straight in terminal |
| 19:44 | crispin | ideas like the kill-ring are awesome, but if you're only used to cut and paste, a bit out there |
| 19:45 | crispin | yeah and you can jack-in to a terminal repl too |
| 19:45 | crispin | then, once you got the hang of emacs, learn "paredit" and install "rainbow-delimiters" |
| 19:46 | justin_smith | after a recent cider lockup, I am just using inferior lisp and skipping cider entirely |
| 19:46 | crispin | and code editing becomes super powerful |
| 19:46 | amalloy | justin_smith: i run SLIME from a git checkout too :P |
| 19:46 | crispin | i mean you can foobar cider sure, like, evaluate an infinte lazy sequence |
| 19:47 | kenrestivo | i have a question about propagating state. i have some state ref, i need to update it from multiple sources, and propagate the changes to all the *other* sources, but not in a loop back to the originating source |
| 19:47 | crispin | then press Ctrl-G to break out |
| 19:47 | justin_smith | crispin: this was a datomic query with more results than I expected, froze my emacs solid for about 10 minutes, finally I had to kill it |
| 19:47 | justin_smith | it wasn't lazy or infinite |
| 19:47 | crispin | haha yeah. try ctrl-g |
| 19:48 | crispin | as with emacs, its always 'what frikking keypress was that thingie; |
| 19:48 | justin_smith | I know about C-g, and C-c C-c and C-c C-b and these are things I only need because of cider |
| 19:48 | crispin | well... ctrl-g is more than just cider |
| 19:48 | kenrestivo | add-watch doesn't have any way to do this. i thought about maybe hacking something together with core.async channels perhaps, but not sure. any examples of how someone has done a similar thing using clojure ref types, channels, etc? |
| 19:48 | amalloy | justin_smith: oh, i didn't know about C-c C-b |
| 19:48 | crispin | say youre emacs buffer is taking ages to render |
| 19:48 | crispin | c-g |
| 19:48 | crispin | general emacs stop-what-your-doing |
| 19:49 | crispin | kenrestivo: are these multiple threads? |
| 19:49 | kenrestivo | yes |
| 19:49 | justin_smith | c-g my point was, my machine is beefy enough that I don't have to interrupt anything else like that, except cider |
| 19:50 | kenrestivo | multiple threads, multiple future loop/recurs and async/go-loop's, all updating a single ref backing a map, with the state. everyone sending updates also needs to know what updated. |
| 19:51 | crispin | yeah, i would say its not a cider thing, but an emacs thing. For instance, a single line file thats hundreds of thousands of chars wide, with line wrapping, and then do some formatting |
| 19:51 | crispin | hang |
| 19:51 | crispin | elisp is not the fastest |
| 19:51 | justin_smith | crispin: the same query inside inferior lisp took a while but did not hang emacs the way cider did |
| 19:51 | crispin | kenrestivo: what about watchers? |
| 19:52 | kenrestivo | add-watch doesn't have any way i can tell to identify *where* the update came from |
| 19:52 | crispin | yeah watchers should be avoided |
| 19:52 | brainacid | ok got syntax highlighting on gedit and have repl running |
| 19:52 | crispin | can you push down the async channel the value, and where it came from? |
| 19:53 | crispin | or what if each source was a different chan, and then use alts! to switch |
| 19:53 | crispin | then you can tell where it came from by which chan it came over |
| 19:53 | crispin | alts! returns a chan, val pait |
| 19:53 | crispin | pair |
| 19:54 | kenrestivo | that's kind of where i was headed. but it feels like i'll run into trouble. |
| 19:59 | crispin | kenrestivo, if the consumer spwans the agents that communicate back to it, the consumer could create the (chan) and then pass it to the agent to communicate back to it with |
| 20:01 | brainacid | thanks for all the help |
| 20:01 | brainacid | i will start somehow |
| 20:01 | NoCreativity | hello people! I have some data here and I want to organize some data I have here but I dunno if there is a good and easy way to do it. |
| 20:01 | brainacid | nil is nil |
| 20:01 | brainacid | :) |
| 20:01 | brainacid | later |
| 20:02 | NoCreativity | I want to turn this [ {:g [{:id 15}], :id 216} {:g [{:id 2}], :id 216} ] in {:g [{:id 2, :id 15}], :id 216} |
| 20:02 | amalloy | {:id 2, :id 15} is not a valid object |
| 20:02 | NoCreativity | opps |
| 20:02 | NoCreativity | Sorry |
| 20:03 | NoCreativity | {:id 216 :g [{:id 2} {:id 15}]} |
| 20:04 | NoCreativity | I would appreciate any help or tip |
| 20:04 | kenrestivo | yeah, it's kind of like, instead of using add-watch, i write my own source-aware watcher, loops checking incoming channels, processes the input and swap!'s the atom, then doseq's sending the change to everyone else. |
| 20:08 | amalloy | what do you plan to do if there are more top-level ids than just 216, NoCreativity? |
| 20:09 | NoCreativity | I wanted to take the duplications and merge their :g |
| 20:09 | amalloy | so you can't produce {:id 216 :g [{:id 2} {:id 15}]}, is what i'm getting at: you need a list of maps, or a map of maps, as your output |
| 20:10 | amalloy | because {:id 215 :g [...] :id 216 :g [...]} is just as illegal as the other thing |
| 20:10 | kristof | gross |
| 20:10 | NoCreativity | You mean |
| 20:11 | NoCreativity | The top :id can conflict with the one inside :g {} ? |
| 20:12 | NoCreativity | {:id 5 :g [ {:id 1} {:id 2} ] } |
| 20:12 | amalloy | no, of course not. look at the example output i gave. you see why that's impossible, right? |
| 20:13 | amalloy | it's a map with the :id key twice, and the :g key twice |
| 20:13 | NoCreativity | Ah |
| 20:13 | NoCreativity | sorry |
| 20:13 | NoCreativity | I got it |
| 20:13 | NoCreativity | Yeah, you are right |
| 20:13 | NoCreativity | And you are right. I want a list of maps. |
| 20:13 | NoCreativity | Even a set |
| 20:13 | NoCreativity | set of maps |
| 20:13 | amalloy | okay. then it's not super hard |
| 20:14 | crispin | NoCreativity: does this help: http://stackoverflow.com/questions/9089200/clojure-group-by-by-multiple-keys |
| 20:15 | NoCreativity | crispin: Let me check |
| 20:16 | crispin | making the output {:id [1 2]} instead of [{:id 1} {:id 2}] may be easier |
| 20:16 | amalloy | NoCreativity: so you just want something like https://www.refheap.com/fa03b31d7b7fe214bf0ca3df9 |
| 20:18 | NoCreativity | amalloy: Cool! I will try it! |
| 20:18 | arrdem | $mail andyf is there an eastwood config for adding all the linters? |
| 20:18 | lazybot | Message saved. |
| 20:20 | crispin | amalloy: TIL fnil. thanks |
| 20:25 | NoCreativity | amalloy: Cool! thanks for the help! I will study this stuff! Thinking in functional is still too different for me. |
| 20:25 | NoCreativity | crispin: Thank you too! |
| 20:28 | rritoch | NoCreativity: Looking at the solution you've been given, that doesn't verify that the primary key (:id) is the same, it is just merging all :g's |
| 20:28 | rritoch | NoCreativity: Take a look at this code. https://github.com/rritoch/clj-grid-kernel/blob/master/src/com/vnetpublishing/clj/grid/lib/grid/util.clj#L39-L60 It was made for a different problem but is very similar |
| 20:29 | rritoch | NoCreativity: In that case they wanted to turn non-array keys into arrays if the keys matched |
| 20:30 | rritoch | NoCreativity: I believe you would need to apply this as your reduce function though, since this was designed to merge in one item at a time. |
| 20:31 | NoCreativity | rritoch: Thank you for the link too. You said primary key, =]. Im trying to play a bit with Relational databases. The functional way of thinking is still a bit different for me so the functional amalloy gave me was a good point for me to think. I will check you link too. |
| 20:31 | NoCreativity | I will need to leave here. Thank you for the help. |
| 20:48 | hydo | is there a way to get a static enum from a string? I'd like to go from "Thing" to Class/Thing. Is it some combination of (symbol? |
| 20:52 | hydo | ah ha! found it. Nothing like asking a question to help you find it immediately. Kinda like lighting a smoke while waiting for a bus. |
| 20:52 | tuft | hydo: whichever way java does it should work fine |
| 20:52 | tuft | hehe, indeed |
| 21:06 | ddima | hm, if I have a Namespace object in a var, is there a better way to switch to it than (in-ns (symbol (str my-ns)))? pretty sure there is, but couldnt figure it out yet. |
| 21:06 | justin_smith | ddima: why do you call both symbol and str on it? |
| 21:06 | justin_smith | ,(.sym *ns*) |
| 21:07 | clojurebot | #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: sym for class clojure.lang.Namespace> |
| 21:07 | justin_smith | err |
| 21:07 | ddima | well, thats the only way I got it to work, as it does not cast to symbol directly |
| 21:07 | chouser | (set! *ns* my-ns) |
| 21:07 | justin_smith | ,(.name *ns*) |
| 21:07 | clojurebot | sandbox |
| 21:08 | justin_smith | chouser: oh cool, I had no idea that worked |
| 21:08 | chouser | I don't know if I'd recommend it or not. *shrug* |
| 21:08 | ddima | ah, thanks. looks slighly evil ;) |
| 21:08 | ddima | I basically want to eval some code in a dynamically built namespace with specific bindings |
| 21:09 | ddima | so maybe I could just bind [*ns*] instead of set! |
| 21:10 | ddima | actually seems to work too |
| 21:10 | chouser | That sounds slightly less scary. |
| 21:10 | ddima | basically just wondered why in-ns doesnt, it has the nice advantage of creating if its not there |
| 21:10 | ddima | but who expects comfort when doing shit like that anyways ;( |
| 21:10 | ddima | err, ;) |
| 21:10 | chouser | that's all in-ns does. Creates the ns if it doesn't exist, then sets *ns* to it. |
| 21:11 | justin_smith | ddima: (in-ns (.name my-ns)) will work too |
| 21:12 | ddima | ah, nice to know too. thanks! |
| 21:12 | chouser | Definition of in-ns: https://github.com/clojure/clojure/blob/05af4b52a474bc60d2eb931e388b302c14edc884/src/jvm/clojure/lang/RT.java#L235 |
| 21:13 | ddima | I only looked at namespace.java before, didnt get to RT yet ;) |
| 21:29 | rritoch | ddima: Storing namespaces in var's could get ugly, if remove-ns is called than you would be holding a namespace object that is no longer connected to the runtime. The second solution by justin_smith is better (in-ns (.name my-ns)) but the best solution would be to just store the name of the namespace in your var (.name some-ns-obj) |
| 21:31 | rritoch | ddima: Holding a namespace in a var will keep it from getting garbage collected, effectively creating a potential memory leak. |
| 21:35 | ddima | its just within a closure on not on some global scope, so I guess that should be fine. but good pointer! |
| 21:35 | ddima | s/on/and |
| 21:37 | ddima | var was wrong in the case |
| 21:42 | ddima | so basically s/Var/local, terminology slipup ;) |
| 22:08 | ddima | but its toying around anyways, so nothing too critical - basically I'm sketching out the design for a small tool with scripting support and due to lazyness am using clojure for that atm (but with some comfort/standard functions, thats why I want dynamically built namespaces), before pluggin in rhino or somesuch. |
| 22:08 | rritoch | Is it possible to delete all thread-local data in java? I'm still trying to figure out how the ns macro breaks out of the isolation, and the only possiblity I can think of would be if the thread-local memory was wiped out. That would cause the InheritableThreadLocal data to re-initialize to the root namespace. |
| 22:09 | kenrestivo | clojure.tools.namespace/refresh ? |
| 22:09 | kenrestivo | sorry, clojure.tools.namespace.repl/refresh |
| 22:14 | rritoch | kenrestivo: Interesting, so it may be the REPL wiping out the isolation? I haven't considered that option. I've just been digging throught the macro-expansions and coming up empty. |
| 22:15 | kenrestivo | it's kind of a shot in the dark, but i figured why not mention it. |
| 22:15 | rritoch | kenrestivo: It is a good idea, I didn't even consider the possiblity that the REPL was involved. |
| 22:28 | ddima | maybe http://dev.clojure.org/jira/browse/CLJ-1125 gives some pointers |
| 22:29 | ddima | (at least sounds vaguely related) |
| 22:29 | andyf | /whois arrdem |
| 22:30 | TimMc | A question for the ages. |
| 22:31 | andyf | Oops. arrdem: there is no short Eastwood command to enable all linters. There is the long one of specifying all of their names, and you should be able to type that once and put it in your project.clj |
| 22:32 | andyf | I will create an issue to remind myself to make an all linters option that is short to type, but the ones disabled by default you might soon learn why they are |
| 22:32 | rritoch | Well, it hasn't been a complete loss. I always assumed transactions were run in a separate thread (such as dosync). Digging through the code it seems that isn't the case. |
| 22:33 | rritoch | I'll need to run some tests outside of REPL to see if the REPL is the culprit. |
| 22:35 | rritoch | I certainly haven't found any code that attempts to delete threadlocal memory, but dosync utilizes threadlocal memory. Another possiblity is that I've run into a java bug, possibly a conflict between using ThreadLocal and IneritableThreadLocal at the same time. |
| 22:37 | rritoch | I find it odd that Clojure doesn't use ineritablethreadlocal anywhere, which makes me think there is an issue with it that I'm not aware of. |
| 22:41 | ddima | rritoch: there seems to be something on Var for that: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L328 |
| 22:41 | ddima | (just decided to poke around a little too, to get a better sense for the runtime) |
| 22:42 | rritoch | ddima: Yes, I've seen that, I was originaly thinking of using vars for the implementation until I saw the InheritableThreadLocal which seems much simpler. |
| 22:43 | rritoch | ddima: It seems that clojure deliberatly avoided using InheritableThreadLocal, and I don't know why. It is possibly why the namespace isolation feature I made is getting broken since it realies on the inheritablethreadlocal. |
| 22:43 | ddima | yeah, looks as if it was considered but left unused. |
| 22:46 | rritoch | ddima: Everything I see regarding this issue is regarding memory leaks, but memory leaks and thread-pools aren't the current issue since as far as I can tell the ns macro never triggers another thread. |
| 22:48 | ddima | yeah, I just meant might be a pointer to start checking how threadlocal might be handled in some places to look further - that's what I did, not knowing the codebase well at all ;) |
| 22:48 | rritoch | ddima: Though, maybe oracle/openjdk have been toying with solutions for the memory leaks that are causing my inheritablethreadlocal to get wiped out. |
| 22:48 | ddima | maybe, try some older versions, quicker to test than wading through the code |
| 22:51 | rritoch | ddima: I think I may have found the problem. |
| 22:51 | rritoch | http://stackoverflow.com/questions/7296623/inheritablethreadlocal-and-thread-pools |
| 22:52 | rritoch | If clojure is doing something similar to that, maybe that is why my data is getting wiped out. |
| 22:53 | rritoch | I can't find any refrences to ThreadPoolExecutor in clojure though :( |
| 22:55 | rritoch | I guess attempting to re-implement this without an inherritablethreadlocal may be the way to go. I looked at the REPL code and that may present some challenges to namespace isolation, but I don't see how that could completely break the isolation. |
| 23:00 | ddima | good luck, I need some sleep ;) |
| 23:07 | babu` | macos: lein install from brew. When you run lein you get java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword. googled and didn't find any solution. java -version ==> java version "1.7.0_71" |
| 23:07 | justin_smith | babu`: lein is a single shell script, you don't need brew to get lein |
| 23:08 | justin_smith | and it's easier if you don't use brew, inf fact |
| 23:08 | justin_smith | *in |
| 23:16 | rritoch | Does anyone know how var's are inheriting values from parent threads? I've yet to find any code which seems to create this behavior. |
| 23:17 | rritoch | The following code prints foo=1 which shows vars are being inherited, I just haven't found how. (do (def ^:dynamic foo) (binding [foo 1] (future (Thread/sleep 3000) (println (str "foo=" foo))))) |
| 23:19 | justin_smith | rritoch: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L312 this method, and the one right after it, are probably what you want |
| 23:20 | justin_smith | looks like it is related to static final ThreadLocal<Frame> dvals |
| 23:20 | rritoch | justin_smith: I've looked at that code, but I still don't see it. That code pushes the new value onto the "linked list" of frames. |
| 23:21 | babu` | justin_smith: Before I tried brew I had downloaded lein.sh. I get the same error. |
| 23:21 | rritoch | justin_smith: But the ThreadLocal initializes to TOP which is an empty frame. |
| 23:21 | justin_smith | and then getThreadBindings uses the same linked list of frames |
| 23:21 | justin_smith | babu`: what lein version? |
| 23:23 | rritoch | justin_smith: As far as I can tell, this code here would execute for any new thread created. https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L69-L71 So every thread would have it's own (separate) bindings. |
| 23:23 | rritoch | justin_smith: What I'm not seeing is how bindings are making it into child threads. |
| 23:23 | babu` | justin_smith: The lein.sh has: export LEIN_VERSION="2.5.0" |
| 23:26 | justin_smith | babu`: and just running "lein help" or "lein repl" gets that error? |
| 23:26 | justin_smith | try deleting ~/.lein/ |
| 23:26 | justin_smith | or temporarily moving it asid |
| 23:27 | justin_smith | *aside (sorry, vino) |
| 23:27 | babu` | justin_smith: yes. In ~/.lein/self-installs there was leiningen-2.5.0-standalone.jar. I renamed it and ran lein.sh. It downloaded leiningen-2.5.0-standalone.jar but I get the same error. |
| 23:29 | rritoch | justin_smith: I think I just found it. Var bindings aren't transported by var, they're transported by the future function |
| 23:29 | rritoch | https://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/core.clj#L6416 |
| 23:29 | babu` | justin_smith: renaming ~/.lein and running lein worked. |
| 23:30 | justin_smith | babu`: awesome, likely the config got into a corrupt state |
| 23:30 | justin_smith | it may be worth archiving the contents of the dir and sharing that with the lein team - did anything happen that could have led to a partially configured / partially installed setup? |
| 23:32 | rritoch | justin_smith: It looks like I really will need to piggyback on the var's instead of using InheritableThreadLocal. I had originally considered using vars but they have a lot of extra functionality that isn't needed for isoalting namespaces. |
| 23:32 | babu` | justin_smith: In ~/.lein there was a profiles.clj with :plugins [[cider/cider-nrepl "x.y.z"]] {:user {:plugins [[cider/cider-nrepl "0.8.1"]]}} [mies-om/lein-template "0.4.1"] |
| 23:32 | justin_smith | yeah, that is totally invalid |
| 23:33 | justin_smith | probably hand edited and you made a mistake? or did some tool mangle it? |
| 23:33 | babu` | justin_smith: It will be good to have a better error message than "java.lang.IllegalArgumentException: Don't know how to create ISeq from ..." |
| 23:34 | babu` | justin_smith: No I didn't hand edit it. Installed cider package in emacs. |
| 23:35 | justin_smith | babu`: extremely nonhelpful error messages are so common in the clojure world... |
| 23:35 | justin_smith | babu`: sounds like an error report for whatever cider packager you tried to use I guess |
| 23:37 | babu` | justin_smith: thanks for your help. |
| 23:37 | justin_smith | np |