#clojure log - Mar 18 2014

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

0:00 yuri_niyazov: But i am not sure how to to capture the result of doing a transient operation so that it's available in a subsequent execution of doseq body

0:01 amalloy: yuri_niyazov: you can't. you need to use some construct other than doseq if you want to pass results around

0:01 yuri_niyazov: maybe I can explain this better with some simpler code

0:02 (doseq [:let [result (transient {})] a (range 1 10)] (assoc! result a (rand)))

0:03 except that it doesn't work, because I have to use the result of the (assoc!) subsequently

0:04 amalloy: right. you need to use reduce, or loop, or recursion: something that lets you carry around state

0:04 i also find it hard to believe you need a transient rather than just an ordinary persistent collection

0:06 yuri_niyazov: Yes, that part has been confirmed by profiling

0:06 ah

0:06 well, wtih-local-vars will work

0:08 amalloy: the only person in the world with enough expertise to use with-local-vars is rich hickey. if you want to mutate state, you have atoms

0:09 yuri_niyazov: Thank you for your input.

0:14 Raynes: ivan, amalloy: Oh. Shit.

0:14 ivan: :-)

0:14 Raynes: So that explains the crazy paste inflation.

0:14 I'm incredibly dumb.

0:15 I'll fix this soon.

0:15 Not much I can do about the pastes though.

0:15 I could delete anonymous forks, but that seems rather intrusive.

0:16 ivan: btw, crawlers will ignore robots.txt, don't rely on that

0:23 danielszmulewicz: Hi everyone! It's been bugging me for a while, but never was so important as to bother. But here it is: How do I redirect stdout for the jetty adapter? It prints messages in my terminal where I run the repl, I would like to redirect it to a file with the bulk of my logging (with the timbre library).

0:26 beamso: https://wiki.eclipse.org/Jetty/Feature/Jetty_Logging

0:26 it looks like either a jetty-logging.properties or a system property can configure jetty logging

0:27 danielszmulewicz: beamso: Awesome. Thanks.

0:27 (inc beamso)

0:27 lazybot: ⇒ 1

0:27 beamso: woohoo!

0:27 danielszmulewicz: :-)

0:44 yuri_niyazov: Why is calling var-set slower than mutating an atom?

1:13 vimuser21: whaa lol been wondering why my new code hasn't been woring, is there a way to remove a multi method?

1:14 saw some stuff that removes all symbols from the current name space…seems overkill

1:16 ah , google served me well, (ns-unmap *ns* 'multimethod)

1:54 chare: I need this book: https://leanpub.com/fp-oo

1:54 someone buy me a copy please

1:59 sdegutis: chare: ok

1:59 chare: sdegutis you lying to me?

1:59 sdegutis: chare: I trust you'll do the right thing

1:59 chare: you've got good in you

1:59 chare: I don't understand what you mean by that

2:42 irctc: I have a vector of boolean values, as [true false true false] in a map, {:id 1 :alias "asd" :values [true false true false]}. Now I want to insert his record into postgres database, where values column is postgres array datatype. How can I do this task making a single query? can anyone help?

2:46 ?

2:46 beamso: i would have no idea

2:46 have you tried doing it from java to give you an idea of what you have to do in clojure?

2:50 further reading tells me that you have to create the postgresql array using the classes in the driver jar

3:05 daniel_karlsson: I'm building a json api with liberator, and now looking around for tips on testing. Is Midje the way to go? Or any tips pointers to projects docs on the subject?

3:06 beamso: i just use the standard testing api :/

3:07 daniel_karlsson: that is what I have been playing with so far

4:15 augustl: daniel_karlsson: I prefer clojure.test, not a big fan of the midje infix stuff

7:38 jcromartie: gooooooooood morning

7:39 beamso: good evening

7:40 jcromartie: that's not how IRC time works

7:40 beamso: it's evening for me

7:40 jcromartie: http://thinkmoult.com/ugt.html

7:42 beamso: in all my years of irc i've never seen that before

7:42 jcromartie: maybe I'm the only one who has :)

7:48 clgv: ugt is useless anyway ;)

7:48 jcromartie: yeah really it is

7:52 aaronj1335: TIL how to render the proper greeting of the day on irc. thnx jcromartie

7:52 it's like being back in the military again

7:54 jcromartie: I just thought it was "good morning" when you arrive, and "good night" when you leave anyway. No need to get too formal.

7:56 * wagjo is AFK (out for lunch)

7:58 augustl: jcromartie: didn't know about ugt, thanks for the link :)

8:00 clgv: jcromartie: well you started noise with referencing a convention to avoid noise :P - but it's not as we were having a focused discussion in here anyway ;)

8:01 jcromartie: http://xkcd.com/

8:01 timely

8:01 UGT being a convention falling on the right-hand side :)

8:12 jph-: anyone else find it easier to write code inside out than outside in (ie thread-first)

8:14 jcromartie: jph-: certainly, I use -> all the time

8:14 mercwithamouth: yup

8:14 jcromartie: let also helps

8:14 jph-: im trying to use -> but it hurts my brain

8:14 heh

8:14 for all but simple examples

8:18 simon__: Hello! Im doing clojure koans, and I have a question about "Iteration can be used for repetition"

8:18 (take 2 (iterate (fn [x] x) :foo))

8:18 => (:foo :foo)

8:18 Ofc

8:18 But

8:18 user=> (take 2 (iterate #(%) :foo))

8:18 IllegalArgumentException Wrong number of args passed to keyword: :foo clojure.lang.Keyword.throwArity (Keyword.java:92)

8:19 I dont understand, why wont my second shorthand anonymus function work when the first does?

8:19 jcromartie: #(%) returns a function will call its argument as a function

8:19 ,(#(%) #(println "hi"))

8:19 clojurebot: hi\n

8:19 jph-: any tips for debugging ssl cert issues from clojure or do i need to dip into java for that?

8:19 sun.security.validator.ValidatorException: PKIX path building failed: sun

8:19 jcromartie: jph-: you need to add the cert to a truststore

8:20 jph-: I've just dealt with this

8:20 jph-: jcromartie, it's peculiar... my browser works fine

8:20 or maybe it's owned too

8:20 simon__: jcromartie: ah, ok.

8:20 jph-: !

8:20 simon__: Thanks.

8:21 jph-: why would by jdk 7 have an outdated trust store

8:21 hrmm

8:21 i've also dealt with this before.. it just seems peculiar

8:21 i'll hunt down the relevant stack overflow or bookmark

8:22 jcromartie: jph-: did you switch JDKs?

8:22 jph-: jcromartie, not to my knowledge

8:23 bore: Hello, a quick question. Is there a way to check if a string is valid EDN other than trying to read it and catching the exception?

8:23 jcromartie: jph-: what I'm asking is: did you connect to this host before? did anything change?

8:23 jph-: or is this failure happening the first time you've ever tried to connect to this host

8:23 jph-: i'm well versed in troubleshooting (used to do firewalls) so that's why im scratching my head

8:23 maybe something i did triggered something else

8:24 i'll have to poke around

8:24 jcromartie: jph-: there are certs that your browser trusts that the JVM does not

8:24 jph-: im connecting to https://btc-e.com/api/2/btc_usd/ticker which is fine in browser but is breaking in http-kit

8:24 i have sun jdk 7

8:24 i've got several things to check

8:25 heh

8:25 its a godaddy cert

8:25 so i need to see if that specific CA is also in jdk certstore

8:27 jcromartie: this cert is trusted in my OS X default JVM (1.6.0)

8:27 beamso: i'm using java 1.7 and it failed

8:27 clgv: jcromartie: how do you check this?

8:28 jcromartie: keytool -list -keystore /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/cacerts | grep '47:BE:AB:C9:22:EA:E8:0E:78:78:34:62:A7:9F:45:C2:54:FD:E6:8B'

8:28 clgv: jcromartie: I mean without trying to programmatically connect?

8:28 beamso: ,(slurp "https://btc-e.com/api/2/btc_usd/ticker")

8:28 clojurebot: #<SecurityException java.lang.SecurityException: denied>

8:28 jph-: hehe

8:28 clgv: ah there it is^^

8:28 jph-: yay its not just me

8:28 * jph- dances

8:28 clgv: no the bot probably does not allow socket connections

8:28 jph-: oh

8:28 yes my bad

8:28 clojail

8:29 beamso: i did get the SSLHandshakeException in a local repl using the same s-expression

8:29 clgv: ,(slurp "http://www.heise.de")

8:29 clojurebot: #<SecurityException java.lang.SecurityException: denied>

8:29 clgv: ^^

8:30 jph-: in linux /usr/lib/jvm/java-7-oracle/bin/keytool -list -keystore /usr/lib/jvm/java-7-oracle/jre/lib/security/cacerts

8:30 (ubuntu)

8:30 jcromartie: it's gone from 1.7

8:30 $ keytool -list -keystore /Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/security/cacerts | grep '47:BE:AB:C9:22:EA:E8:0E:78:78:34:62:A7:9F:45:C2:54:FD:E6:8B'

8:30 nothing

8:30 jph-: interesting

8:30 jcromartie: oh wait

8:31 beamso: that's an old jdk

8:31 jcromartie: yeah it's gone (sorry wrong command before, but verified this time)

8:31 I'm running 1.7.0_17 on OS X

8:31 this is a dev machine for a stuffy institution :)

8:31 jph-: "it's an older code, but it's valid" (star wars)

8:32 jcromartie: but seeing as the cert is there in 1.6 but gone in 1.7

8:32 jph-: i wonder if there's a changelog for why these are removed

8:32 maybe it was compromised

8:32 jcromartie: maybe somebody just doesn't like GoDaddy :) I wouldn't blame them

8:33 jph-: i wish i could copy/paste from firefox view cert

8:33 the fingerprint itself

8:33 clgv: jph-: you can easily use an application specific truststore

8:34 jph-: clgv, oh i know that, i'm more curious about the WHY right now

8:34 clgv: that way you could also use self-signed certs for your own services

8:34 jph-: since i want to do some transactional stuff over that API, and bad ssl certs make me nervous

8:34 beamso: jph-: http://notes.richdougherty.com/2013/09/adding-godaddy-g2-root-cert-to-jdk-7.html

8:35 jph-: beamso, awesome

8:35 how do i inc again

8:35 (inc beamso)

8:35 lazybot: ⇒ 2

8:35 beamso: there is a godaddy cert listed in my jdk but it wasn't the root one for that website

8:35 woohoo!

8:36 jcromartie: but I thought you were interested in the why? ;)

8:36 jph-: im still interested in the why :)

8:36 clgv: me too :P

8:36 jph-: but the fact it's a known issue gives me a little more confidence

8:36 ie it didnt just happen overnight

8:37 jcromartie: so meanwhile

8:37 developing Atlassian plugins in Clojure?

8:37 because I want to add 10s to my Atlassian app startup time

8:38 I'd really like a REPL in my JIRA

8:39 and JIRA in my REPL

8:39 http://img3.wikia.nocookie.net/__cb20110112210935/familyguy/images/5/5e/Reeces1.png

8:41 sid_: I have a noir session that contains :user-id in {:noir {:user {:pass $2a$10$BHASD1221asD.AsdasdWWAASDQOLfqsE.PPfOtKrt32szyEmrW, :last_name nil, :first_name nil, :id sid}, :user-id sid}} . How can I retrieve the value of this key in ajax call?

8:42 hyPiRion: what do you mean by "this key"?

8:43 jph-: sid_, have a compojure route that replies with (session/get :user-id)

8:43 but the ajax caller would have to be authenticated

8:43 since it's session/cookie based

8:44 sid_: jph_, I'll try and reply if it works

8:44 jph-: sid_, you could also call {{ user-id }} in a selmer template

8:45 or whatever templatingyour using

8:45 sid_: jph_, I'm using selmer, but I have to make the get call in js file

8:45 jph-: its more about where you want to use :user-id

8:46 are you using luminus?

8:46 sid_: jph_, yes, I'm using luminus

8:46 jph-: ie

8:46 in app/views/layout.clj

8:46 i have

8:46 :username (session/get :username))

8:46 in my (assoc params ...)

8:47 so in my selmer templates

8:47 i can now use {{ username }}

8:47 sid_: yes, I made :user-id in app/views/layout.clj

8:47 jph-: so the var is visible in templates

8:47 if you purely want it in an ajax call

8:47 sid_: but can I directly use {{user-id}} in my js file?

8:47 jph-: it'd be somethin glike

8:47 (GET "/ajax/user-id" [] (session/get :user-id))

8:48 in your defroutes

8:48 somewhere

8:48 sid_: I've used selmer tags in static html pages

8:48 jph-: so your js ajax call requests /ajax/user-id to get the user-id

8:49 sid_: thanks jph_, I''ll try it

8:50 jph-: good luck

8:51 sid_: :)

8:55 jph-: "GoDaddy has not added their newer G2 CA server to the default java truststore - causing default java installations to not trust it's authority, and hence, does not trust your chained certificate."

8:55 h (session/get :user-id)

8:55 <jph-> but the ajax caller would have to be authenti

8:55 woops

8:55 https://stackoverflow.com/questions/18746565/godaddy-ssl-cert-not-working-with-java

9:10 xsyn: how do I get the first record that appears in an incanter set for all records?

9:11 so if I have duplicates, I just want all of the first ones?

9:23 clgv: xsyn: (-> ds :rows distinct)

9:23 noidi: I wrote a blog post showcasing some cool REPL tools: http://dev.solita.fi/2014/03/18/pimp-my-repl.html

9:32 _bart: Freesound.org is so unstable right now, continuously on- and offline.

9:32 (using it with Overtone)

9:36 xsyn: clgv: thanks will give it a try

9:38 AeroNotix: best way to deploy an uberjar to archiva or w/e?

9:38 I've seen lein deploy-uberjar, looking for alternatives.

9:38 mdrogalis: AeroNotix: Archiva's not meant to be used with uberjars, just jars.

9:38 AeroNotix: mdrogalis: I understand this, obviously.

9:39 mdrogalis: AeroNotix: Not obvious to me. :P

9:42 mpenet: AeroNotix: you can use lein deploy and pass the .jar + pom as arguments

9:42 clgv: AeroNotix: you could create the pom for the normal lib and modify it for the uberjar and then upload both manually via the webui - provided you are sure you actually need it there

9:43 AeroNotix: clgv: it's just a nice way to deploy to boxen

9:43 mpenet: AeroNotix: see lein help deploy

9:43 AeroNotix: mpenet: cheers

9:45 clgv: mpenet: awesome

10:13 mskoud: Looking to the functional way of adding new items to a map like this: {:a 2 :b "test" ...} => {:a 2 :a_x "y" :b "test :b_x "test2" ...}

10:14 jcromartie: ,(assoc {:a 2 :b "test"} :a_x "y")

10:14 clojurebot: {:a_x "y", :a 2, :b "test"}

10:14 jcromartie: ,(assoc {:a 2 :b "test"} :a_x "y" :b_x "test2")

10:14 clojurebot: {:b_x "test2", :a_x "y", :a 2, :b "test"}

10:14 jcromartie: ,(merge {:a 2 :b "test"} {:a_x "y" :b_x "test2"})

10:14 clojurebot: {:a_x "y", :b_x "test2", :a 2, :b "test"}

10:15 mskoud: i need to add a new key ?_x for all existing keys.

10:15 jcromartie: how are you going to derive the values?

10:15 that's easy enough BTW

10:16 mskoud: a function will return the modified value.

10:17 jph-: anything i could use for queueing (fifo) functions? i can do a max of 4/sec

10:17 jcromartie: ,(let [m {:a 2 :b "test"} f #(str % "_2")] (merge m (into {} (map (fn [[k v]] [(keyword (name k) "_x") (f v)]) m)))

10:17 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

10:18 jcromartie: more like

10:18 ,(let [m {:a 2 :b "test"} f #(str % "_2")] (merge m (into {} (map (fn [[k v]] [(keyword (str (name k) "_x")) (f v)]) m))))

10:18 clojurebot: {:b_x "test_2", :a_x "2_2", :a 2, :b "test"}

10:18 mskoud: Thanks!

10:19 jcromartie: into tends to be a handy tool when transforming collections

10:19 actually

10:19 ,(let [m {:a 2 :b "test"} f #(str % "_2")] (into m (map (fn [[k v]] [(keyword (str (name k) "_x")) (f v)]) m)))

10:19 clojurebot: {:a 2, :b "test", :a_x "2_2", :b_x "test_2"}

10:19 jcromartie: just skip the merge

10:20 pjstadig: i want to set the filePermissions element as described here https://github.com/jcaddel/maven-s3-wagon/wiki/Permissions which says to set it in ~/.m2/settings.xml, but i want to set it in my project.clj

10:20 is that possible?

10:24 mskoud: works like a charm. any good references to articles learning this style of programming.

10:40 jstew: mskoud: Are you new to functional programming?

10:40 mskoud: I am, and this helps a lot: https://leanpub.com/fp-oo

10:40 mskoud: yes. started to look at clojure some months ago...

10:41 pythonjohn: morning clojurins

10:41 *clojurians

10:41 I have a very general question to pose to the flor

10:41 jstew: mskoud: Plus, writing some clojure every day helps. Even if just a little bit. 4clojure.org, project eueler, and google code jam is what I suggest.

10:42 dnolen_: pythonjohn: just ask your question

10:42 pythonjohn: coming from the land of oo, I am always tempted to view my projects as several smaller parts (classes), each with it's own small job to do

10:42 when I am organizing a clojure namespace

10:42 jcromartie: pythonjohn: you should continue to do so

10:42 pythonjohn: how should I best organize my files

10:43 should I view them as each smaller parts of a whole, like classes

10:43 that is my habit

10:43 i am trying to understand the best way to organize things

10:43 AeroNotix: pythonjohn: use lein and go and read some popular projects.

10:43 pythonjohn: okay

10:43 jstew: pythonjohn: your namespaces in clojure are kind of like classes in OO. Classes are often little more than a namespace for grouping a set of methods.

10:43 pythonjohn: that is kind of what I was thinking

10:43 but thought I might be way off

10:44 jcromartie: namespaces are for preventing collisions, not for imposing hierarchy, but a first pass at translating a OO approach into Clojure, will probably end up with namespaces that look a lot like classes

10:44 and there's nothing wrong with that

10:44 pythonjohn: so that is normalish

10:44 I am trying to break old habits

10:44 slowly

10:44 wunki: anyone have an idea how you would do a "SELECT COUNT(id) FROM table" in Korma?

10:45 pythonjohn: thanks for the input everyone

10:45 I am ging to read more github projects to get a concrete idea of the layout

10:45 of some experienced folks

10:46 seangrove: wunki: Sadly, I can't deep link into the page, but it's literally covered on the docs site (aggregate (count :*) :cnt :status)

10:46 http://sqlkorma.com/docs

10:46 dnolen_: You get a chance to checkout the 'glueing' concept?

10:47 wunki: seangrove: aggregate count adds it on a row basis, I just want to have the amount of rows

10:47 dnolen_: seangrove: sorry, haven't yet

10:47 augustl: pythonjohn: I tend to think about what I need to require. If two files requires the same things, perhaps they should be one file?

10:47 s/files/namespaces

10:48 pythonjohn: that is a good point

10:48 I will try to keep that in mind for sure

10:49 augustl: pythonjohn: this code used to be two files, for example, to separate run and export which are very different in nature https://github.com/augustl/augustl.com/blob/master/src/augustl_com/cli.clj

10:49 but they are also very similar :)

10:49 jstew: Clojure is so much fun, that I want to find a job working with it, once I become more proficient.

10:50 AeroNotix: damn right

10:50 I have a clojure jobb

10:50 seangrove: wunki: Let me check the sql output of that code...

10:50 * jcromartie does too

10:50 jcromartie: we have a lot of people using it

10:51 AeroNotix: it's awesome when I see coworkers struggling with tooling and/or language issues and I breeze by with Clojure

10:51 such a great platform to develop on

10:51 the JVM is really mature

10:51 I mean, their struggling is not awesome, but that I don't struggle is. :)

10:51 jstew: I keep seeing more and more people wanting clojure experts, too. The past couple of years it has seemed to catch on a lot faster.

10:51 seangrove: AeroNotix: I was going to say, careful with that Schadenfreude...

10:52 jstew: AeroNotix: I struggle with rubygems on a daily basis. Ruby is fun, but rubygems is a horrid mess. Ruby devs don't seem to care about dependencies at all.

10:54 seangrove: wunki: (korm/dry-run (korm/select db/users (korm/aggregate (count :id) :cnt))) => dry run :: SELECT COUNT("users"."id") AS "cnt" FROM "users" :: []

10:54 mskoud: How do i include the old clojure.contrib.strint string interpolation library in Clojure 1.5?

10:54 seangrove: wunki: Isn't that the sql you asked for?

10:54 wunki: seangrove: it is, strange, when I tried it I got every row back from the db :/

10:55 seangrove: let me try it out again

10:55 seangrove: wunki: No worries

10:55 stuartsierra: mskoud: I think it's in core.incubator

10:56 mskoud: indeed it is :-) thanks!

10:56 wunki: seangrove: yup, that was it... my mistake was that I did the following `(select users (aggregate (count :*) :cnt))`

10:57 seangrove: thanks for the help

10:57 seangrove: wunki: No problem, happy to help!

11:06 jjttjj: anyone know of a more advanced core.async tutorial that talks about the pubsub/mult, etc, or a project on github that uses these?

11:17 jstew: People who have clojure jobs: Out of curiousity, what sorts of things do you work on every day?

11:18 jcromartie: web apps, lots of API interop

11:18 seangrove: Product, generally.

11:18 jcromartie: data ingest

11:18 zspencer: web apps

11:18 jcromartie: data conversion

11:18 zspencer: and services supporting the web apps

11:18 jstew: Nice. These are things that I enjoy doing also. Back end services.

11:18 hyPiRion: parsing complex formats specified by another format at runtime

11:19 * hyPiRion is probably an outlier in that regard.

11:19 zspencer: I also use clojure daily to make myself feel smarter than my ruby/javascript programmer friends

11:19 which is probably the most important feature

11:19 seangrove: jstew: Front-end dev is becoming unbelievably better these days

11:20 Om, reusable components, tooling, core.async, and some new patterns... it's fantastic.

11:20 pjstadig: zspencer: you have ruby/javascript programmer friends‽</horror>

11:20 jstew: Thanks for your responses :)

11:21 jcromartie: I used to be the one asking that question

11:21 cbp: I use clojure mostly for clojurescript at work

11:21 but do some backend services on my own time

11:21 jstew: seangrove: I have seen some wicked demos involving core.async and Om. I work with a guy on the jQuery core team and he was left scratching his head but was amazed with the performance.

11:22 seangrove: jstew: The tooling, layout management, and reusable components are what get me giddy these days, but it's all fantastic fun.

11:39 danno1: Dumb Q: Ifn is an interface that represents functions...right?

11:40 llasram: IFn, yes

11:40 danno1: thanks, llasram

11:40 also, in https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java

11:41 What is:

11:41 static public interface L{long invokePrim();}static public interface D{double invokePrim();}static public interface OL{long invokePrim(Object arg0);}static public interface OD{double invokePrim(Object arg0);}static public interface LO{Object invokePrim(long arg0);}static public interface LL{long invokePrim(long arg0);}static public interface LD{double invokePrim(long arg0);}static public interface DO{Object invokePrim(double arg0);}static public

11:41 methods called DLL, DOD, DLO, DLD, etc.

11:41 pjstadig: those allow you to pass unboxed primitive arguments to functions that are compiled to take them

11:41 clgv: danno1: those are for primitive functions

11:41 Bronsa: danno1: mostly implementation details for primitive taking functions

11:42 danno1: oh yeah

11:42 derp on me

11:42 haha

11:42 clgv: that's why primitive functions have limitations on the number of arguments...

11:42 danno1: cigv: interesting

11:48 Simple Q Again:

11:48 I can create a list that is like a List in Java/Scala/Groovy: (list 1 2 3 4)

11:49 but if I create a list purely as (1 2 3 4) it is expecting the first element to be a IFn?

11:49 since it is evaluated immediately?

11:49 joegallo: ,(= '(1 2 3 4) (list 1 2 3 4))

11:49 clojurebot: true

11:50 joegallo: danno1: that's right, (1 2 3 4) is going to treat 1 as a fn

11:50 danno1: Boom! Nice! joegallo.

11:50 joegallo: which you don't want, so typically you'd see the list quoted, like above

11:50 cbp: If you don't quote it the first element must be a function, macro or java class

11:50 or special form

11:50 clgv: ,(1 2 3 4)

11:50 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

11:50 clgv: ^^

11:51 danno1: cbp & clgv: Noting. Thank you

11:51 napper2: ,(source recur)

11:51 clojurebot: Source not found\n

11:51 justin_smith: napper2: I think recur is a symbol that is bound inside loop / fn?

11:51 it isn't bound at the top level

11:52 clgv: napper2: recur is a special form

11:52 napper2: thanks for the corrections

11:53 clgv: ,(keys (clojure.lang.Compiler/specials))

11:53 clojurebot: (deftype* new quote & var ...)

11:53 clgv: ,(println (keys (clojure.lang.Compiler/specials)))

11:53 clojurebot: (deftype* new quote & var ...)\n

11:53 clgv: &(keys (clojure.lang.Compiler/specials))

11:53 lazybot: java.lang.SecurityException: You tripped the alarm! class clojure.lang.Compiler is bad!

11:53 clgv: :/

11:53 justin_smith: ,(doc recur)

11:53 clojurebot: Gabh mo leithscéal?

11:53 clgv: well, check yourself^^

11:54 ,((clojure.lang.Compiler/specials) 'recur)

11:54 clojurebot: #<Parser clojure.lang.Compiler$RecurExpr$Parser@b31bff>

11:54 cbp: (doc recur)

11:54 clojurebot: Pardon?

11:54 justin_smith: ,(do (use 'clojure.repl) (doc recur))

11:54 clojurebot: Titim gan éirí ort.

11:54 justin_smith: hrm

11:54 jstew: http://clojure.org/special_forms#Special Forms--(recur exprs*) <-- there :)

11:54 cbp: I thought all the special forms had some sort of docs

11:55 seangrove: I think doc is special-cased. But clojurebot's always a bit loopy

11:55 clgv: justin_smith: it is neither a def, defn or defmacro - hence there is nothing for "doc" to find ;)

11:55 cbp: maybe clojurebot is just being silly

11:55 jconnolly: whoa clojurebot speaks irish?

11:55 justin_smith: cbp: doc recur works in my repl

11:55 clgv: ^^

11:55 clgv: ah right

11:56 cbp: &(doc recur)

11:56 lazybot: ⇒ "Special: recur; Evaluates the exprs in order, then, in parallel, rebinds\n the bindings of the recursion point to the values of the exprs.\n Execution then jumps back to the recursion point, a loop or fn method."

11:56 cbp: lazybot: botsnack

11:56 lazybot: cbp: Thanks! Om nom nom!!

11:56 clgv: $source doc

11:56 lazybot: Source not found.

11:56 clgv: $source clojure.repl/doc

11:56 lazybot: clojure.repl/doc is http://is.gd/qrh0LE

11:58 danno1: ,(first (list 1 2 3 4))

11:58 clojurebot: 1

11:59 justin_smith: danno1: in my experience I don't see list used very often - usually it's either a [] vector literal or '() quoted sequence

12:00 ,(map class (list 1 2 3) '(1 2 3))

12:00 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/class>

12:00 danno1: justin_smith: I kind of figured that vector is used more

12:00 justin_smith: ,(map class [(list 1 2 3) '(1 2 3)])

12:00 clojurebot: (clojure.lang.PersistentList clojure.lang.PersistentList)

12:01 justin_smith: yeah, but notice '(1 2 3) is the same datatype as (list 1 2 3)

12:01 danno1: danno1: since function args are vectors

12:01 justin_smith: yes

12:15 jph-: how might i rewrite this in clojure using interop? CurrencyUnit.registerCurrency("TST", 991, -2, Arrays.asList("TS"));

12:15 in particular the Arrays.asLists bit confuses me (no java background)

12:16 cbp: (Arrays/asList "TS")

12:16 jph-: oh, duh

12:16 cbp: provided you import java.util.Arrays

12:16 jph-: k

12:16 hyPiRion: jph-: it just converts a vararg to a list of those values

12:16 you can just use ["TS"] instead

12:16 cbp: Ah

12:40 seangrove: bbloom: How'd the talk last night go?

12:47 dnolen_: seangrove: I was there, was good!

12:49 seangrove: dnolen_: Did he come off as researcher-executor or crazy-shouty-rambling-homeless-man?

12:50 dnolen_: seangrove: neither, solid talk :)

12:52 locks: haha

12:53 gfredericks: https://github.com/budu/lobos/blob/master/src/lobos/connectivity/jdbc_2.clj

13:48 does java.jdbc not have anything for upserts anymore?

13:54 amalloy: justin_smith: i use list in function position pretty rarely, it's true, but not never. where the function list *does* see use is in stuff like (map list xs ys)

13:55 and like, okay, in that specific context vector is still more common than list. but i claim list is good sometimes anyway

13:56 turbofail: hm. i can't remember the last time i used list at all

13:56 rasmusto: ,(apply map list [[1 2 3] [4 5 6]])

13:56 clojurebot: ((1 4) (2 5) (3 6))

13:56 rasmusto: I do that all the time

13:56 technomancy: sometimes I apply list. I don't think I ever have called it directly.

13:57 jstew: any reason you would want a list of lists rather than vectors when mapping 2 vectors?

13:58 turbofail: dunno. i'm sure you could come up with a reason

13:58 i just can't think of one, and never felt the need to do it

13:59 llasram: jstew: Most of the "lists" you see e.g. in the Clojure REPL are actually lazy sequences, which are, well, lazy

13:59 So that's a reason to prefer them

14:02 amalloy: technomancy: why would you apply list? that's what list* is for

14:03 rasmusto: ,(doc vector*)

14:03 clojurebot: No entiendo

14:03 amalloy: i mean, obviously the results are a little different: (apply list 1 2 3 xs) forces all of xs, where (list* 1 2 3 xs) doesn't force any of it

14:04 jstew: TIL about list*

14:11 bts-: anyone know of a way to get prep-tasks to run before loading my dev profile's source-paths in lein? my dev source-paths depends on thrift class compiliation done by prep-tasks

14:12 justin_smith: amalloy: yeah, not claiming it is useless, just mentioning that it is fairly rare in code I see

14:13 amalloy: bts-: really? shouldn't it be known statically where the classes output by thrift will go?

14:16 bts-: amalloy: i know where the classes will go, but i need to have them compiled before i load the code in my dev source-paths. lein seems to load the dev source-paths before executing prep-tasks

14:18 amalloy: and so I get a ClassNotFoundException

14:24 technomancy: bts-: nothing gets loaded by default unless you ask for it

14:28 Bronsa: technomancy: any idea why mixing AOT compiled deftypes with reloading its definition doesn't work in a lein repl but works when from java -cp `lein classpath` clojure.main?

14:30 bts-: technomancy: from the docs "By default the :dev, :provided, :user, :system, and :base profiles are activated for each task"

14:31 technomancy: is there a way to get prep-tasks to run without loading :dev?

14:34 amalloy: Bronsa: i wouldn't expect it to work in either case, really. do you have a simple example of making it work?

14:34 Bronsa: amalloy: one sec

14:35 amalloy: like, if you just `lein classpath` without ever running `lein compile`, i'm not sure the AOT ever happens, so you wouldn't see the usual issues

14:35 Bronsa: amalloy: I'm calling `compile`

14:41 bts-: technomancy: as a workaround I currently temporarily comment-out :dev's source-paths if the thrift classes aren't yet compiled

14:44 Bronsa: amalloy: http://sprunge.us/cjeS

14:45 technomancy: bts-: those profiles are active, but that just places them on the classpath. it doesn't load anything.

14:45 Bronsa: amalloy: http://sprunge.us/jTYS a bit cleaned up

14:47 technomancy: Bronsa: hm; very strange. I don't do AOT at not-deploy-time or deftype, so I'm also surprised that works.

14:48 amalloy: Bronsa: does your call to compile in the first example actually generate classfiles? i don't have a ton of experience with AOT, and especially not with doing it by hand, but the most obvious difference to me is that lein is implicitly running compile before repl in the second case and not the first

14:48 well, i guess that depends what's in your project.clj

14:48 Bronsa: amalloy: it's straight out of lein new test

14:49 amalloy: yes it's generating classfiles btw

14:50 technomancy: amalloy looks like there's something going wrong with how leiningen/nrepl handles classloaders

14:54 bts-: technomancy: okay that makes sense. I guess my problem then is that I have REPL utility functions in dev/user.clj that I only want to load after prep-tasks. any recommendation to achieve that?

14:56 hiredman: Bronsa: is ./classes in `lein classpath`?

14:57 I suspect lein compiles to target/classes

14:57 technomancy: bts-: oh, user.clj is loaded by clojure itself; that's outside lein's control. depending on what you're doing, runtime resolve might be a good option there

14:58 Bronsa: hiredman: let me try binding *compile-path* to target/classes then

14:59 bts-: technomancy: awesome -- thanks!

15:00 Bronsa: hiredman: that makes it fail, good catch

15:00 technomancy: not a lein bug then, sorry for the fuss

15:02 technomancy: no worries

15:08 dnolen_: http://mreinhold.org/blog/jdk8-ga

15:08 Cr8: hum

15:15 Bronsa: hiredman: amalloy anyway, do you know of any good reason why that behaviour should be expected or am I right in assuming that this limitation should be considered a bug?

15:16 hiredman: which behaviour?

15:16 Cr8: the stuff in the core.async docs about >! and >!! returning true on success doesn't seem to be accurate

15:16 amalloy: the limitation that...if you reload code containing AOTed deftypes, references to the old class stick around?

15:17 dacc: dnolen_: implications for clojure? nice to see permgen go.

15:17 dnolen_: dacc: for ClojureScript users the appearance of Nashorn is big

15:17 tbaldridge: Cr8: explain?

15:18 Bronsa: amalloy: hiredman specifically that a class name gets resolved to the AOT class rather than to the dynamically compiled one

15:18 dnolen_: dacc: I suspect when Nashorn perf enhancements land, and we improve the CLJS compiler a bit, Nashorn could be a pretty sweet scripting solution for Clojure users

15:18 dacc: in the long wrong, perhaps Clojure can leverage the invokeDynamic stuff which finally not slow

15:19 jcromartie: the long wrong :)

15:19 I like that idea

15:19 dnolen_: s/long wrong/long run

15:19 hiredman: Bronsa: it is an issue that is known to those in the know, but I don't know what the specifics of it our (how why it happens, etc)

15:20 Cr8: tbaldridge: https://www.refheap.com/61482

15:20 dacc: dnolen_: so compiling clojure to javascript to run on nashorn? seems like you'd just script jvm programs using the clojure compiler itself, no?

15:20 tbaldridge: Cr8: what version of core.async?

15:20 amalloy: Bronsa: i mostly regard AOT as a mysterious black box in which all manner of sad things become routine. i don't know which sad things are bugs and which are not

15:21 Cr8: "0.1.267.0-0d7780-alpha", just the one from the README

15:21 should I be building master? :)

15:22 tbaldridge: Cr8, go read the README again :-P

15:22 dnolen_: dacc: not saying it will actually work out - but worth exploring, jjs will likely optimized to start as quickly as possible - not necesarrily really true for Java

15:22 hiredman: amalloy: too long for an OH

15:22 tbaldridge: Cr8: that's my bad, I never updated the README

15:23 Cr8: ah

15:23 amalloy: hiredman: remove all the verbs? I AOT box sad things. sad things bugs

15:23 tbaldridge: Cr8: we changed the value returned from put in the latest version. So the docs you were reading are correct, it's just the version in the README was too old

15:23 Cr8: all fine now :)

15:24 hiredman: amalloy: works for me

15:24 Cr8: that makes sense

15:31 abaker: so I noticed that in clojure java.jdbc implementation, the macros like with-connection and such leverage private vars, and then rebind *db* -- is this considered good practice?

15:32 jcromartie: abaker: that's actually deprecated now

15:32 abaker: jcromartie: which is, the entire library or just that implementation?

15:32 jcromartie: wait wait

15:33 yeah

15:33 that style

15:33 all of those macros live in clojure.java.jdbc.deprecated now

15:33 and the functions just take a connection instead

15:34 you generally need a very good reason to depend on dynamic vars

15:34 abaker: yeah, I've seen it on the' do not use list' before.. I'm writing a with-connection style macro, and debating if I even need a macro, and if I do, how to go about it

15:34 like with-open, it would just be to standardize closing out of resoruces

15:34 cbp: abaker: god no, no globals for database connections and certainly no dynamic vars

15:35 jcromartie: there's nothing simpler than a parameter to a function

15:36 ToBeReplaced: abaker: consider stuartsierra's component library for start/stop standards

15:37 abaker: yeah that left me wondering why any of the with- style macros exist in the first place, like with-open, afaict, it's grown a lot to avoid swallowing exceptions all for the one purpose of making sure the stream gets closed

15:37 jcromartie: abaker: with-open has good reason to exist

15:38 stuartsierra: Unlike many of the with- macros, with-open uses lexical scope, not dynamic binding.

15:40 katratxo: cemerick: ping?

15:40 cemerick: just poking you on the friend change proposal

15:42 stuartsierra: abaker: here's my point of view on that pattern. http://stuartsierra.com/2013/03/29/perils-of-dynamic-scope

15:43 abaker: ah, that's what i was looking for, thanks stuartsierra

15:44 stuartsierra: You're welcome

15:51 cemerick: katratxo: responded on the gist. Probably better to just open an issue in the future. :-)

15:56 katratxo: cemerick: sure, will to that next time, i'll open an issue

16:00 mikerod: I found something fun out.

16:01 satisfies? seems to be a bit slow when checking on things that are not implementing an interface

16:02 ,(time (dorun (map #(satisfies? clojure.core.protocols/CollReduce %) (repeat 1000000 "hi"))))

16:02 clojurebot: Execution Timed Out

16:03 Bronsa: mikerod: that's because it has to lookup in the impl map not only the class, but all the super classes/interfaces

16:03 mikerod: slows down at lot near 1 million checks. I profiled it, looks like most of the time is spent in java.lang.Class#getInterfaces

16:04 I would have thought this was fast?

16:04 Class#getInterfaces is slow?

16:04 I know it is a harder search when it doesn't satisfy it or directly implement an interface generated by the protocol

16:06 I'm just surprised by this being a performance hit like this

16:06 we had a tight loop that had a `satisfies?` in a precondition

16:08 Bronsa: mikerod: I remember remiving a satisfies? check in tools.reader improved perf by 40x

16:08 removing*

16:09 mikerod: Bronsa: That doesn't surprise me now that I've seen the damage it can do :P

16:09 I was just trying to get a good error message when a fn was called on a obj that didn't satisfy the required protocol. I think I'll have to explore a different alternative

16:09 Bronsa: mikerod: I suspect a small cache in find-protocol-impl could speed-up significantly satisfies?

16:10 mikerod: *that's why I had the satisfies? in the :pre-condition block

16:10 Bronsa: I'd imagine so

16:11 Bronsa: mikerod: you can try (with-redefs [find-protocol-impl (clojure.core.cache/lru find-protocol-impl)] ..) and see how it goes :P

16:12 s/cache/memoize

16:12 mikerod: Bronsa: hah, well that is one alternative I suppose

16:12 that'd be interesting...

16:12 amalloy: Bronsa: but protocols can be extended at runtime. i assume that's why there's not a cache already

16:13 Bronsa: amalloy: fair enough

16:13 mikerod: amalloy: oh, duh I didn't think that way about it

16:13 good point

16:13 Bronsa: amalloy: well, extend could invalidate that cache

16:13 mikerod: I guess, if I wanted to try calling a protocol fn on something and I just wanted a good error message, I could try-catch it

16:13 amalloy: mikerod: you'll never be able to be sure though

16:14 mikerod: amalloy: I know, it could claim to satisfy, but not really impl the fn.

16:14 amalloy: maybe it does implement the protocol, but its implementation involves throwing an exception that looks the same as dont-implement-this-protocol

16:14 mikerod: amalloy: yep, lose-lose situation? :P

16:14 amalloy: Bronsa: that sounds plausible to me

16:15 Bronsa: amalloy: I'm doing something similar in tools.analyzer for resolving classes, it's working fine

16:16 mikerod: The one thought I still had, how is Class#getInterfaces where I'm seeing most of the time spent though? I thought that would be fast. A native method in the Class class.

16:17 amalloy: mikerod: anything in Class or java.lang.reflect.* is slow

16:17 mikerod: amalloy: I thought that was true for java.lang.reflect, I didn't think so for Class.

16:17 it is hard to search on this topic it seems

16:17 amalloy: anything you do with Class is reflection

16:18 except using == to compare them, simple stuff like that

16:18 it's just in java.lang because getClass() is part of Object, i suspect; otherwise it would be in reflect

16:18 mikerod: amalloy: that is where I wasn't making the connection. I thought an object has a concrete reference to it's Class class obj. So I thought the information on the Class class were just direct references; that sort of thing.

16:19 I see.

16:22 Bronsa: oh well, memoizing find-protocol-impl accounts only for a 2x speedup, that's sad

16:23 mikerod: :(

16:27 hiredman: Bronsa: but now if someone extends a protocol find-protocol-impl doesn't work correctly

16:27 amalloy: hiredman: i already waved that flag. he points out that extend could invalidate the cache, if the cache were useful enough to actually include in clojure

16:28 hiredman: amalloy, Bronsa: oh sure, huh

16:30 mikerod: if you make an actual protocol fn that returns true on some objects and false on other objects, it will be faster than satisfies?, because you get a little inline cache

16:31 (defprotocol Yo (yes? [whatever])) (extend-protocol Yo Object (yes? [_] false)) then have it return true for your thing

16:32 amalloy: huh. i just found this in the source for java.lang.Class: throw (InstantiationException) new InstantiationException(...);

16:32 why would you ever cast a constructor's result to its own class?

16:32 oh, i see. i parsed it wrong

16:32 it's really: throw (InstantiationException) new InstantiationException(...).initCause(e);

16:36 hiredman: I am skeptical of the value of speeding up satisfies?, guarding a dynamic polymorphic function with those kind of guards seems like an anti-pattern, the same way in java people frown and using instanceof checks everywhere (and I know someone is going to point out the clojure source does that everywhere, but that is bootstrapping a dynamic language on a static runtime, it happens)

16:36 jcromartie: how slow are you talking?

16:38 mikerod: hiredman: that is a good idea

16:39 hiredman: I haven't really explored the idea of implementing it in a way that would be checkable and inline cacheable

16:40 I like this idea, for my use cases at least

16:42 hiredman: it is unlikely that satisfies? as a general function would every keep up with the performance of an actually protocol function, given the current impl and the likely future path of protocol fns (invokedynamic switch points)

16:43 maybe if clojure went full indy replacing ifns with method handles

16:44 mikerod: interesting thoughts

16:50 coventry: Is there a way to get a java dump on a clojure process on OS X, as in the following URL? "kill -QUIT <pid>" doesn't seem to have any effect. http://publib.boulder.ibm.com/infocenter/javasdk/v5r0/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.50%2Fdiag%2Ftools%2Fjavadump_trigger.html

16:51 amalloy: coventry: like a heap dump?

16:51 jmap for heap dumps, jstack for stacktraces

16:52 ordnungswidrig2: coventry: it's like for every java vm instance, clojure does not make a difference

16:53 justin_smith: coventry: also in jvisualvm you can look at / collect stats interactively at runtime and at your option trigger a dump

16:53 coventry: amalloy: sweet, thanks.

16:53 justin_smith: jvisualvm comes with java

16:53 jcromartie: jvisualvm <3

16:53 amalloy: yourkit for life

16:53 mikerod: yourkit cost $$

16:53 visualvm has done alright :P

16:54 amalloy: free license for open-source projects. and if you use it at a real company, it's worth the money

16:54 mikerod: I didn't know that. I'll have to check it out and see the difference.

16:54 technomancy: it's only free if you advertise for them

16:54 amalloy: fwiw coventry, i've never heard of a Javadump in my life. must be some weird thing specific to the IBM jdk

16:55 technomancy: gratis, rather

16:55 amalloy: technomancy: true. on the one hand, i've never actually done that; on the other, here i am in #clojure

16:55 technomancy: ~guards

16:55 clojurebot: SEIZE HIM!

16:56 mikerod: amalloy: so you've fulfilled your duties

16:56 using a profiler on nrepl always confuses me

16:58 it uses several threads and I don't suppose I know how they are being used

16:59 justin_smith: seems like clojure always has a set of threads (for agents I think?)

16:59 ordnungswidrig2: mikerod: +1

16:59 mikerod: justin_smith: it appears to be agents indeed

17:07 ordnungswidrig: there was a blog post on symbols as functions or like that. some days ago

17:08 does anybody have a pointer? I wan't to resolve a function at runtime, not earlier

17:08 amalloy: i mean, the function is named resolve

17:09 justin_smith: ,('symbol '{symbol value}) ; at first I thought ordnungswidrig meant this

17:09 clojurebot: value

17:09 amalloy: as usual, consider carefully whether you really need to do this: namespaces are great at holding functions you refer to statically; delayed stuff for runtime is often better held in a map anyway

17:09 ordnungswidrig: amalloy: I'm playing with user ns and dev

17:10 and refresh-all.

17:10 like in stuarts workflow

17:10 I don't want to refer to my system-init function from user because this might break lein repl startup

17:17 chare: looking for something to host a web app that allows some free use and free db storage

17:17 what do you guys use

17:17 jcromartie: Amazon can be free

17:17 EC2

17:17 you just don't want to go over the limits

17:18 dacc: i thought free tier was only for a year?

17:18 chare: what do you mean free

17:18 since when is ec2 free

17:18 dacc: chare: i think you can have a free micro ec2 for the first year of your account

17:18 jcromartie: http://aws.amazon.com/free/

17:19 chare: a year is not my definition of free

17:19 jcromartie: yes 1 year after signing up for AWS

17:19 TINSTAAFL

17:20 chare: jcromartie damn it

17:20 jcromartie: I'm assuming you're talking about hosting a Clojure web app

17:21 if you can package it as a .war then there are some free Java app hosts

17:21 technomancy: he's asking about an erlang web app, he just didn't like the answers he got in #erlang

17:21 jcromartie: well yeah you're pretty much screwed there

17:23 robink: I've got a Java method that's supposed to return a class (RtfHeader), but instead Clojure is reporting that RtfHeaderFont (the child class) is being returned.

17:23 chare: come on guys there needs to be an answer, heroku gives you a free instance, but no free db storage, so its like half way there

17:23 robink: Am I doing something wrong?

17:23 Rather, an instance of class RtfHeader.

17:23 jcromartie: chare: define "web app" and "db" first

17:24 chare: what do you mean?

17:24 isn't that standardized

17:24 amalloy: jcromartie: TANSTAAFL, man. i don't know how heinlein would feel about someone using such a fancy-pants word as "isn't" instead of "aint"

17:24 akhudek: chare: there is appengine that has a permanent free tier

17:24 chare: but you might have to work a bit to fit your app to their api

17:25 chare: akhudek: google app engine doesn't support erlang ><

17:25 jcromartie: chare: no it's not standardized

17:25 akhudek: oh, I didn't realize that they were serious about that

17:25 haha

17:25 chare: akhudek: is google app engine the only one that has a true free tier?

17:25 akhudek: chare: no clue

17:25 chare: akhudek: what do you mean you saying that erlang isn't serious?

17:25 jcromartie: some people mean a few PHP files, some people mean a whole VM, some people mean a .war file

17:26 akhudek: chare: I thought they were kidding that you were trying to host an erlang app is all

17:26 erlang is pretty cool

17:26 chare: akhudek: and even if i use clojure instead don't i have to use some messed up api involving some datastore thats not sql

17:27 jcromartie: chare: again, no free lunch

17:27 sorry

17:27 chare: google app engine uses some google datastore not sql right?

17:27 jcromartie: chare: any free host does so by minimizing what they give you via things like that

17:27 akhudek: chare: yes

17:27 jcromartie: key-value stores instead of free reign on a SQL DB

17:27 sdegutis: chare: I think Google Datastore is SQL right?

17:27 chare: pretty sure Google App Engine is just a wrapper around AWS btw

17:28 justin_smith: sdegutis: https://developers.google.com/appengine/docs/python/datastore/ it is nosql

17:28 chare: google app engine is not running on AWS no chance of that

17:28 sdegutis: chare: citation needed

17:28 akhudek: I mean there is https://developers.google.com/cloud-sql/

17:28 but it's not free

17:29 justin_smith: "most queries are eventually consistent"

17:29 chare: ok so in worst scenario i can use clojure with google's datastore?

17:29 technomancy: chare: heroku postgres has a free tier: https://addons.heroku.com/heroku-postgresql

17:31 sdegutis: Chasm: Yeah, you can do it, but you need to make sure your Clojure app runs fine on App Engine first, which it probably won't, seeing as it's Java.

17:31 chare: Yeah, you can do it, but you need to make sure your Clojure app runs fine on App Engine first, which it probably won't, seeing as it's Java.

17:31 Chasm: sorry about that

17:34 devth: any SFW-filter-type libs out there in clojure land? could be very simple or clever. i was surprised to not find much via google.

17:35 TimMc: devth: SFW = Safe For Work?

17:35 devth: yeah. and by that i mean detect and filter out NSFW words

17:38 amalloy: (remove #{"butt" "butts"} words) ;; prototype

17:38 cbp: eheheheh

17:38 sdegutis: amalloy: shouldn't it also allow some kind of regex?

17:38 amalloy: sdegutis: i don't want to make the clbuttic mistake

17:38 sdegutis: touche

17:39 also haha

17:40 chare: ok I decided to try heroku

17:40 lets see if its actually free

17:40 benmoss: http://en.wikipedia.org/wiki/Scunthorpe_problem

17:40 devth: lol, yeah. we are having same convo in work irc :)

17:40 thought i’d check to see if there were existing libs

17:41 benmoss: this looks pretty legit http://kickjava.com/src/org/nemesis/forum/filter/FilterProfanity.java.htm

17:41 akhudek: benmoss: there is word boundary support in java regex

17:41 benmoss: lots of copyrights, CoolServlets.com

17:42 yedi: in om: i'm having trouble getting om/build to work -- https://www.refheap.com/61495

17:42 header doesn't show up

17:42 akhudek: if you tokenize the string you have to identify word boundaries anyways, but you additionally have the problem of putting it back together again if you need raw text at the end

17:42 yedi: when i replace `app` with `header` in the `start` fn, the header renders

17:54 TimMc: devth: Lost cause.

17:55 You're familiar with l33t-speak, yes?

17:55 devth: yes, well aware you can’t catch 100%

17:55 but 80% would be pretty nice

17:56 TimMc: I'm pretty sure it won't accomplish sh!t.

17:56 devth: haha

17:56 technomancy: is the goal to stop people from using objectionable language or just to keep people from seeing it who don't want to?

17:56 devth: so actual use-case is i have a chat bot, and one of its features is urban dictionary lookups. half the time they’re pretty dirty

17:56 benmoss: perhaps it is a societal problem

17:57 devth: of course it can’t filter out anything someone says. it’s irc.

17:57 but filting dirty UD defs would be fairly easy to hit 80% i think

17:57 TimMc: Urban dictionary is inherently NSFW.

17:57 technomancy: ah, so if the users creating the content aren't being directly exposed to the filtering it has a chance of working

17:57 TimMc: A lot of those definitions are NSFW without even having "NSFW words".

17:58 devth: yes, but some are just funny, and not dirty

17:59 TimMc: ...some.

18:00 But technomancy is right; if it is not obvious to the authors of the text that the text is being filtered/censored, it might be OK.

18:00 devth: right

18:01 TEttinger: I'm pretty sure there's a massive amount of things on urban dictionary that would easily bypass even the strictest NSFW filter, blocking someone from using his name "Sanchez" when there's a similar entry that's very NSFW would be a problem

18:02 amalloy: yeah, i think trying to somehow clean up urban dictionary is like dusting the contents of a garbage can

18:03 devth: all the most offensive things we’ve seen in chat would be very easy to filter with a simple blacklist

18:03 they don’t go for subtlety

18:03 amalloy: http://www.theatlantic.com/technology/archive/2013/01/ibms-watson-memorized-the-entire-urban-dictionary-then-his-overlords-had-to-delete-it/267047/

18:18 felher: If I want to put defrecords into a sorted-set, is (extend...)-ing Comparable the way to go?

18:20 amalloy: felher: Comparable is an interface, not a protocol, so you'd have to implement it as part of the defrecord definition

18:20 but using sorted-set-by, with a sensible Comparator, is more flexible

18:21 felher: amalloy: okay, got it, big thanks :)

18:22 amalloy: felher: note that functions implement Comparator, so you can use (sorted-set-by (fn [a b] ...) x y z)

18:28 felher: amalloy: ah, that is way cool. Thanks.

19:40 dacc: what's a good sequence technique for grouping certain subsequences? e.g. [1 2 \a \b 3 \c] -> [1 2 [\a \b] 3 [\c]] (chars are grouped, but not ints)

19:41 justin_smith: dacc: you could use reduce for that, maybe there is also a way to do it lazily using mapcat

19:41 amalloy: dacc: do you really want to have 1 and 2 as top-level elements, instead of single-element collections?

19:41 dacc: amalloy: yes

19:41 amalloy: justin_smith: mapcat can't work because he needs context

19:42 justin_smith: ahh yeah

19:42 hyPiRion: ,(mapcat (fn [[x :as xs]] (if (char? x) [xs] xs)) (partition-by char? [1 2 \a \b 3 \c]))

19:42 clojurebot: (1 2 (\a \b) 3 (\c))

19:43 hyPiRion: Not that I would have numbers as top-level elements, but that's how I'd do it.

19:43 dacc: cool, thanks

19:44 hyPiRion: Hmm, I had a neat idea just now.

19:45 but it wouldn't work, so no matter.

20:01 coventry: Is there an extension for light table which gives a more conventional REPL interface? It would be nice to have something which provides a transcript of commands entered and arbitrarily long output.

20:32 kanwei: has anyone else played with jdk8? a simple benchmark results in 2x worse performance for me

20:33 (time (reduce + (range 1e8))): jdk7 = 4.2s, jdk8 = 8.3s

20:35 xeqi: I don't trust benchmarks not run with criterium

20:36 yedi: any om devs know why the element attribute :selected might work differently then :className or :id? I can't get my :selected attribute on option to show up in this code: https://www.refheap.com/61515

20:36 but it works when i try it with :className or :id

20:40 beamso: kanwei: i get roughly similar times between jdk7 and jdk8

20:43 kanwei: beamso: mac?

20:44 beamso: yes

21:06 apricots: hi, when i run cider-jack-in, println from the repl prints to the repl, but println from within a ring handler doesn't seem to print anywhere. where does the stdouts go in the ring case?

21:12 ah nm

21:18 kras: Any good readme for clj-antlr? Sorry don't have a Java background

21:21 pmonks: kris - have you looked at instaparse? Unofficial Tagline: "It kicks parse".

21:21 *kras

21:22 Or are you looking to generate a pure Java parser?

21:24 kras: pmonks: I tired instaparse, but it doesn't suite my requirements

21:25 pmonks: ah ok

21:25 Shame - my experience with it has been euphoric.

21:25 kras: pmonks: I don't need a complex parser but one which is fast and efficient

21:25 My grammar is not very complex

21:25 pmonks: how do we ignore whitespace and newlines using instaparse?

21:26 TimMc: Oh neat, lein-voom has an option to help with deterministic builds (using the git commit time for any timestamps.)

21:27 pmonks: kras: I listed whitespace explicitly in my grammer

21:27 https://github.com/pmonks/lolcmis/blob/master/src/lolcmis/grammar.clj

21:27 Note: I'm a n00b to both clojure and instaparse, so it might suck

21:28 kras: pmonks: whitespace is ubiquitous in my grammar

21:28 I can't afford to list it in every rule

21:28 akhudek: kras: you can suppress whitespace in the generated parse trees, but you still need to put it in the grammar unfortunately

21:28 pmonks: Yeah it's common in mine too - I just list it and suppress it.

21:29 kras: pmonks: akhudek: I am actually surprised that this feature is missing. Basic for any good parser

21:30 Imagine writing a subset of C like grammar listing all the whitespaces

21:30 pmonks: Luckily for me that's not my use case. ;-)

21:30 LOLCODE syntax is rather different to C

21:31 gfredericks: today on a new project I made some utility functions in a .main namespace for organizing CLJ commands -- the idea being any var in your namespace with ^:command metadata becomes a CLI action. Then it's easy also to programmatically print out the options for a "help" task.

21:31 does that sound like a useful lib?

21:32 kras: pmonks: I see quite a few whitespaces in your grammar

21:32 gfredericks: s/CLJ/CLI/

21:32 pmonks: kras: yeah there are a few, but not "ubiquitous" I wouldn't say

21:32 And suppression helps a lot - it's awesome!

21:34 guns: gfredericks: That sounds logical; the arglists can also be displayed in usage: summary style

21:35 gfredericks: guns: ah right; and docstrings of course

21:36 guns: These commands aren't amenable to -s/--switches of course

21:37 gfredericks: yeah; I wonder if it could combine well with tools.cli

21:37 guns: tools.cli needs a higher level CLI composition framework

21:37 I only upgraded the parser

21:38 gfredericks: I guess if it was done simply enough it could be combine easily

21:39 e.g., the base functionality is [Namespace Keyword -> [String Any * -> Any]]

21:39 doesn't even *have* to be CLI specific

21:39 guns: Tying the command to namespaces seems a little restrictive

21:40 gfredericks: you could search all loaded namespaces

21:40 seems a little magical

21:41 guns: I think metadata for CLI metadata is a great idea. If you start building a larger framework around this idea, please let me know

21:42 but yes, explicit declarations

21:44 gfredericks: the tricky part is options that you want to span commands

21:45 oh snap could inheritance do that nicely?

21:46 I need to stop thinking about this it's not going to turn into anything sane

21:49 guns: I guess metadata is kind of inexpressive if you want to write it inline as a reader attr-map

21:50 Once you start using alter-meta! you may as well be using real data

21:58 hugod: guns, gfredericks: I had a go at a higher level cli lib a while back https://github.com/pallet/cli-cmds

22:03 guns: hugod: Do you have an example project that uses this library? Also, you should upgrade tools.cli (the parser is much better!)

22:05 hugod: guns: sorry the only examples of usage I have aren't open source - I should try and add some examples to the repo

22:21 gfredericks: hugod: looks interesting, thanks

22:22 technomancy: gfredericks: I did something vaguely like that ^:command thing in mire

22:23 where you use metadata to indicate a function should be a command for a telnet game thing

22:27 gfredericks: (->> clojure-features (sort-by #(/ (use %) (hype %))))

22:27 (take 5)

22:28 dsrx: mire.... is that a mud engine?

22:28 my oft-started-but-never-finished pet project in many a freshly learned language was a mud client named "quagmire"

22:31 gfredericks: I bet #1 is refs

22:31 bufferloss: ,(* [2,2] [3,4])

22:32 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>

22:32 bufferloss: how can I "multiply" two arrays together? in the above example I'd like the answer to be [6,8]

22:32 and I know I could just map * 2 in this case, but for something more arbitrary

22:32 gfredericks: ,(map * [2 2] [3 4])

22:32 clojurebot: (6 8)

22:32 bufferloss: hmm, ok thx

22:33 ,(map * [0.28384 -0.11029] [3 4])

22:33 clojurebot: (0.8515199999999999 -0.44116)

22:33 bufferloss: nice :)

22:33 brehaut: (aka zipwith in other languages)

22:36 amalloy: ~zip

22:36 clojurebot: zip is not necessary in clojure, because map can walk over multiple sequences, acting as a zipWith. For example, (map list '(1 2 3) '(a b c)) yields ((1 a) (2 b) (3 c))

22:45 devn: i cant brane good. i have a case of the dums

22:46 technomancy: dsrx: it was the sample project for the peepcode screencast I did on clojure

22:47 devn: i have a seq of maps: ({"foobar" #{"UNIQUE1" "UNIQUE2"}} {"foobaz" #{"UNIQUE1" "NOTINFOOBAR"}}) and I want to get something out like {"foobar" [{"foobaz" 1}]}

22:48 where the output is a map from the the original thing to a vector of maps which contains the connecting thing ("foobaz") and the number of occurences of shared values

22:48 basically i want to get back something that will show me how closely connected "foobar" is to "foobaz" and everything else in that sequence of maps

22:49 by returning the number of matching occurences of values

22:50 im thinking (count (clojure.set/union ...)) will be what i use

22:51 maybe this is just loop recur? reduce perhaps?

22:51 bleh. im dead right now. probably time for bed

22:52 but if you are reading this and want to take a crack at it, im interested in basically finding how many occurences of a value are shared between all of these maps with sets as their vals

22:54 so (find-it '({"a" #{1 2 3}} {"b" #{2 3 4}} {"c" #{3 4 5}})) => {"a" [{"b" 2} {"c" 1}]}

22:54 that's the input/output im thinking

22:54 cheers

22:55 xuser: http://clojure.org/lazy - does this document has next and rest backwards?

23:05 devn: bah i mis-spoke above

23:05 i meant intersection

23:09 vimuser2: when using defmulti/defmethod, is there a way to check to see if the the dispatcher value will be handled?

23:09 oh getmethod mabey

23:10 *get-method looks like it's the answer

23:15 technomancy: ,(require '[clojure.set :as clojure.string])

23:15 clojurebot: nil

23:15 technomancy: ,clojure.string/union

23:15 clojurebot: #<set$union clojure.set$union@f78c3d>

23:16 technomancy: http://p.hagelb.org/10hair.gif

23:16 that is all.

23:17 bbloom: who, i didn't realize that aliases could have dots in them, but i guess of course they can...

23:18 in general, namespaces seem half baked despite being 100X better than anything python/ruby/javascript/etc can even think about offering

23:18 technomancy: inc

23:19 bbloom: #<core$inc clojure.core$inc@43350e24>

23:19 technomancy: that too

23:22 half baked as opposed to 5%-baked

23:22 bbloom: or in the case js, negative baked

23:22 devn: technomancy: heh

23:23 {} + []

23:23 like you do!

23:23 ,clojure.set/union

23:23 clojurebot: #<set$union clojure.set$union@f78c3d>

23:23 devn: ,clojure.string/union

23:23 clojurebot: #<set$union clojure.set$union@f78c3d>

23:23 devn: ,clojure.string

23:23 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.string, compiling:(NO_SOURCE_PATH:0:0)>

23:24 technomancy: ,clojure.string/replace

23:24 clojurebot: #<CompilerException java.lang.RuntimeException: No such var: clojure.string/replace, compiling:(NO_SOURCE_PATH:0:0)>

23:24 devn: boggle

23:24 xeqi: haha

23:24 technomancy: heavens! where has it gone?

23:24 devn: ,clojure.string

23:24 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.string, compiling:(NO_SOURCE_PATH:0:0)>

23:24 brehaut: bbloom: js doesnt even mix the ingredients. baking isnt even on the recipe

23:24 devn: ,clojure.string/union

23:24 clojurebot: #<set$union clojure.set$union@f78c3d>

23:24 technomancy: http://p.hagelb.org/mystery.gif

23:24 xeqi: ,(require '[clojure.string :as clojure.string])

23:24 clojurebot: #<IllegalStateException java.lang.IllegalStateException: Alias clojure.string already exists in namespace sandbox, aliasing clojure.set>

23:24 devn: wow, that's nasty, but i mean, if you find yourself in that position

23:24 you're absolutely fucking insane

23:25 brehaut: technomancy: do you have chords bound for all of these?

23:25 bbloom: ouch, now clojurebot is broken foreverz

23:25 xeqi: ,(require 'clojure.string)

23:25 clojurebot: nil

23:25 bbloom: or at least until it's next reboot

23:25 xeqi: ,clojure.string/union

23:25 clojurebot: #<set$union clojure.set$union@f78c3d>

23:25 devn: ,bbloom i think it cleans up after itself every 10min or something

23:25 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: bbloom in this context, compiling:(NO_SOURCE_PATH:0:0)>

23:25 xeqi: heh

23:25 devn: ,(require [clojure.string :as clojure.string])

23:25 clojurebot: #<CompilerException java.lang.ClassNotFoundException: clojure.string, compiling:(NO_SOURCE_PATH:0:0)>

23:26 devn: ,(require '[clojure.string :as clojure.string])

23:26 clojurebot: nil

23:26 bbloom: (def bbloom 'rules)

23:26 devn: clojure.string/replace

23:26 technomancy: brehaut: these are hand-typed, quality gif urls my friend

23:26 devn: ,clojure.string/replace

23:26 clojurebot: #<string$replace clojure.string$replace@1179aa5>

23:26 devn: there we go

23:26 bbloom: dev ##bbloom should work just fine now

23:26 devn: technomancy: artisanal

23:26 technomancy: http://p.hagelb.org/tastes-mature.png

23:26 brehaut: technomancy: i need to build my own keyboard for high speed linking then

23:26 devn: "hello? operator?"

23:27 "yes, i need a sweet gif. thanks"

23:27 that'd be a great service. call and speak to a real human who will provide you with one of their curated, artisanal, raw denim, lofi gifs

23:28 brehaut: technomancy: i imagine the shopkeeper has keyboard pants under that apron

23:28 devn: Swag narwhal VHS blog fingerstache. Butcher squid distillery polaroid, Truffaut chillwave brunch chia umami Bushwick forage irony mustache. 8-bit High Life quinoa Pinterest. Jean shorts locavore seitan pop-up sustainable. Roof party farm-to-table readymade, sustainable leggings mlkshk ennui Truffaut biodiesel 90's organic cardigan.

23:28 * technomancy 's head explodes

23:29 devn: http://hipsum.co/

23:29 hipster ipsum

23:29 technomancy: want to know what else is cool?

23:29 bbloom: devn: something about that girl's glasses offends me

23:30 brehaut: devn: its got to be. ive never seen truffaut twice in one paragraph before

23:30 bbloom: devn: maybe it's the black box on her nose

23:30 devn: bbloom: dude, that's so chillwave.

23:30 super swag

23:30 technomancy: serving resources from disk normalizes double slashes in paths, but serving resources out of a jar does not.

23:30 ._.

23:30 bbloom: devn: i'm such a hipster that i'm too cool to have ever heard any of this hipster stuff you're making fun of

23:30 devn: technomancy: noooooooooo

23:31 xeqi: technomancy: why u make double slashes?

23:31 devn: http://meettheipsums.com/

23:31 whoa. that is a lot of ipsums.

23:31 technomancy: xeqi: it wasn't me!

23:32 well

23:32 it might have been me in 2012 or something weird

23:32 xeqi: https://github.com/technomancy/lein-survey/commit/7a33705b983f4bdfb31e7915e4d9030720b13044

23:33 * technomancy realizes he should have gotten rid of the slash in "public/" instead; oh well

23:33 devn: "No, the, uh, police chief of Malibu. A real reactionary. Dude, please!… Is this your homework, Larry? No ma'am, I didn't mean to give the impression that we're police exactly. We're hoping that it will not be necessary to call the police. I just want to say, sir, that we're both enormous—on a personal level. Chinaman is not the preferred nomenclature. Asian-American. Please. We want that money, Lebowski."

23:33 Lebowski Ipsum

23:33 This makes me actually want to do front end work

23:33 technomancy: devn: the #emacs bot has a ,apropos-dude command

23:33 it is invaluable

23:34 apricots: is it possible to derestructure a map partially and get the remainder at the same time? i'm aiming for something like (let [{:keys [a b & therest]} {:a 12 :b 34 c:56}] [a b therest]) => [12 34 {:c 56}]

23:35 technomancy: why do they never increment the last segment of the JDK version numbers?

23:36 guns: ,(alias 'clojure.set 'clojure.string)

23:36 clojurebot: nil

23:36 guns: ,clojure.set/join

23:36 clojurebot: #<string$join clojure.string$join@1a89909>

23:36 guns: nice

23:36 what is this crap

23:36 xuser: are lazy-seqs delayed only when used at the top level of a function?

23:38 xeqi: apricots: you can use :as to get the original map ##(let [{:keys [a b] :as all} {:a 12 :b 34 :c 56}] [a b all])

23:38 lazybot: ⇒ [12 34 {:a 12, :c 56, :b 34}]

23:39 apricots: xeqi: cool thanks

23:40 xeqi: xuser: lazy seqs are delayed until they are needed

23:42 vimuser2: hm, when writing test code involving defmulti/defmethod, i often have to go through a couple of iterations before things are right..i run into an issue where i have to update a defmulti, but only way to do this is to ns-unmap it then re-def the methods and multi method….is there a better solution?

23:43 xuser: xeqi: yeah, I understand the concept, just having a hard time figuring out how they are used or work in clojure

23:44 guns: ,(ns-unalias *ns* 'clojure.set)

23:44 clojurebot: #<RuntimeException java.lang.RuntimeException: No such var: clojure.core/eval>

23:44 guns: ns impl is gross

23:45 xeqi: guns: yep, it also prevents some awesome classloader stuff I wanted to do

23:45 since the loaded ns list is global

23:48 noprompt: $seen ddellacosta

23:48 lazybot: ddellacosta was last seen joining on clojure 2 hours and 49 minutes ago.

23:48 ddellacosta: noprompt: ping

23:48 noprompt: ddellacosta: hey sorry if i misunderstood your patch earlier.

23:48 ddellacosta: no problem, as I said I should have framed it different from the get-go

23:49 noprompt: ddellacosta: i think it's a good idea to expose a way to get the route, i just wanted to understand your problem clearly.

23:49 ddellacosta: that's what I get for being in a hurry

23:49 noprompt: hahah

23:49 no sweat

23:49 ddellacosta: noprompt: :-)

23:49 technomancy: vimuser2: I usually put (def mymulti nil) before defmulti during development

23:49 ddellacosta: noprompt: yeah, so, I'm in a meeting but let me ping you when I'm done if you're around

23:49 noprompt: (otherwise we can just keep talking via the github thread, whatever)

23:49 noprompt: ddellacosta: i'll stick around just for you ;)

23:50 ddellacosta: nah, let's chat here, it's more efficient

23:50 ddellacosta: noprompt: thanks!

23:50 noprompt: :)

23:50 ddellacosta: k

23:50 vimuser2: technomancy: hmm, thanks

23:55 noprompt: Raynes: omg. is the file/join shit ever gonna end...

Logging service provided by n01se.net