2016-03-12
| 01:19 | cfleming | clgv: TEttinger: Sorry, I'm around more in Slack than in IRC these days. |
| 01:22 | TEttinger | ah, thanks for the heads-up |
| 01:22 | TEttinger | do I need an invite? |
| 01:23 | TEttinger | cfleming: I've had a nagging issue with dependencies not appearing in anything IntelliJ/Cursive sees except for the REPL |
| 01:24 | TEttinger | REPL allows me to import stuff fine, but the lein deps don't seem to appear at all in the editor |
| 01:24 | TEttinger | I don't know if this is a known bug or a config issue on my side |
| 01:30 | cfleming | TEttinger: I don't think so, I think you can sign up at clojurians.slack.com |
| 01:30 | cfleming | TEttinger: Are you refreshing after adding them to the project.clj? |
| 01:30 | TEttinger | that's part of the issue too I think |
| 01:30 | TEttinger | it doesn't seem like quite a lot of options are present |
| 01:30 | TEttinger | let me check |
| 01:31 | cfleming | You should be able to use Cmd/Ctrl-Shift-A and search for Refresh Leiningen Projects, or you can open the Leiningen toolwindow. |
| 01:32 | cfleming | I'm planning to add a warning soon that the current project.clj has been modified since the last refresh, with a shortcut link to refresh immediately. |
| 01:32 | cfleming | This causes all sorts of problems for people, it's a real source of confusion. |
| 01:32 | TEttinger | hm, I just can't find refresh anywhere |
| 01:32 | TEttinger | http://i.imgur.com/JcFpKun.png |
| 01:32 | TEttinger | I'll try that shortcut |
| 01:34 | TEttinger | clicked the leiningen project refresh one, nothing seems different |
| 01:34 | cfleming | That's in the lein toolwindow? |
| 01:35 | cfleming | Ok, do you see the dependency in External Libraries at the bottom of the Project view? |
| 01:35 | TEttinger | I don't have a lein toolwindow |
| 01:35 | cfleming | Sure you do :) |
| 01:35 | TEttinger | and no, only... a few things in external libs |
| 01:36 | cfleming | View->Tool Windows->Leiningen |
| 01:36 | TEttinger | I imported the project.clj, but I really haven't seen any lein tool window |
| 01:36 | TEttinger | ah! |
| 01:36 | TEttinger | listed there, but not in external libs |
| 01:36 | cfleming | So in the toolwindow, hit the refresh button there. |
| 01:37 | TEttinger | yep, did that, still not seeing the imports |
| 01:37 | TEttinger | it's a java class I'm trying to import, and it isn't from maven central or clojars if that matters |
| 01:38 | cfleming | You don't get any errors when refreshing your project? |
| 01:39 | TEttinger | no, it shows nothing |
| 01:39 | TEttinger | you can see why I was confused :) I think it may be a config issue |
| 01:40 | TEttinger | partially installed cursive or something. running community 15.0.4 |
| 01:40 | cfleming | So just so I'm clear - this class comes from a dependency in your project.clj, right? |
| 01:40 | TEttinger | yes, let me actually gist that |
| 01:41 | cfleming | That dep isn't in maven central or Clojars, so you're installing it locally into .m2? Or using another repo? |
| 01:41 | cfleming | That would be great |
| 01:41 | TEttinger | https://gist.github.com/tommyettinger/0259d15be0ce241e4a46 |
| 01:41 | TEttinger | it's another repo |
| 01:42 | TEttinger | I could try a local install |
| 01:42 | TEttinger | hm, no |
| 01:42 | TEttinger | jitpack is great, but it changes some names |
| 01:42 | cfleming | Ok, so squidlib comes from the jitpack repo? |
| 01:43 | TEttinger | oh d'oh. I might have got it |
| 01:43 | TEttinger | it's possible it was already installed in my .m2 so the repl could see it |
| 01:43 | TEttinger | but the project.clj was looking for a weird name |
| 01:43 | cfleming | Ok - that -SNAPSHOT version is bizarre |
| 01:43 | cfleming | Is that right? |
| 01:44 | TEttinger | yes |
| 01:44 | cfleming | Shouldn't that be master-SNAPSHOT? |
| 01:44 | TEttinger | and that wasn't the issue, the one I just said |
| 01:44 | TEttinger | let me check jitpack's docs |
| 01:45 | cfleming | Let me try to import that project, one sec. |
| 01:47 | TEttinger | I can't make heads or tails of this https://jitpack.io/docs/BUILDING/#multi-module-projects |
| 01:47 | TEttinger | it doesn't say if lein needs an extra section of some kind |
| 01:47 | cfleming | Actually, it looks like a lein problem |
| 01:47 | TEttinger | hm |
| 01:47 | TEttinger | I'm on 2.5.3 |
| 01:48 | TEttinger | it's probably an ancient version |
| 01:48 | cfleming | I got your project.clj, and put it in a directory. lein deps :tree downloads a bunch of squidlib stuff, but doesn't add it to the dependencies. |
| 01:48 | TEttinger | eh... eh? eh. |
| 01:48 | TEttinger | that's bizarre |
| 01:49 | cfleming | I'd just download the repo and install it locally. |
| 01:49 | cfleming | That should work. |
| 01:49 | cfleming | I don't know what jitpack is doing, but lein doesn't like it. |
| 01:50 | TEttinger | trying master-snapshot now |
| 01:50 | TEttinger | yeah, jitpack is really fantastic for java dev |
| 01:51 | cfleming | Except that it doesn't seem to work very well :) |
| 01:51 | TEttinger | indeed, for clojure it needs way better docs :| |
| 01:52 | cfleming | It's not just that, it's doing something very strange: |
| 01:52 | cfleming | https://gist.github.com/cursive-ide/4422cfa7e21ba4104403 |
| 01:52 | TEttinger | the really strange thing is I don't see any transitive deps of one project that has a bunch |
| 01:53 | TEttinger | why... is it adding a dep to parent.... |
| 01:53 | TEttinger | that's a pom-only parent project |
| 01:53 | TEttinger | no code |
| 01:54 | cfleming | Right, I don't think jitpack is handling the deps properly. I see it downloading jars, but they aren't put anywhere in the cache. |
| 01:54 | cfleming | Actually, I lie, sorry, they're there - spot blindness. |
| 01:55 | cfleming | Anyway, I'm not sure what the problem is sorry, but it looks like a lein issue. I think probably lein doesn't like that version much. |
| 01:56 | cfleming | If you use the -v3.0.0-b3-g386143b-39 version, it works, at least for lein - I bet Cursive will pick them up too. |
| 01:56 | TEttinger | whaaaaaaaat is going on! |
| 01:56 | cfleming | It doesn't like the -SNAPSHOT version. |
| 01:56 | TEttinger | I tried lein deps :tree at the command line! |
| 01:57 | cfleming | Maybe it trims -SNAPSHOT from the version, or something. |
| 01:57 | TEttinger | and it doesn't see any deps other than clojure |
| 01:57 | cfleming | Right. |
| 01:57 | cfleming | Or you mean you don't get clojure-complete or nrepl either? |
| 01:57 | TEttinger | sorry yes |
| 01:57 | TEttinger | I get those two |
| 01:58 | TEttinger | but they aren't listed as deps in project.clj, they could be implicit? |
| 01:58 | cfleming | Yes, lein adds them. |
| 01:58 | cfleming | But that's what I meant above - lein doesn't add those deps. |
| 01:58 | TEttinger | hmm |
| 01:58 | cfleming | If you use the explicit version, it does, and I bet Cursive will see them then. |
| 01:58 | TEttinger | that is odd |
| 01:58 | TEttinger | ok, I will try |
| 01:59 | TEttinger | I would like to get a snapshot build but it looks out of the question somehow |
| 01:59 | cfleming | I think if you download the repo, and compile and install it locally, you can get a snapshot version. |
| 02:00 | cfleming | But jitpack doesn't work for whatever reason. master-SNAPSHOT might work, though. |
| 02:01 | cfleming | master-SNAPSHOT doesn't work either. |
| 02:02 | cfleming | Got to go, sorry |
| 02:03 | TEttinger | you're a hero cfleming! |
| 02:03 | TEttinger | it works now |
| 02:03 | cfleming | With the explicit versions? |
| 02:03 | TEttinger | not -SNAPSHOT, but the example you give works |
| 02:03 | TEttinger | yes |
| 02:03 | cfleming | Nice! |
| 02:03 | TEttinger | thanks so much |
| 02:04 | TEttinger | as recompense, here's the cat who has been gradually forcing me out of my seat https://dl.dropboxusercontent.com/u/11914692/Satchmo_Portrait.png |
| 02:20 | cfleming | TEttinger: That's a pretty cute cat :) |
| 02:20 | TEttinger | he's a good un. loves water |
| 02:21 | TEttinger | he's happy about southern california getting some rain finally |
| 07:45 | pvinis | hello. when using cider and eval something, how can i keep the overlay after moving the cursor? |
| 08:38 | Xack | is it normal that `lein repl` uses around 300MB of RAM? :( |
| 08:38 | justin_smith | depends on your deps, but that sounds about right |
| 08:39 | justin_smith | Xack: if you follow the instructions for FAST_TRAMPOLINE that will also reduce RAM usage (by launching the process in the same VM instead of launching three vms total) |
| 08:39 | justin_smith | ~faster |
| 08:39 | clojurebot | faster is https://github.com/technomancy/leiningen/wiki/Faster |
| 08:40 | justin_smith | also if you avoid starting nrepl, you can cut it down to one vm running |
| 08:40 | Xack | :dependencies [[org.clojure/tools.nrepl "0.2.12"]]}} |
| 08:40 | Xack | i see, thanks! |
| 08:40 | justin_smith | that faster link also describes how to start clojure.main directly |
| 08:41 | justin_smith | nrepl has great features, but it also means you need two processes, the client and the server |
| 08:42 | justin_smith | if you are connecting from eg. an editor, you can trampoline repl :headless as well (still accepts connections, doesn't start a second client vm) |
| 08:42 | Xack | i see, thanks! |
| 10:15 | pilne | i feel like between clojure and clojurescript, using a browser for any "gui", is probably my best bet when it comes to what i'd like to create (relatively/easily portable x-platform (mostly desktop, possibly android, doubtfully iOS), applications, in terms of "learning" overhead. clojure seems to be one of the best 1:1 mappings of the jvm language to the js, but i haven't dug deep into scala or kotlin as much, due to... not liking |
| 10:15 | pilne | them as much, and i can be lazy... |
| 10:17 | pilne | and... i can't help that i think in s-exprs >.< |
| 10:18 | dysfun | clojure/script are a good combo for that. there's a phonegap extension that has up to date webkit as well |
| 10:19 | pilne | yes, i have it in the growing list of 'awesome stuff' links... too many bookmarks >.< lol |
| 10:19 | dysfun | i have that with pdfs of academic papers |
| 10:21 | pilne | i looked at doing the javascript all the way down thing like... node.js for a few days... and i'd rather have to treat my functions as "less capable" when going from jvm -> js, than try and make my "less capable" functions into "more capable" functions (at least that's how i felt writing js for a backend), and... a lot of my stuff is more compute oriented than io oriented for now. |
| 10:21 | pilne | ... don't get me started on my haskell addiction >.< |
| 10:21 | pilne | well, ghc... to be proper |
| 10:22 | dysfun | on the haskell side, i find haste better than ghcjs right now |
| 10:22 | dysfun | ghcjs will be amazing when it's finished, but that's not today |
| 10:23 | pilne | right after i get a new install, comfy, i install leiningen, stack, virtualenvwrapper, and nvm. lol |
| 10:24 | dysfun | i currently have a project where stack is insufficient for papering over cabal hell |
| 10:24 | pilne | that's where i enjoy playing, kinda in an order of preference too, but i try to be pragmatic, and yeah, haste is approaching it like "haskell inspired" so they can play a bit more cut-and-loose, whereas ghcjs is like a complete reproduction (i feel) |
| 10:24 | pilne | i'm just a learner... still so.. it suffices for me *knocks on wood |
| 10:25 | pilne | and i get tempted to read about new languages more than i should >.< |
| 10:25 | pilne | i have a love/hate/intrigue for julia and rust as well |
| 10:26 | dysfun | i have to confess i gave up on rust and chose modern c++ for my low level code |
| 10:26 | pilne | and nothing but respect for common lisp, scheme, racket either |
| 10:26 | pilne | rust is still... polishing (irony?) |
| 10:26 | dysfun | yeah, but i'll need to deploy before they get that far |
| 10:26 | pilne | i think anyone who likes clojure, could enjoy htdp and/or sicp implemented in racket |
| 10:27 | pilne | pragmatism is always the better way |
| 10:27 | pilne | it is possible to write "nice" c++, it just takes more effort lol. |
| 10:27 | dysfun | modern c++ is a different animal, but it's a huge language |
| 10:28 | pilne | yeah, you can avoid a lot of the pitfalls if you stick to as much 11/14 as possible |
| 10:28 | dysfun | yeah, i now require c++14 by default |
| 10:28 | pilne | still too big for my brain |
| 10:28 | pilne | i respect it, but fear it in my hands >.< |
| 10:28 | dysfun | some of my c++ is on the bleeding edge because it gives me the ability to achieve more safety |
| 10:29 | pilne | i'm cool with the 12guage that is macros, but not the vulcan cannon that is c++ |
| 10:29 | dysfun | perhaps you'd like one of my projects that i've been hacking on today: simplified c++ with clojure syntax |
| 10:29 | pilne | O.o |
| 10:29 | pilne | that could be quite pragmatic in a lot of situations |
| 10:29 | pilne | that's like pixie.. but with balls |
| 10:30 | dysfun | i got fed up of not being able to have macros after a few months of c++ hacking |
| 10:30 | pilne | no offense to pixie btw |
| 10:30 | pilne | yeah, macros are what i hate the most when i'm not in a lisp... it's painful! |
| 10:30 | dysfun | i might be more interested in pixie if they got it off python |
| 10:31 | pilne | agreed, it made it easier, but... GIL >.< |
| 10:31 | pilne | and good c++ is easier to port around a bit imho |
| 10:32 | dysfun | so i'm building a cross-platform app (desktop and mobile) and the only way i can minimise repetition and have the option to replace guis is to use c++ for the bulk of the code |
| 10:32 | pilne | oh, and repls... mustn't forget those wonderful things :) |
| 10:33 | dysfun | naturally c++ is more annoying to bind than C, but oh well |
| 10:33 | dysfun | i'm contemplating emscripten |
| 10:33 | pilne | if it needs a lot of efficient low-level access yeah, that would make sense, i'm not going quite that far yet, so jvm level should work fine for me |
| 10:34 | dysfun | yeah, there are some things you just don't do in java |
| 10:35 | pilne | every single platform out there has pros and cons, you just find one that has cons you can avoid or work with lol. |
| 10:35 | dysfun | that's your first job as a programmer, identify which things might possibly work for your use case |
| 10:35 | pilne | because if "rainbowshittingunicorn" lang existed, we'd all be using it. |
| 10:36 | pilne | it's like writing a sudoku solver in assembly by hand, sure you can, but why not prolog? |
| 10:37 | dysfun | because no. |
| 10:37 | pilne | lol |
| 10:41 | dysfun | pilne: have you use core.logic? |
| 10:42 | pilne | i haven't more than some passing intros yet |
| 10:42 | pilne | i do like what i've seen though :) |
| 10:42 | dysfun | likewise. i was hoping for a prolog user's view of it |
| 10:43 | pilne | it doesn't seem quite as "elegant" as prolog (but i'm an odd duck) for the syntax and application, but, it looks to be feature-complete, and integrates with a langauge that could add interesting functionality to the present-features |
| 10:43 | pilne | and a wild hyphen appears |
| 10:44 | dysfun | i think the design of the prolog standard library is really excellent, but i also think the same of clojure |
| 10:45 | pilne | in short, it's pros far outweigh it's cons, for me, i just dabbled in that 7 languages book enough to get an appreciation for prolog. |
| 10:45 | pilne | kinda blew my mind |
| 10:45 | dysfun | heh |
| 10:45 | dysfun | i was reading the manpage for swipl the other day and it referred to the book i'm currently using as a rolling mat |
| 10:45 | pilne | lol |
| 10:46 | pilne | in ways it reminds me of fortran, like a razor in its intended domain, from an era where it was beneficial to have highly specialized programming languages |
| 10:47 | pilne | now we toss around gigabytes like they are nothing... |
| 10:47 | AimHere | Back in Fortran's day, it was pretty much the one programming language, and was necessarily general purpose |
| 10:47 | pilne | ghz, cores... pipelines |
| 10:48 | pilne | the application domain of computers was smaller then as well |
| 10:48 | pilne | the evolution and intermixing of different paradigms is fascinating :) |
| 12:08 | moredhel | hi, I'm having issues understanding why some code isn't working. I believe that what I have written is equivalent, so any help on describing what is actually different would be appreciated: https://gist.github.com/hamhut1066/d4fbcd67cc3ba3f303e2 |
| 12:11 | opqdonut | ,(macroexpand-1 '(-> dna (map f) foo)) |
| 12:11 | clojurebot | (foo (map dna f)) |
| 12:12 | opqdonut | moredhel: ^ see, dna becomes the _first_ arg |
| 12:12 | opqdonut | ,(macroexpand-1 '(->> dna (map f) foo)) |
| 12:12 | clojurebot | (foo (map f dna)) |
| 12:12 | opqdonut | that's better: ->> puts it in last |
| 12:13 | opqdonut | ,(macroexpand-1 '(-> dna ((fn [x] (map f x))) foo)) |
| 12:13 | clojurebot | (foo ((fn [x] (map f x)) dna)) |
| 12:13 | opqdonut | ^ that's how you make the fn hack work: note the double parens |
| 12:13 | opqdonut | ,(macroexpand-1 '(-> dna (fn [x] (map f x)) foo)) |
| 12:13 | clojurebot | (foo (fn dna [x] (map f x))) |
| 12:13 | moredhel | hmm, thanks. I had forgotten ->/->> were macros |
| 12:13 | opqdonut | ^ because this becomes nonsense |
| 12:13 | opqdonut | moredhel: if you want nonmacro, just use comp |
| 12:14 | moredhel | no, I'm more than happy with macros :) |
| 12:14 | opqdonut | remember macroexpand-1, it's your friend |
| 12:14 | moredhel | yeah, I was looking into that, but there doesn't feel like it's necessary, as the functions are statically defined |
| 12:16 | moredhel | hmm, see, this seems to work... (macroexpand-1 '(->> "AAB" (map opposite-strand))) |
| 12:17 | moredhel | until I actually try and execute it, and it fails. |
| 12:17 | moredhel | (map opposite-strand "AAB") |
| 12:17 | moredhel | should work |
| 12:17 | opqdonut | what happend when you try to execute? |
| 12:18 | moredhel | nvm, I was throwing an expected error, my fault. |
| 12:18 | opqdonut | :> |
| 13:16 | sdegutis | How can a deftype call one of its own methods? Like, (deftype Foo [] IFoo (calling-from-method [this] (some-method 123)) (some-method [this n] ...)) |
| 13:16 | sdegutis | What's the syntax and is it even possible? |
| 13:18 | justin_smith | sdegutis: of course it's possible, since you can only define methods that are already defined in a protocol or interface |
| 13:18 | justin_smith | you can simply call them |
| 13:18 | sdegutis | justin_smith: so then I have to :refer those methods into the current namespace or something? |
| 13:18 | sdegutis | If so, "ugh, okay, fine then I guess" |
| 13:19 | justin_smith | sdegutis: no, if you do (deftype Foo [a b] IBar ...) then clojure knows to look up the following method definitions in the IBar interface |
| 13:19 | justin_smith | you don't need any refer |
| 13:19 | sdegutis | Uh. |
| 13:19 | sdegutis | Hmm. |
| 13:19 | justin_smith | now if you want the function version of a protocol method, either call the properly qualified name of the method, or refer it - or hey maybe it just works you could try unqualified call. |
| 13:21 | sdegutis | Hmm yeah. |
| 13:21 | sdegutis | I'll just refer it. |
| 13:22 | sdegutis | Thanks justin_smith. |
| 13:37 | justin_smith | oh I was wrong, it's not the context of the protocol /interface you declare that would make it resolve, it would resolve the method the same way the method would be resolved in any other context |
| 13:43 | brianboyko | Hello. I'm trying to work through "Clojure for the Brave and True" but it seems like the instructions are out of date -- or I don't understand them." |
| 13:44 | brianboyko | I'm able to lein run "Hello world" but I can't build an uberjar that outputs "Hello World." |
| 13:44 | justin_smith | brianboyko: feel free to ask any specific questions here |
| 13:44 | brianboyko | Anyone here? |
| 13:44 | justin_smith | what happens when you try to run "lein uberjar" |
| 13:45 | brianboyko | It builds two files, both jars, one standalone. |
| 13:45 | justin_smith | right, the one with standalone in the name is the uberjar |
| 13:46 | justin_smith | on linux, you can run that jar, on other platforms you can run 'java -jar target/foo-standalone.jar' |
| 13:46 | justin_smith | or whatever the name, of course |
| 13:46 | brianboyko | Running this: java -jar app-1.0.0-SNAPSHOT-standalone.jar => no output to the console. But I'm on Linux. |
| 13:46 | justin_smith | brianboyko: so no error, it just isn't doing anything? |
| 13:46 | brianboyko | Nope. |
| 13:47 | justin_smith | what's in your -main definition? |
| 13:47 | brianboyko | (ns app.core (:gen-class)) (defn -main "I don't do a whole lot...yet." [& args] println "I'm a little teapot!" ) |
| 13:48 | justin_smith | brianboyko: that doesn't print, that returns a string |
| 13:48 | justin_smith | to call println, you'll need another set of parens |
| 13:48 | brianboyko | I think I saw it as soon as it was all on one line. |
| 13:48 | justin_smith | returning a string doesn't do anything useful when running the jar |
| 13:48 | justin_smith | brianboyko: heh |
| 13:48 | brianboyko | So, basically () around println and the string? |
| 13:48 | justin_smith | brianboyko: right, in clojure () means "call this" |
| 13:49 | justin_smith | so println without the () is just a function, it doesn't get called |
| 13:49 | justin_smith | ,println |
| 13:49 | clojurebot | #object[clojure.core$println 0x577625cb "clojure.core$println@577625cb"] |
| 13:49 | justin_smith | ,(println) |
| 13:49 | clojurebot | \n |
| 13:49 | brianboyko | :) |
| 13:50 | brianboyko | Thanks. I may need your help. I'm a pig on rollerskates with lisp/closure |
| 13:55 | ulrichschinz | brianboyko, nice, so I think im gonna stay here... learning as well :) and maybe seing same questions i have ;) |
| 14:02 | brianboyko | Right now I'm pair-programming with my friend Josh, he just told me about Lighttable's support for LightTable's in-line evaluation. |
| 14:03 | justin_smith | careful with lighttable, last I heard it still had "lose all your code" level bugs |
| 14:03 | justin_smith | or, unsaved changes at least |
| 18:35 | adam1 | Hi folks! |
| 18:36 | adam1 | I'm quite new to clojure(script), such a wonderful language |
| 18:36 | qbg | hello adam1 |
| 18:36 | adam1 | I do have a question. I've installed leiningen but it's driving my crazy. I catt' start a repl, can't create a new project, can't do anything really... |
| 18:37 | adam1 | For instance "Failed to resolve version for mies:lein-template:jar:RELEASE: Could not find metadata mies:lein-template/maven-metadata.xml" |
| 18:37 | adam1 | I'm not behind a proxy, no idea why it fails :( |
| 18:37 | justin_smith | is that the only error? |
| 18:38 | adam1 | No |
| 18:38 | adam1 | "lein repl" results in a long error begining with "Could not transfer artifact org.clojure:tools.nrepl:pom:0.2.12 from/to central (https://repo1.maven.org/maven2/)" |
| 18:38 | justin_smith | can you share a paste of the full error output? |
| 18:38 | adam1 | Sure |
| 18:38 | justin_smith | adam1: are you on ubuntu by any chance? |
| 18:39 | adam1 | Yes, ubuntu gnome more precisely |
| 18:39 | justin_smith | this reminds me of an ubuntu issue (with a different error as the root cause) |
| 18:39 | justin_smith | they fucked up their java security certificate dep, and so the java process refuses to do the downloads |
| 18:40 | adam1 | Arg, no solution then ? |
| 18:40 | justin_smith | oh there is, here's the link in case it is your issue http://askubuntu.com/a/635395 |
| 18:41 | justin_smith | but I wasn't sure you were getting the same error, didn't want to jump to that conclusion |
| 18:41 | justin_smith | so if that doesn't fix it, please do share the whole error output on a paste site |
| 18:42 | adam1 | Oh yeah ! Just ran the given command and it's fixed ! |
| 18:42 | justin_smith | awesome, if this irc channel had a faq I would have to add that link |
| 18:42 | adam1 | Thank you so much ! |
| 18:42 | justin_smith | np, glad it was an easy fix |
| 18:42 | adam1 | Repl and creating new projects works perfectly now :) |
| 18:44 | adam1 | Well I'll go clojuring around and might come back here once in a while, bye ! |
| 18:46 | rhg135 | justin_smith: that's what facts are for |
| 18:46 | rhg135 | On clojurebot |
| 18:46 | justin_smith | oh, right |
| 18:47 | rhg135 | Witty jokes are also an use |
| 18:47 | justin_smith | ~ubuntu is there's a simple fix for download failures on ubuntu http://askubuntu.com/a/635395 |
| 18:47 | clojurebot | 'Sea, mhuise. |
| 18:47 | justin_smith | ~ubuntu |
| 18:47 | clojurebot | ubuntu is there's a simple fix for download failures on ubuntu http://askubuntu.com/a/635395 |
| 19:42 | bendavisnc | hey guys, i'm still super new to learning clojure, and i was wondering if i could just throw out a few questions about clojure / lisp compared to non functional approaches like java |
| 19:43 | bendavisnc | mainly what changes when thinking / dealing with things like interfaces and design patterns |
| 19:43 | bendavisnc | are design patterns as much of a thing in the clojure world? |
| 19:49 | qbg | Are you comparing it to Spring's AbstractSingletonProxyFactoryBean? |
| 19:54 | ben_vulpes | bendavisnc: write a bunch of functions, and when that starts to hurt check in |
| 19:55 | ben_vulpes | if you really need protocols or interfaces, take a look at the reloaded libraries for how that's done |
| 19:57 | bendavisnc | ok so i'mma infer because i for some reason can't get a straight answer that the answer is "no, design patterns aren't as much of a thing" |
| 19:57 | justin_smith | I use the interpreter pattern in clojure all the time |
| 19:57 | justin_smith | some patterns are just the right way to use the language (because the language features support them directly) |
| 19:58 | bendavisnc | like let me throw a specific example |
| 19:58 | bendavisnc | decorator? facade? |
| 20:00 | justin_smith | many typical usages of first class functions could be called decarator, in particular in middleware. But we don't tend to reference decarator by name. |
| 20:00 | bendavisnc | hmmm ok. thanks |
| 20:00 | bendavisnc | i think i need to read this |
| 20:00 | bendavisnc | http://mishadoff.com/blog/clojure-design-patterns/ |
| 20:00 | ben_vulpes | no, "design patterns aren't much of a thing" |
| 20:00 | justin_smith | but it is different because instead of adding fields to a class, this is passing a function to another function and getting a new function back |
| 20:01 | bendavisnc | hmmm ok |
| 20:03 | bendavisnc | i mean i've read a bit about protocols like seq. and idk... i assume the gof matra of "always program to an interface" is still true in lisp land? right? |
| 20:03 | justin_smith | bendavisnc: in a normal lisp it's so pervasively a single interface (list) that it's invisible |
| 20:03 | justin_smith | but yes, in clojure all the core functions call interface code |
| 20:04 | justin_smith | we do have more variety of interfaces than a typical lisp |
| 20:04 | bendavisnc | yeah i guess long story short. i've come to be really interested in clojure, but i've sorta hit somewhat of a wall when trying to figure out how to have basic extends style inheritance |
| 20:04 | justin_smith | bendavisnc: for example, it's actually impossible to implement methods on a deftype or defrecord call unless they are defined by some interface or protocol first |
| 20:05 | justin_smith | bendavisnc: don't |
| 20:05 | justin_smith | that is, don't use inheritence |
| 20:05 | bendavisnc | ok |
| 20:05 | justin_smith | bendavisnc: I think the book that would really help you is Joy of Clojure |
| 20:05 | bendavisnc | i've been reading clojure for the brave and true and really like it |
| 20:05 | bendavisnc | but i've been sorta skipping around honestly |
| 20:06 | justin_smith | bendavisnc: one thing about clojure's design is that it's very opinionated, one of those opinionated things is the avoidance of concrete inheritence |
| 20:06 | ben_vulpes | (without clos, there's not much oop in clojure) |
| 20:06 | ben_vulpes | (that i've seen) |
| 20:06 | yonatankoren | clojure for the brave and true, 4clojure, and also Clojure for Machine Learning by Wali greatly helped me |
| 20:06 | bendavisnc | so if i have a basic inheritance situation though |
| 20:06 | justin_smith | ben_vulpes: every function is an object that implements callable, |
| 20:07 | bendavisnc | say i have an animal, a cat, and a dog |
| 20:07 | justin_smith | bendavisnc: then change your design such that you don't |
| 20:07 | bendavisnc | how do i split this code up? |
| 20:07 | yonatankoren | 4clojure is not a book btw, it's a set of exercises. I improved mostly from that (practice) |
| 20:07 | bendavisnc | where can i put dog/run, cat/run, animal/run? |
| 20:07 | yonatankoren | as an introduction clojure for the brave and true is a really good book |
| 20:08 | bendavisnc | this would just be like maybe one protocol and three def records ? |
| 20:09 | justin_smith | bendavisnc: don't use concrete inheritence, it's just clumsy in clojure and not worth it. Make an IAnimal protocol if you must, define the methods in that protocol, but that only defines signitures and does not implement any logic. Then implement it in Dog and Cat records |
| 20:09 | justin_smith | but you probably don't need to do any of that, and don't do it until you can prove you need to |
| 20:09 | bendavisnc | ok i think i hear you |
| 20:10 | bendavisnc | i'm right in how i think you mimic let's say java style inheritance, but try to keep everything a plain function instead |
| 20:10 | bendavisnc | ok let me ask one more question |
| 20:10 | bendavisnc | kinda towards the annoying same vain, but different |
| 20:11 | justin_smith | bendavisnc: we wouldn't mimic java inheritence anyway - we don't abstract the jvm enough for that. When we inherit we produce actual bytecode for a class that inherits. But this tends to be a poor choice in clojure. |
| 20:11 | bendavisnc | would it be possible to use clojure to implement java interfaces though? |
| 20:12 | justin_smith | yes |
| 20:12 | justin_smith | bendavisnc: to define them, or extend them, yes |
| 20:12 | justin_smith | these are both actually quite easy things to do |
| 20:12 | bendavisnc | i'm thinking for like specifically android development where basically i just import one big jar for the implementations of my java interfaces |
| 20:13 | bendavisnc | do ppl do that ever? |
| 20:13 | justin_smith | it's very easy to call java from clojure, or clojure from java, whichever makes sense situationally |
| 20:13 | bendavisnc | does that sound to weird or impossible? |
| 20:13 | justin_smith | there's projects for clojure on android yes |
| 20:13 | bendavisnc | i'm thinking about how big this clojure included jar will be |
| 20:13 | justin_smith | well, if you run clojure you need to load the compiler |
| 20:13 | bendavisnc | right ok. but i'm thinking more like normal java deployment. like more java centric maybe |
| 20:14 | justin_smith | sure, what we do is package an uberjar that includes clojure.core, and have clojure itself launch the code |
| 20:14 | justin_smith | this is neccessary because of the things clojure code is allowed to do at runtime |
| 20:16 | bendavisnc | alright. thanks guys. i'm real new to functional programming practice. thanks for bearing with me |
| 20:38 | troydm | how do I extend-type vector or generally any arbitary Sequence? |
| 20:46 | troydm | nvm figured it out |
| 22:33 | sharms | I have a two lists: x ([1 2]) and y (([3 4])) - what is the best way to join these together to make ([1 2] [3 4])? For y it could be deeply nested |
| 22:41 | justin_smith | sharms: so you don't know how y is shaped? what's the rule that decides what part of y you want? |
| 23:09 | Elijah1310 | hey |