#clojure logs

2015-03-14

00:23arrdemcfleming: o/
00:25cflemingarrdem: a^
01:23Guest34606hoplon anyone?
01:24Guest34606(+ 1 1)
01:24clojurebot2
01:28handojin(apply + (filter even? (range 100)))
01:33justin_smith,(apply + (transduce (filter even?) (range 100)))
01:33clojurebot#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...
01:33justin_smithoops
01:33justin_smith,(transduce + (filter even?) (range 100)))
01:33clojurebot#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...
01:33justin_smithergh
01:35handojin(map + (filter even? (range 100)))
01:35handojinmaybe?
01:35justin_smiththe apply version will work
01:35justin_smithI was trying to use a transducer
01:35justin_smith,(apply + (filter even? (range 100)))
01:35clojurebot2450
01:35handojinfor why?
01:35justin_smithno particular reason
01:36handojinthe best kind of reason then
01:39justin_smithhaha
01:39handojini'll be here all night. try the veal.
01:41handojinsince the channel is dead justin
01:42handojini have two choices
01:42handojinlet's postulate a datomic backend
01:42handojinand a webapp
01:42justin_smithOK
01:43handojinin between i can either
01:43handojina/ compose an application middle tier using hoplon
01:43handojinor
01:44handojinb/ put one together using a combo of sente + reagent
01:45handojinwhere does you gut go?
01:45justin_smithsadly I haven't used any of those, I haven't done much frontend stuff
01:45justin_smithnow if you wanted to know which ring server implementation to use...
01:46handojinwhy? what are the issues there?
01:46justin_smithI'm just saying I can
01:47justin_smith't really provide input about hoplon / sente / reagent because I haven't used any of them
01:47handojinfair enough
01:47handojinby ring server impl you mean like http-kit vs jetty vs immuatant?
01:48justin_smithright
01:49handojinwhat are the trade offs?
01:51justin_smithjetty 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
01:52justin_smithwith tomcat you would deploy a war, of course, with aleph or http-kit you would launch an uberjar
01:55handojinok (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?
01:55justin_smithbeanstalk can do http-kit?
01:55justin_smithall my beanstalk apps are wars run in tomcat
01:56justin_smithnow ec2, I have apps running http-kit in ec2 instances
01:56handojinwell i deploy there and it runs, i was kind of assuming that http-kit was running inside of tomcat
01:56handojinone sec
01:56justin_smithoh, no, absolutely not
01:57justin_smithyou upload a war, and tomcat loads the war's classes / resources and serves your app
01:58justin_smithwhat 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 /
01:58justin_smith*from there
01:59justin_smiththat's how beanstalk with tomcat and clojure has always worked for me at least
01:59jcrossley3-awayjustin_smith: technically, immutant 1 used jboss. immutant 2 uses undertow, which is more analogous to aleph and http-kit. just fyi.
01:59justin_smithjcrossley3-away: oh, thanks for the info!
01:59justin_smithjcrossley3-away: so does it not have the same scaling and scheduled task type conveniences that were there under jboss?
02:01jcrossley3-awayjustin_smith: immutant 2 does scheduled tasks with quartz. it can be deployed to wildfly (the next generation of jboss) to achieve some scaling features.
02:02justin_smithinteresting, thanks
02:02handojinok, i don't get it
02:02justin_smithdo you have a more specific question?
02:03handojini'm trying to formulate it
02:03handojinso i have a thing that runs locally using http-kit
02:04justin_smithone 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)
02:05justin_smithring tells the container (tomcat) what your handler function is, via an xml file it generates
02:05justin_smithtomcat calls your handler function for each request to your app
02:05handojinbut when i do lein-beanstalk it somehow...
02:05handojinah
02:05justin_smithyour classes are loaded inside tomcat's vm
02:05justin_smithand it calls your handler method
02:06handojinso when i run lein-beanstalk of generates a different runtime config
02:06handojin?
02:06justin_smithit generates xml that tells tomcat how to call your handler
02:07handojininteresting
02:07handojinso my local config vs. what's deployed are nothing alike
02:08justin_smithfor running in an app server, they have some differences, yeah
02:08handojini am educated
02:10handojinso if i want control, time to look into pallet maybe?
02:10justin_smithor immutant, or just running your uberjar on the server
02:10justin_smithjava makes deploying pretty simple compared to most deployment platforms
02:11handojinyeah, i liking the jvm
02:12handojinjust looking at the alternative non-magic universe all of a sudden
02:13handojinso immutant 2 bailed on jboss huh?
02:13justin_smithhaha
02:14ddellacosta:-)
02:14ddellacostaand as far as I know you don't live in my time zone
02:14ddellacostaso it's a mystery
02:14justin_smithddellacosta: 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!
02:14jcrossley3-awayhandojin: not exactly. immutant 1 forced you to run your app inside jboss. immutant 2 gives you the choice of doing so.
02:15ddellacostajustin_smith: why are you assuming being on #clojure means you don't have a life! ;-)
02:16handojinwell sente specifies immutant or http-kit, and probably not the jboss version
02:17jcrossley3-awayhandojin: correct, but it's kinda weird to speak of the "jboss version". "jboss" is an overloaded term, unfortunately.
02:19handojini think it wants an event loop
02:20handojinwhich probably equates to undertow
02:20arrdemjustin_smith: next version of Grimoire getting some final polish right now. the multimethod examples are great. thanks!
02:21justin_smitharrdem: cool, glad you like them
02:21justin_smithI may contribute more examples, if I get the right combination of caffeinated / add / inspired
02:21arrdemhehe I'll be adding in some support to make that easier in future :P
02:21jcrossley3-awayhandojin: 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. :)
02:22handojinbritish or american?
02:23handojinyeah, don't get me wrong, jboss rocks
02:25handojinso, general question...
02:26handojinhoplon & castra or reagent & sente
02:33handojinany and all opinons welcome
02:36arrdemjustin_smith: thoughts... should I add some sort of authentication system and have in-Grimoire editing or is the fork and pr thing OK.
02:36arrdembecause I'm a lazy bastard and I wouldn't personally mind the fork and PR thing.
02:40scottjarrdem: have you considered allowing searching from the url not just the field? for example, so people can define a custom search in their browser.
02:41scottjarrdem: maybe it's possible to do without changing the backend, by allowing ?q=term and then pulling that out with javascript?
02:44handojini have a very basic stormpath lib that can provide authN
02:44justin_smitharrdem: hmm, it depends whether the git paradigm or the wiki paradigm makes more sense for the examples - I can see arguments for each
02:44arrdemscottj: 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.
02:45justin_smitharrdem: copy-paste a search to IRC to share the result as an answer to a question maybe?
02:48arrdemjustin_smith: I'd consider that linking to a subset of the cheatsheet...
02:48arrdemcheatsheet needs an overhaul anyway it's some of the oldest Clojure code I know of in active use
02:48scottjarrdem: 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
02:48arrdemthat isn't Core itself.
02:49arrdemscottj: huh. that would be... seriously badass.
02:49arrdemscottj: is there page metadata advertising that I need to go along with this?
02:50arrdem(full search of Grimoire is an open problem I haven't addressed, but this would be cool)
02:50scottjyou seem too excited, I'm worried you didn't understand me again :)
02:51scottjall I'm talking about is accepting a query parameter in the get request and filling in that search field with it
02:51arrdemYep I got that but it gave me an idea for a bigger feature.
02:51scottjlike 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.
02:52scottjI'm not sure if there's a standard for browsers to recognize these custom searches automatically
02:52arrdemyeah or I could just read ?q and ?query on the server side and set the default value of the search field.
02:52arrdemcave a client the trouble.
02:52arrdem*save
02:53arrdemI 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.
02:53arrdemI'll dig into that... that's what I got all excited over :P
03:06arrdemscottj: 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.
03:07anefirefox used to have a "make a search engine using this form field" in a context menu
03:07scottjarrdem: cool, I just realized melpa (emacs thing) accepts ?q= and got pretty excited because their search results updating as you type gets annoying.
03:07arrdemscottj: I'm one of the emacs master race, I know what melpa is :P
03:08anemelpa.org/#/?q=cider works, but it's not registering that as a search engine in chrome
03:08arrdemyeah they aren't advertising it appropriately in their header.
03:09anebah stupid single-page apps :-(
03:11arrdemIt looks like this convention calls for generating XML responses...
03:12arrdemhttp://www.opensearch.org/Home
03:12arrdemgot it
05:34dysfunarrdem: have they even thought about ssl yet? ISTR having quite a long discussion about clojars security with someone in here a while back
05:34dysfun(melpa, that is)
05:35arrdemdysfun: 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.
05:35arrdembut technomancy or someone would know more than I do
05:35arrdemI'm just a compiler hacker, my emacs-foo is limited
05:39dysfuntechnomancy doesn't have much time to debate these days, what with being off doing good and all that
05:40dysfunthe issue i think is that melpa doesn't support ssl
05:41dysfuni'm also slightly less paranoid than he is :)
05:49arrdemIMO after Snowden we're all less paranoid then we should be :P
05:49arrdemeven me
05:50dysfunheh
05:50dysfuni can't speak for you but i'm lazy. and nothing i do is particularly secrecy-worthy
05:50dysfunplus i give away most of the code i write :)
05:51dysfun(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 :)
06:07arrdemyou should check my commit history and then revise your assessment of "gh worthy" :P
06:10dysfun:p
06:11dysfunyes, 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
06:11dysfunconsequently 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 :)
06:12dysfuni was really pleased when i found someone built libwebkitgtk+ because i hated writing bindings :)
06:18noncom|2dysfyn: actually i think that's ok in the big sense since these unfinished projects have the meaning of interning some knowledge and testing ideas..
06:18noncom|2*dysfun :)
06:21dysfunoh definitely
06:22dysfunwhen i look back, the most useful things i've learned have been from things that didn't work out so well :)
06:22dysfuni make mistakes so you don't have to, or something :)
09:14AtarianAnyone familiar with mig-panel from seesaw?
09:14noncom|2actually its java swing thing..
09:15AtarianYeah, not a java bunny lol
09:16AtarianI just want to display a vertical list of about a dozen labels, from my googling apparently mig-layout is the way to go
09:16AtarianNot much documentation though. It only displays the first label in the list of :items
09:17AtarianI can't figure out how to position the labels
09:17Atarian(def stat-panel
09:17Atarian (mig/mig-panel
09:17Atarian :items [[(sc/label :text "Field 1: ") ""]
09:17Atarian [(sc/label :text "Field 2: ") ""]
09:17Atarian [(sc/label :text "Field 3: ") ""]]))
09:17Atarian
09:32mr_rmthe 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:15noncom|2why i cant (into []) an empty {} ?
13:15noncom|2ph, sorry
13:15noncom|2my bad
13:15justin_smithph?
13:44justin_smith,Math/PI
13:44clojurebot3.141592653589793
13:44justin_smith,(Math/PI)
13:44clojurebot3.141592653589793
13:45justin_smith,((Math/PI))
13:45clojurebot#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:16eli-sehi
15:26justin_smithhello
15:39eli-seI love Clojure.
15:41jk1896Hi!
15:41justin_smithme too, it's pretty great
15:41jk1896How many slots can we expect for clojure?
15:41jk1896For gsoc , I mean
15:42justin_smithjk1896: I think this is discussed on the mailing list (which is available on google groups)
15:42justin_smithhttps://groups.google.com/forum/#!forum/clojure
15:42jk1896Ok
15:43justin_smithhttps://groups.google.com/forum/#!searchin/clojure/gsoc$202015
15:45jk1896There's nothing about slots~
15:45jk1896:(
15:47justin_smithwell, that's also a great place to ask
15:47jk1896hmm ok
15:47jk1896Shall I ask one here?
15:48justin_smithjk1896: both of the mentors are here, sometimes
15:48jk1896Ok
15:48justin_smithBronsa and dnolen
15:48jk1896Do you think any of the core.typed will be chosen?
15:48jk1896Those sound interesting
15:48justin_smithI don't know if either are actually present as opposed to just having their client logged in
15:49jk1896I think it's just that their client is logged on
15:49jk1896Do YOU have any idea?
15:52justin_smithno, but one advantage of asking on the group is that other people can search for the answer there when it's answered
15:59Frozenlockjustin_smith: to be fair, this channel is indexed by google...
15:59FrozenlockSo I wouldn't say it's an advantage over IRC.
16:00justin_smithFrozenlock: I think it's easier to get a specific topic and result for the group
16:00justin_smithFrozenlock: I've tried using google to find things in the logs here...
16:36eli-seSince I treat OOP as syntactic sugar for tuples of functions, life's become better.
16:40arohnereli-se: yup
16:40arohnerin 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:43eli-searohner: Why'd you want it?
16:44arohnerI 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:44justin_smitharohner: why not put a delay on the channel? or would you not want the consumer to wait for the delay to be realized?
16:47arohnerI 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:41chancerussellI 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:41chancerussellAnd when I say "returns", I mean inserts into the macro expansion
17:43chancerussellThe closest I can come is nil or a quoted empty list. Can you quote "nothing"?
17:44Bronsachancerussell: it's not possible for a macro to return nothing
17:48chancerussellI don't necessarily need the whole macro to return nothing -- just to include one section conditionally
17:51sandbagschancerussell: how is what you are describing different to the when macro?
17:52chancerussellsandbags: if the conditional in a when fails, it returns nil
17:53chancerussellIt's not a huge deal to have a nil in this spot anyway, was just wondering if was possible to avoid
17:55sandbagsah, i see you mean have a macro expand into no expression at all
17:55Bronsachancerussell: not sure I understand what you need but unquote splicing might be what you need
17:55Bronsa,`(foo ~@(if true [1] nil))
17:55clojurebot(sandbox/foo 1)
17:56Bronsa,`(foo ~@(if false [1] nil))
17:56clojurebot(sandbox/foo)
17:57sandbagsneat Bronsa
17:59chancerussellBronsa: Ah! That's perfect!
18:00chancerussellBronsa: I like that a whole lot. Wouldn't have occurred to me
18:01Bronsachancerussell: note that you can use that only when you have a collection to splice into
18:31arohneris there a modern nrepl thing for emacs that works worth a damn?
18:32arohnercider.el 0.8.2 is completely unusable for me
18:32Frozenlockarohner: nrepl.el still works
18:32arohnerFrozenlock: where can I get it?
18:34FrozenlockGood question... through the git history of cider I suppose... :-/
18:38dlaudoes 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:57gfrederickslein isn't a namespace name
18:57gfredericksanybody who wrote that probably thought it would be run somewhere where somebody had (:require [leiningen.something :as lein])
18:57gfredericksI don't know anything about chestnut so that's all I can speculate about
18:58gfredericksthe full namespace might be leiningen.core.main maybe
19:25pandeirowhat 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:42amalloywhat makes you think that's not the default, pandeiro?
20:10nicferrierhey clojure hackers.
20:11nicferrierI'm kinda doing something a bit like xslt.
20:11nicferrierand I wonder if there's a way to branch a (->> stream)
20:11nicferrierhmmm. not explaining this very well.
20:11nicferrierit was all sensible in my head 5 mins ago.
20:14nicferrierI guess I want multiple values somehow
20:47justin_smithnicferrier: recursive processing of subtrees?
20:53justin_smithdoes 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:53justin_smitherr, making mutable state global rather than hidden I mean
22:24aka`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:35justin_smithwhy are you trying to use 2.1.2?
22:51pandeiroamalloy: 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