2014-08-09
| 00:02 | Frozenlock | Anyone knows if it's possible to use Kerodon to test POST requests? |
| 00:05 | justin_smith | Frozenlock: the examples in the readme look like POST requests to me (one even has a file upload) |
| 00:06 | Frozenlock | justin_smith: They are (the press button), but I was wondering if there was a way to give it raw maps as a post. |
| 00:06 | Frozenlock | Without going too deep in the source that is... |
| 00:06 | mdeboard | Jaood: I assume it doesn't show SNAPSHOT versions |
| 00:06 | technomancy | Jaood: oh, no Central pays a TON |
| 00:07 | justin_smith | not sure, really. I am sure it is possible. I use a lib I wrote called groundhog to record requests, and serialize to a replayable form. |
| 00:07 | technomancy | US$150,000 a year and growing |
| 00:07 | justin_smith | Frozenlock: the advantage is that I can run any request I care to, the disadvantage is that it isn't in a nice declarative form in the source like kerodon requests are |
| 00:08 | Frozenlock | I understand. |
| 00:08 | Frozenlock | I guess I could also just make the request by hand. It's a single POST after all. |
| 00:08 | justin_smith | the tricky part is that ring expects an input stream, but that's not so hard to construct |
| 00:09 | Frozenlock | aww |
| 00:09 | justin_smith | or you could splice the request in after the handler that sucks in the input stream |
| 00:09 | Frozenlock | Why is it always a rabbit hole? |
| 00:09 | justin_smith | Frozenlock: it's just one more detail, really - you can make an inputstream out of a string or an array of bytes trivially |
| 00:10 | justin_smith | ,(java.io.ByteArrayInputStream. (.getBytes "hello")) |
| 00:10 | clojurebot | #<ByteArrayInputStream java.io.ByteArrayInputStream@17c26cc> |
| 00:10 | justin_smith | boom, input stream, ready to use |
| 00:13 | Frozenlock | justin_smith: thanks |
| 00:13 | Frozenlock | Oh, turns out Kerodon is built on top of this https://github.com/xeqi/peridot |
| 00:37 | mdeboard | ARGH why is cider broken for me :((((( |
| 00:39 | justin_smith | mdeboard: latest release? |
| 00:39 | mdeboard | yeah, from today |
| 00:40 | mdeboard | https://gist.github.com/mattdeboard/e7520729acf056ff45ad |
| 00:40 | mdeboard | idgi |
| 00:40 | mdeboard | I don't know what that error actually means :-\ |
| 00:41 | mdeboard | seems like the last few times I've gone to start a project with Clojure, Cider has some breaking bug |
| 00:43 | mdeboard | between cider and elixir-mode I'm ready to switch to vim |
| 00:43 | mdeboard | ok, that's exaggeration. |
| 00:45 | justin_smith | I've been planning for months now to switch to cider as soon as bug reports for 0.7.0 slow down |
| 00:48 | mdeboard | clojure-jack-in always seemed so stable to me :( |
| 00:48 | mdeboard | and nrepl-jack-in |
| 00:48 | mdeboard | but really smart dudes are working on cider, I'm sure it'll get worked out |
| 00:48 | mdeboard | I'm actually pretty sure the problem is with how melpa does it's damned packaging |
| 00:48 | mdeboard | Sorry, "Packaging" |
| 00:49 | mdeboard | because I don't understand how I can possibly have cider 0.8.0-SNAPSHOT when the latest release is v0.7.0 |
| 00:51 | mdeboard | and as we all know, the problem will definitely pan out to being something I'm doing wrong |
| 00:51 | mdeboard | every time i get worked up about something, it turns out I'm just an idiot |
| 00:54 | jeremyheiler | mdeboard: are you using melpa-stable? |
| 00:55 | mdeboard | jeremyheiler: idk, am I? `(setq package-archives '(("melpa" . "http://melpa.milkbox.net/packages/")))' |
| 00:56 | jeremyheiler | http://melpa.milkbox.net/#/getting-started |
| 00:56 | mdeboard | idk what you mean by using melpa-stable, i'm just using package.el |
| 00:56 | mdeboard | oh for heaven's sake |
| 00:56 | mdeboard | thanks. |
| 00:56 | mdeboard | I'll try that. |
| 00:56 | mdeboard | thanks melpa |
| 00:56 | mdeboard | that's really, really productive. |
| 00:56 | mdeboard | I hate melpa :) |
| 00:59 | mdeboard | turned out not to matter |
| 00:59 | mdeboard | melpa-stable has the same version |
| 00:59 | mdeboard | which is pretty bizarre. |
| 01:01 | jeremyheiler | are you sure about that? |
| 01:01 | jeremyheiler | http://melpa-stable.milkbox.net/#/cider |
| 01:02 | mdeboard | yeah I just deleted cider, restarted emacs and checked again and it had the new version |
| 01:02 | mdeboard | er, stabl version |
| 01:02 | mdeboard | maybe it was caching or something. |
| 01:02 | justin_smith | mdeboard: elisp compilation and the caching of .elc files is pretty much magic to me |
| 01:02 | mdeboard | One might expect "show me the stable package versions" to be the most sensible default |
| 01:02 | mdeboard | principle of lease surprise etc. |
| 01:02 | mdeboard | Yeah ditto |
| 01:03 | justin_smith | I mean even more so than cached clojure compilation artifacts (which are weird enough already) |
| 01:03 | jeremyheiler | hmm yeah, the recipe seems to be the same for both *shrug* |
| 01:04 | mdeboard | I never really noticed any glitches or hitches with melpa until I started maintaining a language mode and publishing it to melpa |
| 01:04 | mdeboard | now it's a circus of frustration |
| 01:05 | mdeboard | ARGH |
| 01:06 | mdeboard | The fundamental, underlying problem still exists. |
| 01:06 | mdeboard | https://gist.github.com/mattdeboard/d86b07a9b9a0cb663697 |
| 01:08 | technomancy | oh cool a hashbang *and* serving packages over http. |
| 01:08 | technomancy | =( |
| 01:08 | technomancy | on the bright side supposedly support for signed packages is landing in emacs trunk |
| 01:09 | technomancy | but I'm seriously considering switching to submodules until that lands in one of the friendlier archives |
| 01:09 | mdeboard | yeah i used to run submodules |
| 01:09 | mdeboard | but everyone told me what an idiot i was being because emacs has a package manager now |
| 01:09 | mdeboard | so here we are. |
| 01:09 | mdeboard | s/package manager/well-maintained package repository/ |
| 01:14 | mdeboard | turns out i was missing a configuration subtlety |
| 01:15 | mdeboard | well, subtlety to me, tl;dr pebcak https://github.com/clojure-emacs/cider/issues/722 |
| 01:16 | mdeboard | I can't even remember what iw as wanting to do |
| 01:21 | Jaood | mdeboard: really, read the READMEs |
| 01:24 | mordocai | Hey, quick question. Is https://github.com/clojure/tools.cli still the recommended command-line arguments parser? |
| 01:43 | mdeboard | Jaood: I DID read the readme. I mean, have you never had the experience where you read through something but don't pick up on everything? Especially late at night? |
| 01:47 | Jaood | mdeboard: and instead of rereading it instead of skimming it you open a github issue? no |
| 01:49 | mdeboard | :) |
| 01:49 | mdeboard | I'm sorry that this transgression has rustled your jimmies so |
| 01:49 | mdeboard | i think it's probably just late. |
| 01:55 | Jaood | mdeboard: nah its okay :) |
| 02:22 | athinggoingon | hi all, I'm trying to learn cider. I have nrepl server running (using lein) ina project. I'm trying to connect to the server but there's no cider-connect. |
| 02:23 | bozhidar | athinggoingon: what cider version are you using? |
| 02:23 | athinggoingon | CIDER 0.5.0 (Clojure 1.5.1, nREPL 0.2.3) |
| 02:23 | bozhidar | way to old |
| 02:24 | bozhidar | cider-connect was known as simply cider back then |
| 02:24 | Jaood | athinggoingon: try M-x cider return |
| 02:24 | bozhidar | you should be using the new cider 0.7 |
| 02:24 | bozhidar | (btw, there a separate channel #clojure-emacs, that mostly dedicated to cider) |
| 02:25 | athinggoingon | I used the built-in package manager in emacs. |
| 02:25 | bozhidar | guess you're using Marmalade, right? |
| 02:26 | bozhidar | I think I uploaded cider 0.6 there, but I couldn't upload 0.7 |
| 02:26 | bozhidar | as noted in cider's documentation - you're advised to use melpa-stable to get the stable releases |
| 02:26 | bozhidar | nikolayb: fancy seeing you here :-) |
| 02:37 | piranha | (Could not find artifact org.clojure:clojurescript:jar:0.0-2307 in central (https://repo1.maven.org/maven2/)) |
| 02:37 | piranha | how do I fix this? |
| 02:37 | piranha | this is with new leiningen (2.4.3) |
| 02:37 | piranha | it seems to be in place: http://search.maven.org/#artifactdetails%7Corg.clojure%7Cclojurescript%7C0.0-2307%7Cjar |
| 02:42 | TEttinger | piranha, odd. maybe the new maven https thing, I dunno |
| 02:43 | piranha | TEttinger: I thought so as well, especially with lein 2.4.2, it tried to download from http |
| 02:43 | piranha | but then after update to 2.4.3 it tries to download from https |
| 02:46 | TEttinger | piranha, yeah this shouldn't be needed with 2.4.3 http://central.sonatype.org/pages/consumers.html#leiningen |
| 02:46 | piranha | TEttinger: yeah, error reports https://repo1... :) |
| 02:47 | TEttinger | is this cljs version brand new? |
| 02:56 | piranha | TEttinger: yep, released yesterday |
| 06:22 | knobo | Is there any swank backend for cljs? |
| 07:14 | hellsom | I'm toying around with Clojure and gvim + plugins, everything is working fine. I've created a infinitive loop. After evaluating, gvim freezes and interaction is not possible . Is there an other way of breaking out of that loop without killing the whole repl process? |
| 08:01 | sm0ke | C-c? |
| 09:21 | meingbg | I need help with a failed cider install. I have no clue why this isn't working. |
| 09:21 | meingbg | I need help with a failed install. I have no clue why this isn't working. |
| 09:22 | meingbg | (package-install 'cider) => Package `emacs-24' is unavailable |
| 09:28 | Frozenlock | meingbg: Does it work by 'M-x package-list-packages'? |
| 09:30 | meingbg | Frozenlock: package-list-packages show cider available in version 0.6.0 |
| 09:30 | meingbg | Frozenlock: I assume I'd want 0.7 |
| 09:31 | Frozenlock | Does the installation work? |
| 09:31 | Frozenlock | But yeah, you probably want a recent version. |
| 09:32 | Frozenlock | Or a very old one... nrepl.el forevaaaaar! |
| 09:32 | meingbg | Frozenlock: No, the installation fails with the error message "Package `emacs-24' is unavailable" |
| 09:33 | Frozenlock | Are you not on 24? |
| 09:33 | Frozenlock | Emacs 24 |
| 09:38 | meingbg | Frozenlock: I am on emacs 24. That's the weird part. |
| 09:38 | Frozenlock | :-/ |
| 09:38 | Frozenlock | Maybe open an issue on github? I can't really help with that; I'm still rocking nrepl.el |
| 09:55 | meingbg | Frozenlock: Alright, issue opened. |
| 09:55 | meingbg | Frozenlock: Thanks for trying |
| 10:06 | TEttinger | meingbg, someone else had a recent cider install error |
| 10:07 | TEttinger | but theirs was an issue with the snapshot not being up to date on melpa or something? |
| 10:07 | jkj | still haven't gotten it to work - ever. |
| 10:07 | jkj | have to try again |
| 10:07 | jkj | nrepl works though |
| 10:34 | meingbg | jkj: What happens when you evaluate this over nrepl?: (print-str '(a b c)) |
| 10:34 | jkj | "(a b c)" |
| 10:35 | jkj | meingbg: in the minibuffer |
| 10:36 | jkj | ...when evaluating in buffer |
| 10:38 | meingbg | jkj: Then maybe nrepl works. It didn't in cider 0.6, getting me to upgrade to cider 0.7, which required but didn't support emacs 24... sometimes I hate what we deal with in the emacs community |
| 10:39 | Frozenlock | Emacs is the best thing since sliced bread :-D |
| 10:40 | Frozenlock | Look 'ma, my text editor is also a webserver! |
| 10:42 | sh10151 | s/webserver/symbolic algebra system/ |
| 10:42 | sh10151 | irc client? :-D |
| 10:42 | Frozenlock | Of course |
| 10:45 | SagiCZ11 | Frozenlock: emacs is too hard |
| 10:47 | Frozenlock | SagiCZ11: Which part? the keybindings? |
| 10:49 | SagiCZ11 | Frozenlock: yes, and how the buffers work.. i had to give up.. also the implementations for windows are lacking in stability |
| 10:55 | inchfwd | There's no clojure.* javadoc is there? |
| 10:55 | TEttinger | inchfwd, for using clojure data structures from java? |
| 10:56 | inchfwd | TEttinger: The actual clojure source. I was trying to figure out what all classes implemented an interface. |
| 10:56 | TEttinger | right, that seems handy |
| 10:57 | TEttinger | tbh I would just do a github search, or download the source and find in files |
| 10:57 | TEttinger | which interface? |
| 10:57 | inchfwd | TEttinger: Sequential |
| 10:58 | inchfwd | TEttinger: I'm writing a game that tests clojure form evaluation ability, and I realized I was using improper terminology for sequences/collections/seqs, etc. |
| 10:59 | TEttinger | oh yeah, and map/map is a mess |
| 11:02 | TimMc | ~seqs and colls |
| 11:02 | clojurebot | seqs and colls is seqs |
| 11:03 | TimMc | ~botsmack |
| 11:03 | clojurebot | clojurebot evades successfully! |
| 11:03 | justin_smith | ~seqs |
| 11:03 | clojurebot | seqs is http://www.brainonfire.net/files/seqs-and-colls/main.html |
| 11:03 | TimMc | inchfwd: ^ |
| 11:03 | TimMc | It's not authoritative, but it might help. |
| 11:04 | inchfwd | TimMc: Yeah, I saw that page. A github search on "Sequential" looks pretty good, too. |
| 11:12 | arrdem | oh gods... there's a symbolic algebra system in here too? I'm already using the IRC/DB/email clients.. |
| 11:12 | Frozenlock | Emacs Calc IIRC |
| 11:13 | Bronsa | arrdem: are you using mu4e or gnus? |
| 11:13 | SagiCZ11 | is there anyone not using *unix* in this channel? |
| 11:13 | arrdem | if so, the door's over there |
| 11:13 | arrdem | Bronsa: I gnus but I'm still like 50% on thunderbird |
| 11:13 | SagiCZ11 | except me i wanted to add |
| 11:13 | sh10151 | arrdem: M-x calc but you'll probably want to review the info pages too |
| 11:14 | Bronsa | arrdem: give mu4e a try then, it's really good |
| 11:14 | arrdem | Bronsa: I'll check it out |
| 11:14 | TEttinger | SagiCZ1, I'm on windows |
| 11:14 | Bronsa | arrdem: http://www.djcbsoftware.nl/code/mu/mu4e.html |
| 11:15 | arrdem | Bronsa: cheers |
| 11:15 | SagiCZ11 | TEttinger: great :) |
| 11:15 | Frozenlock | SagiCZ11: I was on windows before. Win7 was great. |
| 11:16 | TEttinger | I downgraded intentionally from 8.1 to 7 |
| 11:16 | Frozenlock | Incidentally, Ubuntu looks more like Win7 than 8 does. |
| 11:16 | Frozenlock | Yeah 8 is terribad |
| 11:16 | arrdem | shrug... 8 isn't designed for hardcore desktop like 7 was |
| 11:17 | arrdem | part of this whole microsoft trying to be mobile thing |
| 11:17 | arrdem | taken in that context it could be a lot worse |
| 11:17 | arrdem | also some good internal cleanups... |
| 11:17 | arrdem | but yeah shit UI for desktop. my win8 install lasted 72hrs |
| 11:17 | Frozenlock | hardcore desktop? Is that how normal use is called now? |
| 11:41 | gfredericks | on top of a hardcore desk |
| 11:48 | justin_smith | Frozenlock: a hardcore desktop is designed to survive binge drinking, mosh pits, and high decibel levels |
| 11:48 | arrdem | lol |
| 11:51 | csd_ | What's the easiest way to reduce a vector in the form [[:a 1] [:a 2] ... [:b 10] [:b 20]] to {:a [1 2] :b [10 20]}? |
| 11:51 | justin_smith | csd_: reduce it to what? |
| 11:51 | justin_smith | oh, sorry, my bad |
| 11:53 | justin_smith | ,(reduce (fn [m [k v]] (update-in m [k] (fnil conj []) v)) {} [[:a 1] [:a 2] [:b 10] [:b 20]]) |
| 11:53 | clojurebot | {:b [10 20], :a [1 2]} |
| 11:56 | csd_ | thank you |
| 11:57 | technomancy | (inc mu4e) |
| 11:57 | lazybot | ⇒ 1 |
| 11:58 | arrdem | (inc justin_smith) ;; nice fnil |
| 11:58 | lazybot | ⇒ 58 |
| 13:00 | nkozo | core.async question: is safe to put using >! inside a go block called from one thread and take using <! using another go block called from another thread? |
| 13:02 | justin_smith | nkozo: go blocks use a thread pool, the thread they are created in doesn't affect them running (it only affects where they return their output channel to) |
| 13:04 | nkozo | justin_smith: ok, thanks |
| 13:16 | elsen | Hey clojurers! Quick question, I'm experimenting with clojure & uberjar and deployement using docker |
| 13:17 | elsen | How hard would it be to run my webapp uberjar from a docker container, and open a remote repl for debugging? |
| 13:18 | justin_smith | elsen: it's easy to open an nrepl server inside your app at runtime, but you should use ssh to connect. The nrepl defaults only allow connections from localhost and that is a good thing. |
| 13:19 | justin_smith | regarding running it from a docker container, it shouldn't be any easier or harder than using an uberjar in any other scenario |
| 13:20 | elsen | so for example, right before starting my jetty app in main, I boot an nrepl server? |
| 13:20 | justin_smith | no, you boot an nrepl server from inside -main |
| 13:20 | justin_smith | that way you can actually access your running process |
| 13:21 | elsen | Nice, I'll give it a shot, thanks! |
| 13:21 | justin_smith | https://github.com/clojure/tools.nrepl you want clojure.tools.nrepl.server/start-server |
| 13:21 | Frozenlock | justin_smith: I often connect to another machine's repl directly... are you sure the default allows only localhost? |
| 13:21 | justin_smith | but instead of their defonce (which breaks with aot), start the server inside -main |
| 13:21 | Frozenlock | (or maybe I changed that config and don't remember...) |
| 13:22 | justin_smith | Frozenlock: I have in the past failed to connect to an nrepl on another machine on my lan |
| 13:23 | justin_smith | Frozenlock: it could be this changed, but I would consider that a security issue |
| 13:23 | Frozenlock | If someone's on my LAN, I'm in deep trouble :-p |
| 13:23 | justin_smith | I mean, it means that anyone using the same LAN (ie. connected to the same wifi access point) could trivially root your machine |
| 13:24 | justin_smith | don't forget that someone using the same wifi you are is also on your lan - you don't run clojure from a laptop while at a café or anything? |
| 13:24 | Frozenlock | Nope |
| 13:25 | Frozenlock | I'm a man, I use real computers. The huge heavy stuff. |
| 13:25 | Frozenlock | :-p |
| 13:25 | Frozenlock | (Private LAN in my house) |
| 13:25 | arrdem | pls open nrepl port on public wifi |
| 13:25 | arrdem | pls |
| 13:25 | arrdem | i will have good tome |
| 13:25 | arrdem | *time |
| 13:25 | jeremyheiler | Frozenlock: you'll have to bind the repl to 0.0.0.0 in order to access it externally |
| 13:26 | xeqi | Frozenlock: did peridot do what you needed earlier? |
| 13:26 | Frozenlock | xeqi: Yup! |
| 13:26 | justin_smith | Frozenlock: regardless of your macho practices, nrepl should bind localhost as a default, anythng else would be insanei |
| 13:26 | Frozenlock | Looking my project config now... |
| 13:27 | jeremyheiler | Frozenlock: at least that's how our vagrant dev machines are set up |
| 13:29 | Frozenlock | Hmmm I don't see anything other than a given port in my config |
| 13:30 | Frozenlock | Again, rabbit hole... |
| 13:43 | Frozenlock | Doesn't this mean that it's public by default? https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/server.clj#L125 |
| 13:45 | justin_smith | Frozenlock: ugh - I could have sworn I had tried to use it from another machine and failed in the past. I wonder why they would use a permissive default mask for such an insecure service. |
| 13:45 | Frozenlock | This. is. clojuuuuure |
| 13:46 | Frozenlock | IIRC, this issue was fixed for slime. |
| 13:46 | gfredericks | ~clojure |
| 13:46 | clojurebot | clojure is the best |
| 13:48 | elsen | justin_smith: the repl works like a charm from docker, thanks again! |
| 13:51 | justin_smith | np |
| 13:53 | pandeiro | anyone played with devcards? |
| 13:55 | donkey_boy | burn all jews in oven |
| 13:55 | donkey_boy | allahu akhbar |
| 13:55 | donkey_boy | i throw stones to jews |
| 13:55 | donkey_boy | death to infidels |
| 13:57 | michaelr | donkey_boy: so.. you fuck donkeys right? |
| 13:57 | donkey_boy | CLOJURE IS INFIDEL PROGRAMMING LANGUAGE |
| 13:57 | donkey_boy | CLOJURE IS INFIDEL PROGRAMMING LANGUAGE |
| 13:58 | donkey_boy | CLOJURE IS INFIDEL PROGRAMMING LANGUAGE |
| 13:58 | donkey_boy | DEATH TO INFIDELS |
| 13:59 | donkey_boy | FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES |
| 13:59 | donkey_boy | FECES |
| 13:59 | donkey_boy | FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES |
| 13:59 | rpaulo | kick? |
| 13:59 | Bronsa | technomancy: your services are required |
| 13:59 | Frozenlock | technomancy: dad, we need a kick |
| 13:59 | donkey_boy | FECES FECES FECES FECES FECES FECES FECES FECES FECES |
| 13:59 | donkey_boy | FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES FECES |
| 14:00 | donkey_boy | burn all jews in oven! |
| 14:00 | donkey_boy | burn all jews in oven! |
| 14:00 | donkey_boy | burn all jews in oven! |
| 14:10 | slpsys | hey, that's great |
| 14:32 | andyf | Bronsa: Was trying out t.a(.j) 0.5.0 in Eastwood last night, and came across an exception thrown near here: https://github.com/clojure/tools.analyzer.jvm/blob/master/src/main/clojure/clojure/tools/analyzer/passes/jvm/emit_form.clj#L79 |
| 14:32 | andyf | I tried replacing class with (:val class) and it seemed better, but I'm just hacking right now and not sure if that is correct. |
| 14:33 | Bronsa | ah yeah |
| 14:33 | Bronsa | andyf: I'll fix emit-form, thanks |
| 14:43 | Bronsa | andyf: fixed emit-form in t.a 0.5.1-SNAPSHOT and t.a.j 0.5.2-SNAPSHOT |
| 14:44 | andyf | thanks, I'll try it out. Might have an exception or three that I found while running the crucible that I'll let you know about. |
| 14:52 | Bronsa | andyf: bah, t.a was actually fine, just try t.a.j 0.5.2-SNAPSHOT |
| 14:53 | andyf | Bronsa: I'll just try latest master of both unless you think that is a bad idea. |
| 14:54 | Bronsa | andyf: won't hurt but t.a master is identical to 0.5.0 |
| 14:54 | Bronsa | I just pushed a commit and reverted it immediately because it was useless |
| 15:16 | michaelr | is there an example out there somewhere of using secretary with om? |
| 15:41 | pandeiro | michaelr: https://github.com/sgrove/omchaya |
| 15:42 | konr | what do you guys use with clojurescript for design? Plain css? |
| 15:43 | pandeiro | hey konr: there's garden https://github.com/noprompt/garden ; i still use less |
| 15:43 | konr | hi, pandeiro! happy to see you! |
| 15:44 | pandeiro | for me the advantage of less is that you have the option of offloading compilation to the browser if you want |
| 15:44 | konr | thanks for the suggestions |
| 15:44 | pandeiro | not sure if garden can do that |
| 15:44 | pandeiro | if it works with edn i guess it can, too, not sure if you would have to write the poller though |
| 15:44 | pandeiro | konr: np :) |
| 15:50 | michaelr | pandeiro: thanks |
| 15:52 | michaelr | pandeiro: I also found this: http://squirrel.pl/blog/tag/clojurescript/ |
| 15:53 | pandeiro | michaelr: you may want to also check out https://github.com/DomKM/silk |
| 15:53 | pavan | hi all |
| 15:54 | gfredericks | hello |
| 15:54 | pavan | trying to run a clojure project with core.async |
| 15:54 | pavan | ran into |
| 15:54 | pavan | 'clojure.core.async' containing period with prefix 'quote'. lib names inside prefix lists must not contain periods |
| 15:54 | pavan | any ideas or fixes |
| 15:55 | gfredericks | sounds like you quoted something inside your ns form |
| 15:56 | gfredericks | e.g., I get the same message for (ns foo.bar (:require 'clojure.string)) |
| 15:56 | gfredericks | removing the ' should fix it |
| 15:56 | gfredericks | ~ns |
| 15:56 | clojurebot | ns is unfortunately more complicated than it needs to be, but http://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns may be helpful. |
| 15:58 | pavan | thanks gfredricks that fixed it |
| 15:58 | gfredericks | thanks clojurebot for having that link handy |
| 16:05 | wagjo | ~fn |
| 16:05 | clojurebot | excusez-moi |
| 16:05 | SagiCZ11 | ~help |
| 16:05 | clojurebot | Nobody can help with "X doesn't work". Please provide context: what you did, what you hoped would happen, and what happened instead. A stack trace is especially helpful, if applicable. |
| 16:06 | SagiCZ11 | in cases where apply and reduce return the exact same results, what is preffered? for example summing a collection (apply + coll) or (reduce + coll) ? |
| 16:07 | rhg135 | apply i'd think, since it involves less fn calls |
| 16:08 | SagiCZ11 | rhg135: makes sense |
| 16:08 | H4ns | SagiCZ11: apply probably has a limit on the number of elements that it can process. |
| 16:08 | H4ns | SagiCZ11: reduce works with any number of elements in the argument sequence. |
| 16:08 | rhg135 | ofc the jvm is great so either'd be ok |
| 16:10 | H4ns | SagiCZ11: it may be that i'm wrong - apparently, apply can take very large numbers of arguments. sorry for misleading. |
| 16:11 | SagiCZ11 | H4ns: alright no problem |
| 16:11 | SagiCZ11 | reduce can take any number of elements right? |
| 16:12 | michaelr | pandeiro: nice.. |
| 16:12 | H4ns | SagiCZ11: for sure, it definitely has no limit, but it needs to invoke the function for each argument. |
| 16:12 | SagiCZ11 | H4ns: yeah |
| 16:17 | SagiCZ11 | is there a function that divides collection into n pieces? |
| 16:17 | SagiCZ11 | (foo 2 [1 2 3 4]) => [1 2] [3 4] |
| 16:18 | gfredericks | partition-all is related |
| 16:18 | gfredericks | you give it the piece-size though, not the piece count |
| 16:19 | Bronsa | ((juxt take drop) 2 [1 2 3 4]) |
| 16:19 | Bronsa | ,((juxt take drop) 2 [1 2 3 4]) |
| 16:19 | clojurebot | [(1 2) (3 4)] |
| 16:19 | SagiCZ11 | nice |
| 16:19 | SagiCZ11 | thank you |
| 16:21 | SagiCZ11 | no that does not divide it into n pieces of equal size |
| 16:21 | hyPiRion | split-at does the same trick |
| 16:21 | SagiCZ11 | ,((juxt take drop) 2 [1 2 4 5 6 7]) |
| 16:21 | clojurebot | [(1 2) (4 5 6 7)] |
| 16:21 | hyPiRion | ,(partition 2 (range 10)) |
| 16:21 | clojurebot | ((0 1) (2 3) (4 5) (6 7) (8 9)) |
| 16:21 | SagiCZ11 | nope |
| 16:21 | SagiCZ11 | i want to specify the number of pieces.. not the size of pieces |
| 16:22 | Bronsa | ah, sorry I misread you SagiCZ1 |
| 16:22 | hyPiRion | SagiCZ11: oh -- there are many edge cases here though. Must n always divide the size of a collection? |
| 16:23 | hyPiRion | if not, how do you split the collection up in n equal pieces? Let the last one contain less elements than the others? |
| 16:24 | SagiCZ11 | split the element |
| 16:24 | SagiCZ11 | for example from "8" u could make "E" and "3" right? |
| 16:25 | Bronsa | hyPiRion: (f 2 [4 4 4]) ;=> ([4 2] [4 2]) obv |
| 16:25 | wagjo | SagiCZ1: H4ns: both reduce and apply can have any number of elements in the collection which is passed as a last argument |
| 16:25 | hyPiRion | Bronsa: ([4 2] [2 4]) I presume? |
| 16:25 | SagiCZ11 | wagjo: thanks |
| 16:26 | SagiCZ11 | hyPiRion: yeah it just gets trickier with non-number elements :] |
| 16:26 | hyPiRion | alright |
| 16:27 | wagjo | SagiCZ1: H4ns: apply converts coll to the seq, which reduce does not, so the reduce should be faster. |
| 16:29 | SagiCZ11 | what colls are not seqs? |
| 16:29 | wagjo | not necessarily |
| 16:29 | Bronsa | ,(seq? []) |
| 16:30 | clojurebot | false |
| 16:30 | wagjo | BUT sometimes apply is faster, as it may use call more optimized fn than reduce :) so it depends. |
| 16:30 | SagiCZ11 | ,(seq? (seq [])) |
| 16:30 | clojurebot | false |
| 16:31 | SagiCZ11 | O.o |
| 16:31 | wagjo | hehe |
| 16:31 | wagjo | ,(seq []) |
| 16:31 | clojurebot | nil |
| 16:31 | wagjo | thats why |
| 16:31 | Bronsa | ,(time (do (apply str (repeat 1e4 "foo")) nil)) |
| 16:31 | clojurebot | "Elapsed time: 16.178562 msecs"\n |
| 16:31 | hyPiRion | Only one I know which runs append faster is `str`. So unless you do (reduce str my-coll), then reduce is good. |
| 16:31 | Bronsa | ,(time (do (reduce str (repeat 1e4 "foo")) nil)) |
| 16:31 | clojurebot | "Elapsed time: 285.509604 msecs"\n |
| 16:31 | gfredericks | ,(list? (list* 3 ())) |
| 16:31 | clojurebot | false |
| 16:31 | SagiCZ11 | ,(seq? (seq [1 2 3])) |
| 16:31 | clojurebot | true |
| 16:31 | gfredericks | ,(list? (cons 42 [42])) |
| 16:31 | clojurebot | false |
| 16:31 | hyPiRion | ,(boolean? (Boolean. false)) |
| 16:31 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: boolean? in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 16:32 | gfredericks | ,(string? string?) |
| 16:32 | clojurebot | false |
| 16:32 | SagiCZ11 | ,(type (cons 42 [42])) |
| 16:32 | clojurebot | clojure.lang.Cons |
| 16:32 | gfredericks | ,(integer? 42.0) |
| 16:32 | hyPiRion | ,(false? (Boolean. false)) ;; that was it. |
| 16:32 | clojurebot | false |
| 16:32 | clojurebot | false |
| 16:32 | SagiCZ11 | there is type "cons" ? |
| 16:32 | wagjo | SagiCZ1: Seq is a particular type of a persistent collection |
| 16:32 | gfredericks | ,(-> false Boolean. false?) |
| 16:32 | clojurebot | false |
| 16:32 | gfredericks | ,(-> false Boolean. false? Boolean. false?) |
| 16:32 | clojurebot | false |
| 16:32 | gfredericks | ,(-> false Boolean. false? Boolean. false? Boolean. false?) |
| 16:32 | clojurebot | false |
| 16:32 | SagiCZ11 | (echo false) |
| 16:33 | hyPiRion | echo false |
| 16:33 | lazybot | false |
| 16:33 | wagjo | Cons, PersistentList, LazySeq - these are all Seqs |
| 16:33 | SagiCZ11 | gosh |
| 16:33 | gfredericks | echo ,'foo |
| 16:33 | lazybot | ,'foo |
| 16:33 | clojurebot | foo |
| 16:33 | SagiCZ11 | what is cons for? |
| 16:33 | SagiCZ11 | gfredericks: neat! |
| 16:33 | wagjo | SagiCZ1: for creating Seqs :) |
| 16:33 | gfredericks | echo ,(println "echo twice") |
| 16:33 | lazybot | ,(println "echo twice") |
| 16:33 | clojurebot | echo twice\n |
| 16:34 | gfredericks | carp |
| 16:34 | hyPiRion | SagiCZ11: gosh, that function you'd like does actually require some thought |
| 16:36 | wagjo | hyPiRion: how about partition using count/n as a chunk size? |
| 16:36 | SagiCZ11 | hyPiRion: in my case i really wanted just to split lists in half.. so that wasnt so hard.. only one edge case |
| 16:36 | SagiCZ11 | wagjo: thats kinda what i did |
| 16:37 | hyPiRion | wagjo: doesn't work if you want all sizes to be exactly equal. You'll have to "split" the elements somehow |
| 16:37 | wagjo | ,(#(partition (/ (count %2) %) %2) 5 [1 2 3 4 5]) |
| 16:37 | clojurebot | ((1) (2) (3) (4) (5)) |
| 16:38 | wagjo | ,(#(partition (/ (count %2) %) %2) 2 [1 2 3 4 5]) |
| 16:38 | clojurebot | () |
| 16:38 | SagiCZ11 | ,(def "racecar") |
| 16:38 | SagiCZ11 | ,((juxt take drop) (/ (count x) 2) x) |
| 16:38 | clojurebot | #<CompilerException java.lang.RuntimeException: First argument to def must be a Symbol, compiling:(NO_SOURCE_PATH:0:0)> |
| 16:38 | clojurebot | #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)> |
| 16:38 | SagiCZ11 | ,(def x "racecar") |
| 16:38 | SagiCZ11 | ,((juxt take drop) (/ (count x) 2) x) |
| 16:38 | clojurebot | #'sandbox/x |
| 16:38 | clojurebot | [(\r \a \c \e) (\c \a \r)] |
| 16:38 | SagiCZ11 | this is enough |
| 16:39 | wagjo | ,(#(partition (int (/ (count %2) %) %2)) 2 [1 2 3 4 5]) |
| 16:39 | clojurebot | #<CompilerException clojure.lang.ArityException: Wrong number of args (2) passed to: core/int--inliner, compiling:(NO_SOURCE_PATH:0:0)> |
| 16:39 | wagjo | ,(#(partition (int (/ (count %2) %)) %2) 2 [1 2 3 4 5]) |
| 16:39 | clojurebot | ((1 2) (3 4)) |
| 16:39 | hyPiRion | ,(split-at (/ (count x) 2) x) |
| 16:39 | clojurebot | [(\r \a \c \e) (\c \a \r)] |
| 16:39 | wagjo | ,(#(partition-all (int (/ (count %2) %)) %2) 2 [1 2 3 4 5]) |
| 16:39 | clojurebot | ((1 2) (3 4) (5)) |
| 16:41 | wagjo | ,(#(partition-all (int (/ (+ (count %2) (dec %)) %)) %2) 2 [1 2 3 4 5]) |
| 16:41 | clojurebot | ((1 2 3) (4 5)) |
| 16:41 | wagjo | ,(#(partition-all (int (/ (+ (count %2) (dec %)) %)) %2) 1 [1 2 3 4 5]) |
| 16:41 | clojurebot | ((1 2 3 4 5)) |
| 16:41 | wagjo | ,(#(partition-all (int (/ (+ (count %2) (dec %)) %)) %2) 3 [1 2 3 4 5]) |
| 16:41 | clojurebot | ((1 2) (3 4) (5)) |
| 16:41 | wagjo | ^there |
| 17:05 | SagiCZ11 | is there something that acts like "when" but doesnt return anything when the test is false? |
| 17:06 | kristof | In an expression based language, "doesn't return anything" makes no sense |
| 17:07 | SagiCZ11 | i have an expression (conj [] (when test x)) and if test is false it shouldnt conj anything... but it adds nil |
| 17:08 | gfredericks | (cond-> [] test (conj x)) |
| 17:08 | kristof | ^. Your conj was in the wrong place, then |
| 17:09 | justin_smith | SagiCZ11: why should conj ever not conj something? |
| 17:11 | SagiCZ11 | this clears duplicates from a collection, only those that are next to each other |
| 17:11 | SagiCZ11 | ,(filter (complement nil?) (reduce #(conj %1 (when (not= (last %1) %2) %2)) [] [1 1 2 3 3 2 2 3])) |
| 17:11 | clojurebot | (1 2 3 2 3) |
| 17:11 | SagiCZ11 | i just have to filter out nils, because "when" returns them there |
| 17:14 | gws | ,(map first (partition-by identity [1 1 2 3 3 2 2 3])) |
| 17:14 | clojurebot | (1 2 3 2 3) |
| 17:14 | gfredericks | SagiCZ11: you want to just not call conj in the first place |
| 17:14 | justin_smith | ,(reduce #(if (= (last %1) %2) %1 (conj %1 %2)) [] [1 1 2 3 3 2 2 3]) |
| 17:14 | clojurebot | [1 2 3 2 3] |
| 17:15 | gfredericks | ,(reduce #(if (not= (pop %1) %2) (conj %1 %2) %1) [1 1 2 3 3 2 2 3]) |
| 17:15 | clojurebot | #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IPersistentStack> |
| 17:15 | gfredericks | ,(reduce #(if (not= (pop %1) %2) (conj %1 %2) %1) [] [1 1 2 3 3 2 2 3]) |
| 17:15 | clojurebot | #<IllegalStateException java.lang.IllegalStateException: Can't pop empty vector> |
| 17:15 | gfredericks | ,(reduce #(if (not= (last %1) %2) (conj %1 %2) %1) [] [1 1 2 3 3 2 2 3]) |
| 17:15 | clojurebot | [1 2 3 2 3] |
| 17:15 | justin_smith | that empty pop error thing is annoying |
| 17:16 | SagiCZ11 | oh ok.. so the first hint you gave me still applies.. i thought i couldnt move it in my case.. now i see i could.. thanks |
| 17:17 | SagiCZ11 | ,(reduce #(if (= (last %1) %2) %1 (conj %1 %2)) [] [1 1 2 3 3 3 3 3 3 3 3 3 2 2 3]) |
| 17:17 | clojurebot | [1 2 3 2 3] |
| 17:18 | SagiCZ11 | ,(reduce #(if (= (last %1) %2) %1 (conj %1 %2)) [] "Heeeeeeeeeeeeeeeeeeeello") |
| 17:18 | clojurebot | [\H \e \l \o] |
| 17:24 | hyPiRion | hm |
| 17:25 | hyPiRion | ,(map first (partition-by identity "Heeeeeeeeeeeeeeeeeeeello")) |
| 17:25 | clojurebot | (\H \e \l \o) |
| 17:29 | PigDude | ,(set "Heeeeeello") |
| 17:29 | clojurebot | #{\e \H \l \o} |
| 17:30 | PigDude | ,(apply sorted-set "Hello") |
| 17:30 | clojurebot | #{\H \e \l \o} |
| 17:31 | gfredericks | ha |
| 17:31 | gfredericks | ,(sort "Hello") |
| 17:31 | clojurebot | (\H \e \l \l \o) |
| 17:31 | gfredericks | ,(sort "hello") |
| 17:31 | clojurebot | (\e \h \l \l \o) |
| 17:32 | justin_smith | ,(sort "☃☕✈🐱") |
| 17:32 | clojurebot | (\☃ \☕ \✈ \? \?) |
| 17:33 | justin_smith | it did something weird with CAT FACE |
| 17:33 | justin_smith | http://shapecatcher.com/unicode/info/128049 (this one) |
| 17:35 | gfredericks | I got a pair of \? at the end |
| 17:35 | PigDude | hm i'm getting somewhere with this |
| 17:35 | PigDude | ,(clojure.string/split "Heeeeellllloooooo" #"(?<=(.))\1+") |
| 17:35 | clojurebot | ["He" "l" "o"] |
| 17:36 | justin_smith | gfredericks: even in the tryclj repl, where the cat face displays properly, clojure splits it into two unprintable characters |
| 17:45 | gfredericks | unicode; can anybody truly know how it works? |
| 17:52 | gws | well java chars can only represent code points inside the basic multilingual plane (up to 0xFFFF) and the cat face is outside that |
| 17:53 | gfredericks | in the "more complicated multilingual plane" |
| 17:53 | gws | yeah or "second circle of hell" however you want to pronounce that |
| 17:55 | gws | kinda curious what the "right" answer is for sorting strings by char but preserving those higher code points - wonder if it's "use ICU"? |
| 18:01 | justin_smith | http://icu-project.org/apiref/icu4j/ looks promising |
| 18:02 | justin_smith | next time I need to sort emoji (or support something outside the basic multilingual plane) I'll be sure to check it out |
| 18:11 | itruslove | Anyone know the status of ritz or swank? Do they with recent versions of clojure? |
| 18:22 | amalloy | itruslove: swank works fine on 1.6. most folks these days use cider, though |
| 18:24 | itruslove | amalloy: thanks, I do too, I'm just trying to scope out the landscape |
| 20:04 | fifosine | I have a list of elements that on each I need to perform a specific function upon. This problem seems to lend itself to using the higher-order function 'map', but for the fact that besides for the first element of the list, the rest of the computations depend on the computation before it—i.e., the function takes as input the result of the last function evaluation. Is there a way to use map in this instance? |
| 20:05 | fifosine | Or is there another high-order function that I'm looking for |
| 20:05 | fifosine | I kind of need a mix of reduce and map |
| 20:07 | JohnTalent | Is it possible to embed html from another server? |
| 20:09 | dbasch | fifosine: you can construct a function that you call with iterate |
| 20:10 | fifosine | dbasch: ok, imma read the docs, I've never used iterate |
| 20:10 | fifosine | can f have arity >1? |
| 20:12 | dbasch | fifosine: it can, but iterate will call you with one argument |
| 20:12 | dbasch | so it has to have 1 as possible arity |
| 20:13 | fifosine | how do I use iterate with a list already defined? |
| 20:13 | fifosine | I perform the function on each el of the list |
| 20:13 | fifosine | the examples of using iterate each take an initial constant |
| 20:14 | dbasch | now that I read your question again, it sounds more like you could use reductions |
| 20:15 | fifosine | why do I want the intermediate results? |
| 20:16 | dbasch | fifosine: you said you have a sequence, and each result depends on the previous one |
| 20:19 | fifosine | dbasch: I'm still not clear on how reductions helps |
| 20:20 | fifosine | the function mapped for each element in the list takes two parameters [element last-result] |
| 20:21 | dbasch | fifosine: just like this: |
| 20:21 | dbasch | ,(reductions + (range 10)) |
| 20:21 | clojurebot | (0 1 3 6 10 ...) |
| 20:21 | dbasch | &(reductions + (range 10)) |
| 20:21 | lazybot | ⇒ (0 1 3 6 10 15 21 28 36 45) |
| 20:22 | fifosine | I'm dumb |
| 20:22 | fifosine | thanks, dbasch |
| 20:29 | fifosine | dbasch: mmm, this makes it a little tougher: the function outputs *two* values, one that should be used in the subsequent calculation and the second is what should be returned in the sequence |
| 20:30 | dbasch | fifosine: why don’t you write it in an old fashioned loop? |
| 20:30 | dbasch | no need to overthink it |
| 20:31 | fifosine | dbasch: I prefer not to use for-loops |
| 20:31 | fifosine | is that silly? |
| 20:31 | dbasch | fifosine: what do you mean for loops? I mean loop/recur |
| 20:33 | fifosine | ok, and then just use an accumulator for the result? |
| 20:33 | dbasch | yes. You may not even need the loop, you can just have a tail-recursive function |
| 20:40 | fifosine | dbasch: What do you mean? What would be a tail-recursive function without the loop? |
| 20:41 | dbasch | fifosine: a simple tail-recursive function |
| 20:42 | fifosine | can the factorial function be defined tail-recursively? |
| 20:42 | fifosine | how would it be? |
| 20:45 | fifosine | dbasch: Is there an advantage to defining the function as tail-recursive versus using loop/recur? |
| 20:48 | dbasch | fifosine: if your function is nothing but a loop, you don’t need the loop construct |
| 20:52 | dbasch | fifosine: here’s a tail-recursive factorial |
| 20:52 | dbasch | ,(defn fact [n & r] (if (= 1 n) r (recur (dec n) (* n (or r 1))))) |
| 20:52 | clojurebot | #'sandbox/fact |
| 20:52 | dbasch | ,(fact 10) |
| 20:52 | clojurebot | 3628800 |
| 20:53 | fifosine | oh just use recur |
| 20:53 | fifosine | ok |
| 20:54 | fifosine | is there a clojuric way to format output if a function outputs two distinct values that each mean something different? |
| 20:54 | fifosine | just putting them in a list seems silly since they're not the same "type" |
| 20:57 | fifosine | with a map I guess? |
| 20:58 | justin_smith | dbasch's fact function above fails on (fact 1) (returns nil) |
| 21:01 | justin_smith | also, is recur doing something weird there? because usually [n & r] would mean r is always a sequence, but it is successfully used as a number |
| 21:01 | justin_smith | what am I missing? |
| 21:02 | justin_smith | does recur not use the same destructuring rules that regular function calls do? |
| 21:05 | amalloy | justin_smith: it doesn't. it turns out it would be pretty useless if it did; let me see if i can find the log of the last discussion on that topic |
| 21:08 | justin_smith | yeah, I get the exception I would expect if I call (fact 2 3), but (fact 3) works, despite the fact that it invokes (recur 2 3) |
| 21:09 | amalloy | oh, i see. i hadn't quite noticed the issue you were asking about |
| 21:09 | amalloy | justin_smith: http://logs.lazybot.org/irc.freenode.net/%23clojure/2014-07-10.txt, starting at around [16:51:53] is the discussion i meant, although i'm not sure it's relevant anymore |
| 21:11 | amalloy | basically (fn [x & y] (recur a b)) sets y equal to b, not to [b] (for reasons discussed in that log). since this happens with a goto rather than a method call, this has the surprising effect in your example function that b is successfully set to a non-list |
| 21:12 | justin_smith | my takeaway from this is to prefer an explicit loop statement if my function uses & for varargs - seems much easier to reason about |
| 21:13 | amalloy | mmmmm, or you could just pretend that your function's arglist is the list of bindings for an explicit loop, since in fact it is |
| 21:14 | justin_smith | right, but overlaying destructuring on top of that feels weird |
| 21:17 | dbasch | justin_smith: pretend (or r 1) was my return value, I’m dumber since I started using ruby for my regular job :P |
| 21:19 | justin_smith | dbasch: I know it was just a quick example anyway, my own confusion with how the recur and parameter declaration interact hurt my head though |
| 21:19 | dbasch | justin_smith: ruby hurts my head but more like a hammer would |
| 21:20 | justin_smith | heh |
| 21:20 | justin_smith | were you the one who mentioned the term "duck punching" recently? |
| 21:20 | dbasch | justin_smith: no, but I do have a rubber duck for debugging |
| 21:20 | justin_smith | not quite the same, but I find it very amusing http://www.paulirish.com/2010/duck-punching-with-jquery/ |
| 21:21 | justin_smith | "… if it walks like a duck and talks like a duck, it’s a duck, right? So if this duck is not giving you the noise that you want, you’ve got to just punch that duck until it returns what you expect. |
| 21:21 | justin_smith | " |
| 21:21 | dbasch | justin_smith: https://twitter.com/HackerNewsOnion/status/476835980863733761 |
| 21:22 | justin_smith | heh |
| 21:23 | dbasch | that’s the problem with a language that has no entry barrier |
| 21:24 | justin_smith | that's why all the extra ((())((()))) help keep clojure on a higher standard - it weeds out some of the more mentally challenged (though it picks up some of the perversely obfuscatory in the process) |
| 21:24 | dbasch | I found code that was doing different things depending on the values of two booleans. It had an if with FOUR elses |
| 21:25 | kristof | justin_smith: I think there's actually an equivalent amount of delimiters in clojure and in Java. |
| 21:25 | dbasch | in case they encountered a case in which one of the variables was neither true nor false I suppose |
| 21:25 | justin_smith | kristof: it's not the bracket count - it's the |
| 21:25 | justin_smith | "weirdness |
| 21:25 | justin_smith | " of placement (sorry my ring finger is sloppy right now for some reason) |
| 21:26 | kristof | I don't think it's so weird. I think Rust is weird. |
| 21:26 | gfredericks | foo.bar(baz,bang) ==> (bar foo baz bang) |
| 21:26 | gfredericks | something got swapped |
| 21:27 | kristof | I have a friend who never understands what I mean when I say that a method is just a function that parameterizes on its first argument. |
| 21:27 | kristof | Not even when I explain where the obj.method() syntax comes from. |
| 21:29 | gfredericks | where does it come from? |
| 21:32 | kristof | gfredericks: An object can literally be thought of as a struct with a field called "method" that is a function pointer to the ad-hoc implementation of that method. |
| 21:33 | kristof | gfredericks: When you say obj.method(arg), you are instructing the computer to place arg on the stack, and call the function located by dereferencing obj's method |
| 21:33 | justin_smith | kristof: well, in most cases you would be puttin obj on the stack too, it's an invisible argument |
| 21:34 | JohnTalent | do you people know what cheap hostings of clojure are? |
| 21:34 | kristof | justin_smith: Right, that too. But the point remains :) |
| 21:36 | justin_smith | JohnTalent: anything with a jvm, just make an uberjar and run java -jar |
| 21:36 | justin_smith | JohnTalent: for extra credit wrap it up in the os specific server process wrapper appropriate for that server |
| 21:37 | dbasch | JohnTalent: you can deploy an app to heroku for free if it’s a toy app |
| 21:37 | kristof | Does anyone know of any software that is actually meant to be operating system agnostic? |
| 21:37 | justin_smith | kristof: all of my clojure deploys are (backends to serve database driven web sites) |
| 21:38 | dbasch | kristof: all software that directly uses hardware is operating system atheistic |
| 21:39 | dbasch | I should say that only interacts with hardware without an OS layer in between |
| 21:39 | amalloy | kristof: lisps have more parens because the "operators" like ||, &&, +, *, and so on, need parens |
| 21:40 | amalloy | for method calls it's the same, but that's hardly the only thing you ever do |
| 21:41 | kristof | justin_smith: I just have trouble justifying the JVM. The JVM was designed when people were using a million different flavors of UNIX, DOS, Apple operating systems, BSD . . . |
| 21:41 | kristof | amalloy: I hardly ever use arithmetic and lobical operators. |
| 21:41 | kristof | *logical. |
| 21:42 | justin_smith | kristof: the jvm means my coworkers did not have to stop using their macbooks or deploy to expensive apple hardware |
| 21:42 | dbasch | kristof: I have a hard time imagining how someone can write software without arithmetic or logical operators |
| 21:42 | amalloy | okay? but people writing java use them an awful lot, for all them for loops. so it really does mean they need a lot more parens to do whatever |
| 21:43 | dbasch | kristof: I have one word for you: Android |
| 21:43 | kristof | Hrm. |
| 21:44 | amalloy | he doesn't use that either |
| 21:44 | kristof | amalloy: I can see that. |
| 21:45 | amalloy | lisp also has way more parens than ruby, with all those implicit parens |
| 21:47 | dbasch | amalloy: and the lack of parentheses often makes ruby harder to read |
| 21:47 | justin_smith | also, my point (admittedly a bit glib) was meant to be as much about unconventional placement of parens as number |
| 21:47 | amalloy | dbasch: i mean, i don't totally disagree with that claim, but it's a matter of perspective. i'm pretty sure you would be outvoted by people saying "the surplus of parentheses often makes lisp harder to read", which is just as reasonable |
| 21:48 | amalloy | surface syntax is just not an important thing to worry about |
| 21:48 | dbasch | amalloy: I found this line in a method, and it wasn’t immediately obvious what it did: |
| 21:48 | dbasch | profile.is_private? != true if profile |
| 21:49 | amalloy | well, that's just bad style. surely it'd be better as: profile && profile.is_private? |
| 21:49 | amalloy | adding a != true in there or whatever |
| 21:49 | dbasch | amalloy: yes, the problem with ruby is the low barrier to entry for people with little experience programming in the large |
| 21:50 | amalloy | you can write equally stupid things in clojure. one of my hobby horses is the overzealous use of ->> to reduce nesting (and, topically, parens!) at the expense of readability |
| 21:51 | dbasch | I suppose that if clojure were as popular as Ruby there would be more examples of bad style in the wild |
| 21:51 | dbasch | http://spectrum.ieee.org/computing/software/top-10-programming-languages |
| 21:51 | dbasch | clojure is not even on that list |
| 21:51 | amalloy | "the problem with language X is that it's easy for people to use" is not an argument that convinces me |
| 21:52 | justin_smith | wow they list arduino and processing as languages - there is something sad about that to me |
| 21:53 | dbasch | amalloy: I agree. In the case of Ruby I think the language is too lenient without necessarily being easier to use |
| 21:54 | justin_smith | dbasch: https://twitter.com/HackerNewsOnion/status/395719209411301376 |
| 21:55 | dbasch | it’s not that the language it’s easy to use, but that it makes it really easy to create undebuggable code |
| 23:43 | lpvb | I'm really starting to ignore the do block inside the let form and instead using it as an identity monad |
| 23:49 | justin_smith | lpvb: got a good example of what that looks like? |
| 23:54 | lpvb | (let [c constant, x (pure-computation c), _ (side-effect c), _ (more-side-effects etc.)] nil) |
| 23:56 | jeremyheiler | lpvb: why not just do the side effects in teh body? |