#clojure log - Mar 14 2015

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:23 arrdem: cfleming: o/

0:25 cfleming: arrdem: a^

1:23 Guest34606: hoplon anyone?

1:24 (+ 1 1)

1:24 clojurebot: 2

1:28 handojin: (apply + (filter even? (range 100)))

1:33 justin_smith: ,(apply + (transduce (filter even?) (range 100)))

1:33 clojurebot: #error{:cause "Wrong number of args (2) passed to: core/transduce", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (2) passed to: core/transduce", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 36] [sandbox$eval25 invoke "NO_SOURCE_FILE" 0] [clojure.lang.Compiler eval "Compiler.j...

1:33 justin_smith: oops

1:33 ,(transduce + (filter even?) (range 100)))

1:33 clojurebot: #error{:cause "Wrong number of args (0) passed to: core/filter/fn--4522", :via [{:type clojure.lang.ArityException, :message "Wrong number of args (0) passed to: core/filter/fn--4522", :at [clojure.lang.AFn throwArity "AFn.java" 429]}], :trace [[clojure.lang.AFn throwArity "AFn.java" 429] [clojure.lang.AFn invoke "AFn.java" 28] [clojure.core$transduce invoke "core.clj" 6569] [sandbox$eval49 invoke...

1:33 justin_smith: ergh

1:35 handojin: (map + (filter even? (range 100)))

1:35 maybe?

1:35 justin_smith: the apply version will work

1:35 I was trying to use a transducer

1:35 ,(apply + (filter even? (range 100)))

1:35 clojurebot: 2450

1:35 handojin: for why?

1:35 justin_smith: no particular reason

1:36 handojin: the best kind of reason then

1:39 justin_smith: haha

1:39 handojin: i'll be here all night. try the veal.

1:41 since the channel is dead justin

1:42 i have two choices

1:42 let's postulate a datomic backend

1:42 and a webapp

1:42 justin_smith: OK

1:43 handojin: in between i can either

1:43 a/ compose an application middle tier using hoplon

1:43 or

1:44 b/ put one together using a combo of sente + reagent

1:45 where does you gut go?

1:45 justin_smith: sadly I haven't used any of those, I haven't done much frontend stuff

1:45 now if you wanted to know which ring server implementation to use...

1:46 handojin: why? what are the issues there?

1:46 justin_smith: I'm just saying I can

1:47 't really provide input about hoplon / sente / reagent because I haven't used any of them

1:47 handojin: fair enough

1:47 by ring server impl you mean like http-kit vs jetty vs immuatant?

1:48 justin_smith: right

1:49 handojin: what are the trade offs?

1:51 justin_smith: jetty is useful during dev, being simple and present by default with lein ring, but it doesn't make as much sense server side. immutant uses jboss, so can establish a more complex app, involving multiple processes or machines, scheduled tasks, etc., http-kit or aleph make sense (behind nginx) if you prefer performance rather than the convenience of a container, tomcat is good if you want a service that does things like taking care of log rotation, qu

1:52 with tomcat you would deploy a war, of course, with aleph or http-kit you would launch an uberjar

1:55 handojin: ok (and sorry for my total ignorance here) but when i deploy to aws via lein-beanstalk an app that specifies http-kit to a tomcat container, what's actually happening?

1:55 justin_smith: beanstalk can do http-kit?

1:55 all my beanstalk apps are wars run in tomcat

1:56 now ec2, I have apps running http-kit in ec2 instances

1:56 handojin: well i deploy there and it runs, i was kind of assuming that http-kit was running inside of tomcat

1:56 one sec

1:56 justin_smith: oh, no, absolutely not

1:57 you upload a war, and tomcat loads the war's classes / resources and serves your app

1:58 what happens is that "lein ring uberwar" is used to create a war file with all your transative deps, that is uploaded to s3, and then from their downloaded to an elasticbeanstalk tomcat instance with a turnkey config, behind a proxy (nginx I believe) and they fire up tomcat serving your war from /

1:58 *from there

1:59 that's how beanstalk with tomcat and clojure has always worked for me at least

1:59 jcrossley3-away: justin_smith: technically, immutant 1 used jboss. immutant 2 uses undertow, which is more analogous to aleph and http-kit. just fyi.

1:59 justin_smith: jcrossley3-away: oh, thanks for the info!

1:59 jcrossley3-away: so does it not have the same scaling and scheduled task type conveniences that were there under jboss?

2:01 jcrossley3-away: justin_smith: immutant 2 does scheduled tasks with quartz. it can be deployed to wildfly (the next generation of jboss) to achieve some scaling features.

2:02 justin_smith: interesting, thanks

2:02 handojin: ok, i don't get it

2:02 justin_smith: do you have a more specific question?

2:03 handojin: i'm trying to formulate it

2:03 so i have a thing that runs locally using http-kit

2:04 justin_smith: one clue that might help is that under tomcat, your -main function does not get automatically run (unless you are a weirdo and call it from some other method, it won't get run)

2:05 ring tells the container (tomcat) what your handler function is, via an xml file it generates

2:05 tomcat calls your handler function for each request to your app

2:05 handojin: but when i do lein-beanstalk it somehow...

2:05 ah

2:05 justin_smith: your classes are loaded inside tomcat's vm

2:05 and it calls your handler method

2:06 handojin: so when i run lein-beanstalk of generates a different runtime config

2:06 ?

2:06 justin_smith: it generates xml that tells tomcat how to call your handler

2:07 handojin: interesting

2:07 so my local config vs. what's deployed are nothing alike

2:08 justin_smith: for running in an app server, they have some differences, yeah

2:08 handojin: i am educated

2:09 * justin_smith lifts up his pistol, blows away the gunsmoke, and calls it a day and a job well done.

2:10 handojin: so if i want control, time to look into pallet maybe?

2:10 justin_smith: or immutant, or just running your uberjar on the server

2:10 java makes deploying pretty simple compared to most deployment platforms

2:11 handojin: yeah, i liking the jvm

2:12 just looking at the alternative non-magic universe all of a sudden

2:13 so immutant 2 bailed on jboss huh?

2:13 * ddellacosta wonders if justin_smith sleeps because every time he goes on #clojure justin_smith is there

2:13 justin_smith: haha

2:14 ddellacosta: :-)

2:14 and as far as I know you don't live in my time zone

2:14 so it's a mystery

2:14 justin_smith: ddellacosta: hey man, I went out to a reading for a magazine some friends published today, it's not like I don't have a life!

2:14 jcrossley3-away: handojin: not exactly. immutant 1 forced you to run your app inside jboss. immutant 2 gives you the choice of doing so.

2:15 ddellacosta: justin_smith: why are you assuming being on #clojure means you don't have a life! ;-)

2:16 handojin: well sente specifies immutant or http-kit, and probably not the jboss version

2:17 jcrossley3-away: handojin: correct, but it's kinda weird to speak of the "jboss version". "jboss" is an overloaded term, unfortunately.

2:19 handojin: i think it wants an event loop

2:20 which probably equates to undertow

2:20 arrdem: justin_smith: next version of Grimoire getting some final polish right now. the multimethod examples are great. thanks!

2:21 justin_smith: arrdem: cool, glad you like them

2:21 I may contribute more examples, if I get the right combination of caffeinated / add / inspired

2:21 arrdem: hehe I'll be adding in some support to make that easier in future :P

2:21 jcrossley3-away: handojin: correct. both immutant 2 and http-kit are evented servers. one backed by undertow/xnio and the other backed by netty. and weirdly, all of those underlying technologies originated at jboss. :)

2:21 * arrdem returns to whiskey, house of cards

2:22 handojin: british or american?

2:23 yeah, don't get me wrong, jboss rocks

2:25 so, general question...

2:26 hoplon & castra or reagent & sente

2:33 any and all opinons welcome

2:36 arrdem: justin_smith: thoughts... should I add some sort of authentication system and have in-Grimoire editing or is the fork and pr thing OK.

2:36 because I'm a lazy bastard and I wouldn't personally mind the fork and PR thing.

2:40 scottj: arrdem: have you considered allowing searching from the url not just the field? for example, so people can define a custom search in their browser.

2:41 arrdem: maybe it's possible to do without changing the backend, by allowing ?q=term and then pulling that out with javascript?

2:44 handojin: i have a very basic stormpath lib that can provide authN

2:44 justin_smith: arrdem: hmm, it depends whether the git paradigm or the wiki paradigm makes more sense for the examples - I can see arguments for each

2:44 arrdem: scottj: hum... so what does that buy you that the JSON API doesn't? Scraping the frontpage should be a last resort unless you want to link to some subset of the cheatsheet.

2:45 justin_smith: arrdem: copy-paste a search to IRC to share the result as an answer to a question maybe?

2:48 arrdem: justin_smith: I'd consider that linking to a subset of the cheatsheet...

2:48 cheatsheet needs an overhaul anyway it's some of the oldest Clojure code I know of in active use

2:48 scottj: arrdem: no, this is not scraping. I wasn't aware of the json api, but I don't think fills this same need. this would just allow people to define custom searches in say their browser or quicksilver or whatever so they could type "grimoire term" and go to the page and the search field would be filled. admittedly not a huge deal because the alternative is grimore RET (wait for load) term, but it may fit in to some peoples workflow better

2:48 arrdem: that isn't Core itself.

2:49 scottj: huh. that would be... seriously badass.

2:49 scottj: is there page metadata advertising that I need to go along with this?

2:50 (full search of Grimoire is an open problem I haven't addressed, but this would be cool)

2:50 scottj: you seem too excited, I'm worried you didn't understand me again :)

2:51 all I'm talking about is accepting a query parameter in the get request and filling in that search field with it

2:51 arrdem: Yep I got that but it gave me an idea for a bigger feature.

2:51 scottj: like I said, I think right now people can pass get parameters on the url fine and they don't get redirected, so in your search field js I think you could pull the query (or q) parameter out of url and just put it in the field.

2:52 I'm not sure if there's a standard for browsers to recognize these custom searches automatically

2:52 arrdem: yeah or I could just read ?q and ?query on the server side and set the default value of the search field.

2:52 cave a client the trouble.

2:52 *save

2:53 I think there is a standard (at least one that firefox supports) because I've been seeing "add this site to your search options" of late in my browser.

2:53 I'll dig into that... that's what I got all excited over :P

3:06 scottj: turns out there's an "open search" standard that uses ?q= to do searches already and that's the "browser bar search" stuff I got all hot and bothered about.

3:07 ane: firefox used to have a "make a search engine using this form field" in a context menu

3:07 scottj: arrdem: cool, I just realized melpa (emacs thing) accepts ?q= and got pretty excited because their search results updating as you type gets annoying.

3:07 arrdem: scottj: I'm one of the emacs master race, I know what melpa is :P

3:07 * arrdem checks their HTML

3:08 ane: melpa.org/#/?q=cider works, but it's not registering that as a search engine in chrome

3:08 arrdem: yeah they aren't advertising it appropriately in their header.

3:09 ane: bah stupid single-page apps :-(

3:11 arrdem: It looks like this convention calls for generating XML responses...

3:12 http://www.opensearch.org/Home

3:12 got it

5:34 dysfun: arrdem: have they even thought about ssl yet? ISTR having quite a long discussion about clojars security with someone in here a while back

5:34 (melpa, that is)

5:35 arrdem: dysfun: IIRC the emacs package.el guys explicitly chose not to require ssl support although ssl is supported. there was some .. whining about that a while back.

5:35 but technomancy or someone would know more than I do

5:35 I'm just a compiler hacker, my emacs-foo is limited

5:39 dysfun: technomancy doesn't have much time to debate these days, what with being off doing good and all that

5:40 the issue i think is that melpa doesn't support ssl

5:41 i'm also slightly less paranoid than he is :)

5:49 arrdem: IMO after Snowden we're all less paranoid then we should be :P

5:49 even me

5:50 dysfun: heh

5:50 i can't speak for you but i'm lazy. and nothing i do is particularly secrecy-worthy

5:50 plus i give away most of the code i write :)

5:51 (or, more likely) have plans to give it away when i've tidied it up enough to not be ashamed of putting it up on github :)

6:07 arrdem: you should check my commit history and then revise your assessment of "gh worthy" :P

6:10 dysfun: :p

6:11 yes, but i do the ADHD thing of finding a shinier idea and immediately dropping the thing i was working on, leaving it probably not compileable

6:11 consequently i have hundreds of repos in ~/code. many things i've since found other people have done better. the line for 'worth releasing' is a funny one :)

6:12 i was really pleased when i found someone built libwebkitgtk+ because i hated writing bindings :)

6:18 noncom|2: dysfyn: actually i think that's ok in the big sense since these unfinished projects have the meaning of interning some knowledge and testing ideas..

6:18 *dysfun :)

6:21 dysfun: oh definitely

6:22 when i look back, the most useful things i've learned have been from things that didn't work out so well :)

6:22 i make mistakes so you don't have to, or something :)

9:14 Atarian: Anyone familiar with mig-panel from seesaw?

9:14 noncom|2: actually its java swing thing..

9:15 Atarian: Yeah, not a java bunny lol

9:16 I just want to display a vertical list of about a dozen labels, from my googling apparently mig-layout is the way to go

9:16 Not much documentation though. It only displays the first label in the list of :items

9:17 I can't figure out how to position the labels

9:17 (def stat-panel

9:17 (mig/mig-panel

9:17 :items [[(sc/label :text "Field 1: ") ""]

9:17 [(sc/label :text "Field 2: ") ""]

9:17 [(sc/label :text "Field 3: ") ""]]))

9:17

9:32 mr_rm: the docs for lein-ring (https://github.com/weavejester/lein-ring) say that you can use a port or port range for :port. I can't figure out how to specify a port range and the source code doesn't seem to support it from what I can tell. Is this possiible?

13:15 noncom|2: why i cant (into []) an empty {} ?

13:15 ph, sorry

13:15 my bad

13:15 justin_smith: ph?

13:44 ,Math/PI

13:44 clojurebot: 3.141592653589793

13:44 justin_smith: ,(Math/PI)

13:44 clojurebot: 3.141592653589793

13:45 justin_smith: ,((Math/PI))

13:45 clojurebot: #error{:cause "java.lang.Double cannot be cast to clojure.lang.IFn", :via [{:type java.lang.ClassCastException, :message "java.lang.Double cannot be cast to clojure.lang.IFn", :at [sandbox$eval71 invoke "NO_SOURCE_FILE" -1]}], :trace [[sandbox$eval71 invoke "NO_SOURCE_FILE" -1] [clojure.lang.Compiler eval "Compiler.java" 6784] [clojure.lang.Compiler eval "Compiler.java" 6747] [clojure.core$eval in...

15:16 eli-se: hi

15:26 justin_smith: hello

15:39 eli-se: I love Clojure.

15:41 jk1896: Hi!

15:41 justin_smith: me too, it's pretty great

15:41 jk1896: How many slots can we expect for clojure?

15:41 For gsoc , I mean

15:42 justin_smith: jk1896: I think this is discussed on the mailing list (which is available on google groups)

15:42 https://groups.google.com/forum/#!forum/clojure

15:42 jk1896: Ok

15:43 justin_smith: https://groups.google.com/forum/#!searchin/clojure/gsoc$202015

15:45 jk1896: There's nothing about slots~

15:45 :(

15:47 justin_smith: well, that's also a great place to ask

15:47 jk1896: hmm ok

15:47 Shall I ask one here?

15:48 justin_smith: jk1896: both of the mentors are here, sometimes

15:48 jk1896: Ok

15:48 justin_smith: Bronsa and dnolen

15:48 jk1896: Do you think any of the core.typed will be chosen?

15:48 Those sound interesting

15:48 justin_smith: I don't know if either are actually present as opposed to just having their client logged in

15:49 jk1896: I think it's just that their client is logged on

15:49 Do YOU have any idea?

15:52 justin_smith: no, but one advantage of asking on the group is that other people can search for the answer there when it's answered

15:59 Frozenlock: justin_smith: to be fair, this channel is indexed by google...

15:59 So I wouldn't say it's an advantage over IRC.

16:00 justin_smith: Frozenlock: I think it's easier to get a specific topic and result for the group

16:00 Frozenlock: I've tried using google to find things in the logs here...

16:36 eli-se: Since I treat OOP as syntactic sugar for tuples of functions, life's become better.

16:40 arohner: eli-se: yup

16:40 in core.async, I notice 'closed? is in the .impl.protocols namespace. Is there a better way to determine whether a channel is closed, aside from trying to take from it?

16:43 eli-se: arohner: Why'd you want it?

16:44 arohner: I do some side-effects, and then put! on the channel. If the channel is closed, I don't want to do the side-effects, and exit

16:44 justin_smith: arohner: why not put a delay on the channel? or would you not want the consumer to wait for the delay to be realized?

16:47 arohner: I was thinking I didn't want the side-effects to happen if the channel is closed, but I guess I need to handle the 'sudden shutdown' case anyways, so it needs to be idempotent

17:41 chancerussell: I have a dumb macro question. How can I write a conditional in a syntax quoted macro that returns a particular value if a condition is met, but returns _nothing_ (not nil) otherwise?

17:41 And when I say "returns", I mean inserts into the macro expansion

17:43 The closest I can come is nil or a quoted empty list. Can you quote "nothing"?

17:44 Bronsa: chancerussell: it's not possible for a macro to return nothing

17:48 chancerussell: I don't necessarily need the whole macro to return nothing -- just to include one section conditionally

17:51 sandbags: chancerussell: how is what you are describing different to the when macro?

17:52 chancerussell: sandbags: if the conditional in a when fails, it returns nil

17:53 It's not a huge deal to have a nil in this spot anyway, was just wondering if was possible to avoid

17:55 sandbags: ah, i see you mean have a macro expand into no expression at all

17:55 Bronsa: chancerussell: not sure I understand what you need but unquote splicing might be what you need

17:55 ,`(foo ~@(if true [1] nil))

17:55 clojurebot: (sandbox/foo 1)

17:56 Bronsa: ,`(foo ~@(if false [1] nil))

17:56 clojurebot: (sandbox/foo)

17:57 sandbags: neat Bronsa

17:59 chancerussell: Bronsa: Ah! That's perfect!

18:00 Bronsa: I like that a whole lot. Wouldn't have occurred to me

18:01 Bronsa: chancerussell: note that you can use that only when you have a collection to splice into

18:31 arohner: is there a modern nrepl thing for emacs that works worth a damn?

18:32 cider.el 0.8.2 is completely unusable for me

18:32 Frozenlock: arohner: nrepl.el still works

18:32 arohner: Frozenlock: where can I get it?

18:34 Frozenlock: Good question... through the git history of cider I suppose... :-/

18:38 dlau: does leiningen require "lein" in the global namespace or something? trying to figure out why this chestnut template with sass wont run :-( it's doing (lein/-main ["auto" "sassc" "once"]) w/ err CompilerException java.lang.RuntimeException: No such namespace: lein

18:57 gfredericks: lein isn't a namespace name

18:57 anybody who wrote that probably thought it would be run somewhere where somebody had (:require [leiningen.something :as lein])

18:57 I don't know anything about chestnut so that's all I can speculate about

18:58 the full namespace might be leiningen.core.main maybe

19:25 pandeiro: what can i do to make a clojure webapp using jetty or httpkit default to treating incoming http requests as if they are utf-8 encoded?

19:42 amalloy: what makes you think that's not the default, pandeiro?

20:10 nicferrier: hey clojure hackers.

20:11 I'm kinda doing something a bit like xslt.

20:11 and I wonder if there's a way to branch a (->> stream)

20:11 hmmm. not explaining this very well.

20:11 it was all sensible in my head 5 mins ago.

20:14 I guess I want multiple values somehow

20:47 justin_smith: nicferrier: recursive processing of subtrees?

20:53 does anyone remember an article, I think it was cemerick but I'm not sure, about making global state mutable rather than hidden in Clojure?

20:53 err, making mutable state global rather than hidden I mean

22:24 aka`: I'm having issues getting lein to work properly, when I add the script to ~/bin and run it it throws a 403 trying to download leiningen-2.1.2-standalone.jar when I attempt to follow the link in a browser I'm getting a similar failure from s3. Is it possible permissions were erroneously changed?

22:35 justin_smith: why are you trying to use 2.1.2?

22:51 pandeiro: amalloy: ended up being a weird bug in the http client i am using, but i suspected jetty/jvm because i still don't know how to properly configure them

Logging service provided by n01se.net