#clojure logs

2013-01-07

00:00dog_cat11hey guys, I was wondering if anyone out there had experience doing text parsing in clojure
00:00dog_cat11if so, what packages, clojures functions are you using for file i/o, and parsing(regex's)
00:00TimMcJust regexes, not CFGs?
00:00gtrakfile i/o is easy, take a look in clojure.java.io
00:01clojurebotAlles klar
00:01gtrakwhat is file i/o?
00:01gtrakclojurebot...
00:01dog_cat11just packages to read in and out text files
00:01dog_cat11a fair amount of the programming i do is in perl
00:02gtrakjava has those built in, clojure wraps them nicely
00:02TimMcdog_cat11: Have you seen slurp and spit?
00:02dog_cat11yeah, i've used that before
00:02dog_cat11a disadvantage is if the file is huge
00:02dog_cat11or at least I don't know how to load it lazily
00:02gtrakinputstreams and readers do that job
00:03gtrakgenerally you do something like (reader (resource uri)), then you've got a java Reader to play with
00:03TimMcdog_cat11: If you need random access, I think the Java stdlib provides memory-mapped I/O.
00:03TimMcbut otherwise just use lazy operations
00:04amalloyTimMc: it does, but that's certainly not the only way to get random access
00:04TimMcI'm sure. I've never had to look into it.
00:06dog_cat11@TimMc, just regular expressions not any other finite automata
00:06TimMcYou just need to rip through a file linearly and spit out some output, right?
00:06dog_cat11exactly
00:07dog_cat11complications include multiline entries, and files larger than RAM
00:13dog_cat11it looks like slurp runs a loop to append chars, I may write a lazy-seq version that returns line by line
00:13gtraki think that exists already
00:14gtrak&(doc line-seq)
00:14lazybot⇒ "([rdr]); Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader."
00:14technomancy,(doc line-seq)
00:14clojurebot"([rdr]); Returns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader."
00:14jkkramerdog_cat11: https://www.refheap.com/paste/8167 shows the basic thrust
00:16dog_cat11oh, that's prime
00:17dog_cat11no all I have to do is convince my boss to learn lisp...
00:24dog_cat11damn, there are so many great clojure functions out there
00:24aperiodici'm trying to use the http.async.client, but whenever I try to GET anything, it fails with a java.net.ConnectionException
00:24aperiodicanyone have any idea what might be going wrong?
00:32tomojaperiodic: doesn't the ConnectException have a message?
00:36aperiodictomoj: the message is just the URL that failed ("http://google.com")
00:36dog_cat11what are people using for IDE's?
00:36bpremacs w/nrepl
00:39dog_cat11thnx
00:39dog_cat11i've just been using vi and lein from the command line
00:40aperiodicthere's good vim support
00:41aperiodici use a combination of vimclojure (for highlighting, formatting, and paredit) and slimv (to connect to a swank server for sweet editor integration)
00:41tpopetime to add a little foreplay.vim, my man
00:41dog_cat11i guess so!
00:42aperiodictpope: does nrepl still only do a namespace at a time, or can i have multiple editor sessions connected to the same nrepl server with a different ns for each?
00:43tpopeclarify multiple editor sessions
00:43aperiodicmultiple instances of vim
00:44tpopeI guess either way, the answer is you can have as many nses as you like
00:44tpopenote the workflow in foreplay.vim is a bit different. the ns used is always the one for the current file
00:45aperiodicthat's acceptable
00:45aperiodici think
00:45aperiodici'll give it a shot
00:47aperiodicis there no 'evaluate the toplevel form the cursor is in' command?
00:47tpopeaperiodic: there's not. it would be easy to add. I've just been repositioning and using cpp
00:47tpopebbloom: what's your current thoughts on evaluating the top form?
00:48aperiodici would love that
00:48bbloomtpope: i still use cpap more than cpp, but cpp is crazy useful when i need it
00:48dog_cat11ccw for eclipse can do that
00:48bbloomtpope: i also use cp$ and cpw quite frequently
00:48tpopeaperiodic: actually :Eval technically defaults to the top level form
00:49bbloomtpope: is :Eval the same as cpap or is it actually matching braces?
00:49tpopebut I'm sure the shift key is an ABSOLUTE DEALBREAKER
00:49tpopebbloom: it matches braces
00:49tpopeparentheses only, but I could make it do braces
00:49bbloomtpope: parens is what i meant
00:49tpopeand brackets
00:49bbloomtpope: is there a standard shortcut for :Eval ?
00:50bbloomb/c cpap only works when i don't have blank lines
00:50tpopeno
00:50bbloombut i tend to only have blank lines in my deftype or extend-protocols, in which case i need to cpr anyway
00:50tpopeI was thinking cpo would be "outer"
00:50bbloomis there a cpi ?
00:50bbloom"inner" ?
00:50tpopewell that's what cpp is
00:50bbloomright, but does cpi do that?
00:51bbloomit would be nice if cpi and cpo both worked, and i'd vote for cpp to be cpo
00:51tpopecpi is half a command. i is the first letter of a text object
00:52bbloomtpope: ah yes, dug
00:52bbloomduh*
00:52bbloomsometimes i forget things that my fingers know
00:53bbloommy biggest complaint (which is admittedly a small complaint) is that cpap will move my cursor to the top of the paragraph, so i have to manually move back there
00:53bbloombut that's just the behavior of text objects, i guess
00:53tpopeyeah I'm really reticent to do things differently than vim does
00:54tpopeactually, the way I was planning on implementing cpo would mandate that behavior, I think
00:54bbloomdid you make any progress on the error window?
00:54tpopesome!
00:54bbloomsweet
00:55tpopethough I don't remember what I discussed with you
00:55bbloomyou have no idea how much you've improved my clojure-ing
00:55bbloom:-)
00:55tpopeoh you mean the stacktrace parsing
00:55tpopeI have a stacktrace parser working
00:55bbloomcool
00:55tpopeI don't have a good way to get stacktraces out of nrepl
00:56bbloomis cemerick helping?
00:56tpopehe said a middleware is probably the way to go
00:57bbloomhmmm :-/ seems like stack traces should be a common thing! did he say anything about session clones?
00:58tpopethe main thing he said was that ccw uses .printStackTrace
00:58bbloomon e* ?
00:58tpopeI assume. I didn't ask
00:58tpopeI guess he could be wrapping all evals in a try
00:58tpopeI am seriously considering that
01:00bbloomhm... part of me thinks "of course that would work" and another part of me is like "the top-level is hopeless, don't make it worse"
01:00bbloombut i'd have to think more deeply about it
01:00tpopeyeah I hate to change the outcome by measuring it
01:01bbloomtpope: well the issue is that "(do 1 2)" isn't technically the same as "1 2"
01:01bbloomthe former is a single compilation unit, the later is two compilation units
01:01bbloombut i dunno if it would matter for the foreplay usecase
01:01tpopebbloom: I've already accepted that reality for the one-off runner
01:02bbloomi suspect that the try/catch would be fine & that if it ever isn't fine cpr would be the answer
01:02tpopeactually, that's a good guestion
01:02tpopeis there a good way to read / eval all forms in a file?
01:02tpoperead gets one form
01:03bbloomi'm not as familiar with clojure's top level as i am with clojurescript's
01:03bbloombut the only things i know of are basically load-file
01:04technomancytpope: open a reader and repeatedly call read on it
01:04technomancyyou can tell read to give you a sentinel value when it hits EOF
01:04tomojwhat's the recursive? param mean?
01:04tpopethat's kind of what I figured
01:05bbloom:vim-foreplay/eof
01:06technomancy(take-while (partial not= ::eof) (repeatedly (partial read rdr)))
01:06technomancyerr: (take-while (partial not= ::eof) (repeatedly (partial read rdr false ::eof)))
01:06tpopeI guess the only implication of this is that I could output multiple values if multiple forms were passed in
01:07tpopetechnomancy: good deal, that's not so bad
01:07bbloom,(do 1 2)
01:07clojurebot2
01:07bbloomtpope: just do with that :-)
01:07tpopebbloom: that's what I'm doing in the one off
01:07tomojthe only use of the recursive? parameter I see is that the reader will throw an exception in certain circumstances if recursive? is true
01:07tpopebbloom: and for symmetry, in the nrepl adapter, I drop all but the last value
01:08technomancytpope: course you can just slap a () around the text you want to read and read it as a single form too
01:08tpopetechnomancy: exactly what I've been doing, with a do in there because I want to eval it
01:09technomancytpope: as long as you're aware of the gilardi scenario you're probably in good shape
01:11tpopetechnomancy: oh yes, that. yes, I bumped up against it and figured it out
01:11bbloomgilardi?
01:11clojurebotthe gilardi scenario is what happens when you try to require and use a var in the same block of code: http://technomancy.us/143
01:12bbloomholy hell. clojurebot was actually useful!
01:12bbloom~botsnack
01:12clojurebotThanks! Can I have chocolate next time
01:12SgeoRacket solves that by ... require not being a function :(
01:13arrdemwhat the shit! clojurebot answered a question!
01:13SgeoHrm, well, I think I don't understand the problem\
01:13SgeoIf I did, I could contemplate Racket's take. But Racket's being annoying in how undynamic it is
01:13bbloomclojurebot seems to love question marks... but that's the first time it actually was really useful
01:14bbloomyou know what i mean??
01:14lazybotbbloom: Definitely not.
01:14muhootwo bots, no waiting.
01:16tpopebbloom: I'd also need to come up with an elegant way to send the stack trace over the wire and pick it out on the other end
01:16bbloomtpope: print-str
01:17bbloomer rather pr-str
01:17tpopeno I mean like
01:17bbloomoh in vim?
01:17arrdemis error info not serializable?
01:17bbloomso you need something regex friendly? like tab delimited lines?
01:17tpopeI could use .printStackTrace, but anyone who prints a stacktrace would then see it silently slurped up into the internals
01:18tpopethe output of .printStackTrace is fine. I just need to recognize *my* printStackTrce
01:18tpopeI guess I could use stderr? that seems pretty seldom used in java land
01:18tpopeor clojure land, at least
01:18bbloomi wouldn't rely on that, since it's just a (binding [*out* *error] ...) away
01:19tpopeso what should I do? I need in band signaling that's unlikely to cause a problem in practice
01:19bbloomhttp://en.wikipedia.org/wiki/Private_Use_(Unicode)
01:19tpopeI'll still do a sanity check against a regex
01:19bbloomyou basically need a magic sequence like JPG or something
01:20tpopethis could work
01:20bbloomi'd go with a random unicode private use byte followed by FOREPLAY or something like that
01:20arrdem0xBAD1D3A
01:20bbloomheh
01:20arrdemthere's your magic string.
01:20tpopeuntil nrepl gives me a clean way to get it back, my options are limited
01:22bbloomtpope: cljs makes use of some private chars for keywords and symbols encoded as strings
01:22bbloomseems to be a pretty useful approach
01:22bbloompresumably you're never writing such characters to stdout unless you're expecting them
01:23tpopeokay I think I have a good-enough approach
01:23bbloomuse a "non character"
01:23bbloom So, noncharacters are: U+FFFE and U+FFFF on the BMP, U+1FFFE and U+1FFFF on Plane 1, and so on, up to U+10FFFE and U+10FFFF on Plane 16, for a total of 34 code points.
01:24bbloomOne particularly useful example of a noncharacter is the code point U+FFFE. This code point has the reverse binary sequence of the byte order mark (U+FEFF)
01:24bbloomnot that one :-)
01:25tpopeso (try a b c (catch Exception e (print whatever) (throw e)))
01:25tpoperight?
01:25clojurebotEqual Rights for Functional Objects is Baker's paper on equality and why it's impossible to define sensible equality in the presence of mutable data structures: http://www.pipeline.com/~hbaker1/ObjectIdentity.html
01:26bbloom(dec clojurebot)
01:26lazybot⇒ 13
01:26bbloomheh, bot bashing
01:26bbloomtpope: i think so... is that how you re-throw correctly?
01:27bbloomdo you want to re-throw?
01:27tpopeyeah I do, I think
01:27tpopeand no idea if that's correct
01:28bbloomwho are you re-throwing to? some up-stream nrepl middleware?
01:28tpopebbloom: I guess. I still want *e to be recorded and whatnot
01:28bbloomah, yes, that makes sense
01:28bbloomi guess you need to look for your magic string and then not show the stack trace twice
01:29tpopebbloom: if it sent the stacktrace back, this wouldn't be an issue :)
01:29tpopeit's deliberately omitted
01:30bbloomthe other approach is to wait 25 years until light table is as feature rich as vim :-P
01:30tpopeor 10 years until evil mode is a strict superset of vim
01:32bpror 1 year to lear emacs...
01:32bpr:-p
01:42ro_st1 year. that's optimistic
01:47ibdknoxbbloom: hey, give me a break. 24 years.
01:53oskarthibdknox: when you were using vim, how did you normally interact with the repl?
01:54ibdknoxoskarth: vimclojure - tpope hadn't written his stuff yet :)
02:04muhooro_st: i've been using emacs for exactly 10 years now and i'm just starting to learn it
02:04muhoolike daily, and for everything.
02:06ro_stmuhoo: yup. do you use orgmode?
02:17freakazoidHow do I import a class from a .java source file that has no package declaration?
02:17freakazoidthe class name is the same as the filename, but (import 'classname) from the repl doesn't seem to do the right thing
02:17freakazoidI get a class but it doesn't seem to be the right class - doesn't have any of the static fields on the actual class
02:22muhooro_st: i do indeed.
02:23muhooin fact, one of the great troubles i have after getting an android tablet, is how to do org mode on it.
02:24freakazoidmuhoo: MobileOrg is not working for you?
02:24muhooi haven't tried it. the syncing looked sketchy to me
02:24muhooi'm a git kind of guy.
02:24ro_sti reckon orgmode is one of the better ways to get hands on with emacs
02:25ro_sti speak as someone who hasn't actually tried, of course.
02:25muhooit appears from looking at clojure source, like the relevance guys use org mode
02:26noidifreakazoid, you can't just import things from .java source files. you have to compile them into .class files and place them on the classpath.
02:26muhoogawd, one more hour of having to write stuff like EditNormalTempDialogFragmentListener, and i'm going to go insane
02:26freakazoidnoidi: Sure, I know that... I am using a bunch of them and most of them are working fine
02:26freakazoidnoidi: It's in my java source directory and I ran lein javac
02:26muhootime to bust out my cljs project soon
02:27freakazoidnoidi: I think the problem may actually be that none of the members have an access declaration, though I'm not sure how the java stuff works either in that case
02:27noidithe default access is "package private"
02:28noidiwhich means that only things within the same package can access the members
02:30freakazoidnoidi: ok, that explains that part. And I got the (import) syntax. What's the :import syntax?
02:30tomojfreakazoid: there's no reason to import if there's no package. but put it in a package!
02:30freakazoidohh
02:30tomojI can add more exclamation points if necessary
02:35freakazoidhmm, but now I have an illegal access error
02:35freakazoidthough I've declared the (static) methods I'm accessing public and the class is public
02:35freakazoidit's possible my repl is hosed
02:36freakazoidyup, that was totally it. thanks, tomoj! (i put it in a package since I had to modify the file anyway)
02:36tomojyou have to restart the repl every time you javac :(
02:37freakazoidgrumble grumble
02:37freakazoidWell, now I have working ed25519 signatures in Clojure at least :)
02:38noidiif you do a lot of Java programming, you might want to invest in JRebel http://zeroturnaround.com/software/jrebel/
02:38freakazoidI do no Java programming.
02:38freakazoidAnd I don't plan to start.
02:38noidiit allows hot-swapping Java classes without restarting the process
02:39freakazoidNight, everyone. Thanks for your help, noidi and tomoj.
02:48muhoohmm, hotswapping java classes would be useful in clojure for interop stuff
03:03ppppauli'm uploading a file to my ring server... i am able to get all the details i need cept the file name, how would i do this?
03:05ro_stppppaul: inspect the ring request directly. reading through the headers in that map should give you what you want.
03:07ppppauli did
03:07ppppaulbut i don't get a file name
03:07ppppauli'm appending the file name onto the end of the post url for now... but it seems a bit hacky
03:09ro_stthat's odd! i'm pretty sure the filename is included with file upload form posts?
03:09ppppauli'm not using a form
03:09ppppauli'm using curl
03:09ro_st:-)
03:10ro_stbing.
03:10ppppaulmaybe i should make it look like a form post
03:10ro_stthe file can't know what it's own name is
03:11ppppauli'm just getting a stream
03:11ppppauli'm glad that it tells me how large it is
03:12ro_stappending a filename is fine. browser does the same
03:16ppppaulthat's what i'm doing now
03:16ro_stgood idea to mimic the form post if you plan to use that eventually
03:17ppppauli have never used a form post
03:17ppppaultoo sexy for forms
03:17ppppauli'll look into using them, though.... may save me headaches
03:36klangAnybody using nrepl.el in a remote host setting?
03:36ro_stsometimes, yes
03:36ro_stautocomplete really slow, unfortunately :-(
03:37klangare the two hosts of different os type?
03:37ro_stosx > ubuntu
03:37klangok .. does M-. work for you, on buildins .. like 'map'? (regardless of speed)
03:38ro_stah. i don't think so. it's a little tough to test right now, sorry
03:41klangok .. I've made a setup here: https://github.com/klang/repl-tests and am trying to fix it .. autocomplete could be fixed as well, if emacs can be tricked to look at local files instead of the remote files, I suppose.
03:44klangI have a clojure instance running for weeks on a CentOS machine, connecting to it via my corp isued Windows7 machine .. so I'm almost always connecting remotely (also at home where I use Suse/mac) the failing nrepl-jump can be fixed. On the positive side, slime/swank fails in the same manner..
03:44tomojswank works with some tramp magic
03:47klanghmm, so, I guess slime/swank isn't entirely deprecated for my usecase, yet.
03:47fmardiniHi, is their a macro that wraps cond and prints the form that matches (for debugging)
04:12wingyso when using a compojure route the number is a string eg. (GET "/item-types/:item-type-id" [item-type-id] ...
04:13wingyis there a way to get the item-type-id as a float directly or do i have to do (let [item-type-id (read-string item-type-id)] myself
04:13ro_styou have to float it directly. (float str) or (read-string str) if str has "." in it
04:14ro_sti had to do the same thing with datomic ids and (Long. str)
04:15wingyro_st: should i use float or Long. ?
04:16tomojis the item type id really a float?
04:16ro_sti used long because i had Longs. you should use float if you have floating point numbers.
04:16wingyyeah
04:16tomojfloating point ids seem.. weird
04:16aperiodicagreed
04:16aperiodici mean, who would want to use the reals for ids
04:17aperiodicthere's an uncountable amount of them between any two. seems odd
04:18aperiodicwhen i think ids i think "counter"
04:18tomojI guess if you're parsing it from a short string you won't run into rounding issues?
04:20ro_stsurely there are enough ints to go around?
04:30tufflaxtpope: I tried with Python, it works well. The only problem is that if I have Ruby on my path, which maybe I want, vim-foreplay will go with Ruby and be slow
04:41tufflaxtpope: Maybe there could be an option I can set in my vimrc which one of Ruby and Python I prefer?
04:53RaynesYikes.
04:53RaynesScala has macros now.
04:54Fossiscala has everything
04:54RaynesBut macros. Ugh.
04:54dbushenkoscala is way too complex
04:55dbushenkoit hasn't clojure's simplicity :-)
04:55RaynesMacros seem like a ridiculous thing for Scala to have.
04:55RaynesThe language is already so unreadable that it's crazy.
04:55dbushenko:-D
04:55dbushenkoeven haskell is more readable :-)
05:02snowylikewhen did they add macros?
05:02dbushenkoin 2.10
05:03dbushenkoI think, its a trend now
05:04dbushenko.NET also has some facilities for metaprogramming
05:04dbushenkoI mean in compile-time
05:04clgvmozilla implemented macros for JS ;)
05:04dbushenkoyep, definitely its a trend
05:10clgvdoes scala have a certification program with a certificate that states you know everything about scala? ;)
05:11dbushenkoahahaha! :-D
05:12dbushenkoI think, there should be lots of highly restrictive guidelines or best practices for Scala
05:12dbushenkolike for Perl years ago
05:13dbushenkoor like for C++
05:13Fossii'd write my scala in this way anyway (call: foo (other: bar baz)) :>
05:14dbushenkobtw, :> -- is a type restriction in scala ;-)
05:14Fossi"functionname:" is such a broken concept
05:14Fossichanging binding according to the last letter in the methodname... i mean... srsly? -_-
05:36wei_how do you debug project.clj? for example, I'm getting "clojure.lang.Symbol cannot be cast to clojure.lang.IPersistentMap" without a stacktrace, when running a lein task
05:38kovaswei_: you probably left out some [] around a sub clause within a :require clause
05:41wei_kovas: my code seems to work outside of project.clj though
05:42wei_would you mind taking a quick look? https://www.refheap.com/paste/8170
05:42ro_stdoes lein repl work?
05:42ro_styou could try starting a repl from another project and using (read-string (slurp "path-to-broken-project.clj")) to possibly get a line number
05:43wei_yes. but "lein cljsbuild once main-dev" doesn't
05:44andrewmcveigh|wowei_: just a guess... don't you need to unquote ~build-opts ?
05:45ro_sti'd load-file that in a repl and inspect the output of (pr-str buld-opts)
05:45wei_andrewmcveigh|wo: ~build-opts seems to work! why?
05:46wei_when referencing a value in non-project.clj code I don't need the unquote
05:46andrewmcveigh|wowei_: something to do with the defproject macro, to eval forms you need to unquote
05:47andrewmcveigh|wowei_: don't know anything deeper than that I'm afraid.
05:47wei_ah. thanks for the tip
06:01abpAny pointers on how to decide which server to use to deploy Clojure web apps? We will not use any cloud services. So the decision is between jetty, immutant or deployment into a servlet container like tomcat.
06:02ro_stwe're using jetty so that we can avoid having to jar files
06:02ro_stwe'll go the jar route once it's clear that it's a performance issue
06:03ro_sthaving said that, we do this on EC2 :-)
06:04ro_stimmutant is quite a big commitment, because it's a turn-key app server
06:04ro_stso you might paint yourself into a corner down the road if you decide you want off of it, and you're now using all its apis
07:07RogachHello! Why is this not working: (clojure.set/intersection #{1 2} #{2 3}) ?
07:07babilenRogach: What exactly doesn't work? I don't see a problem
07:08babilen#(clojure.set/intersection #{1 2} #{2 3})
07:08Rogachbabilen: In my repl, it gives "ClassNotFoundException clojure.set java.net.URLClassLoader$1.run (URLClassLoader.java:202)"
07:09ro_stdo you have clojure.set required?
07:09ro_st(require 'clojure.set)
07:09babilenRogach: Which repl is that and which version of Clojure? It works fine there with leiningen2 on 1.5-RC1 and 1.4.0
07:09Rogachbabilen: Plain 1.4.0, without lein.
07:10babilenRogach: I would recommend to use leiningen2's "lein repl" -- Does it make a difference if you require the namespace as suggested by ro_st ? How do /you/ get a REPL?
07:11Rogachbabilen: Yes, ro_st's suggestion worked, thanks!
07:11Rogachbabilen: java -cp clojure.jar clojure.main
07:11Rogachbabilen: (+ rlwrap)
07:13babilenRogach: Give leiningen2 a try -- You will not want to miss it
07:13Rogachbabilen: Thanks, I'll try it.
08:36_wingyis immutant a platform like heroku?
08:37RaynesNo.
08:37sundbp_wingy: it's self-hosted
08:37clgv_wingy: an application server based on jboss afair
08:37sundbp_wingy: and provides things like schedules jobs, messaging, queues, etc
08:37cemerick_wingy: see http://immutant.org/
08:38sundbp_wingy: and don't let the jboss bit scare you, it's a very nice clojure only api and no XML involved
08:38sundbp:)
08:38_wingyso i can use heroku to serve my app that is using immutant?
08:40sundbp_wingy: yes, i would think so bar any heroku restrictions
08:45_wingyis it production ready?
08:46jcrossley3-away_wingy: immutant won't run on heroku just yet
08:47jcrossley3_wingy: there are some folks using immutant in production, but we haven't released a 1.0 yet
08:47_wingyhow should i host my app then?
08:48_wingydoes redhat have something like heroku where u just push things up?
08:48dbushenkowhy do you need immutant at all?
08:48jcrossley3_wingy: http://openshift.com
08:48dbushenkoits just a server
08:48dbushenkoyou may choose any
08:49ro_st_wingy: https://devcenter.heroku.com/articles/clojure
08:49dbushenkoring, tomcat, glassfish -- doesn't matter
08:49_wingydbushenko: im just curious about how it can help
08:49cemerickdbushenko: this is like comparing languages by reference to turing completeness
08:49dbushenkoit has some nice features like bacground job
08:49dbushenkobut you still need a servlet, like ring, a routing library like compojure, etc.
08:52tcrawley_wingy: no, immutant is something you host yourself
08:52tcrawleyha
08:53tcrawleybut you can run it on openshift http://immutant.org/news/2012/12/11/openshift-postgresql/
08:54_wingycan i use datomic with it?
08:54tcrawley(it's a bit of a hack to do so atm)
08:54tcrawley_wingy: no, immutant won't currently run on heroku
08:55jcrossley3tcrawley: you're kinda repetitive today ;)
08:56tcrawleyyou can get it to run on heroku, but the value is limited, since each dyno ends up being a full immutant process
08:57jcrossley3_wingy: you can use any clojure library with immutant, including datomic.
08:57_wingyok
08:58_wingyreading about what an app server is and how it can help me
09:01_wingyhttp://www.infoq.com/presentations/Introducing-Immutant
09:02cemerick"Heroku?! You people with your hippy-dippy ruby platforms. gtfo!"
09:02cemerick;-)
09:03jcrossley3cemerick: you're projecting way too much anger onto tcrawley :)
09:04cemerickjcrossley3: nah, just projecting what I'd be thinking if I were getting asked about heroku every day.
09:04cemericks/getting/being
09:05ro_stnot your first language, then?
09:05cemerickhar, har
09:08jcrossley3cemerick: getting sounded just as correct as being to this english speaker
09:10Raynescemerick: Morning.
09:13cemerickRaynes: Morning. :-)
09:14cemerickjcrossley3: It's formally incorrect IIRC. I couldn't quickly find a relevant page on english.stackexchange.com though.
09:17Raynesalexbaranosky: Just rewrote laser's tests with midje.
09:21tcrawleycemerick: thanks - I *was* angry, but not over the heroku questions. my messages where reaching the channel late, out of order, and only half of the time
09:22ro_stwere* -hide-
09:23tcrawleyro_st: thanks. it's important we keep the standards high here.
09:23uvtcIf I were asked about being asked, I'd say getting asked is better than not having been asked at all.
09:23tcrawleyuvtc: yes indeed. I'm happy to chat about it.
09:24ro_stwhat's ridiculous is that we all know precisely what you meant, and i corrected you anyway.
09:24tcrawley:)
09:24uvtc(sorry, missed what tcrawley was talking about --- just making a joke about how much gunk the english language tends to contain)
09:25tcrawleyha
09:25tcrawleyI think I'm going to go back to bed
09:26jcrossley3tcrawley: i thought you were "happy to chat about" the subtle semantic differences between getting, being, and been. ;)
09:35jonasencemerick: according to https://github.com/clojure/tools.nrepl/blob/master/doc/ops.md#eval :session is _required_ in a {:op :eval ..} message. But the example at https://github.com/clojure/tools.nrepl#talking-to-an-nrepl-endpoint-programmatically it is not present in the message. Which one is correct?
09:41jonasencemerick: Also, in some design docs i read it says that session id's are provided by the server and message id's are for the client to create. Is this still the case?
09:43cemerickjonasen: Yes, any string will do for messages. Those are purely for the client's benefit, whereas session IDs correspond to a server-side resource.
09:44jonasencemerick: so if I want to create a new session I should call {:op :clone}?
09:44cemerickright
09:44cemerickYeah, that eval :session doc is misleading. :session isn't strictly required, but not identifying one will use a temporary session that will be disposed of immediately once evaluation is complete
09:45jonasencemerick: ok. That makes sense. Thanks!
09:46jonasencemerick: do message-id's have to be string or can I use a long?
09:47cemerickjonasen: I *think* it can be either.
09:53thorwilRaynes: weren't you rather skeptical of midje? what't your impression now?
09:55tpopetufflax: I think I will just give python priority. if_ruby has always bee a bit whack
09:55tufflaxtpope: ok :)
10:09xbatis it normal that i have to re-set the Graphics2D font every frame?
10:10xbatotherwise it switches to er javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog
10:10xbatwhich i wasn't expecting :/
10:31babilenIs there a chance that an IKVRecduce and CollFold implementation for nil makes it into 1.5 ? (cf. CLJ-1098) -- I find the inconsistent behaviour regarding nil to be quite unfortunate
10:31yogthosRaynes: hey, what was the format for the znc password again? :)
10:46clgvbabilen: better ask on the ML
10:46babilenclgv: will do
10:47babilenclgv: So far I am just using my wrappers for reduce-kv that handle nil gracefully, but I'd like to see consistent behaviour in upstream's reduce-kv too
10:48clgvbabilen: the problem is when you pass nil instead of a collection?
10:49babilenclgv: exactly
10:50babilenclgv: Well, I never pass it intentionally, but it might sneak in - I'd just like reduce-kv to handle it gracefully (like reduce and all the other)
10:51clgvbablien: yeah, I understand. It is very useful to not have to care whether you have an empty coll or nil in those operations
10:52jweiss,({:foo nil} {{:foo nil} :yay {:bar 1} :nooo})
10:52clojurebotnil
10:52jweisshow come this doesn't print :yay
10:53solussdWhat's the appropriate approach /alternative to response descriptors for following a 'link' in a restful webservice that provides a mime-type? E.g. If I discover the url to a resource via the links in an entity and from that I know what type of entity I need mapped
10:53jweissoh wait duh
10:53jweisslookup was backwards
10:53jweiss,({{:foo nil} :yay {:bar 1} :nooo} {:foo nil})
10:53clojurebot:yay
10:53solussdwrong room..
10:55aroemersor is it? maybe jweiss likes it when clojurebot is joyful
10:55babilenclgv: I voted and there is a patch, just not sure what else can be done :)
10:57clgvbabilen: oh try to get some of the active developers to screen that patch
10:59_wingyanyone here using openshift
10:59_wingyi cant see clojure doc for it. is it simple to use it with a clj app?
11:01uvtc_wingy: I think jcrossley3 and tcrawley are using it, IIRC.
11:04clgvbabilen: the bug I found had two people commenting that the patch from christophe grand worked for them. then rich hickey accepted and merged it
11:04clgvbablien: but its priority was "Major"
11:05babilenclgv: I guess that not /that/ many people run into this issue (or simply work around it by explicitly checking for nil) and that consistency is not that much of a priority
11:06clgvbut it took almost a month
11:06babilenclgv: Maybe I should simply write to the mailing list again and ask for somebody to take another look
11:06clgvbabilen: if it is just trivial adding the nil cases returning the init value. then that should be done quikcly
11:07clgvbalien: you got a CA? then you could write it to the dev ML
11:08babilenclgv: Well, there is the hack approach (check for nil, return sensible default) or the good approach (implement CollFold and IKVReduce for nil) -- The patch does the latter and it is the right approach to be taken in the language itself. The hack works for me, but is IMHO ugly and checking for nil? should /never/ be necessary
11:08babilenclgv: I don't have it -- The patch is already there rotting away :)
11:08babilenhttp://dev.clojure.org/jira/secure/attachment/11648/0001-CLJ-1098-Implement-IKVReduce-and-CollFold-for-nil.patch
11:12clgvthen normal ML ;)
11:13phuffSo, I'm trying to write a string to a ZipOutputStream (I'm making a zipfile and I have some strings to use as the contents of the files)
11:13phuffBut ZipOutputStream requires you to write a bytearray to it
11:13phuffSo I did this:
11:14phuff(defn writeZipOutput [zip-output filename content]
11:14phuff (let [contentBytes (.getBytes content "UTF-8")]
11:14phuff (.putNextEntry zip-output (new ZipEntry filename))
11:14phuff (.write zip-output contentBytes (.length contentBytes))))
11:14clgvphuff: use refheap.com or similar for multiline code
11:14phuffbut clojure is saying that contentBytes doesn't have a length method?
11:14uvtcphuff: fyi, check out https://refheap.com/ for pasting.
11:14phuffThanks
11:14phuffSorry. :) some places are more tolerant with 3-4 lines of code
11:14clgvphuff: you want `alength` for arrays
11:15phuffAh interesting.
11:15phuffWhy can't it pick up the .length member of the java array?
11:15clgvphuff: but better wrap the zip stream in a dataoutputstream
11:15uvtcRaynes: re. refheap, "this connection is untrusted". Cert expired.
11:15clgvphuff: there is no such member since arrays are no objects in the jvm
11:15phuffclgv: Yeah, java i/o stuff gives me fits anyway.
11:15clgvphuff: thats compile magic
11:15phuffclgv: Ahhh I didn't know :)
11:16phuffMakes more sense
11:16clgv"compiler magic" I meant
11:16phuffI understood :)
11:16phuffSo the problem with wrapping the outputstream with dataoutpustream or something is that I need to call methods on the zipoutputstream for each new file I write to the zipfile
11:16clgvbutter better wrap that stream since you probably want to write other data in there as well soon ;)
11:17phuffEach time you add a new file you have to call putNextEntry which dataOutputStream won't have.
11:17phuffI suppose I could repeatedly wrap it
11:17phuffinside the wrapper function
11:17clgvI dont recall the zip api. you got the javadoc link at hand?
11:18phuffhttp://docs.oracle.com/javase/6/docs/api/java/util/zip/ZipOutputStream.html
11:19clgvwell you can keep bindings to both streams and call putNextEntry when needed maybe you need to call "flush" before
11:19clgvI mean on the dataoutputstream
11:20phuffSo go from this: https://gist.github.com/4476119
11:20phuffTo something like this:
11:20phuffhttps://gist.github.com/4476128
11:20phuff?
11:21phuffOr maybe trade let for with-open?
11:21clgvbetter not if you want to continue writing to that stream ;)
11:22clgvbut you will need a (.flush dataOutputStream) there
11:22clgvphuff: I'd try to do the wrapping only once though.
11:22phuffYeah just seems like a pain to pass around _two_ references to the same thing everywhere, in different guises.
11:22phuffSeems logically wrong I guess
11:23clgvdo you have to pass it along that often?
11:24phuffWell I call it from like 4 different functions
11:24clgvI'd do the whole zip-creation in one function
11:24phuffSo the problem is that I'm making an ebook :)
11:24phuffSo I have one top level function
11:24phuffbut then I've split the logic down into a lot of helper functions
11:24phuffBecause to write ebooks you have to write 3 different files in addition to the content
11:25clgvyou can create the content before the writing of the zip file if it fits in memory (and memory is no QoS requirement)
11:25phuffSo it logically makes sense to me to pass on the outputstream to a helper function to write each of the metadata files and then map a function across each chapter of the ebook
11:25phuffclgv: Yeah, memory's not _really_ a problem.
11:25phuffEspecially since this is just a quality of life program :)
11:26phuffk, I really appreciate the tutoring, clgv :)
11:26phuffIt's been most helpful.
11:26clgveven if it were you create the whole zip content in a lazy-seq and have no memory problem ;)
11:26phuff:)
11:47gfrederickshow does the clojure compiler avoid reflection generally?
11:49TimMcgfredericks: Can you refine that question?
11:49ohpauleezgfredericks: Like sspecifically when you type-hint, what happens in the compiler?
11:53gfrederickshow does the compiler make type-hinting not necessary?
11:53gfredericksin non-obvious cases
11:53gfrederickslike calling methods on a string literal
11:54gfredericksI can't imagine why it wouldn't need a hint 99% of the time
11:54gfredericksso there must be a trick I don't know about
11:54clgvgfredericks: there is local type inference, e.g. to detect usage of primitives
11:55clgvgfredericks: and there is :tag metadata on functions.
11:56TimMcgfredericks: What's complicated about it? (.foo "bar" 5) is clearly the String.foo method.
11:58gfredericksTimMc: yes, those are the obvious ones
11:58gfredericksI assume most interop calls aren't on a literal
11:58nDuffgfredericks: ...sure, but if you know a call, you know what its return type is, so you can attach that.
11:59gfredericksso this :tag stuff gets added automatically?
11:59clgvgfredericks: (let [s "bar"] (.foo s)) works because the compiler infers that s is a string binding
12:00clgvgfredericks: no. you have to do it manually like (defn ^String create-user-string [param1 param2] ...)
12:01gfredericksso (fn call-string-methods [x] (.substring x 1 2)) will _always_ reflect?
12:01nDuffgfredericks: Yup.
12:01gfredericksoh. maybe it just reflects a lot more often than I expected
12:02nDuff(now, if it's defmacro, then not so much)
12:02nDuffgfredericks: ...are you using *warn-on-reflection*?
12:02gfredericksI don't ever use warn-on-reflection, so my expectations could be way off. I just thought I would hear about type-hinting a lot more than I do if it were that bad
12:03TimMcgfredericks: Oh, I thought you were giving that as an example of non-obvious, not obvious!
12:03nDuff*shrug*. "that bad" isn't very.
12:03gfredericksTimMc: hwhoops!
12:03odie5533Is clojure fun?
12:03gfredericksnDuff: speculating wildly, I would think most of my interop calls would reflect
12:04TimMcodie5533: Quite.
12:04nDuffgfredericks: I can believe that, but that's because you've done basically no attempts at hinting. It doesn't take that many hints, if they're well-placed and your calling convention permits.
12:04TimMcgfredericks: I think reflection-avoidance is limited to where you have a chain of method calls starting with a hinted expression or a class.
12:05clgvgfredericks: use *warn-on-reflections* and you'll see that it happens quite often in interop ^^
12:05gfredericksspeaking of warn-on-reflection, is the normal way to set that at the top of each file you're interested in?
12:05nDuffgfredericks: Yup.
12:05TimMcI've used :warn-on-reflection true in lein, I think
12:05gfredericksand the compiler pops that off the binding stack at the end of the file?
12:05gfredericksTimMc: oh nice
12:05gfredericksTimMc: top level?
12:06clgv`set!` works locally
12:06gfredericksclgv: sure but that doesn't imply it will be different in the next file
12:06TimMcFor instance, I'm pretty sure that (.. (System/getenv) (get "foo") (indexOf "hi")) doesn't involve reflection.
12:06clgvif you set it to true once it will stay that way
12:07clgvbut the leiningen approach is better if you want to check the whole project
12:07TimMcclgv: Only if the compiler doesn't rebind for every file. I don't see why it would, though.
12:07gfrederickshaha look at those 60 reflection warnings
12:07clgvTimMc: I often use it once at repl and then it stays on ;)
12:08gfredericksclgv: the "it will stay that way" part seems kind of lame to me, since you're setting it for multiple files but it's not quite clear which files those are; depends on require order
12:08clgvgfredericks: well, there might be some performance gains burried in there ;)
12:08TimMcOnly bother with the tight loops, obviously.
12:08gfredericksclgv: I want a performance gain!
12:10clgvTimMc: I wont ever start performance tweek without a profiler run before ;)
12:10clgvonce suffices ^^
12:11gfredericksdynamic vars have a stack built-in, don't they?
12:13clgvusin tools.logging how can I redirect all those ssl log messages (in debug mode) to a different file?
12:20no7hingi'am kinda torn wether this macro is ok or not: https://www.refheap.com/paste/8182
12:20no7hingit expects people to know the arguments if they want to use them in the body
12:20no7hingany opinions?
12:21gfredericksI think that's atypical
12:21gfredericksyou could have the args provided by the caller
12:21gfredericks(def-property-change-listener FooClass [this ob pr v st] ...)
12:22no7hingyeah, makes the use slightly more verbose, but definitely more clear
12:22dnolen_no7hing: and avoid horrible unintended variable capture
12:22dnolen_avoids
12:22S11001001no7hing: it's known as "anaphoric", and is generally discouraged
12:23no7hingditto - but to get what it actually means
12:23no7hingthanks guys
12:27pjstadighttp://blog.fogus.me/2010/08/10/monkeying-with-clojures-defmethod-macro/
12:33no7hingthanks for that too
12:36TimMcI feel like I've run into this problem a lot... I have data like {:foo :a, :bar :b, :baz :b} and I want to produce {:a [:foo], :b [:bar :baz]}.
12:37TimMc(My input is actually the [k v] pairs of the map.)
12:43lsdafjklsdFavorite resources for thinking functionally?
12:43lsdafjklsdI completely flamed out in the recursion section of clojure koans
12:44lsdafjklsdand passing map to reduce is insane
12:44AimHereSICP might be a place to begin
12:44lsdafjklsdok
12:48TimMc&(->> {:foo :a, :bar :b, :baz :b} (map #(array-map (val %) [(key %)])) (apply merge-with concat))
12:48lazybot⇒ {:b (:bar :baz), :a [:foo]}
12:50lsdafjklsdTimMc: nice!
12:51uvtcIs there any convention you know of where you start a keyword name with a hash mark? As in `:#foo`?
12:51TimMcuvtc: Writing Enlive selectors. :-P
12:52TimMcI have no reason to believe it's supported syntax, actually.
12:52uvtcHm. Now that you mention enlive, I recall seeing it in hiccup.
12:52SgeoIn Racket, I need to stop interjecting with Racket talk on a Clojure channel
12:53uvtcWhere I just saw it is in the seesaw tutorial/gist.
12:54uvtcThere's also a `:.foo` in there.
12:54uvtcWhich is certainly reminiscent of css id/class
12:54uvtc.
12:55uvtcOh. Sorry. I think it may be explained in the tut/gist but I skimmed.
12:58clgvis there any clojure dsl to configure file appender for tools.logging?
13:02uvtcSgeo: wait a second ... certainly there's no top-secret classified back-room skunkworks unaffiliated Clojure implementation in Racket afoot, is there?
13:12technomancydnolen: hey, does clojurescript-mode.el make sense to keep around any more?
13:12dnolentechnomancy: I don't know I never used it :)
13:12technomancyoh, my bad; must be misremembering.
13:14technomancyI think with piggieback etc it's no longer needed
13:14Sgeouvtc, there's a partial broken implementation of some ideas
13:14SgeoAnd also vague contemplation of something more thorough
13:15uvtcSgeo: Oh? Neat. Link?
13:15Sgeohttps://github.com/takikawa/racket-clojure
13:15uvtcSgeo: thanks.
13:15SgeoYou're welcome
13:16TimMc"takikawa", is that toki pona, or Japanese?
13:17SgeoNote that it does its [] and {} interpretation in a sucky way
13:18SgeoIt replaces function application (not macro application) with a macro that, if it's given [] or {}, does the right thing
13:18SgeoBut macro application won't be affected, as far as I can tell
13:24clgvAm I right that `dosync` blocks until the transaction was successfull completed?
13:34gtrakanybody figured out how to get jump-to-definition in cljs in emacs yet?
13:34gtrakclgv: that's not what dosync does
13:35clgvgtrak: yeah. I found the real error a few minutes ago
13:36clgvsometimes late in the evening you start to doubt basic wisdom when struggleing with strange errors
13:38gtrakyea, the "I've been doing it wrong for a very long time" feeling? I hate it :-)
13:38gtrakice cream helps
13:39SegFaultAXgtrak: It's a mixed bag for me because yes, I've been Doing It Wrong (tm) for a long time, but now I have a better way.
13:39SegFaultAX(Hopefully)
13:42gtrakI just add dithering to my code style in order to randomize my classes of errors... provides a seemingly higher resolution result.
13:54clgvgtrak: I should add a derandomizer on my errors ;)
13:54borkdude"The Passion of the Clojurist"?
13:55borkdudehttps://twitter.com/tpope/status/288148128958382080
13:55gtrakclgv: too random? that's an issue of SNR :-)
13:59gfredericksmarginalia doesn't touch mid-function comments blocked off with ;;
13:59gfredericksis there some other way to format comments so that they get included?
13:59gfredericksor does marg want me to refactor until none of my functions need comments aside from docstrings?
14:00algernonmarg will happily link ;; comments above the function to it, that may be a workaround in some cases
14:01gfredericksthat kind of separates the comments from the thing they apply to
14:02gfredericksI imagine if I dedented them to the beginning of the line it would also catch them
14:02gfredericksbut that's sooper ugs
14:02algernonas far as I remember, that confuses marg badly
14:02algernonas in, it will place the comments after the function
14:02gfrederickstime to look at the marg source
14:02algernonlet me know if you find a solution or workaround :)
14:03gfrederickssure
14:03gfrederickswoah a defrecord
14:04technomancyhas the "you can't do jack in a newly-opened file in nrepl.el until you compile it" problem been fixed in git master?
14:07clgvwhy do I get a 1 in the hour part with this: (format "%1$tH:%1$tM:%1$tS,%1$tL" 0) ???
14:07lazybotclgv: Oh, absolutely.
14:07clgv&(format "%1$tH:%1$tM:%1$tS,%1$tL" 0)
14:07lazybot⇒ "16:00:00,000"
14:08clgvoooh
14:08clgv(format "%1$tH:%1$tM:%1$tS,%1$tL" (* 3600 1000))
14:08clgv&(format "%1$tH:%1$tM:%1$tS,%1$tL" (* 3600 1000))
14:08lazybot⇒ "17:00:00,000"
14:08clgvseems to add the time zone...
14:09TimMcclgv: Using format for date formatting seems like a pretty bad idea.
14:10clgvTimMc: thats a duration and I want it formatted in hours minutes seconds millisecs
14:10gfrederickswoah man
14:10gfredericksmarg does some spooky stuff
14:12TimMcclgv: I dunno, anythign to do with time, I reach for a library.
14:13amalloymy solution to "time problems" is to think about all the edge cases and then throw my hands up in the air: no library could possibly be well-thought-out enough to solve any such problem
14:14clgvI just want to pretty print a time duration, so that should be pretty easy. but instead it is interpreted as a date by `format` :(
14:14gfredericksamalloy: like you just don't care?
14:15ppppauli want to take an input stream that is a string and realize it as a string, how do?
14:15gfrederickssorry that joke was not worth anybody's attention
14:15amalloygfredericks: thanks for saving me the trouble of letting you know
14:15ppppauli use clojure.java.io for things like this, but i've never needed to go further than passing around streams
14:15technomancyall of the time libraries I've investigated fail to take into account the wibbly-wobbly nature of time
14:15gfredericksamalloy: I try to be helpful when it's not too much effort
14:15technomancythey all assume it's a linear progression from cause to effect
14:16xeqippppaul: slurp ?
14:16ppppaulslurp will do this?
14:16ppppaul^_^
14:16ppppauli'll try
14:16gfredericks"In what manner is it wobbly?" "In a wibbly manner."
14:16amalloytechnomancy: have you read about the tardis monad? someone's joke on this theme
14:16djwonktardis?
14:17gfredericks"A Tardis is the combination of the State monad transformer and the Reverse State monad transformer."
14:19technomancyfails to address the fact that you can't interfere with your own personal time stream
14:19technomancythen again, so do several canonical episodes, so I can't really fault them
14:20gfrederickswoah guys #! is valid single-line comment syntax
14:21hiredmanof course
14:21amalloygfredericks: wasn't this discussed yesterday?
14:22amalloythere was someone who really hated semicolons and was looking for any excuse not to use them
14:22gfredericksamalloy: I wasn't here
14:22amalloywell, see what you miss? shape up
14:23djwonkamalloy: haha, that was me
14:23gfredericksI just happen to be reading LispReader.java
14:25Bronsathe problem with UnreadableReader is that ###<foo>
14:25Bronsadang.
14:25Bronsa,#<foo>
14:25clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unreadable form>
14:25technomancyhuh; so apparently nrepl.el fixed M-. on fresh buffers but not C-x C-e?
14:25technomancythe heck
14:25Bronsamhm, it's not going to work on clojurebot
14:26gfredericks,(read-string "###<foo>")
14:26clojurebot#<RuntimeException java.lang.RuntimeException: Unreadable form>
14:26Bronsaw/e, just try it on the repl
14:26gfredericksmultiple excetions?
14:27Bronsa#< is just throwint at "#<", everything else gets evaluated
14:27technomancyah, no false alarm; it hasn't been fixed
14:28amalloyuhhhh, i see no evidence of this, Bronsa. what should i try?
14:28Bronsa so if you try to read "#<Object java.lang.Object@5ab8b24>" it will read "Object", "java.lang.Object", it will try to deref "5ab8b24>" failing with a NumberFormatException
14:30djwonktechnomancy I'm having trouble with M-. too in nrepl.el master -- but with namespace issues
14:30amalloythat doesn't happen to me in a slime repl
14:30amalloyit does happen in lein repl, and probably also in nrepl.el but i don't have that installed
14:31technomancydjwonk: https://github.com/kingtim/nrepl.el/issues/138 <- looks like he's going to take a fix, but it hasn't been applied yet
14:31djwonkgfredericks: re: #1 see (defn skip-whitespace … "Does not interpret #! as comment to end of line"
14:31djwonkre: #1 I mean
14:32djwonkaarg. #!
14:32gfredericksdjwonk: see that where?
14:32djwonkclojure source: main.clj
14:33djwonkso, I'm not sure that #! is a "full" replacement for ;
14:34gfredericksI certainly wasn't going to start using it for anything
14:34djwonkhaha
14:34gfredericksother than replacing ;
14:34gfredericksalso of course replacing ;; with #!#!
14:37Bronsaamalloy: no idea how slime is hiding it, but trust me on that, you can see here how it just throws as soon as it gets to the "<" and does nothing to prevent further reading https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/LispReader.java#L1111-L1115
14:37gfredericksdjwonk: I didn't get it. was that a reading rainbow thing?
14:38djwonkgfredericks: yes, but also "le" is "the" in french. so it is a pun of "the var reader". anyhow. if you have to explain it, then it probably wasn't very funny
14:38amalloyBronsa: slime is probably sending the whole line and aborting the read once it gets an error, rather than attempting to find more readable chunks in the line
14:38Bronsayeah, probably
14:38amalloywhich seems like a better approach to me
14:38gfredericksdjwonk: I guess I got distracted by geordi laforge (sp?)
14:41djwonkgfredericks: https://gist.github.com/4477682
14:43eggheadhah
14:44TimMc:-D
14:44gfredericksWell I think I see the manner in which marg discards the sub comments. Also how to patch it to add them to the left column docs; but removing them from the code would be a bit more involved maybe
14:45gfredericksalso lining them up well :/
14:48gfredericksoh my coworker has had an issue open for this for 5 months
14:51gfredericksand nobody's committed to the project in 7 months
14:51TimMcMarginalia?
14:51gfredericksyeah
14:52algernongfredericks: fogus was looking for someone to take it over a couple of weeks (months?) back
14:53TimMcgfredericks: Congratulations on your new project!
14:53TimMc*maintainership
14:54gfredericksoh I see he has a separate branch with a single commit for inner comments
14:54SgeoHmm. Advantage of Scheme over Clojure: Oleg cares about Scheme
14:54gfredericksSgeo: what does that result in?
14:55Sgeogfredericks, it results in being able to read and sometimes more directly use Oleg awesomeness
14:56Seba51What's the advantage to run an application with jetty-run instead of lein ring server
14:56hiredmanyou mean jetty-runner?
14:57Seba51ring.adapter.jetty (run-jetty (get-handler) {:join? false :port port})
14:57hiredmanyou should use lein ring server for developement
14:58hiredmanand generate a war or uberwar and deploy it via jetty or jetty-runner or tomcat or …
14:58djwonk,(min [1 2 3])
14:58clojurebot[1 2 3]
14:58abphiredman, so basically it doesn't matter?
14:58hiredman,(doc min)
14:58clojurebot"([x] [x y] [x y & more]); Returns the least of the nums."
14:58djwonkpersonally, I think ^^^ is a weird way to do min
14:58hiredmanabp: who said that?
14:58gfredericksmin is the identity function!
14:59djwonk,(min 1 2 3)
14:59clojurebot1
14:59gfredericks$findfn 42 42
14:59lazybot[clojure.set/union clojure.set/intersection clojure.set/difference clojure.core/time clojure.core/dosync clojure.core/long clojure.core/short clojure.core/+ clojure.core/* clojure.core/doto clojure.core/unchecked-long clojure.core/+' clojure.core/unchecked-short... https://www.refheap.com/paste/8188
14:59abphiredman, your last statement seemed to imply that. ;)
14:59hiredmanabp: no, you definitely should be be call run-rutty
14:59djwonkwoah coal https://github.com/Raynes/findfn
15:00abphiredman, I meant the servers.
15:00hiredmanabp: should not be calling run-jetty
15:00hiredmanabp: depends what you want
15:00abprun-jutty? :D
15:00Seba51Lumius and mostlikely webnoir are doing this in the main the template creates
15:01Seba51correction: in the main method the template creates
15:01hiredmanI typically create uberwars and use jetty-runner
15:01hiredmanSeba51: so? just because a library does it, that does not make it good
15:02abphiredman, hard work to compare all the servers and servlet containers
15:03abphiredman, blame yogthos :)
15:03hiredmannoir has fallen short on just about every point
15:03djwonk^ticker DJIA
15:03Seba51I am learning and just state my observervations
15:03yogthosabp: what am I getting blamed for? :P
15:04Seba51When there is a good reason, I could write a patch for Luminus
15:04yogthosSeba51: patches are very much welcome :P
15:04djwonkticker DJIA
15:04hiredmanSeba51: /win 15
15:04hiredmanwhoops
15:05gtrakdoes lein-ring suck less with AOT on lein2?
15:05yogthosone thing to note is that there's two ways to run apps, one is as a standalone and another as a war deploy
15:05djwonk$findfn [1 2 3] 1
15:05yogthosfor stuff like heroku you actually have to have a main
15:05lazybot[clojure.core/first]
15:06djwonk$findfn [2 3 4 5 6 7 8 1 9 10] 1
15:06lazybot[]
15:06djwonkI stumped lazybot
15:06Seba51I run into this, when trying to get a context listener running to start up background jobs. I expected this to be simple but found org.lpetit.ring plugin, the ring documentation which seems to work only for uberwar and couldn't get it run in development mode in luminus.
15:07SegFaultAXdjwonk: No you didn't. You asked it to find something that doesn't exist in its classpath.
15:07hiredmanI can't say I particular care for herku's model
15:07hiredmanbut at least they don't just deploy from git, they build a slug or whatever
15:08yogthoshiredman: the luminus template supports both approaches though
15:08djwonkSegFaultAX min is in core
15:08yogthoshiredman: if you run lein ring uberwar it'll make the deployable war, and it uses a separate handler than the one running in the main
15:08hiredmandjwonk: have you read the docs for min?
15:09djwonkhiredman: yes
15:09djwonkI don't know how to '
15:09technomancyyeah, building a single uberjar from your CI server is my recommended way of deploying
15:09hiredmanyogthos: I know nothing about luminus and have not heard of it before today
15:09djwonkI don't know how to unwap [1 2 3] into parameter args
15:09SegFaultAXdjwonk: Are you sure?
15:09technomancybut if you like uberwars for whatever reason that's fine too
15:09SegFaultAX,(min [1 2 3])
15:09metellus$findfn2 3 4 5 6 7 8 1 9 10 1
15:09clojurebot[1 2 3]
15:09SegFaultAX,(apply min [1 2 3])
15:09clojurebot1
15:10technomancyusing lein in production takes special care not to pull in changes in your deps accidentally
15:10yogthoshiredman: ah well let me know what you think of it ;)
15:10Seba51Reloading does not work with Luminus, if you use lein ring server. :init or :destroy in the ring configuration does not work with you run Luminus with lein run
15:10djwonkSegFaultAX: thanks, apply is what I'm looking for
15:10SegFaultAXdjwonk: So I'll say it again, you asked it to find something that doesn't exist in its classpath (or clojure.core if that's what it's searching)
15:11yogthosSegFaultAX: you can just call init method at the start of the main, but destroy I have no good option for
15:11SegFaultAXyogthos: Huh?
15:11yogthosSegFaultAX: err that was aimed at Seba51
15:11SegFaultAXyogthos: Oh. :D
15:12hiredmanyogthos: unlikely, lein-ring and compojure when required have me covered
15:12djwonkSegFaultAX right, the 'issue' is that findfn did not find the answer, because there is no single function that combines apply and min
15:12Seba51It is a good idea to close down connections on tear down. This is not an option.
15:12yogthoshiredman: no problemo ;)
15:12yogthosSeba51: I guess once your main exits, everything will be torn down in any case
15:13yogthosSeba51: but if you had to persist something on exit for example, then that wouldn't happen
15:13djwonkSegFaultAX my point was simply that both apply and min are on the classpath -- findfn is designed to explore composite functions
15:13djwonkerr, *not* designed
15:14SegFaultAXdjwonk: That's not really stumping lazybot is it? Asking it to do something you already know it isn't capable of doing?
15:14SegFaultAXdjwonk: /pedantry :)
15:14djwonkSegFaultAX it was a joke
15:14djwonkI didn't know how much searching it might be able to do
15:14Seba51At least you can disconnect connections to queues etc.
15:14SegFaultAXdjwonk: Read the sauce, yo.
15:20Seba51@Yogthos I am playing with using this (def get-handler2 (get-handler)) as ring handler. It seems to work.
15:21yogthosSeba51: what are you doing with the get-handler2? :)
15:22Seba51I use it in the project.clj: :ring {:handler clearlight.server/get-handler2 :init clearlight.application/startup :destroy clearlight.application/shutdown }
15:22Seba51
15:22yogthosSeba51: I already provide the (def war-handler (middleware/war-handler app)) for that though
15:23yogthosSeba51: it should get hookup with the template in the project already too, so you can just add :init and :destroy
15:23yogthosSeba51: I think I've already got :init setup actually
15:24Seba51Init and destroy are servlet context listener
15:25yogthosSeba51: yeah they aren't part of the handler itself
15:26yogthosSeba51: but you need to wrap-resource, wrap-file-info, and wrap-base-url to get proper behavior in a war
15:26yogthosSeba51: and wrap-resource wraps a different folder in main and war deployments
15:26yogthosSeba51: hence the war-hanlder
15:32pmonksG'day gurus!
15:32pmonksIs the fact that the code "(seque 3 (seque 3 (range 10)))" livelocks considered a bug?
15:32pmonks(note: only tried on 1.4.0)
15:33hyPiRionmh
15:34hyPiRion,(doc seque)
15:34pmonksI'm looking at a case where I want to chain together 3 process via 2 queues, but I think this behaviour torpedoes "seque" as part of the solution…
15:34clojurebot"([s] [n-or-q s]); Creates a queued seq on another (presumably lazy) seq s. The queued seq will produce a concrete seq in the background, and can get up to n items ahead of the consumer. n-or-q can be an integer n buffer size, or an instance of java.util.concurrent BlockingQueue. Note that reading from a seque can block if the reader gets ahead of the producer."
15:35Seba51I cannot see a solution. If I want to build a uberwar and not create a custom web.xml, I need to rely on :init and :destroy of the ring configuration. If I do so, I have to use lein ring server and stay away from lein run. As long as I do not use Heroku or deploy a war to heroku it should not be a problem.
15:35jkkramerpmonks: there was a seque related fix that went into 1.5 master. not sure if it's for the same thing
15:35weavejesterSeba51: You can use lein ring server on Heroku
15:35jkkramerpmonks: https://github.com/clojure/clojure/commit/0e3a535711044c68c34c34caa26c8cb05e10a346
15:36amalloyjkkramer: no, doesn't fix it
15:36weavejesterAnd the latest snapshot of lein-ring allows you to create an executable uberjar for deployment to a linux/nginx environment
15:36pmonks@jkkramer: ta - looking now
15:44Seba51Thanks weavejester, I have never seen this before.
15:53cemerickweavejester: did I see you mention something about a compojure release soon?
15:53weavejestercemerick: A Ring release
15:53cemerickah, ok
15:53weavejestercemerick: There's not much to add to Compojure
15:54cemerickweavejester: I am, as always, self-interested ;-P
15:55weavejestercemerick: Is there anything you wanted to add to Compojure?
15:55weavejesterOh… wasn't there something to do with Friend?
15:55cemerickno, it's already in master
15:55cemerickrelated, yeah
15:55weavejesterOh, I can cut a point release.
15:55ivanhttp://www.flickr.com/photos/lindseykuper/3023329529/ <- heh, 2nd edition of Reasoned Schemer coming real soon now for 4 years
15:55cemerickweavejester: you are the man :-)
15:56AimHereThey'd have to wait until I bought the book before putting out the next edition
15:56ivanyes
15:58eggheadwhat do you guys do when you have a transformation you want to do over a list, where the transformation is dependent on previous or subsequent elements
15:58eggheadjust a big reduce job?
15:58AimHerereduce or loop over it
15:59S11001001egghead: you can also move a window over a seq, I forget what function in core it is though
15:59S11001001takes seq, window size, step size
15:59eggheadinteresting
15:59gtraklooks like partition is used for that
16:00eggheadI basically have a bunch of 'holes' in my data that I want to fill in based on the context of the closest not-empty siblings
16:00S11001001for simple cases it can be even clearer to just do it yourself, e.g. adjacent elements, stepping 1: (map f xs (rest xs))
16:00eggheadguess I'll just do a reduce, was wondering if there was some prettier pre-baked solution
16:00AimHeresHow would partition work for that?
16:00gtrakegghead: http://stackoverflow.com/a/1428436/244235
16:00AimHere*how
16:00S11001001egghead: your problem is what does "closest" mean
16:00eggheadya
16:01AimHereI mean, I could see some ways of doing it with partition, but they'd be pretty unwieldy
16:01abpHm, how does liberator
16:01abpups
16:01abpliberator doesn't work with Ring middleware to convert to json for example, does it?
16:15sveduboisHow I can avoid to write the "/path/project/"?
16:15svedubois(java.io.File. "/path/project/image.png")
16:15svedubois(java.io.File. "image.png")
16:17pmonks@jkkramer: just tried the seque example with 1.5.0-RC1, and the same thing happened (it livelocks).
16:17pmonks(seque 3 (seque 3 (range 10)))
16:46pmonksSo is it a bug, do you reckon?
16:47amalloypmonks: of course. but it's sorta hard to fix
16:47amalloyi have a version of seque that uses futures instead of agents, which fixes this issue but comes with its own problems
16:48pmonksI (probably naively) thought that each seque would return a distinct queue & thread pool.
16:48pmonksOr is the issue to do with coordination between the queues?
16:49pmonkss/return/use
16:49amalloycoordination. clojure is a bit weird about agent sends
16:50pmonksah ok (Clojure n00b nods his head) ;-)
16:51pmonksI guess my real question is - is it worth raising?
16:52amalloypmonks: http://dev.clojure.org/jira/browse/CLJ-823
16:52pmonksQuestion answered - thanks!
16:54pmonksAnyone else out there looking to do SEDA style apps in Clojure?
16:55mklappstuhlhey
16:56mklappstuhlI'm writing some kind of parser with clojure for fun and I wonder a little how I can produce beautiful functional code without downloading a site twice
16:56ohpauleezpmonks: that's a very typical domain for Clojure systems
16:56ohpauleezhighly concurrent, highly parallel, event systems
16:56mklappstuhl(do-something (fetch "url"))
16:56ohpauleezusually driven by message queues
16:56pmonksYeah seems like a really good fit.
16:57pmonksMy current case is real simple - no distribution or anything needed. Just have an IO-intensive task followed by a CPU-intensive task followed by another IO-intensive task (to a different IO system, so minimal IO contention between tasks 1 & 3). Would love to be able to wire it all up with something as simple as seque!
16:58pmonks(by distribution I mean "distributed systems stuff")
16:59arrdem~paste
16:59clojurebotpaste is not gist.github.com
17:00pmonksI'd love to separate those phases with queues, so I can better utilise the machine's IO and CPU capacity.
17:01gtrakpmonks: agents are useful for ordering, they each have their own queue, and they share a threadpool. Dataflow variables can be fulfilled with promise/deliver and futures.
17:02mklappstuhlI want to do multiple things on that fetched page... basically the goal is to create one single hash from it
17:03bprpmonks: of course there's also the java.util.concurrent package. It's got some very nice abstractions. You also might find lamina (https://github.com/ztellman/lamina) useful. Though, IMO it's fairly complicated.
17:04mklappstuhlanyone some input regarding my question? (build single hash from one website in a functional way without loading the page twice
17:04gtrakpmonks: here's an interesting use of promises http://clj-me.cgrand.net/2009/11/18/are-pipe-dreams-made-of-promises/
17:05gtrakmklappstuhl: not sure what you want? save off the value of a slurp? need a way to tell how long it's valid?
17:07gtrakhuh, christophe's thing looks a lot like seque
17:10mklappstuhlgtrak: basically I'm looking for a pattern to build a parser I guess.. In my mind I do things like (get-author (fetch "url")) & (get-title (fetch "url")) but this would download the content twice, right?
17:11gtrakwhat's fetch? something you wrote?
17:11mklappstuhlgtrak: a fictional function that returns some html it downloaded from the given url
17:12gtrak(let [a (fetch "http://myurl&quot;)] (do-something1 a) (do-something2 a))...
17:14gtrakreplace fetch with slurp and you've got yourself a string... replace fetch with clojure.java.io/reader or inputstream and you've got a stream to work with
17:21jro_is there there a lazy sort in clojure's core libraries?
17:21jro_similar as in Joy of Clojure's example
17:21amalloyno
17:22gtrakwhat's a lazy sort? :-)
17:23jro_(take 10 (sort coll)) computes only required work
17:27bbloomjro_: with immutable data structures, you want to search for a merge sort
17:27bbloomi believe that there's one on contrib somewhere
17:27clojurebotcontribute is http://clojure.org/contributing
17:28bprpmonks: check http://clj-me.cgrand.net/2010/04/02/pipe-dreams-are-not-necessarily-made-of-promises/ it's what I would use in production rather than the pipe built on promises
17:29bprpmonk: that said, the promises implementation was neat as hell
17:30hiredmano/win 15
17:35ravsterhello everyone
17:55pmonksThanks @pbr, @gtrak et al!
17:59pmonksApparently my brain isn't large enough to understand anything cgrand does on first (or often even Nth!) pass… :-(
18:06ian_noob here. I'm trying to run an init fn when starting my ring server. I'm typing 'lein server-headless' from the command line, and I've specified the following in my project.clj ':ring {:handler myapp.handler/app :init myapp.handler/init}'
18:06gtrakpmonks: this is the worst thing I've ever tried to understand of his: https://github.com/cgrand/moustache/blob/master/src/net/cgrand/moustache.clj#L151
18:06ian_What should the init fn return?
18:06weavejesterian_: Nothing, it's side effectful
18:07ian_weavejester: Thanks!
18:07ravstereeeeeeeeeewwwwww
18:08ravsteroh, moustache. nvm. I feel you.
18:08ian_did I specify the :init fn correctly? :init myapp.handler/init
18:10Raynesalexbaranosky: ping
18:10ian_It seems to be trying to call what I return from the myapp.handler/init as a fn
18:13ian_sorry. nevermind
18:14arrdemgeneral design quesiton: when should I be implementing a "real" object as opposed to documenting a standard structure for a map and some transformations thereof?
18:15gtraka record's useful for polymorphism
18:15bbloomarrdem: for most tasks, you should prefer one of clojure's types
18:15bbloomeven with polymorphism, multimethods are generally preferable as they are more flexible
18:15technomancyarrdem: almost never?
18:16bbloomyou should create a new concrete type when you're implementing a new abstraction, or implementing an existing abstraction in a new way
18:16gtrakarrdem: https://github.com/cemerick/clojure-type-selection-flowchart/blob/master/choosingtypeforms.png
18:16Raynesarrdem: No.
18:16arrdemOkay. so yall wouldn't call me batshit insane for taking the structured map approach almost everywhere.
18:16technomancyonly when required for Java interop pretty much
18:16Raynesarrdem: No.
18:16bbloomheh
18:16bbloomarrdem: not bat shit insane. simply uninitiated :-)
18:16Raynesbbloom: I think you misread what he said.
18:16bbloombut i'm nicer than Raynes .... apparently
18:17Raynesbbloom: Structured map is good.
18:17arrdembbloom: I'm new here. I can live with uninitiated, but I just need to hear that I'm on the right track... ish.
18:17gtrak&(defrecord EATME [])
18:17lazybotjava.lang.ClassNotFoundException: clojure.core.EATME
18:17technomancygtrak: the thing that's missing from that chart is the part where it's like "I need to define a type" and it's like "no you don't"
18:17RaynesUsing records for no particular reason is not.
18:17gtraktechnomancy: it does say "just use a map" in one section
18:17bbloomtechnomancy: yes.
18:18technomancygtrak: one section is not enough =)
18:18bbloomit needs like a "are you really really really sure?"
18:18bbloomand if no, the use a map
18:18bbloomif yes, then "you should probably use a map... but"
18:19technomancybbloom: "rule 1: don't optimize. rule 2: (for experts only) don't optimize yet."
18:19Raynestechnomancy: I can see that 138 people have downloaded conch from maven central. Can we get stats like that in clojars?
18:20technomancyRaynes: I think xeqi might be brewing something?
18:20bprRaynes: btw, thanks for conch. very nice
18:20technomancywe have access logs for 100 days only unfortunately
18:20Raynesxeqi: I want to taste your brew.
18:20Raynesbpr: You're welcome, kind sir.
18:20technomancyRaynes: you should write a log file analyzer for clojars =)
18:20RaynesYou should stop telling me to write things. :P
18:21technomancyRaynes: but it sometimes works!
18:21bbloomtechnomancy: heh yes
18:21gtrakyea, it's also weird to prefer deftype for anything but low-level code
18:21RaynesSometimes
18:21technomancyRaynes: inconsistent reward for actions leads to addictive behaviour patterns
18:21amalloydeftype is nice if you want to define a new type of sequence or collection that participates in clojure's collection interfaces
18:21gtrak"do you need it to have a hash-code"? I guess not...? says the noob
18:22bbloomheh, i always forget hashCode until it bites me :-)
18:22Raynestechnomancy: Why does it have to be like 10 steps to release something to central? :(
18:22technomancyRaynes: why do you care?
18:22RaynesWhy would I want to 'stage'? I've already bloody staged. I ran `lein test`, for Christ's sake!
18:22Raynestechnomancy: Because it's annoying.
18:22technomancyRaynes: then don't do it =)
18:23Raynestechnomancy: I do it because some guy said he couldn't use clojars in his work and wanted to use conch.
18:23RaynesI'm a real people pleaser, you see.
18:23technomancythere's your problem
18:24Raynestechnomancy: I'd probably release to his personal maven repository if he asked me to. Moar users, man.
18:25technomancycurious, did he say why he can't use clojars?
18:25Raynestechnomancy: Know what's craziest? Apparently lots of people use conch, but I've never actually used the non-low-level portion of it in a real project. Nobody has reported any bugs. At all.
18:25RaynesHe didn't say.
18:25technomancyheh
18:25technomancyhe might be able to use the clojars releases repo
18:26RaynesI can't even remember who it was now.
18:26arrdem(inc gtrak) ; belated but still counts
18:26lazybot⇒ 4
18:28xeqitechnomancy, Raynes: _ato has preliminary work at https://github.com/ato/clojars-web/pull/76 , I'll see about it after cleanup / better search
18:29Raynesxeqi: o/
18:29technomancyyeah, search seems more important
18:29xeqidownload stats will hopefully make search better too
18:29technomancytrue
18:34jlewisis there a version of apply whose last argument isn't a list? e.g. something like #(apply % %&) ?
18:37gtrakjlewis: pass in an empty vec as the last arg
18:37technomancyjlewis: that's called funcall, but clojure doesn't have it
18:37TimMctrampoline
18:37technomancyunless you have only one arg, in which case you can (ab)use deliver
18:37TimMc(no, don't use that)
18:38systemfaultWhat are examples of well-written clojure?
18:38jlewisweird, deliver really just does that doesn't it
18:39TimMc&(trampoline + 2 3)
18:39lazybot⇒ 5
18:39technomancyTimMc: nice
18:39TimMc$findfn + 2 3 5
18:40amalloyman, using trampoline for that is even worse than using deliver
18:40lazybot[]
18:41TimMc80% of the time it works 100% of the time!
18:41jlewisheh so you can have an uncurry function that uses deliver. that's kind of yuck. (reduce deliver f args)
18:41TimMcholy what
18:42TimMcOh, cute.
18:42jlewisassuming each of your functions only take 1 arg that is
18:43gtraktrampoline seems like a close-cousin to apply in spirit, more than deliver anyway
18:44jlewisi spose so
18:44gtrakthe IFn-ness of a promise is an implementation detail
18:44RaynesThere is a notable lack of brehaut in this channel today
18:45ohpauleezsystemfault: Take a look at Ring, ClojureScript, and Leiningen
18:45systemfaultohpauleez: Thank you
18:45dnolensystemfault: ring, compojure, refheap, laser
18:45ohpauleeztotally welcome
18:45systemfaultdnolen: Thank you also :)
18:46Raynesdnolen: o/ for rockin' the laser.
18:46ohpauleezI know, and the heap
18:47ohpauleezthat was basically saying "You should model yourself after weavejester and Raynes"
18:47ohpauleez:)
18:47systemfaultBecause right now… I feel like having a toolbox but I don't know what tools are the best for any job :/
18:47RaynesHaha
18:47systemfaultI read the clojure-doc tutorials and the documentation on the official website
18:47ohpauleezRaynes: Can laser only do content swaps?
18:47gtraksystemfault: the nice thing about macros is you can hide the fact you're hammering that screw
18:47systemfault:)
18:47ohpauleezor does it do the full cascading class stuff? Like can I look up by class and then attach attributes
18:48ohpauleez(you can also tell me to go look at the source)
18:48Raynesohpauleez: It can do lots of stuff. I haven't really formally announced it yet, because I wanted to write a big tutorial and get refheap's views using it first, but cats been out of the bag for a while because I talk about it in here all the time.
18:48Raynesohpauleez: If Enlive can do it, laser can probably do it too.
18:48dnolenjlewis: I would just write your own funcall (defn funcall [f & args] (apply f args))?
18:48ohpauleezcool
18:49Raynesohpauleez: You can definitely look up by class and attach attrs.
18:49ohpauleezsolid
18:49jlewisdnolen: sure, just thought i'd throw it out there first to see if it already existed.
18:49Raynesohpauleez: Something like (document (parse (resource "your.html")) (class= "myclass") (attr :foo "bar")) or with defdocument, fragment, defragment, etc.
18:50RaynesBut yeah, I want to write a really great tutorial on all of it.
18:50ohpauleezcool, exactly what I was curious about
18:50RaynesThat's the biggest next step besides refheap (for a real world example usage).
18:52Raynesohpauleez: Note that (attr ..) is just a function that returns a function that takes a node, modifies it, and returns a new node or a sequence of nodes. You can do anything you want. Could replace it with #(assoc-in % [:attrs :foo] "bar")
18:52RaynesSelectors are just functions that return a function that take a location in the html zipper and return truthy or falsey.
18:53ohpauleezcool
19:03bprdoes anyone know of a pallet crate for datomic?
19:03ziltiHmm I just typed (join #clojure) ...
19:04ziltiThen wondered why it doesn't work.
19:04technomancyit's because you're not doing IRC from Emacs
19:05technomancys'ok; nobody's perfect
19:05SegFaultAXDoes that acutally work?
19:05ziltiWell I use ERC, but... probably "the wrong way"?
19:05SegFaultAXI mean, isn't # still a dispatch character in elisp?
19:05technomancyyeah, it'd have to be a string =\
19:06technomancyit would be more like (erc-join-channel "#clojure")
19:06technomancyJOKE RUINED
19:06systemfaultI don't use emacs, do I deserve immolation?
19:06systemfault:(
19:06amalloyjust set up reader macros for all the alphanumeric characters that read the form as a string
19:06amalloyJOKE REVIVED
19:07ziltisystemfault: Emacs is in good mood today, so you might be lucky.
19:07systemfaultI might ask her out when I'll be more familiar with clojure
19:08systemfaultI guess that elisp must be very different than clojure though...
19:08arrdemeh... it's still a lisp... so you use an arguments list instead of a vector. whop de frikkin do.
19:09hyPiRionsystemfault: Well, you're not setting up much anyway when using emacs.
19:09technomancyit's only mildly brain damaged
19:09hyPiRionMaybe some stuff people already have done in you init.el file, which you just copypaste
19:09technomancywhat's the trick to reverse a sort-by by changing its comparator instead of reversing after the fact?
19:09zilti&(let [coll '([:!f (fn [x] (inc x)) :data])] (fn? (-> coll first second)))
19:09lazybot⇒ false
19:09systemfaultI tried emacs once… a few years back. It was basically copy/pasting snippets from everywhere.
19:10gtraktechnomancy: minus?
19:10ziltiWhy is this returning false? Did I forget something?
19:10systemfaultAnd emacs has weird names for obvious functionalities.. like syntax highlighting which is called IIRC font-lock
19:10gtrakcomparators return -1 0 or 1
19:10ziltiyes, font-lock... I wondered who came up with that name
19:11TimMc&(sort-by (comp - identity) (range 5))
19:11lazybot⇒ (4 3 2 1 0)
19:11hyPiRionzilti: '(fn [x] (inc x)) is not a function, it's a list evaluating to a function
19:11AimHereI'd guess it was an ancient TECO- or PDP-ism
19:11systemfaultAnd the clojure mode for emacs is good?
19:11technomancygtrak: of course
19:11systemfaultRight now, I'm practicing with that IntelliJ IDEA plugin (La Clojure)
19:11TimMcsystemfault: You won't get flamed in here for using a particular editor.
19:11AimHeresystemfault, we can't say. The guy who wrote it is here, and if we complain, he'll get offended
19:12systemfaultHaha
19:12systemfaultI love AimHere's answer :)
19:12TimMcWell, you won't get flamed in here for *not* using a particular editor.
19:12TimMcI can think
19:12systemfaultBut I will sure try it when I'll retry emacs
19:12AimHereSo who's going to be first to admit writing clojure in Windows notepad?
19:12ziltisystemfault: What's particularly awesome is the nREPL-integration and paredit mode, both of which IntelliJ lacks.
19:12gtrakTimMc: sort-by - works too
19:12systemfaultTimMc: I use MS Word
19:12hyPiRionThe most important thing, I think, it trying stuff out and figuring what you prefer
19:12gtrakwhich I find odd
19:12technomancysystemfault: emacs has odd terminology because it predates all the "standard" WIMP conventions by many years
19:12systemfaultzilti: Good
19:13TimMcgtrak: "identity" stands in here for the original comparator.
19:13technomancyso it's kind of a "why should I change my name; he's the one that sucks" situation
19:13gtrakTimMc: yea, I figured, it happens to work for numbers :-), but nothing else
19:13technomancyanyway, I only brought it up for IRC, not for editing clojure
19:13technomancyuse whatever you like for clojure
19:13gtrak&(sort-by - (range 6))
19:13lazybot⇒ (5 4 3 2 1 0)
19:14systemfaultRight :) Thanks for the feedback though
19:14TimMctechnomancy: I don't understand. If you use Emacs for one thing, don't you use it for everything?
19:14technomancyTimMc: there are still a few things I need a browser for, to my great shame
19:14TimMc&(sort-by / (range -3 3))
19:14lazybotjava.lang.ArithmeticException: Divide by zero
19:14TimMcawww
19:15gtrakhaha
19:15TimMc&(sort-by / (range -3.0 3.0))
19:15lazybotjava.lang.ArithmeticException: Divide by zero
19:15gtrakTimMc: wait... first arg is keyfn, second is comparator
19:15gtrakI think we're doing it wrong
19:16jlewisyou're just negating the integer and using the default comparator, heh
19:16hyPiRiongtrak: right.
19:16TimMc,(doc sort-by)
19:16clojurebot"([keyfn coll] [keyfn comp coll]); Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."
19:16AimHere&(sort-by #(Math/pow %1 %2) (range -3 3))
19:16lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: sandbox7657$eval178244$fn
19:16TimMcoh shi--
19:16hyPiRion,(doc sort)
19:16clojurebot"([coll] [comp coll]); Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."
19:17gtrak&(sort-by identity (comp - compare) (range 5))
19:17lazybot⇒ (4 3 2 1 0)
19:17gtrakhow's that?
19:17hyPiRion,(sort (comp - compare) (range 6)) ; better.
19:17clojurebot(5 4 3 2 1 ...)
19:17TimMcOh, of course... why did I expect identity to be a comparator? >_<
19:17arrdemcan I define one macro that expands into two top-level forms?
19:17gtrakah, tricky
19:17TimMcarrdem: Nope, but there's do.
19:17gtrakTimMc: and you almost got away with it too
19:17AimHerearrdem, you mean like two defns?
19:18arrdemAimHere: da
19:18AimHerearrdem, what TimMc said
19:18AimHerewrap them in 'do'
19:18hyPiRionThough I don't understand.
19:18hyPiRionWhy not just
19:18hyPiRion,(sort > (range 6))
19:18clojurebot(5 4 3 2 1 ...)
19:18gtrakhyPiRion: not just numbers
19:18jlewisthe question was about negating some other comparison
19:18jlewiscomparator*
19:18ziltihyPiRion: lol
19:18hyPiRiono right. better stay in this channel all the time then
19:18gtrak(sort (comp - compare) ["a" "b" "c" "d" "e"])
19:19gtrak&(sort (comp - compare) ["a" "b" "c" "d" "e"])
19:19TimMchyPiRion: I would expect no less of you.
19:19lazybot⇒ ("e" "d" "c" "b" "a")
19:19TimMc&(/ 0.0)
19:19lazybotjava.lang.ArithmeticException: Divide by zero
19:19TimMc&(/ 1 0.0)
19:19lazybot⇒ Infinity
19:19TimMco\__/o
19:19ziltihuh?
19:19gtrak&(/ -0.0)
19:19lazybotjava.lang.ArithmeticException: Divide by zero
19:19ziltiHUH?
19:19arrdemher der (do) works magic as always.
19:19gtrak&(/ 1 -0.0)
19:20lazybot⇒ -Infinity
19:20arrdemthanks all
19:20gtrakthere ya go
19:20gtrakapparently clojure knows calculus
19:21hyPiRionWhut.
19:21gtrak&(/ 1 (+ 0.0 -0.0))
19:21lazybot⇒ Infinity
19:21gtrak&(/ 1 (- 0.0 -0.0))
19:21lazybot⇒ Infinity
19:22gtrakha.. how the heck are you supposed to get negative-zero
19:22hyPiRion##(/ 0.0) expands into (/ 1 0.0) though.
19:22lazybotjava.lang.ArithmeticException: Divide by zero
19:23gtrakhyPiRion: perhaps the boxing screws up the polymorphism
19:24devthgiven a nested map: {:foo {:bar {:baz {:qux "hi"}}}}, how can I extract just :qux's val if I don't know/care about the keys foo/bar/baz?
19:24gtrakdevth: tree-seq
19:25hiredmandevth: you have to do a tree walk
19:26hiredmandepending on your exact requirements you can use tree-seq or zippers or …
19:26mattmoss&(/ 1 (/ 1 -0.0))
19:26lazybot⇒ -0.0
19:26amalloymaps are optimized for lookup by fixed/known key though, so if you have a situation like that you should reconsider whether you really want a totally unstructured map
19:26devththanks gtrak + hiredman. first i've heard of tree-seq.
19:27TimMcgtrak: -0.0 is easy.
19:27devthamalloy: it's a json response from an api
19:27TimMc&-0.0
19:27lazybot⇒ -0.0
19:27amalloy&(keep :qux (tree-seq map? vals {:foo {:bar {:baz {:qux "hi"}}}}))
19:27lazybot⇒ ("hi")
19:27devthamalloy: nice :)
19:28TimMcgtrak: What's surprisingly hard is telling whether a double has the negative bit set.
19:28amalloyit's a bit rubbish but could work
19:28mattmoss&(< -0.0 0.0)
19:28lazybot⇒ false
19:28amalloy&(neg? -0.0)
19:28lazybot⇒ false
19:28arrdemmattmoss: ololololol
19:28TimMc&(Math/signum -0.0)
19:28lazybot⇒ -0.0
19:28mattmossI tried.
19:28arrdemoh gods I hate floating point...
19:29TimMcHere's the answer I came up with: ##(neg? (Math/copySign 4.0 -0.0))
19:29lazybot⇒ true
19:29TimMc&(neg? (Math/copySign 4.0 0.0))
19:29lazybot⇒ false
19:29bpr$(.signum (BigDecimal. -0.0))
19:30bpr&(.signum (BigDecimal. -0.0))
19:30lazybot⇒ 0
19:30gtrakgod, I always forget about keep
19:31gtrakremove nil? is just so intuitive
19:43bpr /join #pallet
19:43bprlol
19:49ziltiIs it still a stack if one can "peek" the topmost n values (but only at once)?
20:06bprdoes anyone know why running (require 'my.namespace) in the repl would work but typing C-c C-l in nrepl.el would fail with: "Namespace not found."?
20:06bprand by "nrepl.el" i mean the buffer with the my.namespace's source in it
20:25tomojwhat's the deal with IKeywordLookup/ILookupThunk?
20:26bbloomtomoj: it's about statically compiling fast (:foo a-map) call sites
20:27hiredmanILookupThunk is the interface for the inline caches created by the compiler created for keyword lookups in records
20:27tomojso one ILookupThunk per record field is automatically emitted?
20:28djwonkzilti IMO, if data structure acts like a stack, consider it a stack … unless it breaks the expectations for performance
20:28hiredmantomoj: they are per callsite, I believe
20:29djwonkzilti adding additional functions to a stack-like API is not a necessary condition for saying it is no longer a stack
20:29tomojso every time you write (:foo x), an ILookupThunk gets emitted, even though the compiler doesn't know x is a record?
20:30tomojguess I can try digging in to the compiler to understand
20:30hiredmanoh, no, they would be per record, the call site for (:foo x) just emits a check "is this a record, if so get the thunk and install it and call it"
20:31tomojah, and then next time you (:foo x) on a record of the same type (or the same record?), the thunk is already there?
20:31hiredmanhmmmm
20:31hiredmanI am not sure
20:31ziltiLol why is that called a thunk?
20:32hiredmanthey are per callsite
20:32amalloy$google functional programming thunk
20:32lazybot[Thunk (functional programming) - Wikipedia, the free encyclopedia] http://en.wikipedia.org/wiki/Thunk_(functional_programming)
20:33tomojoh, right, only at that callsite
20:34ziltiamalloy: Thanks, but I just wondered about the funny name.
20:34hiredmanwell the object per callsite knows how to look up the real thunk in the record
20:34amalloyzilti: the name is explained right in the article
20:36ziltiamalloy: Oh, yes now I see it. That's funnier than I expected.
20:36djwonkI was going to lookup what thunk meant, but I decided to wait until later to do it.
20:37djwonkActually… wait until someone asked me what it meant.
20:37zilti"thunk" means a muffled sound according to my dictionary
20:38ziltiBut "thunk" as 2-o'clock-in-the-morning-passive of "think" is way better.
20:39djwonkzilti: yes, it is pretty funny if you thunk about it
20:40ziltidjwonk: It's even funnier because here at me it is actually 2 o'clock in the morning.
20:40djwonkzilti: did you figure out your stack question?
20:41ziltidjwonk: I thunk about the advice and decade that I'll call it a stack
20:42djwonkzilti: did you notice the note on http://clojure.org/data_structures that says "Treat a list like a stack: peek pop"
20:43ziltidjwonk: Yes, I did. But usually you can only look at the topmost element of a stack, not at the second-topmost, without removing the topmost, so I wasn't sure
20:44djwonkwant to share a code snippet? what are you doing with it?
20:44ziltidjwonk: Stay tuned a few more minutes ;)
20:47ziltidjwonk: I need it to "keep track of results" in my data flow library: https://github.com/zilti/visuflow
20:48ziltiI bet something like that exists already, but better... But I couldn't find it.
20:49djwonkcolonbangs might be an unfortunate choice of terminology
20:50ziltiBut... but... hashbang...
20:52djwonkthat looks interesting
20:53kovaslol
20:56ziltidjwonk: I hope so, the concept took me hours to figure out ;) I thought, after decoupling data from functionality when switching from OO to Functional, why not also decoupling functions and the order of calling them?
20:56ziltiOk now, good night... Argh, working tomorrow will be hard...
21:03arrdemherm... any ideas on why this is giving me a Duplicate Key error on :rzero? https://www.refheap.com/paste/8197
21:05hiredman,(set [1 1])
21:05clojurebot#{1}
21:06bbloomarrdem: works for me
21:06hiredmanwhat version of clojure?
21:06bbloomarrdem: restart your repl?
21:06bbloomi'm on 1.4.0
21:07arrdemyeah I'm (supposedly) 1.4.0 also
21:08hiredmanthere have been changes around how and when duplicate keys are checked for sets and maps recently
21:08arrdemrepl restart didn't help either.
21:08hiredmanarrdem: well, uh, are you or aren't you on 1.4.0?
21:08bbloomarrdem: i just pasted your code into my repl and it worked, are you able to reproduce the issue with the same exact code you shared?
21:09bbloom(not in context, via copy paste to a non-project repl)
21:09arrdemlemme try on a fresh repl
21:10bprarrdem: you can check what version of clojure you're running by evaluating: *clojure-version*
21:10hiredmandefining a protocol then calling the impl method like that is pretty gross, so is using _ for a parameter name when you use the parameter
21:10arrdem... wtf works in a clean repl
21:10hiredmanby convention _ means "not used"
21:10hiredmanor don't car
21:10hiredmancare
21:11arrdemhiredman: the theory here is that this record replaces a structured vector I was previously using
21:11arrdemporting from that to this has given me pain all day
21:11arrdemso the theory is that I define an interface that insulates me from such changes in future.
21:12arrdemthanks for the _ correction, that'll get fixed.
21:12hiredmanarrdem: I would really recommend just using regular functions and a map instead of a protocol and a record
21:13arrdemafter `lein clean` it works like a charm.
21:13arrdem(in context)
21:13bprthat's b/c you're using a record and a protocol
21:13bpr(the need to lein clean)
21:13arrdembpr: right. I cleaned out the old :aot
21:15arrdemhiredman: when I'm doing structured map work like this, I should just define top-level functions left and right, then use :require :as to keep everything straight when I use it elsewhere?
21:16tomojwhat is a structured map? alternatively, what is an unstructured map?
21:17arrdemwhen I say "structured map" I really mean that I'm using a map with a programmer defined set of keys in a way that other languages would tell me to use an object.
21:18djwonkarrdem: so, a map :)
21:18arrdemdjwonk: XP I got that
21:20djwonkarrdem if your API works with only the functions 'left' and 'right' more power to you
21:21arrdemdjwonk: ... so I should be designing for clojure.zipper?
21:22djwonkarrdem: sure, it sounds like you are mostly there :)
21:25djwonkarrdem I'm doing a 'practice' project using all maps and namespaces.
21:26djwonkI looked at the data structures flowchart whenever I got tempted to try the fancier things
21:28arrdemdjwonk: you'd like what I'm doing right now... it's a purely functional (but eager) simulator for an out of order processor. my top-level loop is just (-> state (fetch) (decode) (issue) (alu) (commit))
21:29arrdembut no good arbitrary trees for the zipper library to play with
21:29arrdemjust a lot of update-in
21:31djwonkarrdem: I was joking around earlier… you said "I should just define top-level functions left and right" … I took that literally for fun … not thinking anything about zippers
21:31arrdem-_________-
21:31djwonkarrdem: yes, I do like simulations
21:34dnolencore.logic 0.8.0-rc1 going out
21:36djwonkarrdem: what does that mean?
21:37arrdemdjwonk: the flat face?
21:37arrdemI use it as an "are you kidding me" expression.
21:38djwonkhaha, I thought you were joking around too
21:39arrdemhaha.. if only I could get away with (left) and (right)...
21:40jweissok i'm confused. I want to override print-method so that I get "#<FooClass \"bar\">" instead of #<FooClass bar> when I print it (so the reader can read it if necessary). so I overrode it, calling (.write w (str o)) thinking that calling str will escape the quotes. it doesn't.
21:40bbloom,((juxt pr-str str) "foo")
21:40clojurebot["\"foo\"" "foo"]
21:40bbloom,((juxt print-str pr-str str) "foo")
21:40clojurebot["foo" "\"foo\"" "foo"]
21:40bbloomjweiss: ^^
21:41djwonkarrdem: small thing, you know you can write (-> state fetch decode issue alu commit)
21:41jweissbbloom: hm, but doesn't pr-str also call print-method under the covers?
21:41gfredericks,((juxt print println pr prn print-str println-str pr-str prn-str) "foo")
21:41clojurebotfoofoo
21:41clojurebot"foo""foo"
21:41clojurebot[nil nil nil nil "foo" ...]
21:41arrdemdjwonk: rly? I've had all kinds of pain from not ()ing my #()s when I put them in ->
21:41gfrederickshaha weird
21:41bbloomjweiss: yes, but print-method is defined for Strings, so you can (pr-str (str foo))
21:41jweissbbloom: ok i'll try that, thanks
21:42gfredericksarrdem: not for #()'s though :)
21:42alexbaranoskyRaynes: pong
21:42djwonkarrdem: yeah? I've been trying it out in my REPL. I could be wrong though
21:42Raynesalexbaranosky: Can you look over laser's tests for me when you get a chance and see if I'm using midje properly?
21:42jweiss,((juxt pr-str pr) "foo")
21:42clojurebot"foo"
21:42clojurebot["\"foo\"" nil]
21:42Raynesalexbaranosky: No hurry.
21:42jweissoh yeah
21:42djwonk,(-> 42 identity inc (identity) (dec))
21:42clojurebot42
21:43arrdemgfredericks: because #() -> (fn []), which is a list not an Ifn?
21:43gfredericksarrdem: yep
21:43alexbaranoskyRaynes, something's fishy with my IRC client. I didn't see your response
21:43Raynesalexbaranosky: What do you mean>
21:43Raynes?
21:44gfredericks&(macroexpand-1 (-> foo #(* % 2)))
21:44lazybot⇒ #<sandbox7657$eval178946$foo__178947 sandbox7657$eval178946$foo__178947@1bf2d06>
21:44gfredericks&(macroexpand-1 '(-> foo #(* % 2)))
21:44lazybot⇒ (fn* foo [p1__178950#] (* p1__178950# 2))
21:44alexbaranoskyit's only showing about 5 lines at a time, so youre message scrolled off the page too fast. Not sure what's up with that. Will have to investigate soon
21:44jweissbbloom: yeah, as i suspected, i get StackOverflowError if i try to call pr-str from my print-method override.
21:44RaynesPeculiar...
21:44bbloomjweiss: what type of object are you trying to print
21:44bbloomwhat is the dispatch value for your print-method ?
21:45alexbaranoskyRaynes: you're better of messaging me
21:45jweissbbloom: example, (AssertionError. "foo \"bar\"")
21:45jweissbbloom: it dispatches to the default, but i overrode Object.
21:45bbloomjweiss: yeah, um, don't do that
21:46bbloomwhy are you overriding the default print method?
21:46bbloomor the object one?
21:46jweissbbloom: how else can i guarantee that my prn output won't contain #< ... > ?
21:46bbloomjweiss: you can't
21:46jweisswell, i am gonna :)
21:46bbloom#< ... > is intentional for non-readable objects
21:47jweissi just want a string instead of the unreadable object.
21:47bbloomif you have a non-readable object that you want to make readable, then define a print-method for that object
21:47jweissinstead of breaking the reader
21:47jweissbbloom: i have no control over what classes will be in that output.
21:47jweissit has to be for anything.
21:47bbloomjweiss: you're only supposed to define a polymorphic method if you own the method or protocol. or if you own the type you're defining it on
21:47bbloomyou'll break print-method for all other clojure clients
21:48jweissbbloom: i made a flag that only prints my way if the flag is on, otherwise uses the vanilla dispatch.
21:48jweissperhaps a paste would help here. one sec
21:49bbloomwhat good does it do you to have a non-readable object be printed readably?
21:49bbloomunless, of course, you are making the object readable
21:49jweisshttps://www.refheap.com/paste/8198
21:49bbloomwhich you shouldn't do for other people's types anyway...
21:49devnbbloom: readability is not binary
21:49clojurebotIk begrijp
21:49TimMchaha
21:49jweissbbloom: i'm tracing functions and i want to be able to navigate the trace after serializing it to disk and reading it back.
21:49devn:)
21:49TimMcbbloom: Makes sense to me. You can read in the whole thing without trouble and just ignore those pieces that you can't use anyway.
21:50bbloomok, well bind your flag to false (binding [*print-all-readably* false] (pr-str (str obj)))
21:50jweissyeah what TimMc said :)
21:50bbloomjweiss: that would short circuit the recursion and your stack won't overflow
21:50bbloomstill doesn't seem like a great idea tho...
21:51jweissbbloom: is there not a function that does the escaping that i can call directly?
21:51bbloomif this is for debugging purposes, i do think we need something for that... but co-opting print-method probably isn't a good plan
21:51bbloomjweiss: not public
21:51bbloomyou can also try print-dup to see if that gets the job done for you in any way
21:52jweissbbloom: no, i'm not interesting in recreating the objects.
21:52jweiss*interested
21:52jweissjust want to go from "reader chokes" to "reader reads it and gives me some clue what the object was"
21:52bbloomi think you'd be better off defining a multimethod transform-to-readable-only
21:52bbloomand then print the result of that
21:53gfrederickswhat is the state of cljs source maps?
21:53jweissbbloom: and then do what for things like vectors, maps, etc? defer to print-method?
21:53bbloomjweiss: yes
21:54jweissi considered doing that, and i seem to recall i couldn't, but now can't remember why.
21:54bbloomthe rule is: only define methods for protocols (or multimethods dispatched by type) for either A) protocols you control or B) types you control
21:54jweisssomething i was doing required print-method.
21:54bbloomotherwise, delegate
21:54jweissmaybe it was pprint. but i don't really require pprint anymore.
21:54jweissi think that was it.
21:54bbloompprint is a mess lol
21:54bbloompprint is on my hit list :-P
21:55jweissyeah i tried to write a custom dispatch, that did not go well. no docs. unless you count the docs for common lisp's pprint.
21:55jweiss(custom dispatch wasn't for this - it was to properly indent trace output)
21:55bbloomjweiss: it's also just an old algorithm and a stateful approach. i've been working on a new pprint for my own needs & i'll probably make it work on clojure data for the hell o fit
21:56TimMcjweiss: Is this something that will be published and combined with other people's code?
21:56jweissTimMc: ideally, yes
21:56jweissbut if it doesn't work that way, i could live with it
21:58jweissbbloom: oh you're the guy who did Facjor. nice.
21:59jweissfactjor rather
21:59bbloomjweiss: apparently people think that thing is super cool :-)
21:59bbloomi submitted a proposal to give a talk about it at clojure west
22:03djwonkhmm. clojure.core has `every?` `not-every?` `not-any?` but not `any?` -- just `some`.
22:05bbloomdjwonk: any? is just (comp boolean some)
22:05bbloomgenerally, 'some is preferrable
22:05bbloompreferable*
22:06djwonkbloom: thanks, I was looking at comp just now. it is asymmetrical
22:06bbloomdjwonk: the real asymmetry is that there is no 'every without the ?
22:06bbloom,(and 1 2)
22:06clojurebot2
22:06bbloom,(every? identity [1 2])
22:06clojurebottrue
22:06arrdem,(reduce #(or %1 %2) [false false false true false])
22:06clojurebottrue
22:07bbloom,(last (filter identity [1 2]))
22:07clojurebot2
22:07gfredericks,((constantly 2))
22:07clojurebot2
22:08bbloomhmmm there should also be a no-predicate version of 'some as well
22:08bbloomand every? etc
22:09gfredericksbbloom: and then we need versions where only nil is falsy
22:09bbloom,(some (complement nil?) [nil nil 2 nil 3 nil])
22:09clojurebottrue
22:09bbloom*shrug*
22:10amalloybbloom: bet you a dollar any? isn't (comp boolean some)
22:10arrdemwhy is 0 truty?
22:10djwonkbbloom: interesting. `any?` seems like a no-brainer.
22:10amalloybecause it ain't nil or false
22:10bbloomamalloy: heh, whoops
22:10bbloom(doc some)
22:10clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
22:10arrdem,(boolean `())
22:10clojurebottrue
22:11arrdemwat
22:11amalloyarrdem: is () false or nil?
22:11jweissoh wait no i'm not
22:11bbloomit claims logical true...
22:11jweissit's wahtever the pred returns.
22:11arrdemamalloy: in any other lisp `() = nil....
22:11arrdembut no it isn't
22:12djwonkjweiss: some returns the value *if* the predicate is true
22:12gfredericksclojure just be diffrent
22:12amalloybbloom: i think i was wrong actually. send me a self-addressed stamped envelope to collect your dollar
22:12bbloomamalloy: heh
22:13gfredericksthat's a net of several dimes
22:13gfrederickstotally worth it
22:13amalloyi confused the issue with #{x} returning a different truthiness from #(= % x)
22:15bbloomah yes
22:17djwonkbbloom: any? discussion: https://groups.google.com/forum/?fromgroups=#!searchin/clojure/any?$20every?/clojure/CxxkO9rBZKg/rLgv_4PvNQ0J
22:19djwonkthe downsides to adding any? would be: a little more code, a little extra documentation. gains: symmetry. I guess symmetry loses in this case?
22:19djwonki'm adding it to my bag of utilities though
22:20djwonkI mean, if you have not-any? you gotta have any? ! think about someone refactoring or tweaking. this is a no brainer
22:26amalloydjwonk: if you have not-any?, you already have any?. it's just (complement not-any?)
22:26djwonkamalloy: LOL
22:26amalloyor (comp boolean some), as bbloom suggests
22:27djwonkI know I can make it, I'm saying it is CRAZY that core doesn't have it. Oh, why do I care?
22:27djwonkI have some but I don't have any?
22:27djwonkhaha
22:29bbloomdjwonk: even if core had any? it's doc string would be similar to #(doc empty?)
22:29bbloomer ##(doc empty?)
22:29lazybot⇒ "([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))"
22:29bbloomsince some is generally more useful than any?
22:29bbloomalthough, occasionally, you want to return a boolean even if you use some since you want your public api to promise true/false and not some extra bit of data, in case you ever change your implementation
22:30djwonkbbloom: exactly. this is about *people* *reading* code
23:02tpopebbloom: surprise!
23:03bbloomtpope: what' sup?
23:03tpopeit's a surprise!
23:03bbloomheh ok
23:04bbloomgithub just ruined the surprise...
23:05tpopewhat would be really cool (and almost completely worthless) would be if I could get the source for the java parts of clojure into my classpath
23:05bbloomtpope: wouldn't be useless to me, i look at the java source frequently :-P
23:05tpopefind a way
23:06bbloomtpope: i think you'd need src jars
23:06tpopeyes
23:06bbloomor at least a checkout synced to the right version
23:06tpopeI gathered that much
23:06tpopeI was hopefully for something transparent
23:06tpopelike a one liner in my project.clj
23:06bbloomtpope: https://oss.sonatype.org/content/repositories/snapshots/org/clojure/clojure/1.5.0-master-SNAPSHOT/
23:06bbloomthere are source jars there
23:06bbloomso in theory.... lein could grab them
23:07bbloompresumably that's where it gets clojure in the first place
23:07bbloomtechnomancy: ?
23:08amalloyi think you can depend on org.clojure/clojure :classifier "source" or something like that
23:08technomancybbloom: sure?
23:08bbloom:classifier "sources"
23:08technomancyritz does that
23:08systemfaultLulz http://www.satlug.org/pipermail/satlug/2013-January/067023.html
23:08bbloomcool
23:09tpopebbloom: does it work for you? I get Could not find the main class: clojure.main. Program will exit.
23:09bbloomtpope: playing with the location list now... neat!
23:10bbloomtpope: you need both with and without the classifier
23:10bbloomyou added a dependency on the sources, but eliminated a dependency on the binaries
23:10tpopebbloom: I tried both ways
23:10bbloom(i'm guessing)
23:10bbloomhmmm
23:10bbloomdunno then
23:10tpopedo I need a version number with the :classifier variant? (I included one)
23:11hugodritz automatically adds source jars if they are in the local repo
23:11bbloomnot sure, but my brain is extremely pre-occupied, so i'm gonna get back to you on this :-P
23:12hugod`lein pom; mvn dependency:sources;` will get them there
23:14tpopeI'm not really up to speed on ritz
23:15tpopethat is, it's a word that seems to usually appear in sentenes involving emacs, so I haven't yet paid it much notice :)
23:17hugodit starts an nrepl server, so can be used with any nrepl client
23:17bbloomtpope: i dunno anything about ritz either, but my understanding is that it's available both in nREPL and SWANK forms
23:17bbloomi suspect the later is the emacs specific part
23:18tpopeI'll give it a try
23:23bprhugod: do you have your emacs dotfiles online anywhere? I can never get ritz working (nrepl or swank).
23:23tpopehugod: so I'd add ritz-nrepl to my lein profile as instructed?
23:23tpopethen run ... lein ritz-nrepl?
23:25hugodtpope: lein ritz-nrepl will start an nrepl - which client are you using?
23:25tpopehugod: foreplay.vim
23:25hugodbpr: I have an old gist I should update - what problems were you having?
23:25tpopeI can pretty much guarantee I'm the first person to try it
23:26hugodI shalln't be betting against that
23:28hugodtpope: I see I haven't added the option to run without the debugger to ritz nrepl - should still work though
23:30bprhugod: i can't give very precise descriptions of the problems, but it doesn't launch a debugger on exceptions (when configured to do so) and nrepl-javadocs doesn't work (it opens a browser tab with a non-url) etc.
23:30tpopehugod: it wasn't working on this machine, but it is on my mac. how do I tell what port it's on?
23:30devthtpope: i've used ritz a bit with slimv. start the swank client with: lein ritz 4005
23:31bpri could try setting everything up again and give you more precise error descriptions.
23:31tpopeoh look, it finally reported a port
23:31devths/client/server
23:32hugodbpr: https://gist.github.com/1934037
23:32tpopewhatever it is, it's behaving differently enough from vanilla nrepl that foreplay.vim is confused
23:32bprhugod: thanks
23:33technomancyhugod: could ritz be made a higher-order task that could then launch an nrepl server or a ring server or whatever?
23:35hugodtechnomancy: not sure exactly what you mean there
23:35technomancyhugod: well the ritz task does the double-jvm setup and then launches a repl in the project JVM, right?
23:35technomancywhy not parameterize the "launches a repl" part?
23:37hugod(in swank it can run without the double jvm too)
23:38hugodtechnomancy: so just have a single lien task, and not one for swank, one for nrepl, one for hornetq, etc
23:38tpopehugod: I am getting ERROR: Unhandled REPL handler exception processing message {:code 1, :op eval} java.lang.NullPointerException whenever I try to eval anything in the usual nrepl manner
23:39TimMcMy excuse for not writing code tonight: Helicopter hovering ~150 ft over my house. >_<
23:39tpopethis is not an urgent matter
23:39hugodtpope: um - I wonder if it relies on having a session
23:40tpopehugod: actually my first attempt was with a session
23:41technomancyhugod: exactly; it seems like a good fit for a higher-order task
23:41technomancyadmittedly I haven't taken a close look, but just from what I've heard
23:42technomancyalso: higher-order tasks are basically the coolest thing in leiningen =)
23:43technomancyor if you don't want to break compatibility you could say `lein ritzfully repl` =)
23:44TimMcritzily
23:46hugodtechnomancy: I'll have to think about that...
23:46tpopehugod: the tracking-eval middleware appears to require an id
23:46tpopenot a session, just a regular id
23:47hugodtpope: right - I guess nrepl.el must provide that
23:48tpopeit's an optional parameter to the eval operation
23:48tpopehttps://github.com/clojure/tools.nrepl/blob/master/doc/ops.md#eval
23:49hugod"It is generally the case that request messages should contain a globally-unique :id." from the nrepl readme
23:50tpopewell, I guess there's no harm in adding one
23:50hugoda request can have more than one reply
23:50hugodand the id is used to match them up
23:50tpopeyes
23:51tpopebut I'm forced into a single threaded, synchronous workflow
23:51tpopethus it doesn't really solve anything for me
23:51hugodah - if you add an issue to ritz I can remove the need for it
23:52tpopewill do
23:52hugodthanks
23:53bprhugod: your config seems to work well. I'll have to look over this and see what I have that's conflicting
23:53bprhugod: thanks
23:53hugodbpr: glad to hear it is working