#clojure logs

2014-03-18

00:00yuri_niyazovBut 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
00:01amalloyyuri_niyazov: you can't. you need to use some construct other than doseq if you want to pass results around
00:01yuri_niyazovmaybe I can explain this better with some simpler code
00:02yuri_niyazov(doseq [:let [result (transient {})] a (range 1 10)] (assoc! result a (rand)))
00:03yuri_niyazovexcept that it doesn't work, because I have to use the result of the (assoc!) subsequently
00:04amalloyright. you need to use reduce, or loop, or recursion: something that lets you carry around state
00:04amalloyi also find it hard to believe you need a transient rather than just an ordinary persistent collection
00:06yuri_niyazovYes, that part has been confirmed by profiling
00:06yuri_niyazovah
00:06yuri_niyazovwell, wtih-local-vars will work
00:08amalloythe 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
00:09yuri_niyazovThank you for your input.
00:14Raynesivan, amalloy: Oh. Shit.
00:14ivan:-)
00:14RaynesSo that explains the crazy paste inflation.
00:14RaynesI'm incredibly dumb.
00:15RaynesI'll fix this soon.
00:15RaynesNot much I can do about the pastes though.
00:15RaynesI could delete anonymous forks, but that seems rather intrusive.
00:16ivanbtw, crawlers will ignore robots.txt, don't rely on that
00:23danielszmulewiczHi 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).
00:26beamsohttps://wiki.eclipse.org/Jetty/Feature/Jetty_Logging
00:26beamsoit looks like either a jetty-logging.properties or a system property can configure jetty logging
00:27danielszmulewiczbeamso: Awesome. Thanks.
00:27danielszmulewicz(inc beamso)
00:27lazybot⇒ 1
00:27beamsowoohoo!
00:27danielszmulewicz:-)
00:44yuri_niyazovWhy is calling var-set slower than mutating an atom?
01:13vimuser21whaa lol been wondering why my new code hasn't been woring, is there a way to remove a multi method?
01:14vimuser21saw some stuff that removes all symbols from the current name space…seems overkill
01:16vimuser21ah , google served me well, (ns-unmap *ns* 'multimethod)
01:54chareI need this book: https://leanpub.com/fp-oo
01:54charesomeone buy me a copy please
01:59sdegutischare: ok
01:59charesdegutis you lying to me?
01:59sdegutischare: I trust you'll do the right thing
01:59sdegutischare: you've got good in you
01:59chareI don't understand what you mean by that
02:42irctcI 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?
02:46irctc?
02:46beamsoi would have no idea
02:46beamsohave you tried doing it from java to give you an idea of what you have to do in clojure?
02:50beamsofurther reading tells me that you have to create the postgresql array using the classes in the driver jar
03:05daniel_karlssonI'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?
03:06beamsoi just use the standard testing api :/
03:07daniel_karlssonthat is what I have been playing with so far
04:15augustldaniel_karlsson: I prefer clojure.test, not a big fan of the midje infix stuff
07:38jcromartiegooooooooood morning
07:39beamsogood evening
07:40jcromartiethat's not how IRC time works
07:40beamsoit's evening for me
07:40jcromartiehttp://thinkmoult.com/ugt.html
07:42beamsoin all my years of irc i've never seen that before
07:42jcromartiemaybe I'm the only one who has :)
07:48clgvugt is useless anyway ;)
07:48jcromartieyeah really it is
07:52aaronj1335TIL how to render the proper greeting of the day on irc. thnx jcromartie
07:52aaronj1335it's like being back in the military again
07:54jcromartieI just thought it was "good morning" when you arrive, and "good night" when you leave anyway. No need to get too formal.
07:58augustljcromartie: didn't know about ugt, thanks for the link :)
08:00clgvjcromartie: 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 ;)
08:01jcromartiehttp://xkcd.com/
08:01jcromartietimely
08:01jcromartieUGT being a convention falling on the right-hand side :)
08:12jph-anyone else find it easier to write code inside out than outside in (ie thread-first)
08:14jcromartiejph-: certainly, I use -> all the time
08:14mercwithamouthyup
08:14jcromartielet also helps
08:14jph-im trying to use -> but it hurts my brain
08:14jph-heh
08:14jph-for all but simple examples
08:18simon__Hello! Im doing clojure koans, and I have a question about "Iteration can be used for repetition"
08:18simon__(take 2 (iterate (fn [x] x) :foo))
08:18simon__=> (:foo :foo)
08:18simon__Ofc
08:18simon__But
08:18simon__user=> (take 2 (iterate #(%) :foo))
08:18simon__IllegalArgumentException Wrong number of args passed to keyword: :foo clojure.lang.Keyword.throwArity (Keyword.java:92)
08:19simon__I dont understand, why wont my second shorthand anonymus function work when the first does?
08:19jcromartie#(%) returns a function will call its argument as a function
08:19jcromartie,(#(%) #(println "hi"))
08:19clojurebothi\n
08:19jph-any tips for debugging ssl cert issues from clojure or do i need to dip into java for that?
08:19jph-sun.security.validator.ValidatorException: PKIX path building failed: sun
08:19jcromartiejph-: you need to add the cert to a truststore
08:20jcromartiejph-: I've just dealt with this
08:20jph-jcromartie, it's peculiar... my browser works fine
08:20jph-or maybe it's owned too
08:20simon__jcromartie: ah, ok.
08:20jph-!
08:20simon__Thanks.
08:21jph-why would by jdk 7 have an outdated trust store
08:21jph-hrmm
08:21jph-i've also dealt with this before.. it just seems peculiar
08:21jph-i'll hunt down the relevant stack overflow or bookmark
08:22jcromartiejph-: did you switch JDKs?
08:22jph-jcromartie, not to my knowledge
08:23boreHello, 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?
08:23jcromartiejph-: what I'm asking is: did you connect to this host before? did anything change?
08:23jcromartiejph-: or is this failure happening the first time you've ever tried to connect to this host
08:23jph-i'm well versed in troubleshooting (used to do firewalls) so that's why im scratching my head
08:23jph-maybe something i did triggered something else
08:24jph-i'll have to poke around
08:24jcromartiejph-: there are certs that your browser trusts that the JVM does not
08:24jph-im connecting to https://btc-e.com/api/2/btc_usd/ticker which is fine in browser but is breaking in http-kit
08:24jph-i have sun jdk 7
08:24jph-i've got several things to check
08:25jph-heh
08:25jph-its a godaddy cert
08:25jph-so i need to see if that specific CA is also in jdk certstore
08:27jcromartiethis cert is trusted in my OS X default JVM (1.6.0)
08:27beamsoi'm using java 1.7 and it failed
08:27clgvjcromartie: how do you check this?
08:28jcromartiekeytool -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'
08:28clgvjcromartie: I mean without trying to programmatically connect?
08:28beamso,(slurp "https://btc-e.com/api/2/btc_usd/ticker")
08:28clojurebot#<SecurityException java.lang.SecurityException: denied>
08:28jph-hehe
08:28clgvah there it is^^
08:28jph-yay its not just me
08:28clgvno the bot probably does not allow socket connections
08:28jph-oh
08:28jph-yes my bad
08:28jph-clojail
08:29beamsoi did get the SSLHandshakeException in a local repl using the same s-expression
08:29clgv,(slurp "http://www.heise.de&quot;)
08:29clojurebot#<SecurityException java.lang.SecurityException: denied>
08:29clgv^^
08:30jph-in linux /usr/lib/jvm/java-7-oracle/bin/keytool -list -keystore /usr/lib/jvm/java-7-oracle/jre/lib/security/cacerts
08:30jph-(ubuntu)
08:30jcromartieit's gone from 1.7
08:30jcromartie$ 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'
08:30jcromartienothing
08:30jph-interesting
08:30jcromartieoh wait
08:31beamsothat's an old jdk
08:31jcromartieyeah it's gone (sorry wrong command before, but verified this time)
08:31jcromartieI'm running 1.7.0_17 on OS X
08:31jcromartiethis is a dev machine for a stuffy institution :)
08:31jph-"it's an older code, but it's valid" (star wars)
08:32jcromartiebut seeing as the cert is there in 1.6 but gone in 1.7
08:32jph-i wonder if there's a changelog for why these are removed
08:32jph-maybe it was compromised
08:32jcromartiemaybe somebody just doesn't like GoDaddy :) I wouldn't blame them
08:33jph-i wish i could copy/paste from firefox view cert
08:33jph-the fingerprint itself
08:33clgvjph-: you can easily use an application specific truststore
08:34jph-clgv, oh i know that, i'm more curious about the WHY right now
08:34clgvthat way you could also use self-signed certs for your own services
08:34jph-since i want to do some transactional stuff over that API, and bad ssl certs make me nervous
08:34beamsojph-: http://notes.richdougherty.com/2013/09/adding-godaddy-g2-root-cert-to-jdk-7.html
08:35jph-beamso, awesome
08:35jph-how do i inc again
08:35jph-(inc beamso)
08:35lazybot⇒ 2
08:35beamsothere is a godaddy cert listed in my jdk but it wasn't the root one for that website
08:35beamsowoohoo!
08:36jcromartiebut I thought you were interested in the why? ;)
08:36jph-im still interested in the why :)
08:36clgvme too :P
08:36jph-but the fact it's a known issue gives me a little more confidence
08:36jph-ie it didnt just happen overnight
08:37jcromartieso meanwhile
08:37jcromartiedeveloping Atlassian plugins in Clojure?
08:37jcromartiebecause I want to add 10s to my Atlassian app startup time
08:38jcromartieI'd really like a REPL in my JIRA
08:39jcromartieand JIRA in my REPL
08:39jcromartiehttp://img3.wikia.nocookie.net/__cb20110112210935/familyguy/images/5/5e/Reeces1.png
08:41sid_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?
08:42hyPiRionwhat do you mean by "this key"?
08:43jph-sid_, have a compojure route that replies with (session/get :user-id)
08:43jph-but the ajax caller would have to be authenticated
08:43jph-since it's session/cookie based
08:44sid_jph_, I'll try and reply if it works
08:44jph-sid_, you could also call {{ user-id }} in a selmer template
08:45jph-or whatever templatingyour using
08:45sid_jph_, I'm using selmer, but I have to make the get call in js file
08:45jph-its more about where you want to use :user-id
08:46jph-are you using luminus?
08:46sid_jph_, yes, I'm using luminus
08:46jph-ie
08:46jph-in app/views/layout.clj
08:46jph-i have
08:46jph-:username (session/get :username))
08:46jph-in my (assoc params ...)
08:47jph-so in my selmer templates
08:47jph-i can now use {{ username }}
08:47sid_yes, I made :user-id in app/views/layout.clj
08:47jph-so the var is visible in templates
08:47jph-if you purely want it in an ajax call
08:47sid_but can I directly use {{user-id}} in my js file?
08:47jph-it'd be somethin glike
08:47jph- (GET "/ajax/user-id" [] (session/get :user-id))
08:48jph-in your defroutes
08:48jph-somewhere
08:48sid_I've used selmer tags in static html pages
08:48jph-so your js ajax call requests /ajax/user-id to get the user-id
08:49sid_thanks jph_, I''ll try it
08:50jph-good luck
08:51sid_:)
08:55jph-"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."
08:55jph-h (session/get :user-id)
08:55jph-<jph-> but the ajax caller would have to be authenti
08:55jph-woops
08:55jph-https://stackoverflow.com/questions/18746565/godaddy-ssl-cert-not-working-with-java
09:10xsynhow do I get the first record that appears in an incanter set for all records?
09:11xsynso if I have duplicates, I just want all of the first ones?
09:23clgvxsyn: (-> ds :rows distinct)
09:23noidiI wrote a blog post showcasing some cool REPL tools: http://dev.solita.fi/2014/03/18/pimp-my-repl.html
09:32_bartFreesound.org is so unstable right now, continuously on- and offline.
09:32_bart(using it with Overtone)
09:36xsynclgv: thanks will give it a try
09:38AeroNotixbest way to deploy an uberjar to archiva or w/e?
09:38AeroNotixI've seen lein deploy-uberjar, looking for alternatives.
09:38mdrogalisAeroNotix: Archiva's not meant to be used with uberjars, just jars.
09:38AeroNotixmdrogalis: I understand this, obviously.
09:39mdrogalisAeroNotix: Not obvious to me. :P
09:42mpenetAeroNotix: you can use lein deploy and pass the .jar + pom as arguments
09:42clgvAeroNotix: 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
09:43AeroNotixclgv: it's just a nice way to deploy to boxen
09:43mpenetAeroNotix: see lein help deploy
09:43AeroNotixmpenet: cheers
09:45clgvmpenet: awesome
10:13mskoudLooking 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:14jcromartie,(assoc {:a 2 :b "test"} :a_x "y")
10:14clojurebot{:a_x "y", :a 2, :b "test"}
10:14jcromartie,(assoc {:a 2 :b "test"} :a_x "y" :b_x "test2")
10:14clojurebot{:b_x "test2", :a_x "y", :a 2, :b "test"}
10:14jcromartie,(merge {:a 2 :b "test"} {:a_x "y" :b_x "test2"})
10:14clojurebot{:a_x "y", :b_x "test2", :a 2, :b "test"}
10:15mskoudi need to add a new key ?_x for all existing keys.
10:15jcromartiehow are you going to derive the values?
10:15jcromartiethat's easy enough BTW
10:16mskouda function will return the modified value.
10:17jph-anything i could use for queueing (fifo) functions? i can do a max of 4/sec
10:17jcromartie,(let [m {:a 2 :b "test"} f #(str % "_2")] (merge m (into {} (map (fn [[k v]] [(keyword (name k) "_x") (f v)]) m)))
10:17clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
10:18jcromartiemore like
10:18jcromartie,(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:18clojurebot{:b_x "test_2", :a_x "2_2", :a 2, :b "test"}
10:18mskoudThanks!
10:19jcromartieinto tends to be a handy tool when transforming collections
10:19jcromartieactually
10:19jcromartie,(let [m {:a 2 :b "test"} f #(str % "_2")] (into m (map (fn [[k v]] [(keyword (str (name k) "_x")) (f v)]) m)))
10:19clojurebot{:a 2, :b "test", :a_x "2_2", :b_x "test_2"}
10:19jcromartiejust skip the merge
10:20pjstadigi 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:20pjstadigis that possible?
10:24mskoudworks like a charm. any good references to articles learning this style of programming.
10:40jstewmskoud: Are you new to functional programming?
10:40jstewmskoud: I am, and this helps a lot: https://leanpub.com/fp-oo
10:40mskoudyes. started to look at clojure some months ago...
10:41pythonjohnmorning clojurins
10:41pythonjohn*clojurians
10:41pythonjohnI have a very general question to pose to the flor
10:41jstewmskoud: 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:42dnolen_pythonjohn: just ask your question
10:42pythonjohncoming 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:42pythonjohnwhen I am organizing a clojure namespace
10:42jcromartiepythonjohn: you should continue to do so
10:42pythonjohnhow should I best organize my files
10:43pythonjohnshould I view them as each smaller parts of a whole, like classes
10:43pythonjohnthat is my habit
10:43pythonjohni am trying to understand the best way to organize things
10:43AeroNotixpythonjohn: use lein and go and read some popular projects.
10:43pythonjohnokay
10:43jstewpythonjohn: 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:43pythonjohnthat is kind of what I was thinking
10:43pythonjohnbut thought I might be way off
10:44jcromartienamespaces 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:44jcromartieand there's nothing wrong with that
10:44pythonjohnso that is normalish
10:44pythonjohnI am trying to break old habits
10:44pythonjohnslowly
10:44wunkianyone have an idea how you would do a "SELECT COUNT(id) FROM table" in Korma?
10:45pythonjohnthanks for the input everyone
10:45pythonjohnI am ging to read more github projects to get a concrete idea of the layout
10:45pythonjohnof some experienced folks
10:46seangrovewunki: Sadly, I can't deep link into the page, but it's literally covered on the docs site (aggregate (count :*) :cnt :status)
10:46seangrovehttp://sqlkorma.com/docs
10:46seangrovednolen_: You get a chance to checkout the 'glueing' concept?
10:47wunkiseangrove: aggregate count adds it on a row basis, I just want to have the amount of rows
10:47dnolen_seangrove: sorry, haven't yet
10:47augustlpythonjohn: I tend to think about what I need to require. If two files requires the same things, perhaps they should be one file?
10:47augustls/files/namespaces
10:48pythonjohnthat is a good point
10:48pythonjohnI will try to keep that in mind for sure
10:49augustlpythonjohn: 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:49augustlbut they are also very similar :)
10:49jstewClojure is so much fun, that I want to find a job working with it, once I become more proficient.
10:50AeroNotixdamn right
10:50AeroNotixI have a clojure jobb
10:50seangrovewunki: Let me check the sql output of that code...
10:50jcromartiewe have a lot of people using it
10:51AeroNotixit's awesome when I see coworkers struggling with tooling and/or language issues and I breeze by with Clojure
10:51AeroNotixsuch a great platform to develop on
10:51AeroNotixthe JVM is really mature
10:51AeroNotixI mean, their struggling is not awesome, but that I don't struggle is. :)
10:51jstewI 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:51seangroveAeroNotix: I was going to say, careful with that Schadenfreude...
10:52jstewAeroNotix: 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:54seangrovewunki: (korm/dry-run (korm/select db/users (korm/aggregate (count :id) :cnt))) => dry run :: SELECT COUNT("users"."id") AS "cnt" FROM "users" :: []
10:54mskoudHow do i include the old clojure.contrib.strint string interpolation library in Clojure 1.5?
10:54seangrovewunki: Isn't that the sql you asked for?
10:54wunkiseangrove: it is, strange, when I tried it I got every row back from the db :/
10:55wunkiseangrove: let me try it out again
10:55seangrovewunki: No worries
10:55stuartsierramskoud: I think it's in core.incubator
10:56mskoudindeed it is :-) thanks!
10:56wunkiseangrove: yup, that was it... my mistake was that I did the following `(select users (aggregate (count :*) :cnt))`
10:57wunkiseangrove: thanks for the help
10:57seangrovewunki: No problem, happy to help!
11:06jjttjjanyone know of a more advanced core.async tutorial that talks about the pubsub/mult, etc, or a project on github that uses these?
11:17jstewPeople who have clojure jobs: Out of curiousity, what sorts of things do you work on every day?
11:18jcromartieweb apps, lots of API interop
11:18seangroveProduct, generally.
11:18jcromartiedata ingest
11:18zspencerweb apps
11:18jcromartiedata conversion
11:18zspencerand services supporting the web apps
11:18jstewNice. These are things that I enjoy doing also. Back end services.
11:18hyPiRionparsing complex formats specified by another format at runtime
11:19zspencerI also use clojure daily to make myself feel smarter than my ruby/javascript programmer friends
11:19zspencerwhich is probably the most important feature
11:19seangrovejstew: Front-end dev is becoming unbelievably better these days
11:20seangroveOm, reusable components, tooling, core.async, and some new patterns... it's fantastic.
11:20pjstadigzspencer: you have ruby/javascript programmer friends‽</horror>
11:20jstewThanks for your responses :)
11:21jcromartieI used to be the one asking that question
11:21cbpI use clojure mostly for clojurescript at work
11:21cbpbut do some backend services on my own time
11:21jstewseangrove: 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:22seangrovejstew: The tooling, layout management, and reusable components are what get me giddy these days, but it's all fantastic fun.
11:39danno1Dumb Q: Ifn is an interface that represents functions...right?
11:40llasramIFn, yes
11:40danno1thanks, llasram
11:40danno1also, in https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/IFn.java
11:41danno1What is:
11:41danno1static 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:41danno1methods called DLL, DOD, DLO, DLD, etc.
11:41pjstadigthose allow you to pass unboxed primitive arguments to functions that are compiled to take them
11:41clgvdanno1: those are for primitive functions
11:41Bronsadanno1: mostly implementation details for primitive taking functions
11:42danno1oh yeah
11:42danno1derp on me
11:42danno1haha
11:42clgvthat's why primitive functions have limitations on the number of arguments...
11:42danno1cigv: interesting
11:48danno1Simple Q Again:
11:48danno1I can create a list that is like a List in Java/Scala/Groovy: (list 1 2 3 4)
11:49danno1but if I create a list purely as (1 2 3 4) it is expecting the first element to be a IFn?
11:49danno1since it is evaluated immediately?
11:49joegallo,(= '(1 2 3 4) (list 1 2 3 4))
11:49clojurebottrue
11:50joegallodanno1: that's right, (1 2 3 4) is going to treat 1 as a fn
11:50danno1Boom! Nice! joegallo.
11:50joegallowhich you don't want, so typically you'd see the list quoted, like above
11:50cbpIf you don't quote it the first element must be a function, macro or java class
11:50cbpor special form
11:50clgv,(1 2 3 4)
11:50clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
11:50clgv^^
11:51danno1cbp & clgv: Noting. Thank you
11:51napper2,(source recur)
11:51clojurebotSource not found\n
11:51justin_smithnapper2: I think recur is a symbol that is bound inside loop / fn?
11:51justin_smithit isn't bound at the top level
11:52clgvnapper2: recur is a special form
11:52napper2thanks for the corrections
11:53clgv,(keys (clojure.lang.Compiler/specials))
11:53clojurebot(deftype* new quote & var ...)
11:53clgv,(println (keys (clojure.lang.Compiler/specials)))
11:53clojurebot(deftype* new quote & var ...)\n
11:53clgv&(keys (clojure.lang.Compiler/specials))
11:53lazybotjava.lang.SecurityException: You tripped the alarm! class clojure.lang.Compiler is bad!
11:53clgv:/
11:53justin_smith,(doc recur)
11:53clojurebotGabh mo leithscéal?
11:53clgvwell, check yourself^^
11:54clgv,((clojure.lang.Compiler/specials) 'recur)
11:54clojurebot#<Parser clojure.lang.Compiler$RecurExpr$Parser@b31bff>
11:54cbp(doc recur)
11:54clojurebotPardon?
11:54justin_smith,(do (use 'clojure.repl) (doc recur))
11:54clojurebotTitim gan éirí ort.
11:54justin_smithhrm
11:54jstewhttp://clojure.org/special_forms#Special Forms--(recur exprs*) <-- there :)
11:54cbpI thought all the special forms had some sort of docs
11:55seangroveI think doc is special-cased. But clojurebot's always a bit loopy
11:55clgvjustin_smith: it is neither a def, defn or defmacro - hence there is nothing for "doc" to find ;)
11:55cbpmaybe clojurebot is just being silly
11:55jconnollywhoa clojurebot speaks irish?
11:55justin_smithcbp: doc recur works in my repl
11:55justin_smithclgv: ^^
11:55clgvah right
11:56cbp&(doc recur)
11:56lazybot⇒ "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:56cbplazybot: botsnack
11:56lazybotcbp: Thanks! Om nom nom!!
11:56clgv$source doc
11:56lazybotSource not found.
11:56clgv$source clojure.repl/doc
11:56lazybotclojure.repl/doc is http://is.gd/qrh0LE
11:58danno1,(first (list 1 2 3 4))
11:58clojurebot1
11:59justin_smithdanno1: in my experience I don't see list used very often - usually it's either a [] vector literal or '() quoted sequence
12:00justin_smith,(map class (list 1 2 3) '(1 2 3))
12:00clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/class>
12:00danno1justin_smith: I kind of figured that vector is used more
12:00justin_smith,(map class [(list 1 2 3) '(1 2 3)])
12:00clojurebot(clojure.lang.PersistentList clojure.lang.PersistentList)
12:01justin_smithyeah, but notice '(1 2 3) is the same datatype as (list 1 2 3)
12:01danno1danno1: since function args are vectors
12:01danno1justin_smith: yes
12:15jph-how might i rewrite this in clojure using interop? CurrencyUnit.registerCurrency("TST", 991, -2, Arrays.asList("TS"));
12:15jph-in particular the Arrays.asLists bit confuses me (no java background)
12:16cbp(Arrays/asList "TS")
12:16jph-oh, duh
12:16cbpprovided you import java.util.Arrays
12:16jph-k
12:16hyPiRionjph-: it just converts a vararg to a list of those values
12:16hyPiRionyou can just use ["TS"] instead
12:16cbpAh
12:40seangrovebbloom: How'd the talk last night go?
12:47dnolen_seangrove: I was there, was good!
12:49seangrovednolen_: Did he come off as researcher-executor or crazy-shouty-rambling-homeless-man?
12:50dnolen_seangrove: neither, solid talk :)
12:52lockshaha
12:53gfrederickshttps://github.com/budu/lobos/blob/master/src/lobos/connectivity/jdbc_2.clj
13:48gfredericksdoes java.jdbc not have anything for upserts anymore?
13:54amalloyjustin_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:55amalloyand like, okay, in that specific context vector is still more common than list. but i claim list is good sometimes anyway
13:56turbofailhm. i can't remember the last time i used list at all
13:56rasmusto,(apply map list [[1 2 3] [4 5 6]])
13:56clojurebot((1 4) (2 5) (3 6))
13:56rasmustoI do that all the time
13:56technomancysometimes I apply list. I don't think I ever have called it directly.
13:57jstewany reason you would want a list of lists rather than vectors when mapping 2 vectors?
13:58turbofaildunno. i'm sure you could come up with a reason
13:58turbofaili just can't think of one, and never felt the need to do it
13:59llasramjstew: Most of the "lists" you see e.g. in the Clojure REPL are actually lazy sequences, which are, well, lazy
13:59llasramSo that's a reason to prefer them
14:02amalloytechnomancy: why would you apply list? that's what list* is for
14:03rasmusto,(doc vector*)
14:03clojurebotNo entiendo
14:03amalloyi 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:04jstewTIL about list*
14:11bts-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:12justin_smithamalloy: yeah, not claiming it is useless, just mentioning that it is fairly rare in code I see
14:13amalloybts-: really? shouldn't it be known statically where the classes output by thrift will go?
14:16bts-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:18bts-amalloy: and so I get a ClassNotFoundException
14:24technomancybts-: nothing gets loaded by default unless you ask for it
14:28Bronsatechnomancy: 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:30bts-technomancy: from the docs "By default the :dev, :provided, :user, :system, and :base profiles are activated for each task"
14:31bts-technomancy: is there a way to get prep-tasks to run without loading :dev?
14:34amalloyBronsa: i wouldn't expect it to work in either case, really. do you have a simple example of making it work?
14:34Bronsaamalloy: one sec
14:35amalloylike, 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:35Bronsaamalloy: I'm calling `compile`
14:41bts-technomancy: as a workaround I currently temporarily comment-out :dev's source-paths if the thrift classes aren't yet compiled
14:44Bronsaamalloy: http://sprunge.us/cjeS
14:45technomancybts-: those profiles are active, but that just places them on the classpath. it doesn't load anything.
14:45Bronsaamalloy: http://sprunge.us/jTYS a bit cleaned up
14:47technomancyBronsa: hm; very strange. I don't do AOT at not-deploy-time or deftype, so I'm also surprised that works.
14:48amalloyBronsa: 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:48amalloywell, i guess that depends what's in your project.clj
14:48Bronsaamalloy: it's straight out of lein new test
14:49Bronsaamalloy: yes it's generating classfiles btw
14:50Bronsatechnomancy: amalloy looks like there's something going wrong with how leiningen/nrepl handles classloaders
14:54bts-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:56hiredmanBronsa: is ./classes in `lein classpath`?
14:57hiredmanI suspect lein compiles to target/classes
14:57technomancybts-: 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:58Bronsahiredman: let me try binding *compile-path* to target/classes then
14:59bts-technomancy: awesome -- thanks!
15:00Bronsahiredman: that makes it fail, good catch
15:00Bronsatechnomancy: not a lein bug then, sorry for the fuss
15:02technomancyno worries
15:08dnolen_http://mreinhold.org/blog/jdk8-ga
15:08Cr8hum
15:15Bronsahiredman: 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:16hiredmanwhich behaviour?
15:16Cr8the stuff in the core.async docs about >! and >!! returning true on success doesn't seem to be accurate
15:16amalloythe limitation that...if you reload code containing AOTed deftypes, references to the old class stick around?
15:17daccdnolen_: implications for clojure? nice to see permgen go.
15:17dnolen_dacc: for ClojureScript users the appearance of Nashorn is big
15:17tbaldridgeCr8: explain?
15:18Bronsaamalloy: hiredman specifically that a class name gets resolved to the AOT class rather than to the dynamically compiled one
15:18dnolen_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:18dnolen_dacc: in the long wrong, perhaps Clojure can leverage the invokeDynamic stuff which finally not slow
15:19jcromartiethe long wrong :)
15:19jcromartieI like that idea
15:19dnolen_s/long wrong/long run
15:19hiredmanBronsa: 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:20Cr8tbaldridge: https://www.refheap.com/61482
15:20daccdnolen_: so compiling clojure to javascript to run on nashorn? seems like you'd just script jvm programs using the clojure compiler itself, no?
15:20tbaldridgeCr8: what version of core.async?
15:20amalloyBronsa: 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:21Cr8"0.1.267.0-0d7780-alpha", just the one from the README
15:21Cr8should I be building master? :)
15:22tbaldridgeCr8, go read the README again :-P
15:22dnolen_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:22hiredmanamalloy: too long for an OH
15:22tbaldridgeCr8: that's my bad, I never updated the README
15:23Cr8ah
15:23amalloyhiredman: remove all the verbs? I AOT box sad things. sad things bugs
15:23tbaldridgeCr8: 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:23Cr8all fine now :)
15:24hiredmanamalloy: works for me
15:24Cr8that makes sense
15:31abakerso 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:32jcromartieabaker: that's actually deprecated now
15:32abakerjcromartie: which is, the entire library or just that implementation?
15:32jcromartiewait wait
15:33jcromartieyeah
15:33jcromartiethat style
15:33jcromartieall of those macros live in clojure.java.jdbc.deprecated now
15:33jcromartieand the functions just take a connection instead
15:34jcromartieyou generally need a very good reason to depend on dynamic vars
15:34abakeryeah, 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:34abakerlike with-open, it would just be to standardize closing out of resoruces
15:34cbpabaker: god no, no globals for database connections and certainly no dynamic vars
15:35jcromartiethere's nothing simpler than a parameter to a function
15:36ToBeReplacedabaker: consider stuartsierra's component library for start/stop standards
15:37abakeryeah 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:37jcromartieabaker: with-open has good reason to exist
15:38stuartsierraUnlike many of the with- macros, with-open uses lexical scope, not dynamic binding.
15:40katratxocemerick: ping?
15:40katratxocemerick: just poking you on the friend change proposal
15:42stuartsierraabaker: here's my point of view on that pattern. http://stuartsierra.com/2013/03/29/perils-of-dynamic-scope
15:43abakerah, that's what i was looking for, thanks stuartsierra
15:44stuartsierraYou're welcome
15:51cemerickkatratxo: responded on the gist. Probably better to just open an issue in the future. :-)
15:56katratxocemerick: sure, will to that next time, i'll open an issue
16:00mikerodI found something fun out.
16:01mikerodsatisfies? seems to be a bit slow when checking on things that are not implementing an interface
16:02mikerod,(time (dorun (map #(satisfies? clojure.core.protocols/CollReduce %) (repeat 1000000 "hi"))))
16:02clojurebotExecution Timed Out
16:03Bronsamikerod: that's because it has to lookup in the impl map not only the class, but all the super classes/interfaces
16:03mikerodslows down at lot near 1 million checks. I profiled it, looks like most of the time is spent in java.lang.Class#getInterfaces
16:04mikerodI would have thought this was fast?
16:04mikerodClass#getInterfaces is slow?
16:04mikerodI know it is a harder search when it doesn't satisfy it or directly implement an interface generated by the protocol
16:06mikerodI'm just surprised by this being a performance hit like this
16:06mikerodwe had a tight loop that had a `satisfies?` in a precondition
16:08Bronsamikerod: I remember remiving a satisfies? check in tools.reader improved perf by 40x
16:08Bronsaremoving*
16:09mikerodBronsa: That doesn't surprise me now that I've seen the damage it can do :P
16:09mikerodI 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:09Bronsamikerod: I suspect a small cache in find-protocol-impl could speed-up significantly satisfies?
16:10mikerod*that's why I had the satisfies? in the :pre-condition block
16:10mikerodBronsa: I'd imagine so
16:11Bronsamikerod: you can try (with-redefs [find-protocol-impl (clojure.core.cache/lru find-protocol-impl)] ..) and see how it goes :P
16:12Bronsas/cache/memoize
16:12mikerodBronsa: hah, well that is one alternative I suppose
16:12mikerodthat'd be interesting...
16:12amalloyBronsa: but protocols can be extended at runtime. i assume that's why there's not a cache already
16:13Bronsaamalloy: fair enough
16:13mikerodamalloy: oh, duh I didn't think that way about it
16:13mikerodgood point
16:13Bronsaamalloy: well, extend could invalidate that cache
16:13mikerodI 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:13amalloymikerod: you'll never be able to be sure though
16:14mikerodamalloy: I know, it could claim to satisfy, but not really impl the fn.
16:14amalloymaybe it does implement the protocol, but its implementation involves throwing an exception that looks the same as dont-implement-this-protocol
16:14mikerodamalloy: yep, lose-lose situation? :P
16:14amalloyBronsa: that sounds plausible to me
16:15Bronsaamalloy: I'm doing something similar in tools.analyzer for resolving classes, it's working fine
16:16mikerodThe 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:17amalloymikerod: anything in Class or java.lang.reflect.* is slow
16:17mikerodamalloy: I thought that was true for java.lang.reflect, I didn't think so for Class.
16:17mikerodit is hard to search on this topic it seems
16:17amalloyanything you do with Class is reflection
16:18amalloyexcept using == to compare them, simple stuff like that
16:18amalloyit's just in java.lang because getClass() is part of Object, i suspect; otherwise it would be in reflect
16:18mikerodamalloy: 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:19mikerodI see.
16:22Bronsaoh well, memoizing find-protocol-impl accounts only for a 2x speedup, that's sad
16:23mikerod:(
16:27hiredmanBronsa: but now if someone extends a protocol find-protocol-impl doesn't work correctly
16:27amalloyhiredman: 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:28hiredmanamalloy, Bronsa: oh sure, huh
16:30hiredmanmikerod: 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:31hiredman(defprotocol Yo (yes? [whatever])) (extend-protocol Yo Object (yes? [_] false)) then have it return true for your thing
16:32amalloyhuh. i just found this in the source for java.lang.Class: throw (InstantiationException) new InstantiationException(...);
16:32amalloywhy would you ever cast a constructor's result to its own class?
16:32amalloyoh, i see. i parsed it wrong
16:32amalloyit's really: throw (InstantiationException) new InstantiationException(...).initCause(e);
16:36hiredmanI 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:36jcromartiehow slow are you talking?
16:38mikerodhiredman: that is a good idea
16:39mikerodhiredman: I haven't really explored the idea of implementing it in a way that would be checkable and inline cacheable
16:40mikerodI like this idea, for my use cases at least
16:42hiredmanit 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:43hiredmanmaybe if clojure went full indy replacing ifns with method handles
16:44mikerodinteresting thoughts
16:50coventryIs 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:51amalloycoventry: like a heap dump?
16:51amalloyjmap for heap dumps, jstack for stacktraces
16:52ordnungswidrig2coventry: it's like for every java vm instance, clojure does not make a difference
16:53justin_smithcoventry: also in jvisualvm you can look at / collect stats interactively at runtime and at your option trigger a dump
16:53coventryamalloy: sweet, thanks.
16:53justin_smithjvisualvm comes with java
16:53jcromartiejvisualvm <3
16:53amalloyyourkit for life
16:53mikerodyourkit cost $$
16:53mikerodvisualvm has done alright :P
16:54amalloyfree license for open-source projects. and if you use it at a real company, it's worth the money
16:54mikerodI didn't know that. I'll have to check it out and see the difference.
16:54technomancyit's only free if you advertise for them
16:54amalloyfwiw coventry, i've never heard of a Javadump in my life. must be some weird thing specific to the IBM jdk
16:55technomancygratis, rather
16:55amalloytechnomancy: true. on the one hand, i've never actually done that; on the other, here i am in #clojure
16:55technomancy~guards
16:55clojurebotSEIZE HIM!
16:56mikerodamalloy: so you've fulfilled your duties
16:56mikerodusing a profiler on nrepl always confuses me
16:58mikerodit uses several threads and I don't suppose I know how they are being used
16:59justin_smithseems like clojure always has a set of threads (for agents I think?)
16:59ordnungswidrig2mikerod: +1
16:59mikerodjustin_smith: it appears to be agents indeed
17:07ordnungswidrigthere was a blog post on symbols as functions or like that. some days ago
17:08ordnungswidrigdoes anybody have a pointer? I wan't to resolve a function at runtime, not earlier
17:08amalloyi mean, the function is named resolve
17:09justin_smith,('symbol '{symbol value}) ; at first I thought ordnungswidrig meant this
17:09clojurebotvalue
17:09amalloyas 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:09ordnungswidrigamalloy: I'm playing with user ns and dev
17:10ordnungswidrigand refresh-all.
17:10ordnungswidriglike in stuarts workflow
17:10ordnungswidrigI don't want to refer to my system-init function from user because this might break lein repl startup
17:17charelooking for something to host a web app that allows some free use and free db storage
17:17charewhat do you guys use
17:17jcromartieAmazon can be free
17:17jcromartieEC2
17:17jcromartieyou just don't want to go over the limits
17:18dacci thought free tier was only for a year?
17:18charewhat do you mean free
17:18charesince when is ec2 free
17:18daccchare: i think you can have a free micro ec2 for the first year of your account
17:18jcromartiehttp://aws.amazon.com/free/
17:19charea year is not my definition of free
17:19jcromartieyes 1 year after signing up for AWS
17:19jcromartieTINSTAAFL
17:20charejcromartie damn it
17:20jcromartieI'm assuming you're talking about hosting a Clojure web app
17:21jcromartieif you can package it as a .war then there are some free Java app hosts
17:21technomancyhe's asking about an erlang web app, he just didn't like the answers he got in #erlang
17:21jcromartiewell yeah you're pretty much screwed there
17:23robinkI'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:23charecome 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:23robinkAm I doing something wrong?
17:23robinkRather, an instance of class RtfHeader.
17:23jcromartiechare: define "web app" and "db" first
17:24charewhat do you mean?
17:24chareisn't that standardized
17:24amalloyjcromartie: 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:24akhudekchare: there is appengine that has a permanent free tier
17:24akhudekchare: but you might have to work a bit to fit your app to their api
17:25chareakhudek: google app engine doesn't support erlang ><
17:25jcromartiechare: no it's not standardized
17:25akhudekoh, I didn't realize that they were serious about that
17:25akhudekhaha
17:25chareakhudek: is google app engine the only one that has a true free tier?
17:25akhudekchare: no clue
17:25chareakhudek: what do you mean you saying that erlang isn't serious?
17:25jcromartiesome people mean a few PHP files, some people mean a whole VM, some people mean a .war file
17:26akhudekchare: I thought they were kidding that you were trying to host an erlang app is all
17:26akhudekerlang is pretty cool
17:26chareakhudek: and even if i use clojure instead don't i have to use some messed up api involving some datastore thats not sql
17:27jcromartiechare: again, no free lunch
17:27jcromartiesorry
17:27charegoogle app engine uses some google datastore not sql right?
17:27jcromartiechare: any free host does so by minimizing what they give you via things like that
17:27akhudekchare: yes
17:27jcromartiekey-value stores instead of free reign on a SQL DB
17:27sdegutischare: I think Google Datastore is SQL right?
17:27sdegutischare: pretty sure Google App Engine is just a wrapper around AWS btw
17:28justin_smithsdegutis: https://developers.google.com/appengine/docs/python/datastore/ it is nosql
17:28charegoogle app engine is not running on AWS no chance of that
17:28sdegutischare: citation needed
17:28akhudekI mean there is https://developers.google.com/cloud-sql/
17:28akhudekbut it's not free
17:29justin_smith"most queries are eventually consistent"
17:29chareok so in worst scenario i can use clojure with google's datastore?
17:29technomancychare: heroku postgres has a free tier: https://addons.heroku.com/heroku-postgresql
17:31sdegutisChasm: 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:31sdegutischare: 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:31sdegutisChasm: sorry about that
17:34devthany 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:35TimMcdevth: SFW = Safe For Work?
17:35devthyeah. and by that i mean detect and filter out NSFW words
17:38amalloy(remove #{"butt" "butts"} words) ;; prototype
17:38cbpeheheheh
17:38sdegutisamalloy: shouldn't it also allow some kind of regex?
17:38amalloysdegutis: i don't want to make the clbuttic mistake
17:38sdegutistouche
17:39sdegutisalso haha
17:40chareok I decided to try heroku
17:40charelets see if its actually free
17:40benmosshttp://en.wikipedia.org/wiki/Scunthorpe_problem
17:40devthlol, yeah. we are having same convo in work irc :)
17:40devththought i’d check to see if there were existing libs
17:41benmossthis looks pretty legit http://kickjava.com/src/org/nemesis/forum/filter/FilterProfanity.java.htm
17:41akhudekbenmoss: there is word boundary support in java regex
17:41benmosslots of copyrights, CoolServlets.com
17:42yediin om: i'm having trouble getting om/build to work -- https://www.refheap.com/61495
17:42yediheader doesn't show up
17:42akhudekif 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:42yediwhen i replace `app` with `header` in the `start` fn, the header renders
17:54TimMcdevth: Lost cause.
17:55TimMcYou're familiar with l33t-speak, yes?
17:55devthyes, well aware you can’t catch 100%
17:55devthbut 80% would be pretty nice
17:56TimMcI'm pretty sure it won't accomplish sh!t.
17:56devthhaha
17:56technomancyis the goal to stop people from using objectionable language or just to keep people from seeing it who don't want to?
17:56devthso 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:56benmossperhaps it is a societal problem
17:57devthof course it can’t filter out anything someone says. it’s irc.
17:57devthbut filting dirty UD defs would be fairly easy to hit 80% i think
17:57TimMcUrban dictionary is inherently NSFW.
17:57technomancyah, so if the users creating the content aren't being directly exposed to the filtering it has a chance of working
17:57TimMcA lot of those definitions are NSFW without even having "NSFW words".
17:58devthyes, but some are just funny, and not dirty
17:59TimMc...some.
18:00TimMcBut 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:00devthright
18:01TEttingerI'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:02amalloyyeah, i think trying to somehow clean up urban dictionary is like dusting the contents of a garbage can
18:03devthall the most offensive things we’ve seen in chat would be very easy to filter with a simple blacklist
18:03devththey don’t go for subtlety
18:03amalloyhttp://www.theatlantic.com/technology/archive/2013/01/ibms-watson-memorized-the-entire-urban-dictionary-then-his-overlords-had-to-delete-it/267047/
18:18felherIf I want to put defrecords into a sorted-set, is (extend...)-ing Comparable the way to go?
18:20amalloyfelher: Comparable is an interface, not a protocol, so you'd have to implement it as part of the defrecord definition
18:20amalloybut using sorted-set-by, with a sensible Comparator, is more flexible
18:21felheramalloy: okay, got it, big thanks :)
18:22amalloyfelher: note that functions implement Comparator, so you can use (sorted-set-by (fn [a b] ...) x y z)
18:28felheramalloy: ah, that is way cool. Thanks.
19:40daccwhat'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:41justin_smithdacc: you could use reduce for that, maybe there is also a way to do it lazily using mapcat
19:41amalloydacc: do you really want to have 1 and 2 as top-level elements, instead of single-element collections?
19:41daccamalloy: yes
19:41amalloyjustin_smith: mapcat can't work because he needs context
19:42justin_smithahh yeah
19:42hyPiRion,(mapcat (fn [[x :as xs]] (if (char? x) [xs] xs)) (partition-by char? [1 2 \a \b 3 \c]))
19:42clojurebot(1 2 (\a \b) 3 (\c))
19:43hyPiRionNot that I would have numbers as top-level elements, but that's how I'd do it.
19:43dacccool, thanks
19:44hyPiRionHmm, I had a neat idea just now.
19:45hyPiRionbut it wouldn't work, so no matter.
20:01coventryIs 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:32kanweihas anyone else played with jdk8? a simple benchmark results in 2x worse performance for me
20:33kanwei(time (reduce + (range 1e8))): jdk7 = 4.2s, jdk8 = 8.3s
20:35xeqiI don't trust benchmarks not run with criterium
20:36yediany 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:36yedibut it works when i try it with :className or :id
20:40beamsokanwei: i get roughly similar times between jdk7 and jdk8
20:43kanweibeamso: mac?
20:44beamsoyes
21:06apricotshi, 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:12apricotsah nm
21:18krasAny good readme for clj-antlr? Sorry don't have a Java background
21:21pmonkskris - have you looked at instaparse? Unofficial Tagline: "It kicks parse".
21:21pmonks*kras
21:22pmonksOr are you looking to generate a pure Java parser?
21:24kraspmonks: I tired instaparse, but it doesn't suite my requirements
21:25pmonksah ok
21:25pmonksShame - my experience with it has been euphoric.
21:25kraspmonks: I don't need a complex parser but one which is fast and efficient
21:25krasMy grammar is not very complex
21:25kraspmonks: how do we ignore whitespace and newlines using instaparse?
21:26TimMcOh neat, lein-voom has an option to help with deterministic builds (using the git commit time for any timestamps.)
21:27pmonkskras: I listed whitespace explicitly in my grammer
21:27pmonkshttps://github.com/pmonks/lolcmis/blob/master/src/lolcmis/grammar.clj
21:27pmonksNote: I'm a n00b to both clojure and instaparse, so it might suck
21:28kraspmonks: whitespace is ubiquitous in my grammar
21:28krasI can't afford to list it in every rule
21:28akhudekkras: you can suppress whitespace in the generated parse trees, but you still need to put it in the grammar unfortunately
21:28pmonksYeah it's common in mine too - I just list it and suppress it.
21:29kraspmonks: akhudek: I am actually surprised that this feature is missing. Basic for any good parser
21:30krasImagine writing a subset of C like grammar listing all the whitespaces
21:30pmonksLuckily for me that's not my use case. ;-)
21:30pmonksLOLCODE syntax is rather different to C
21:31gfrederickstoday 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:31gfredericksdoes that sound like a useful lib?
21:32kraspmonks: I see quite a few whitespaces in your grammar
21:32gfrederickss/CLJ/CLI/
21:32pmonkskras: yeah there are a few, but not "ubiquitous" I wouldn't say
21:32pmonksAnd suppression helps a lot - it's awesome!
21:34gunsgfredericks: That sounds logical; the arglists can also be displayed in usage: summary style
21:35gfredericksguns: ah right; and docstrings of course
21:36gunsThese commands aren't amenable to -s/--switches of course
21:37gfredericksyeah; I wonder if it could combine well with tools.cli
21:37gunstools.cli needs a higher level CLI composition framework
21:37gunsI only upgraded the parser
21:38gfredericksI guess if it was done simply enough it could be combine easily
21:39gfrederickse.g., the base functionality is [Namespace Keyword -> [String Any * -> Any]]
21:39gfredericksdoesn't even *have* to be CLI specific
21:39gunsTying the command to namespaces seems a little restrictive
21:40gfredericksyou could search all loaded namespaces
21:40gfredericksseems a little magical
21:41gunsI think metadata for CLI metadata is a great idea. If you start building a larger framework around this idea, please let me know
21:42gunsbut yes, explicit declarations
21:44gfredericksthe tricky part is options that you want to span commands
21:45gfredericksoh snap could inheritance do that nicely?
21:46gfredericksI need to stop thinking about this it's not going to turn into anything sane
21:49gunsI guess metadata is kind of inexpressive if you want to write it inline as a reader attr-map
21:50gunsOnce you start using alter-meta! you may as well be using real data
21:58hugodguns, gfredericks: I had a go at a higher level cli lib a while back https://github.com/pallet/cli-cmds
22:03gunshugod: Do you have an example project that uses this library? Also, you should upgrade tools.cli (the parser is much better!)
22:05hugodguns: sorry the only examples of usage I have aren't open source - I should try and add some examples to the repo
22:21gfrederickshugod: looks interesting, thanks
22:22technomancygfredericks: I did something vaguely like that ^:command thing in mire
22:23technomancywhere you use metadata to indicate a function should be a command for a telnet game thing
22:27gfredericks(->> clojure-features (sort-by #(/ (use %) (hype %))))
22:27gfredericks(take 5)
22:28dsrxmire.... is that a mud engine?
22:28dsrxmy oft-started-but-never-finished pet project in many a freshly learned language was a mud client named "quagmire"
22:31gfredericksI bet #1 is refs
22:31bufferloss,(* [2,2] [3,4])
22:32clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number>
22:32bufferlosshow can I "multiply" two arrays together? in the above example I'd like the answer to be [6,8]
22:32bufferlossand I know I could just map * 2 in this case, but for something more arbitrary
22:32gfredericks,(map * [2 2] [3 4])
22:32clojurebot(6 8)
22:32bufferlosshmm, ok thx
22:33bufferloss,(map * [0.28384 -0.11029] [3 4])
22:33clojurebot(0.8515199999999999 -0.44116)
22:33bufferlossnice :)
22:33brehaut(aka zipwith in other languages)
22:36amalloy~zip
22:36clojurebotzip 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:45devni cant brane good. i have a case of the dums
22:46technomancydsrx: it was the sample project for the peepcode screencast I did on clojure
22:47devni have a seq of maps: ({"foobar" #{"UNIQUE1" "UNIQUE2"}} {"foobaz" #{"UNIQUE1" "NOTINFOOBAR"}}) and I want to get something out like {"foobar" [{"foobaz" 1}]}
22:48devnwhere 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:48devnbasically 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:49devnby returning the number of matching occurences of values
22:50devnim thinking (count (clojure.set/union ...)) will be what i use
22:51devnmaybe this is just loop recur? reduce perhaps?
22:51devnbleh. im dead right now. probably time for bed
22:52devnbut 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:54devnso (find-it '({"a" #{1 2 3}} {"b" #{2 3 4}} {"c" #{3 4 5}})) => {"a" [{"b" 2} {"c" 1}]}
22:54devnthat's the input/output im thinking
22:54devncheers
22:55xuser http://clojure.org/lazy - does this document has next and rest backwards?
23:05devnbah i mis-spoke above
23:05devni meant intersection
23:09vimuser2when using defmulti/defmethod, is there a way to check to see if the the dispatcher value will be handled?
23:09vimuser2oh getmethod mabey
23:10vimuser2*get-method looks like it's the answer
23:15technomancy,(require '[clojure.set :as clojure.string])
23:15clojurebotnil
23:15technomancy,clojure.string/union
23:15clojurebot#<set$union clojure.set$union@f78c3d>
23:16technomancyhttp://p.hagelb.org/10hair.gif
23:16technomancythat is all.
23:17bbloomwho, i didn't realize that aliases could have dots in them, but i guess of course they can...
23:18bbloomin general, namespaces seem half baked despite being 100X better than anything python/ruby/javascript/etc can even think about offering
23:18technomancyinc
23:19bbloom#<core$inc clojure.core$inc@43350e24>
23:19technomancythat too
23:22technomancyhalf baked as opposed to 5%-baked
23:22bbloomor in the case js, negative baked
23:22devntechnomancy: heh
23:23devn{} + []
23:23devnlike you do!
23:23devn,clojure.set/union
23:23clojurebot#<set$union clojure.set$union@f78c3d>
23:23devn,clojure.string/union
23:23clojurebot#<set$union clojure.set$union@f78c3d>
23:23devn,clojure.string
23:23clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.string, compiling:(NO_SOURCE_PATH:0:0)>
23:24technomancy,clojure.string/replace
23:24clojurebot#<CompilerException java.lang.RuntimeException: No such var: clojure.string/replace, compiling:(NO_SOURCE_PATH:0:0)>
23:24devnboggle
23:24xeqihaha
23:24technomancyheavens! where has it gone?
23:24devn,clojure.string
23:24clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.string, compiling:(NO_SOURCE_PATH:0:0)>
23:24brehautbbloom: js doesnt even mix the ingredients. baking isnt even on the recipe
23:24devn,clojure.string/union
23:24clojurebot#<set$union clojure.set$union@f78c3d>
23:24technomancyhttp://p.hagelb.org/mystery.gif
23:24xeqi,(require '[clojure.string :as clojure.string])
23:24clojurebot#<IllegalStateException java.lang.IllegalStateException: Alias clojure.string already exists in namespace sandbox, aliasing clojure.set>
23:24devnwow, that's nasty, but i mean, if you find yourself in that position
23:24devnyou're absolutely fucking insane
23:25brehauttechnomancy: do you have chords bound for all of these?
23:25bbloomouch, now clojurebot is broken foreverz
23:25xeqi,(require 'clojure.string)
23:25clojurebotnil
23:25bbloomor at least until it's next reboot
23:25xeqi,clojure.string/union
23:25clojurebot#<set$union clojure.set$union@f78c3d>
23:25devn,bbloom i think it cleans up after itself every 10min or something
23:25clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: bbloom in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:25xeqiheh
23:25devn,(require [clojure.string :as clojure.string])
23:25clojurebot#<CompilerException java.lang.ClassNotFoundException: clojure.string, compiling:(NO_SOURCE_PATH:0:0)>
23:26devn,(require '[clojure.string :as clojure.string])
23:26clojurebotnil
23:26bbloom(def bbloom 'rules)
23:26devnclojure.string/replace
23:26technomancybrehaut: these are hand-typed, quality gif urls my friend
23:26devn,clojure.string/replace
23:26clojurebot#<string$replace clojure.string$replace@1179aa5>
23:26devnthere we go
23:26bbloomdev ##bbloom should work just fine now
23:26devntechnomancy: artisanal
23:26technomancyhttp://p.hagelb.org/tastes-mature.png
23:26brehauttechnomancy: i need to build my own keyboard for high speed linking then
23:26devn"hello? operator?"
23:27devn"yes, i need a sweet gif. thanks"
23:27devnthat'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:28brehauttechnomancy: i imagine the shopkeeper has keyboard pants under that apron
23:28devnSwag 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:29devnhttp://hipsum.co/
23:29devnhipster ipsum
23:29technomancywant to know what else is cool?
23:29bbloomdevn: something about that girl's glasses offends me
23:30brehautdevn: its got to be. ive never seen truffaut twice in one paragraph before
23:30bbloomdevn: maybe it's the black box on her nose
23:30devnbbloom: dude, that's so chillwave.
23:30devnsuper swag
23:30technomancyserving resources from disk normalizes double slashes in paths, but serving resources out of a jar does not.
23:30technomancy._.
23:30bbloomdevn: 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:30devntechnomancy: noooooooooo
23:31xeqitechnomancy: why u make double slashes?
23:31devnhttp://meettheipsums.com/
23:31devnwhoa. that is a lot of ipsums.
23:31technomancyxeqi: it wasn't me!
23:32technomancywell
23:32technomancyit might have been me in 2012 or something weird
23:32technomancyxeqi: https://github.com/technomancy/lein-survey/commit/7a33705b983f4bdfb31e7915e4d9030720b13044
23:33devn"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:33devnLebowski Ipsum
23:33devnThis makes me actually want to do front end work
23:33technomancydevn: the #emacs bot has a ,apropos-dude command
23:33technomancyit is invaluable
23:34apricotsis 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:35technomancywhy do they never increment the last segment of the JDK version numbers?
23:36guns,(alias 'clojure.set 'clojure.string)
23:36clojurebotnil
23:36guns,clojure.set/join
23:36clojurebot#<string$join clojure.string$join@1a89909>
23:36gunsnice
23:36gunswhat is this crap
23:36xuserare lazy-seqs delayed only when used at the top level of a function?
23:38xeqiapricots: 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:38lazybot⇒ [12 34 {:a 12, :c 56, :b 34}]
23:39apricotsxeqi: cool thanks
23:40xeqixuser: lazy seqs are delayed until they are needed
23:42vimuser2hm, 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:43xuserxeqi: yeah, I understand the concept, just having a hard time figuring out how they are used or work in clojure
23:44guns,(ns-unalias *ns* 'clojure.set)
23:44clojurebot#<RuntimeException java.lang.RuntimeException: No such var: clojure.core/eval>
23:44gunsns impl is gross
23:45xeqiguns: yep, it also prevents some awesome classloader stuff I wanted to do
23:45xeqisince the loaded ns list is global
23:48noprompt$seen ddellacosta
23:48lazybotddellacosta was last seen joining on clojure 2 hours and 49 minutes ago.
23:48ddellacostanoprompt: ping
23:48nopromptddellacosta: hey sorry if i misunderstood your patch earlier.
23:48ddellacostano problem, as I said I should have framed it different from the get-go
23:49nopromptddellacosta: i think it's a good idea to expose a way to get the route, i just wanted to understand your problem clearly.
23:49ddellacostathat's what I get for being in a hurry
23:49noprompthahah
23:49nopromptno sweat
23:49ddellacostanoprompt: :-)
23:49technomancyvimuser2: I usually put (def mymulti nil) before defmulti during development
23:49ddellacostanoprompt: yeah, so, I'm in a meeting but let me ping you when I'm done if you're around
23:49ddellacostanoprompt: (otherwise we can just keep talking via the github thread, whatever)
23:49nopromptddellacosta: i'll stick around just for you ;)
23:50nopromptddellacosta: nah, let's chat here, it's more efficient
23:50ddellacostanoprompt: thanks!
23:50noprompt:)
23:50ddellacostak
23:50vimuser2technomancy: hmm, thanks
23:55nopromptRaynes: omg. is the file/join shit ever gonna end...