#clojure logs

2011-03-12

01:50amalloysritchie: postwalk-replace?
01:56waxrosegreetings
01:57brehautmorning waxrose
01:57waxroseMorning brehaut . :)
02:00sritchie_amalloy: hey, can I ask for an example usage?
02:00amalloy&(use 'clojure.walk)
02:00sexpbot⟹ nil
02:01amalloy&(postwalk-replace {4 5} {1 {2 {4 5} {8 {9 4}}}})
02:01sexpbotjava.lang.ArrayIndexOutOfBoundsException: 3
02:01amalloyoops
02:01amalloy&(postwalk-replace {4 5} {1 {2 {4 5} {8 {9 4}} 10}})
02:01sexpbot⟹ {1 {2 {5 5}, {8 {9 5}} 10}}
02:02sritchie_hey, that's exactly what I was looking for
02:03sritchie_oh, well, almost
02:03sritchie_that swaps keys, I wanted to swap values
02:03amalloyit did both
02:04amalloyi included one of each on purpose
02:04sritchie_ah, I see
02:05sritchie_so, the use here is replacing default values in a map with custom values -- I wanted a function that swaps out k-v pairs
02:05sritchie_let me grab what I ended up writing...
02:09sritchie_gah, I swapped it out for something simpler, in the end, and didn't check in the file with that function
02:10sritchie_in any case, I wrote something that mapped across all values in my default-config map and did the replace for each sub-map
02:11sritchie_not a general solution, but it got the job done
02:24amalloysritchie_: after hearing you say "three config files but i don't want the user to have to deal with which is which" i would be pretty sure you were doing hadoop stuff even if i didn't already know :P
02:25waxroselol
02:30amalloysritchie_: have you looked at cascalog? i saw a presentation on it recently that made me weep with joy after having worked with hadoop
02:35brehautcascalog looks like 6 kinds of awesome
02:38amalloybrehaut: it's more awesome when you're watching nathan marz hack together queries in ten seconds that turn into hadoop jobs that would take three days to write by hand
02:39brehautive gladly never had to write hadoop by hand
02:43amalloybrehaut: instead you...?
02:43brehautdont use hadoop
02:46amalloyk. your "by hand" qualifier made me wonder
02:46brehautoh sorry
02:49brehautive never had to process enough data that hadoop would be a good idea
02:56amalloyit rarely is a *good* idea. but sometimes it is the least bad idea
03:00brehauthaha
03:14sritchie_hey, sorry, I'm back
03:14sritchie_yes!
03:14sritchie_I'm using cascalog, it's amazing
03:14sritchie_I'm working on a hadoop crate for pallet, now
03:14sritchie_the goal is to allow cascalog queries to run on distributed clusters, all controlled by pallet
03:16sritchie_amalloy: haha, and yes, good guess on the config trinity
03:21ejacksonsritchie: that would be pretty groovy
03:23amalloysritchie_: ooc how hard is it to integrate with custom data types (via thrift, presumably)? eg my keys are Penguins and i have a Penguin thrift file, how hard is it to get cascalog to find me the name of the tallest penguin?
03:25sritchie_amalloy: you'd have to write a thrift tap for cascading, but that's about it
03:25amalloyoh, interesting. i think there's already one, since nmarz had his stuff defined in thrift but didn't really go into how it integrated
03:27sritchie_then, (?<- (stdout) [?penguin-name ?max] ((thrift-tap penguin-dir) ?penguin-name ?height) (cascalog.ops/max ?height :> ?max))
03:27sritchie_or, probably, (?<- (stdout) [?penguin-name ?max] ((thrift-tap penguin-dir) ?penguin) (penguin-attrs ?penguin :> ?name ?height) (cascalog.ops/max ?height :> ?max))
03:28sritchie_s/?penguin-name ?name
03:28sritchie_s/?penguin-name/?name
03:28sritchie_hmm, screwing that up
03:29amalloythe sed?
03:29amalloy? is a modifier
03:30sritchie_ah, okay
03:41amalloys/\?/this
03:41sexpbot<amalloy> this is a modifier
03:42amalloyif you actually cared to make it work :P
03:43sritchie_s/\?penguin-name/\?name
03:43sritchie_it's been too long! and I think everyone here gets the idea :)
03:52amalloy*chuckle*
03:52amalloythe s/foo/bar form only works on your most recent mesage
03:52amalloy$sed -sritchie_ s/gets.*/wishes we would quit going on about penguins
03:52sexpbot<sritchie_> it's been too long! and I think everyone here wishes we would quit going on about penguins
03:53sritchie_sexpbot: took the words right out of my mouth
10:04gfrlogis there a summary somewhere of what's new in 1.3?
10:04gfrlogor does that wait till the full release?
10:05fliebelgfrlog: There is a changelog included in the messages about the lates alpha releases.
10:05gfrlogwhere are these messages?
10:06fliebelmailing list
10:06gfrlogokay, thanks
10:06TimMcfliebel: Where can I find changes from 1.1 to 1.2?
10:07TimMcSame place?
10:07fliebelDon't know, but let me know when you find it.
10:07TimMcOK.
10:08TimMcI'm a little alarmed to see breaking changes on minor version bumps... without a highly visible changelog.
10:09gfrlogI remember Rich mentioning the explicit :dynamic attribute on vars at Conj, but having used vars a lot more since then it suddenly seems a little more important
10:10gfrlogdoes it mean that if I'm using a library, I can't rebind any vars unless the author provides for it? or is there a way to dynamically dynamicafy a var?
10:10fliebelgfrlog: I think the former, but there might be some back magic to do it deep down in java land.
10:11gfrlogsuddenly clojure is a lot less like ruby
10:11gfrlogprobably a good thing ultimately :-/
10:12fliebelgfrlog: I hadn't the impression there was a lot of similarity?
10:12gfrlogthere's not; but they at least both had the property that you could reach deep into somebody's code and change arbitrary things
10:13gfrlogvery useful for hacking, and very scary for people who like guarantees
10:13fliebelgfrlog: Can you make + do * in Clojure? I mean, outside of binding, and outside of your own namespace?
10:14gfrlogwell binding is what I was referring to
10:14gfrlogso it's diff from ruby in that it's thread-local and dynamically scoped rather than a global change
10:14gfrlogbut similar capabilities and concerns
10:14gfrlogperhaps less concerns than the ruby case
10:15gfrlogin fact I think ruby is working on a new feature that would make changes like that more scoped
10:15fliebelgfrlog: That would be very backwards incompatible, wouldn't it?
10:16gfrlogfliebel: the way I stated it, yes. I doubt they're actually writing it that way
10:16gfrloge.g., maybe add a new keyword for redeffing in a local context; dunno
10:16gfrlogif I could remember the name they gave the tactic, I could probably google it
10:17gfrlogI guess adding a new keyword is a bit backwards incompatible as well :)
10:17gfrlogis "reserved word" a legitimate definition of "keyword" or was I being confusing there?
10:18spewngfrlog: Monkey patching?
10:18gfrlogspewn: no, that's not what I'm thinking of. I think that's just a general term for redeffing
10:18gfrlogooh
10:18gfrlogum
10:18gfrlogrefinements maybe?
10:19gfrlog$google ruby refinements
10:19sexpbotFirst out of 14100 results is: Ruby Refinements: An Overview of a New Proposed Ruby Feature
10:19sexpbothttp://www.rubyinside.com/ruby-refinements-an-overview-of-a-new-proposed-ruby-feature-3978.html
10:19gfrlogah hah
10:19gfrlogthe example given uses a presumably new keyword "refine"
10:20gfrlogI would imagine it's okay to be backwards incompatible if it's aimed at Ruby 2.0
10:23ApeShotSo what is the deal with lein and swank and emacs?
10:23fliebelI wonder what message passing would do to functional programming. Silly thought probably… You know, Smalltalk without the objects.
10:23ApeShotI just set up a new lein project, added the swank dependency in project.clj
10:24ApeShotand I thought that is just what I did in other projects
10:24ApeShotbut lein swank doesn't work in the new project
10:24gfrlogfliebel: erlang?
10:24ApeShotThe documentation on github says that I don't need a swank dependency
10:24ApeShotBut it seems like I do
10:25TimMclein deps?
10:25TimMc(on the off-chance...)
10:27ApeShotTimMc: just tried that
10:27ApeShotTimMc: Maybe there is some problem with lein deps and local libraries? It seems to hang on trying to fetch my "utils" project
10:27ApeShotNot hang, but die
10:28ApeShotTimMc: I have a separate project for utilities, which I believe i'm supposed to put a symlink to in the checkouts directory
10:28ApeShotTimMc: Do I also need to put it in my project.clj file?
10:29TimMcI believe so.
10:29ApeShotThat seems to be the problem
10:29TimMcIsn't checkouts there so you can do work in two projects at once?
10:29ApeShotI just *removed* it from project.clj, ran lein deps, and it works
10:29ApeShotTimMc: yes
10:30ApeShotI rarely work on utils by itself
10:30ApeShotIt fills up as I write other projects
10:30TimMcOK, then you need it in project.clj
10:30ApeShotIf I put it in there, lein deps can't run
10:30ApeShotIt says it can't find the project
10:30TimMcI guess that narrows it down.
10:31ApeShotHowever, if I take it out, then run lein deps and start up clojure, the project can use the utils
10:31ApeShotSo clojure can find the utils
10:31ApeShotBut then if I try to compile the project, it says it can't find them again
10:32ApeShotHow should I specify a local project linked in checkouts in the project.clj?
10:33ApeShotI'm not super java ecosystem literate
10:34TimMcBut you have this working in other projects?
10:37ApeShotI can develop with swank in other projects, but not compile to a single jar
10:37ApeShotSame thing happens, it complains it can't find the dependencies corresponding to the project in checkouts
10:38TimMcAh. Can't help you there, haven't used checkout-deps myself.
10:39ApeShotMaybe I need to build and install the utilities before doing lein deps in a project which depends on them
10:41ApeShotOh well
10:41ApeShotI can develop, at least
10:41ApeShotI'll just cross this bridge when I need to distribute
10:42ApeShotIt seems to me that project management is the most complicated part of any project
10:42ApeShotwhich is weird
10:43ApeShotIt seems to me that project dependency information is implicit in the source code of the project
10:43ApeShotWhy can't compilers just figure it all out
10:43TimMcheh
10:43TimMcVersioning.
10:43gfrlogand write the code
10:43ApeShotWell, maybe the mistake is to not force programmers to indicate versioning when they include libraries
10:44ApeShotEach version is essentially a different library
10:44ApeShotYou could have a central repository, or just expect libraries to be on the path somewhere
10:44gfrlogbut that would imply you could use two versions of the same library
10:44ApeShotWhy not?
10:45gfrlogcause they have identical namespaces
10:45gfrlogto make it work library authors would have to change their namespaces at each release
10:45ApeShotNo, there namespaces are version qualified
10:45gfrlognow you have to change your code every time you upgrade your deps
10:45TimMcApeShot: Then objects passed around in your code would have ambiguous semantics.
10:45gfrlogunless the compiler auto-aliases
10:46gfrlogbut it can't auto-alias if you're using two versions of the same lib
10:46TimMcThere is a package management system that allows multiversion installs, by the way.
10:46ApeShotHow often would people realistically want to use two version of the same libary in the same context, though?
10:46gfrlogwhich you probably would be, without even knowing it
10:46TimMcApeShot: Via dependencies.
10:46gfrlogApeShot: not conciously
10:46gfrlogit'd happen indirectly
10:46ApeShotTimMc: well, you're sort of in the shit then either way
10:46TimMcIndeed.
10:47gfrlogno more libraries! All code reuses will henceforth be done inline.
10:47ApeShotThe forth people have something to say about this
10:47ApeShotThey think its best to just rewrite everything every time
10:47gfrlogsudo apt-get insert libxml2-dev
10:50TimMcApeShot: https://secure.wikimedia.org/wikipedia/en/wiki/Nix_package_manager
10:50ApeShotIt seems to me that if two version of a library aren't semantically identical then they aren't really the same library anyway, and they should be indicated as different in the code
10:50ApeShotInstead of sticking one's head in the sand about it
10:50gfrlogTimMc: what's with the https for wikipedia?
10:50TimMcgfrlog: That's my default.
10:50ApeShotYeah, I was thinking about the Nix package manager
10:51TimMcApeShot: That's what major version bumps are for.
10:51gfrlogTimMc: a service they have for people concerned about snooping?
10:51ApeShotTimMc: well, given that we spend a lot of time thinking about lib versions, maybe the current practices could stand some revision
10:51TimMcgfrlog: Yeah, though I have an extension that redirects me to the HTTPS version of every site it knows about.
10:52TimMcApeShot: I'm just miffed that Clojure apparently isn't following SemVer.
10:53ApeShotTimMc: SemVer?
10:53TimMchttp://semver.org/
10:53TimMcSemantic versioning.
10:53TimMcClojure should be at a 0.y.z version right now.
10:54TimMcAlternatively, 1.1, 1.2, and 1.3 should have been called 1.0, 2.0, and 3.0.
10:56ApeShotTimMc: I am down with SemVer, I think
11:30TimMcDoes Leiningen allow range dependencies?
11:34User`hm
11:35User`what's currently popular way of making web apps in clojure?
11:38fliebelTimMc: It does
11:39fliebelUser`: Anything that uses Ring goes. :)
11:39joodieI like ring (+ some compojure stuff) for web apps. I think the Ring part is the most important.
11:39fliebelMoustache and Enlive are cool as well
11:40User`I was thinking about implementing servlet through proxy using enlive for html templating
11:40User`then I would deploy the servlet on glassfish or something
11:40fliebelUser`: There is a Ring wrapper for deploying as a servlet?
11:41fliebel(minus the question mark)
11:41User`well I want the container goodies too
11:41User`security and stuff
11:42User`how do you generally limit access to pages user shouldn't be accessing
11:42fliebelUser`: Using ring midleware.
11:42joodieI wouldn't be too quick to throw out ring... it's probably easier to write some stuff to get at the container from within ring than having to rewrite the ring extensions.
11:44joodiebut then, I try to stay as far away as possible from the servlet API anyway.
12:10avdibeating my head against (use ...) here
12:11avdiI think I've worked out that it takes an array, unlike what is shown in "Programming Clojure"
12:11joodie@avdi: in (ns (use ...)) ?
12:12joodieerm.. (ns (:use ..))
12:12avdijoodie: no ns. Just working at the REPL, trying to copy what I see in Programming Clojure
12:12avdiHere's my current conundrum:
12:12avdiuser=> (use ['clojure.contrib.repl-utils])
12:12avdijava.lang.IllegalStateException: source already refers to: #'clojure.repl/source in namespace: user (NO_SOURCE_FILE:0)
12:12avdiuser=> (use ['clojure.contrib.repl-utils :as ru])
12:12avdijava.lang.Exception: Unable to resolve symbol: ru in this context (NO_SOURCE_FILE:30)
12:12avdiuser=> (use ['clojure.contrib.repl-utils :as 'ru])
12:12avdijava.lang.IllegalStateException: source already refers to: #'clojure.repl/source in namespace: user (NO_SOURCE_FILE:0)
12:12avdi1. Can't just use it because of some conflict
12:13avdi2. Can't seem to alias it using an unquoted symbol
12:13avdi3. Can't seem to alias it with a quoted symbol either
12:13avdiVery confused.
12:13joodieif you just want to alias it, use (require ..) instead
12:13raekavdi: when calling the use-function, you often quote the whole argument: (require '[clojure.contrib.repl-utils :as ru])
12:14raek(then you don't have to quote each symbol)
12:14avdiI'd really like a way to load and alias at the same time, hence use
12:15joodienote that (use '(bla :as bla)) will still try to import all the vars into the current namespace. so you should use require instead.
12:15avdiAh. Right. Gotcha.
12:15raekavdi: the reason it complains about it already being there is because the user namespace has clojure.repl use'd by default in more recent versions
12:15joodieor (use '(bla :only [....]))
12:15raek(or was it leiningen that did that)
12:16raekdon't use lists there
12:16avdiOK, require works better. Thanks :-)
12:16raekvectors are for options, lists are for shared prefixes
12:17raek(since having a list there doesn't work)
12:18raek(use 'foo.a 'foo.b 'foo.c) = (use '(foo a b c))
12:19raek(use 'foo.a '[foo.b :only [x]] 'foo.x) = (use '(foo a [b :only [x]] c))
12:26angermananyone got a suggestion for a black-box optimization algorithm? I guess I could compute some bounds on the parameter space (1-dimensional). But apart from that I know nothing about the objective function.
12:26angermanIt's quite likely that it's smooth but there's no derivative.
12:33midsangerman: can you provide a little more context?
12:35angermanI'm computing planar solutions of a mesh using a projective geometry approach. Fixed Points correspond to solutions. The projective transformation can be rewritten as a Eigensystem problem, in which the Eigenvectors correspond to the Fixed Points. In case of identical Eigenvalues, the Eigenvectors represent an Eigenspace of dimension 1.
12:36angermanIn that case I try to find a good solution from the Eigenspace. The objective function is fed the solution and computes the points locations to ensure planarity. There are some conditions that classify the solution as good, eg. having as rectangular as possible patches, sub-patches behing smaller than their parent patches, ...
12:37angermanSo I basically have (obj-fn [sol]) -> quality of solution.
12:38angermanI could constrain the Eigenspace to a minimum and maximum, but It'd still have a continuous range of possible solutions, from which I'd like to obtain the "best" or a "good" one.
13:17TimMc*crickets*
13:23TimMcangerman: How expensive is the quality function?
13:23angermana few ms
13:24angermanjust a bunch of matrix multiplications and then some convexity tests, area and circumflex calculations. Nothing that dramatic.
13:27TimMcAnd the parameter space is one-dimensional?
13:27angermanyes.
13:27angermanx + t d
13:27TimMcbut not bounded?
13:27angermant \in [A,B]
13:27angermanat least I think I can construct an upper and lower bound.
13:33hvcan a macro know the name of its calling namespace?
13:34angermanhv: maybe *ns*?
13:35raekhv: like an ordinary function would do it (ns-name *ns*)
13:35hvwill that be the calling ns or the ns the macro/function is defined in?
13:36raekhv: that depends on whether you put that call in the macro code, or in the code that the macro returns
13:37raek(defmacro foo [] (let [x (ns-name *ns*)] `(print ~x))) vs (defmacro foo [] `(print (ns-name *ns*)))
13:38hvraek: thanks :)
13:42waxroseMorning every one.
13:47TimMchey, waxrose
13:50waxroseTimMc, howdy partner
13:51waxroseHow's the pipeline project going?
13:51TimMcWell, I pushed out 0.1.0-SNAPSHOT
13:51TimMcIt seems to work.
13:51TimMcI named it org.timmc/feedback
13:51waxrosecool, I'll check it out in a little while.
13:52waxroseWould you happen to know a good library to help create a graphed chart?
13:53waxroseI may need to do it in JavaScript till I become better in Clojure. :/
13:55ScalaI want to use Vim for clojure development, should I use VIMClojure or slimv?
13:57waxroseI've heard good things about VimClojure, not sure about slimv.
13:57Scalawaxrose: Okiedokes
13:57waxroseWhy not use both?
13:58ScalaAre they exclusive?
13:58ScalaO_o
13:59waxroseI meant, just try both till you decided which one fits your goals best.
14:03Scalawaxrose: Yeah I want to minimize experimentation for now since I'm just getting started with a new language though
14:08TimMcScala: Very good idea.
14:09ScalaTimMc: Do you have any other suggestions
14:09ScalaI've never worked with anything on the JVM so I don't know if it's expected for me to know anything already
14:09TimMcI first tried to learn Emacs while at the same time was trying to get started on a research project in CFG parser-generators written in Scheem48 macros.
14:10ScalaTimMc: That sounds horrible lol
14:10TimMcI totally failed to learn any of Emacs, Scheme48, and the internals of this parser generator. :-P
14:10waxroselol
14:10ScalaHaha yeah
14:10TimMcWith Clojure, I just used Gedit until I was comfortable with Clojure, then switched to Emacs, which I was actually able to learn this time.
14:11ScalaI'm already very comfortable with Vim at this point fortunately
14:11waxroseI picked up Emacs very fast, but I still prefer Vim's hjkl so I remapped that. Did you use this http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Vim
14:11waxrose?
14:11DeranderI switch back and forth between editors every couple of years
14:11TimMcScala: So just use vim and leiningen, and worry about integrated REPLs later.
14:11Scalaleiningen?
14:11clojurebothttp://github.com/technomancy/leiningen
14:11Scalaokay
14:12Deranderhahahaha. that was nice of clojure bot
14:12Scalaoh ahhaa I didn't realize that wasn't you
14:12TimMclemme check something:
14:12TimMcwhy?
14:12clojurebotwhy not?
14:12TimMcheh
14:12waxroseScala, As long as you are comfortable with your editor is really all that matters.
14:12Scalayeah
14:13TimMcEmacs is ideal for s-expression languages, but is a learning project of its own.
14:13waxroseTimMc, So you failed to learn emacs and scheme48? lol
14:13TimMcyup
14:13ScalaI was mostly just wondering if I should use something like RVM or VirtualEnv (ocming from ruby/python) when using clojure
14:13TimMcAnd the continuation-passing macro style.
14:13waxroseI learned both fairly fast but I am a slacker so I have been forgetting some of it.
14:14waxroseI've been doing too much Html 5 and JavaScript.
14:14TimMcScala: I don't know what those are... I just write stuff in Emacs or Gedit or whatever and run `lein run` and `lein test` as needed.
14:14waxroseTimMc, RVM is for Ruby.
14:14tomojScala: lein, cake
14:15tomojthere isn't really an equivalent to RVM because we just started that way in the first place
14:15TimMcScala: Cake is another build tool for Clojure, similar in basic usage to Leiningen.
14:15tomojclojure is just a jar that gets downloaded into your project dir
14:16ScalaOh
14:16TimMcBoth are super-easy to use, once you get used to how Clojure namespaces are mapped to files and directories.
14:16ScalaAh that's not bad, that's what python does
14:17Scalahaha why
14:17waxroseI was doing Ruby for a little while and the Ruby Confs I've been to have made me dislike the snake.
14:17ScalaAh
14:18TimMcPersonally, I think Python is fun.
14:18ScalaThere's too much implicitness in ruby for my liking
14:18waxrosePlus I don't like Zed Shaw.
14:18amalloy"<TimMc> Scala: Very good idea" - i intend to take this out of context and use it as blackmail
14:18TimMcha!
14:18Scalaahha
14:19ScalaTim are you a scala lover now!! lols
14:19waxroselol
14:19waxroseTimMc, Finish your pipeline project before you get blackmailed!
14:19TimMcwaxrose: It's basically done.
14:19ScalaI've never used scala yet, I've been debating between clojure and scala but ended up picking clojure
14:19waxroseamalloy, Greetings.
14:19TimMcI won't declare 1.0.0 until I'm sure it works for my dependant project, though.
14:20waxroseWell there are two more Clojure books coming out so that could be a nice way to jump into it. That's what I'm doing.
14:20ScalaI'm mostly interested in learning a lisp
14:20ScalaI wanna give game development a shot
14:20amalloywaxrose: which two?
14:21waxroseWell there is always ansi-common lisp, SICP.. and a few others
14:21TimMcScala: If you want to see an example of Java Swing interop in Clojure, here's a Bézier curve editor I wrote for a school assignment: https://github.com/timmc/CS4300-HW3/
14:22waxroseamalloy, The Joy of Clojure and Clojure in Action
14:22TimMcDon't pattern on my code too much, though -- I'm still somewhat of a beginner.
14:22TimMcwaxrose: Who is writing the latter?
14:22waxroseamalloy, I work part time at B&N so I already have them pre-ordered.
14:22waxroseTimMc, Amit Rathore
14:22zoldar,(eval `(-> {:yes {:yes 1}} ~@[:yes :yes]))
14:22waxroseTimMc, http://www.manning.com/rathore/
14:22clojurebotDENIED
14:23zoldarouch
14:23TimMcwaxrose: Yeah, but what's their *real* name? :-P
14:23amalloywaxrose: JoC isn't something i'd call "coming out soon". i read the early-access version in like august, and the ebook has been finished for months
14:23waxroseamalloy, I meant in physical form. :D
14:23amalloyTimMc: i met amit on thursday. he's probly real
14:23zoldaris there some cleaner way to go through nested maps when key path is given as seq ?
14:23TimMcamalloy: Amit is just his meatspace name.
14:24amalloyzoldar: {assoc,update,dissoc}-in
14:24TimMcI was curious if he had a True Name, aka IRC handle.
14:24amalloyi don't think so
14:24zoldaramalloy, without modifying
14:24amalloyget-in
14:24amalloyknew i'd missed on :P
14:24amalloy*one
14:25zoldarthanks! missed that one too
14:25waxroseThe physical copy of JoC will be in my store on the 26th I believe and goes on the floor on the 28th.
14:25parasebazoldar: get-in update-in
14:25amalloywaxrose: worried nobody will buy it so you're just throwing it on the floor?
14:26TimMc:-P
14:26waxroseamalloy, No one will, I'm more worried about people actually touching the book and tearing pages, dropping coffee on it, letting their kids spit food on it. So forth.
14:26TimMcgrimy little paws
14:26waxrosegremlins >.>
14:27waxroselol
14:27waxrosehappens
14:28waxroseI work in the Cafe' but people will grab TONS of books, good quality/just released, and stack them high then just leave them.
14:28waxrosethey get all torn up
14:28waxroseThat is why I always get the books before they go on the floor.
14:30tomojTimMc: pipeline?
14:31TimMctomoj: https://github.com/timmc/feedback
14:31TimMcIt's a behavioral simulator utility for sequential logic circuits.
14:32TimMcVery basic, you just throw in your logic blocks, their connections, and the initial values of the registers, and then you can step it forward repeatedly.
14:32waxroseTimMc, Are you on spring break yet?
14:32TimMcwaxrose: Already past.
14:33waxroseAww, I just started mine. I plan on reading 4 books in that time. Cancun is for losers!
14:33waxrosej/k :)
14:33TimMcHaha, I spent my whole spring break on the couch writing Clojure. :-)
14:33TimMcNo regrets.
14:34waxroselol I want to finish ansi common lisp, javascript book, reread sicp, and practical/programming clojure
14:35waxroselet the slackers have their fun, I'm pre-paring for Clojure Conj
14:37TimMcHmm, reading http://www.infoq.com/articles/in-depth-look-clojure-collections (JoC chapter 5) I see a note that vectors are often used as stacks. Seems wrong to me. Wouldn't lists be better?
14:38tomojTimMc: cool
14:39amalloyTimMc: depends which end you want
14:40amalloyand if you were using it purely 100% as a stack it wouldn't matter, but sometimes you might want to treat it as a stack most of the time, but sometimes do random peeks
14:42amalloy&((juxt peek pop) [1 2 3])
14:42sexpbot⟹ [3 [1 2]]
14:42TimMcOh hey, didn't know about peek and pop.
14:43TimMcI think I have some stack code that needs those.
14:44amalloyTimMc: peek and pop are last and butlast, except that they're not crazy-slow and only work on vectors
14:44amalloyor...##(peek '(1 2 3))
14:44sexpbot⟹ 1
14:44amalloyokay they work on whichever end is most convenient. nice
14:45TimMcThere's no push. :-(
14:45amalloyTimMc: conj
14:45TimMcI mean, conj works, but...
14:45amalloyTimMc: if you want some help i can write (def push conj) for you
14:47raekspeaking about stacks... is there any fn for getting a seq of a stack in "pop order"?
14:47amalloyraek: rseq?
14:48amalloy$findfn [1 2 3 4] [4 3 2 1]
14:48sexpbot[clojure.core/rseq clojure.core/reverse]
14:48TimMcamalloy: But it's not symmetrical for lists.
14:48raekI was thinking about one that is data structure independent
14:48amalloyah, i see
14:49amalloybest you can do is probably a custom multimethod
14:50raekI was thinking 'bout (defn stack-seq [coll] (lazy-seq (when (seq coll) (cons (peek coll) (stack-seq (pop coll))))))
14:51raekwould be nice to have something like iterate, but with a predicate for when to stop
14:53amalloyraek: isn't that just (take-while (complement pred) (iterate f n))?
14:54tsdhHi. Is there a way to make private functions accessible in the test namespace?
14:55raekok, I left out an important detail. I don't want the pred to look at a value produced by iterate, I want iterate to use it do determine if there are any more values
14:56amalloyraek: that sounds more like unfold
14:57amalloytsdh: a good wall hack is to access the var objects directly: (#'myns/private-fn args)
14:57raekamalloy: what does unfold do?
14:57amalloyraek: https://gist.github.com/805583
14:57tsdhamalloy: Ah, great
14:58raekamalloy: yes. that's exactly it.
14:58raekwhich languages does it exist in? haskell?
14:58amalloyyeah
14:58amalloyand others, presumably
14:58TimMctsdh: There's a snippet of code that will refer *all* private vars...
14:59TimMctsdh: https://groups.google.com/group/clojure/msg/66f15396411e49e9
15:00amalloyraek: and apparently F# has it
15:01TimMcamalloy: Yay! https://github.com/timmc/CS4300-HW3/blob/master/src/timmcHW3/history.clj#L58
15:01amalloyheh
15:02tsdhTimMc: Oh, that's nice.
15:02amalloyoh noes, your undo buffer is linear, not a tree
15:02TimMcamalloy: Just wait until my program's state history is backed by git. :-P
15:02raek(def stack-seq (partial unfold (juxt peek pop) empty?))
15:03amalloyoh nice
15:04raekI wonder how a tree-based (or DAG-based?) history navigation would look like in a web browser
15:04amalloy$google time travel with vim
15:04sexpbotFirst out of 39300 results is: qBang Solutions Blog - Travel Back Vim Time
15:04sexpbothttp://blog.qbangsolutions.com/travel-back-vim-time/
15:04amalloyman. google never finds what i want
15:04raekI mean, it makes sense that if you press the back button and then follow some links, you get a branch in the history tree
15:06amalloyraek: repurpose the dropdown-ish thing on the Forward button to "slide" sideways in the tree
15:07raekamalloy: yeah, that'd be cool.
15:07raekI wonder what "the dropdown-ish thing" should look like
15:07amalloywhat do you mean?
15:08raekyou were thinking about a menu where each item represents a branch?
15:08amalloyyeah
15:08amalloyit's already the case that you get a dropdown when you rightclick the forward button
15:09amalloythe entries in it are just fairly useless
15:09raekah, so instead of squeezing those "old" entries into each item, you simply have something else there...
15:09amalloyright
15:09TimMcThe back button dropdown (as it currenty stands) is quite useful for badly-behaved web pages.
15:10amalloyTimMc: indeed
15:10amalloybut not the forward dropdown
15:10raekI'm currently implementing a client for the Gopher protocol
15:10TimMcHowever, the browser should handle that by not allowing redirects until after a timeout from hitting the back button.
15:10raekmaybe I could experiment with this in that project
15:10raekTimMc: agreed
15:11TimMcI guess you don't have that problem in Gopher.
15:12raekexactly :)
15:12TimMcraek: Alt-tab provides an interesting template, where holding down Alt gives you a list of windows to scroll through with tab.
15:13TimMcImagine Alt+[up,down,left,right] to navigate a horizontal tree. (grows to the right)
15:13amalloyTimMc: sounds good to me
15:13amalloyalt+left/right already do that
15:14TimMcNow, there might be some dissonance with the tree-structured directories the user is browsing... hmm.
15:14amalloywut?
15:15TimMcDoesn't Gopher provide a tree-structured view?
15:15raekconventionally, yes
15:15raekbut each directory item is allowed to point to any other directory
15:16TimMcOK, that's what I thought.
15:16TimMcIt has symlinks. :-)
15:16raekbut the directories of a gopher server are most often organized in a hierarchial manner
15:16amalloyoh we're talking about gopher now. i don't know anything about gopher :P
15:16raekit's a very small protocol
15:17ekoontzsigh.. (difference '(a b) '(b c))
15:17raekafter reading the wikipedia article, you know enough to implement it
15:17ekoontzhow do i do it in clojure?
15:18TimMc,(difference (set '(a b)) (set '(b c)))
15:18clojurebotjava.lang.Exception: Unable to resolve symbol: difference in this context
15:18TimMc,(clojure.set/difference (set '(a b)) (set '(b c)))
15:18clojurebot#{a}
15:18ekoontzThanks a ton TimMc :)
15:18TimMcekoontz: Oh, and '#{a b c}
15:18ekoontzi love the clojurebot too
15:18TimMc,#{'a 1 'c}
15:18ekoontzdidn't know about that
15:18clojurebot#{1 a c}
15:18ekoontz,(list 4 5 6)
15:18clojurebot(4 5 6)
15:19ekoontz,(clojure.set/difference (set '(a b)) (set '(b c)))
15:19clojurebot#{a}
15:19Geisteskrankh,+
15:19clojurebot#<core$_PLUS_ clojure.core$_PLUS_@15ee9d9>
15:20TimMcekoontz: Just make sure you (:require ...) or (:use ...) clojure.set in your code -- it is available by default only in some environments.
15:20ekoontz,(clojure.set/difference '#(a b) (set '(b c)))
15:20clojurebotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IPersistentSet
15:20TimMcekoontz: Braces, not parens.
15:20amalloyekoontz: #{a b}, not #(a b)
15:20ekoontzthanks TimMc yeah
15:20ekoontz,(clojure.set/difference '#{a b} (set '(b c)))
15:20clojurebot#{a}
15:20ekoontzcool
15:21TimMcekoontz: I also highly recommend the ClojureDocs site: http://clojuredocs.org/clojure_core/clojure.set/difference
15:22ekoontzthanks TimMc; good reference, better than what i was using (google) :)
15:22amalloythere's also sexpbot's findfn:
15:22amalloy$findfn '#{a b} '#{b c} '#{a}
15:22sexpbot[clojure.set/difference]
15:22TimMcThe search function has some trouble with hyphens, but other than that it it great.
15:23amalloynot so useful here cause what you didn't know about was sets, but for later
15:23TimMcs​/it it/it is/
15:24ekoontzyeah clojure is a little more type-strict than common lisp
15:24ekoontzso that takes some getting used to
15:25TimMcekoontz: WHen you work in the realm of sequences and collections, it usually doesn't matter, though.
15:25TimMcYou only have to drop down to set for set operations, for instance.
15:25amalloyekoontz: it's not *just* strictness, fortunately. if you tell clojure something is a set rather than a list, it does all kinds of handy things for you
15:26ekoontzi like the key value pairs..
15:26ekoontz{:foo 42 :bar 99}
15:26amalloy&(let [s #{1 2 4 8}] (filter s (range 10)))
15:26sexpbot⟹ (1 2 4 8)
15:56amalloyseriously? firefox has a history-tree extension, but i can't find one for chrome
15:56waxroselol
15:56waxroseDid you check their app mall?
15:57amalloymaybe? i haven't been using chrome for long
15:57waxroseBtw, Fx 4 beta 13 pre is great.
15:57waxroseMuch smaller interface.
15:58waxroseamalloy, https://chrome.google.com/webstore?hl=en-US ?
15:59amalloywell, i found an Asteroids extension. i guess that's cool
16:00waxroseThe beta Fx looks similiar to chromium but I think if you compile it, it's so much quicker.
16:00User`hm how are protocols invoked
16:01amalloyUser`: like normal functions
16:02raekUser`: how you invoke its methods, or how they are implemented?
16:02User`I mean
16:02User`if I have protocol that have fn called foo
16:02User`and then call (foo x)
16:03User`how is this different than a normal fn
16:03User`I don't understand the concept
16:04raekUser`: the protocoll does not specify what code gets executed when you call it
16:04User`I know
16:05User`but if I implement a protocol
16:05User`how is that different from writing those same fns without being a part of protocol implementation
16:06User`they do the same thing
16:06amalloyUser`: it's a lot like interfaces in java
16:06raekthe code that uses the protocol does not have to know what implementation is used
16:08raekso, lets assume the clojure stack functions are protocol functions: (defprotocol Stack (conj [coll value]) (peek [coll]) (pop [coll]))
16:08joodieUser`: protocols can have multiple implementations, and which implementation is called depends on the *arguments* provided to the call.
16:08waxroseamalloy, I don't know what type of system you are running but I literally just pushed this for Fx just in case you get annoyed with Chrome. https://github.com/waxrosecabal/install_scripts/blob/master/build_fx.sh
16:08User`ok, how that different from multimethod that dispatches on class of first parameter
16:09amalloyUser`: it's conceptually the same
16:09amalloybut jvm can optimize protocols better
16:09User`so if I define a protocol that has a fn with same name as existing fn what happens?
16:10raekif the fn is in your namespace, it will be overwritten
16:10amalloyUser`: namespacing takes care of it
16:10raekif the fn is some unrelated namespace, then there is no collision
16:11User`so if I make protocol with fn named first then with call (first x) I dispatch on the class of x
16:11raekif the fn is in some namespace that you have use'd, then you get a warning and the name will from there on point to your protocol function
16:11raekUser`: yes
16:11User`what happens when nothing implements a protocol for that type
16:11raekyou get an exception
16:12raekstuart halloway explains protocols and how they differ from multimethods in this video: http://vimeo.com/11236603
16:12raekalso, protocols group functions together.
16:12User`how does clojure find all implementations floating around? by normal symbol lookup in the current context?
16:13raekthe code that implements it has to use the protocol var (and changes something in it, iirc)
16:13raek,(do (defprotocol P) P)
16:13clojurebotDENIED
16:13raek&(do (defprotocol P) P)
16:13sexpbot⟹ {:on-interface sandbox7565.P, :on sandbox7565.P, :sigs {}, :var #'sandbox7565/P, :method-map {}, :method-builders {}}
16:13User`ok, what does reify do then?
16:14raekit's like a one-off deftype
16:14raekit creates an object that implements the given protcolols with the given method implementations
16:14raekmuch like 'proxy' does for java interfaces
16:14joodieah, that's good to know. haven't spend enough time looking through the protocol docs.
16:15User`so reify returned object also has data fields or something?
16:16raekit can close over local variables, but does not have explicit fields, like deftype and defrecord
16:16joodieprotocols only specify methods, AFAIK. if you want to store date, use closures
16:16joodiefrom the docs @ http://clojure.org/protocols:
16:16joodie(foo
16:16joodie (let [x 42]
16:16joodie (reify P
16:16joodie (foo [this] 17)
16:16joodie (bar-me [this] x)
16:16joodie (bar-me [this y] x))))
16:17raek(defprotocol Pair (the-one [x]) (the-other [x])) (let [x 1, y 2] (reify Pair (the-one [_] x) (the-other [_] y)))
16:18User`but this object created by reify, I can't see what's its dispatch
16:19User`when does a call to the-one dispatch to this implementation, returned by reify
16:19raekit's an object of a new unique type
16:20raekUser`: (def p (reify Pair ...)) HERE --> (the-one p)
16:20User`so unlike other protocol implementations, this can pretty much never be a target for dispatch unless you are calling the fn on this exact object
16:21raekyes, it's an implementation unique to that object
16:21joodieUser`: but that's what dispatch IS. !?
16:21User`:D
16:22User`I get it, it's basically an anonymous interface implementation
16:22raekcgrand uses protocols very beautifully: http://vrac.cgrand.net/DSL.pdf
16:22raekUser`: exactly
16:23angermanso {:keys […], :or {…}} does not make the arity 0?
16:26angermanok, I failed to get this right. sorry
16:44zoldaris there a way to make "(read)" act as expected in SLIME?
17:11Somelauwclojurebot (Math/min 5 Double/POSITIVE_INFINITY)
17:11SomelauwOr what is the bot called again?
17:12zoldar,(Math/min 5 Double/POSITIVE_INFINITY)
17:12raekSomelauw: clojurebot evals utterances beginning with a comma
17:12amalloySomelauw: prefix your command with , or &
17:12raekand sexpbot those with a &
17:12Somelauw, (Math/min 5 Double/POSITIVE_INFINITY)
17:12Somelauwclojurebot, (Math/min 5 Double/POSITIVE_INFINITY)
17:12amalloyclojurebot isn't here now apparently
17:12Somelauw& (Math/min 5 Double/POSITIVE_INFINITY)
17:12sexpbotjava.lang.IllegalArgumentException: No matching method found: min
17:12SomelauwYes, that was the thing that confused. Why that error?
17:12SomelauwSince
17:13Somelauw& (Math/min 5 6)
17:13sexpbot⟹ 5
17:13SomelauwSo what is wrong with infinity?
17:13amalloySomelauw: nothing is, you're just mixing types
17:13Somelauw& (Math/min 5.0 Double/POSITIVE_INFINITY)
17:13sexpbot⟹ 5.0
17:14SomelauwI thought java was able to implicitely cast ints to floats.
17:15Somelauw& (Math/min 3.5 Double/POSITIVE_INFINITY)
17:15sexpbot⟹ 3.5
17:16joodie& (Math/min 1 1.5)
17:16sexpbotjava.lang.IllegalArgumentException: No matching method found: min
17:16amalloydoes paredit have a command to turn a (f b c) into (f a b c)?
17:20joodieamalloy: don't think so. it's quite a specific modification
17:21amalloyjoodie: it seems like it would be useful more often than the current backwards-slurp, which gives you (a f b c)
17:21amalloysince f is already "known" to be a function
17:21joodieamalloy: hmmm... maybe
17:21joodieI tend to use M-s a lot as it is.
17:22joodieand I'd rather have a command to turn (a (b c d)) into (a c d)
17:22amalloynot sure how M-s is useful in this context
17:22amalloyjoodie: you already have that command
17:23amalloyput point before c, and M-<UP>
17:23joodieoooh
17:23joodiethanks
17:24amalloywelcome
17:26joodiedoesn't emacs have some sort of "swap words" command that might work correctly in lisp modes?
17:26joodiethen you could just slurp in the a and then swap f and a
17:27amalloyjoodie: yeah, #emacs just came up with that as well
17:27hiredmanclojurebot: ping?
17:28clojurebotPONG!
17:28hiredmantesting indexing
17:28joodiewell, maybe you'll just have to define you own keybinding to do both commands. :)
17:28hiredman~search for testing
17:28clojurebot#<HttpHostConnectException org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:9200 refused>
17:28joodieit's emacs, you
17:28joodie're SUPPOSED to make it incomprehensible to other users :)
17:30amalloyjoodie: i'll just rebind C-M-<LEFT> and damn anyone who expects it to do this crazy thing it currently does
17:37SomelauwIs emacs the most popular editor for clojure?
17:37SomelauwSince it seems to be very popular for lisplike languages for some reason.
17:38joodiedunno if it's the most popular, but emacs traditionally has very good lisp integration. SLIME is pretty good (if you get it configured just right)
17:39Chousukeit's also written in a dialect of lisp, which probably has something to do with its popularity in lisp circles.
17:39joodieand of course, being able to extend the editor in a lisp helps :)
17:39raekit has a tradition of interactive development
17:39hiredman~search for indexing
17:39clojurebot<#clojurebot:hiredman> indexing test
17:39User`I develop in emacs because that's what clojurebox uses
17:39User`I tried eclipse plugins
17:39hiredman~search for emacs
17:39clojurebot<#clojure:User`> I develop in emacs because that's what clojurebox uses
17:39clojurebot<#clojure:joodie> dunno if it's the most popular, but emacs traditionally has very good lisp integration. SLIME is pretty good (if you get it configured just right)
17:39User`but they didn't work at all
17:40User`no autocomplete
17:40waxroseI think it keeps you thinking about lisp when you can extend lisp emacs.
17:40waxrosein*
17:41waxroseinstead of your mind wandering off to some thing else
17:41joodieI use emacs mostly because I use it for everything else too. it's very versatile and it doesn't give you a load of gui crap to distract you.
17:41waxroseI build Emacs from source every night. :/
17:41raekdoes anyone know how to make slime print the evaluated result in the repl instead of the minibuffer when pressing C-M-x?
17:43raekanyway, interactive development in Clojure was the reason I started to use emacs :)
17:43raeknow I use it for everything
17:44hiredmanso just an fyi clojurebot is indexing #clojure now
17:44raekwell, not like RMS
17:44amalloySomelauw: emacs is built in lisp, for lisp. the language integration is incredible
17:44amalloynot having to rely on the mouse is pretty awesome too once you get the hang of it
17:45waxroseraek, I started using Emacs mostly out of spite for my UNIX 101 teacher who was a vim fan boy.
17:45amalloyhaha
17:45SomelauwI can already live without mouse.
17:45joodieraek: you can redefine the slime-message function to print somewhere else.
17:45SomelauwSince I am a vim user.
17:46waxroseInstall StumpWm then you have a Hands free, lisp built window manager.
17:46chouserhiredman: indexing?
17:46hiredmanwrites to elasticsearch
17:46joodiebut it would take a bit more than that to get it to work right
17:46amalloymy first CS teacher introduced us to a bit of unix while he was teaching java. "And for editing text files there's VIM. VIM is an acronym: it stands for "sucks""
17:46SomelauwBut since few lisp programmers seem to use vim, I was wondering if emacs might be better for that specific language.
17:46waxroseamalloy, hahahahahahahahahhaha!
17:47hiredman~search for sender:chouser
17:47clojurebot<#clojure:chouser> hiredman: indexing?
17:47waxroseSomelauw, Use what you feel most comfortable with.
17:47amalloyhiredman: looks nice
17:48amalloyi imagine pretty soon the indexes will be getting large: i assume you have some scheme to make him output only the N "best" matches?
17:48joodiewaxrose: for tabbed WMs, I prefer i3 at the moment.
17:48hiredmanresults are sorted by timestamp descending, and you an page through them with something like [n] where n is the page number, four results per page
17:48hiredmanyou can page
17:49waxrosejoodie, I'm actually using dwm now since StumpWm annoys me too much.
17:49waxroseWould be nice to have a clojure wm.
17:49SomelauwIs StumpWm the same as Awesome but then with lisp?
17:49hiredmanwould need a java xlib binding
17:49waxroseSomelauw, It's the same as Ratpoison built in lisp.
17:51joodieI really don't care about hacking wms, I just run emacs on one screen and the rest on the other. All I need is multi-screen support and as much keyboard actions as possible.
17:51joodieso i3 is perfect for me.
17:52SomelauwI would think that a webbrowser that completely ignores the mouse you probably can't even use firefox or openoffice.
17:52SomelauwI would think that a window manager that completely ignores the mouse you probably can't even use firefox or openoffice.
17:52waxroseI get easily distracted so I try to keep every thing oriented in the same environment.
17:52amalloySomelauw: i went without a mouse for a month recently
17:53amalloyit's not that hard
17:53joodieI should try that
17:53waxroseIt doesn't ignore the mouse, you can use it if you want.
17:53amalloyi set up the numpad to emulate the mouse for the really mouse-only programs, but firefox is not one of the ones that needed it
17:53SomelauwI like to work without touching the mouse but my webbrowser frequently requires me to.
17:54joodiemy main "keep everything the consistent" action was to configure alt/meta/super to work the same on my macbook and my linux desktop
17:54hiredmana few guys at work use http://conkeror.org/
17:54amalloySomelauw: tab+enter to click on links. for pages with too many links to conveniently tab through, C-f <link text> ESC RET
17:54waxroseThat is the benefit of Tiling Window Manager....... you can have emacs and firefox next to each other and you can use your keyboard to switch between the two.
17:55waxrosevery fast
17:56waxrosejoodie, That looks like a vim keyboard.
17:56joodieit works amazingly well with emacs too :)
17:56amalloyjoodie: blurg. i'm willing to accept spending some horizontal space to make it easy to type numbers
17:56joodieI just don't want to have to reach for a mouse when I need one
17:57joodieand number typing on the top row is easily learned
17:57zoldarjoodie, nice - I own a filco tenkeyless, but I'm not that great at touch typing to go with blanks ;)
17:58joodiezoldar, ooh good one. I've been meaning to try those.
17:58amalloyjoodie: i used the top row for a long time, and i can do it if i have to, but to type longish numbers i'd rather not
17:58joodieI've been touch typing for ages now. years ago some coworker swapped all the keys on my work machine. I didn't even notice it.
17:59amalloyyeah, as long as you have JF indexed you're all set. my keyboardis under the desk; i can't even see the keys
18:01fbru02,(doc letfn)
18:01clojurebot"([fnspecs & body]); Takes a vector of function specs and a body, and generates a set of bindings of functions to their names. All of the names are available in all of the definitions of the functions, as well as the body. fnspec ==> (fname [params*] exprs) or (fname ([params*] exprs)+)"
18:06rata_does anyone know about something like regex for sequences in general? something like "I want everything in this seq from the beginning until I find a @ symbol/string followed by two numbers"
18:06technomancyhiredman: ISTR finding a java xlib binding once upon a time
18:06amalloyrata_: fnparse
18:06technomancyI'm not patient enough to write a WM though
18:07rata_amalloy: mmm you're right
18:08rata_didn't think about it
18:10amalloy(rep* (not-followed-by (lit-conc-seq ['@])) anything) looks like a good start
18:33User`,(doc rep*)
18:33clojurebotIt's greek to me.
18:33amalloyUser`: fnparse
18:36User`rata_: how about (take-while (fn [x] (not (re-find #"@\d\d" x))) sequenc)
18:36clojurebot2009:Jan:29:16:03:17 <hiredman> I call Xiphojura
18:36rata_User`: that's for strings, not seqs
18:37User`I thought you wanted to take all elements until you find a certain string
18:38amalloyUser`: rata_ is trying to generalize regexps to non-strings
18:38amalloyby the way, cgrand also has a neat regex library, i think
18:39rata_yes, but it compiles to j.l.Regex
18:39amalloysure
18:39amalloynot what you're looking for, but possibly relevant
18:40rata_amalloy: fnparse is probably what I want, but I'll think first of a simpler approach
18:40User`,(doc fnparse)
18:40clojurebotHuh?
18:40amalloy$google fnparse
18:40sexpbotFirst out of 247 results is: joshua-choi/fnparse - GitHub
18:40sexpbothttps://github.com/joshua-choi/fnparse
18:42User`interesting
18:43amalloyUser`: i recently used fnparse for the first time: you can see how easy it is at https://github.com/amalloy/claudius/blob/master/src/claudius/core.clj
18:47amalloya few data pairs and five lines of parser logic, and it can read roman numerals
18:52User`hm interesting
18:52User`say...why do you have tokens (x, m etc) as quoted symbols instead of just putting them in " " ?
18:53joodieUser`: in clojure in general?
18:54joodiebecause strings are just lists of characters, while symbols and lists etc are objects in their own right
18:54joodieit's tied to the read/eval stage of interpretation/compilation.
18:55amalloyjoodie: i think he means my code
18:55amalloyUser`: i just didn't want to type "" over and over
18:55amalloyso i put them in a quoted list and then mapped (str) over them to turn them into strings
18:56User`ah convenience then
18:56amalloyyeah
18:56amalloyplus it arguably makes the pair-definitions more readable
18:57User`that's cool... I'll have to really get into this to make a parser for something like a special configuration files
18:57amalloyUser`: better still, don't use special configuration files :)
18:57Somelauwmaybe make clojure compile to native machinecode
18:58amalloyjust make your configuration file a .clj file you can read or load, and tada, you have a map
18:58hiredmanjoodie: Strings are not just lists of characters
18:59hiredman,(->> (class "foo") .getMethods (map #(.getName %)))
18:59clojurebot("hashCode" "compareTo" "compareTo" "indexOf" "indexOf" "indexOf" "indexOf" "equals" "toString" "length" ...)
19:00joodieyeah sure.
19:00joodieclojure strings are java strings, with random access reads.
19:00hiredmanjoodie: and what you said is bogus anyway "because strings are just lists of characters" but then "symbols and lists are objects in their own right"
19:01hiredmanif a list is an object, and an object is good, a list of charactes is no less of an object and no less good
19:02joodieI was talking about the reader. I'm sorry if I didn't make myself clearer, but there's only so many words for sequences and structures.
19:03SomelauwMaybe you can create java from clojure and use gnu to compile the java to machine code.
19:03hiredmanthe reads strings as Strings, infact it reads them using a StringBuilder
19:03joodieIOW, the difference between "(a b c)" and '(a b c)
19:03Somelauwstring and quoted list
19:03amalloySomelauw: gcj is woefully useless
19:05joodieAnd I didn't want to imply that string are somehow worse than other data types. Just that in lisps, code is not usually thought of as text.
19:11User`people told me to use Ring for webapps instead of servlets...then why does ring have servlet module?
19:11Somelauwwhy is it useless
19:11joodieUser`: because then you can use ring in a standard java web server.
19:12User`I thought Ring WAS the server
19:12brehautUser`: ring is firstly an interface
19:12joodiering is not a server. it's an abstraction on http request/response
19:12brehautUser`: secondly a set of adapters to existing servers
19:13brehautand thirdly a set of standard tools for working with http and surrounding ecosystem
19:13User`but according to tutorials it seems that it works just fine in combination with jetty even without this servlet package
19:14joodiebasically, a ring-based system should be portable to most web servers - even ones that don't implement the servlet API.
19:15joodiesee ring-jetty-adapter vs ring-servlet
19:15brehautUser`: it does
19:15User`so the servlet package is for Ring to appear as servlet to webserver, not for my app to be a servlet
19:15brehautUser`: but if you want to AOT compile a ring app to be hosted as a WAR in a servlet container
19:16User`do I have to do any gen-class stuff in my own code to have it AOT compile
19:16User`being able to make a WAR appeals to me tremendously
19:16brehauti think how it is AOT compiled varies on your project/build tool
19:18User`what I'm asking in essence is: do I have to gen-class which extends Servlet or does the ring do that
19:18brehauti am quite content with an embeded jetty so ive never gone looking
19:18User`ok
19:18technomancymake love, not war.
19:18joodiesame here.
19:18User`war has the advantage that you can use paid hosting and send them war updates
19:19joodiebut I think that ring-servlet takes care of most of the glue.
19:19User`i'm using leiningen for build tool and to do any AOT
19:19TimMctechnomancy: Do you suppose there's a WAR-file generator called "love"? Or perhaps instead a competing format?
19:19User`maybe "peace"
19:20User`War and Peace by Dostojevski :P
19:20User`or did I screw that one up :D
19:20brehautUser`: by digging through https://github.com/mmcgrana/ring/blob/master/ring-servlet/src/ring/util/servlet.clj briefly, i dont believe the servlet util does any AOT itself; it uses a proxy to create an HttpServlet instance
19:21User`crap, so AOT doesn't work at all?
19:21technomancyTimMc: there better be
19:21brehautUser`: i didnt say that, only that the servlet utils dont do any themselves
19:22User`WAR will require that there is some kind of class that extends servlet in there also with appropriate web.xml deployment descriptor
19:22brehautUser`: go nuts: https://github.com/alienscience/leiningen-war
19:23User`:D I'm not that skilled yet, to be writing my own libraries
19:24brehautmy bad, that link itself suggests https://github.com/weavejester/lein-ring
19:25TimMcUser`: Writing what libraries?
19:25ieureUser`, brehaut, Having _just_ gone through both lein-war and lein-ring, use lein-ring.
19:26ieureIt rules. Lein-war brings nothing to the table.
19:26brehautUser`: there is an associated blog http://weavejester.com/getting-started-with-lein-ring
19:26ieureLein-ring made ma a WAR file that I successfully deployed to EC2 with Elastic Beanstalk. I came in my pants a little.
19:26brehauti didnt need to know that
19:27User`lein-ring dev-dep just downloaded whole Ring
19:27ieureI also came in brehaut’s pants.
19:27User`do I have to put it under dependecies of a project too?
19:27ieureUser`, No.
19:27User`or at least the stuff it downloads?
19:27User`the Ring stuff?
19:27ieureNo.
19:28brehautUser`: weavejesters tutorial has ring/ring-core in deps and lein-ring in dev-deps
19:28ieureI had [ring/ring-jetty-adapter "0.3.5"] in the main deps, but I think that Compojure pulls all that stuff in.
19:28User`I currently have some parts of ring in my deps, do I need that?
19:28brehautUser`: I would think you do
19:29User`I am asking that because if lein-ring packs the war from its Ring libs it downloaded under development deps folder, then I don't need them under dependencies?
19:29User`Maybe?
19:30TimMcieure: I remembered having pointed someone towards leiningen-war the other day, so I grepped my logs to see who I should poke about lein-ring... and it was you!
19:30brehauttechnomancy can probably clarify but you dev dependancies dont get packed into your .?ar files
19:30User`I know they usually don't
19:30brehautthey only exist in your dev enviroment
19:30ieureTimMc, Indeed. I was much more impressed with lein-ring, which worked out of the box, first time, no extra work necessary.
19:30User`but if you have a special lein job, it's probably possible
19:30ieureIt also has a dev server which is very slick.
19:31TimMcieure: Ah, nice.
19:31ieureNot having attempted to hack on Clojure webapps in a while, I’m _really_ pleased with how far things have come.
19:32User`hm....
19:33User`why am I having multiple versions of some jars in my dev lib folder?
19:33User`I have clojure 1.1 and clojure 1.2
19:33seancorfielddo: lein clean, deps
19:33seancorfieldsee what's left after that
19:34User`same
19:34User`no change
19:34seancorfieldmaybe stuff you're depending on has different clojure dependencies?
19:34User`possibly
19:36User`http://pastebin.com/AKmvJyvv
19:37User`here's my configuration and contents of my dev libs folder
19:37brehautUser`: enlive is at 1.0.0 now
19:38User`how do I update that
19:38brehautdrop -SNAPSHOT from the version string in your project.clj
19:38brehautand then lein deps
19:38brehaut(although any lein command mgiht trigger it if its sees it has changed
19:40User`but now I have 2 jars lol
19:40wtetznerlein clean; lein deps
19:41User`lein clean does nothing it seems
19:41User`never deletes anything
19:41User`screw it I'll delete the folders
19:42wtetznerrm -rf lib; lein deps
19:42seancorfieldlein clean always clears my lib folder... wonder why it doesn't do it for you?
19:42User`no idea
19:43User`but deleting the folder then rerunning deps worked
19:43brehautlein version ?
19:43User`it didn't even download the jars
19:43User`I wonder where it got them lol
19:43brehautif they are in your ~/.m2 cache it wont
19:43wtetzner~/.m2/repository
19:43clojurebotexcusez-moi
19:43seancorfieldhmm, you know, now i just tried lein clean on a project, it didn't empty lib
19:44brehautmaybe tis just a placebo command now
19:44danieljompheI don't think clean would do that, although it would definitely delete compiled files (target)
19:44seancorfieldit does remove the classes folder tho'
19:44User`right :)
19:45seancorfieldso... rm -rf lib; lein deps :)
19:45danieljomphesometimes it's useful to rm -rf the libs to get rid of multiple old versions of a lib
19:47danieljompheoh, I believe I was wrong; I just tried and it appears lib is deleted
19:52danieljompheso if it's not deleted for you, it may be that you have something open that locks one of the files in lib?
19:54TimMcOn Linux, that shouldn't result in the file still being accessible -- it should appear to be deleted.
19:57technomancydeps deletes the jars from lib before proceeding, so having clean do it is redundant
19:59danieljompheoh that's right, I was not running 'lein clean' to test re: this discussion, I was erroneously running 'lein deps'! Looks like I need some rest :)
21:34brundlenewbie question http://pastebin.com/7Fj9dY6y
21:36brundlespecifically I want to know if I can avoid the flatten->partition steps
21:38zakwilsonHow does the overhead on Clojure maps compare to say... Java hashtables?
21:38zakwilson(size, not speed, to clarify)
21:53ysphi'm thinking of writing a dsl for parsing binary data formats, i'm unsure that what i'm doing is worthwhile, does this look insane? https://gist.github.com/867824
21:53tomojysph: seen gloss yet?
21:53ysphno
21:54tomojhttps://github.com/ztellman/gloss not sure if it will match your needs
21:54ysphbut i'm glad that you've pointed it out to me
21:54tomojdocumentation is pretty bare still it seems
21:54tomojoh, the introduction in the wiki isn't bad
21:55Chousukeysph: in general I think you should avoid using lists in DSLs unless the expressions actually get evaluated as code.
21:55ysphthe let and the for in that example would be evaluated
21:56ChousukeI mean the (5 bits) thing
21:56ysphah, good point
21:56tomojbrundle: one way is (mapcat (juxt identity reverse) x)
21:56ysphi was thinking of that as a shortcut for (repeat 5 bits)
21:57Chousukeyou could just make a bits function
21:57Chousukeand have (bits 5)
21:57ysphprobably
21:57Chousukeit's backwards but that's not too bad
21:57ysphanyhow, i'll check out gloss
21:57ysphthanks for the feedback
21:57tomojgloss won't like 5 bits unless there are 3 after it
21:58tomojbytes can be split but not across frames afaik
21:58ysphi do need something that can handle arbitrary splits
21:58tomoji.e. you can't read 5 bits and then start reading the rest as if they were bytes
21:59ysphin this case, what's read for the rest is determined by the value contained within the first five bits
21:59tomojI _think_ trying to do that with gloss will probably be harder than writing your own
22:00ysphhence the (:nbits bits), to indicate substituting :nbits with the value previously read
22:04tomojbrundle: also (interleave x (map reverse x))
22:05brundletomoj - thank you very much
22:25nickikHow can it be that when I use lein run it takes about 200ms but when I use an uberjar it takes 750ms?
22:26tomojneat key?
22:27nickik?
22:27tomojnevermind
22:27tomojyour nick happens to look like it means something
22:28tomojwith lein run, maybe it only loads the jars when needed? while with the uberjar, it has to load everything at startup? guessing.
22:29nickikIt looks like my name is nick and the first time I had to choise a nickname "nick" was already used I just an other "ik"
22:30nickiktomoj, I only use clojure nothing else in this example.
22:30tomojno contrib? no idea then.
22:31nickikI going to try with a normal jar.
22:49nickikIsn't there a generic way to make "6" --> 6? I remember somebody asking about that a while ago. You can do it with Intager/parseInt but what if you get a other numbertype?
22:52TimMcnickik: I guess you could use read-string if you were certain it was safe numeric input.
22:52TimMcBut that's quite a sledgehammer.
22:55nickikmmhh true. I think it was something else. I have to search the logs. Im doing benchmarks so it does not matter. Thx for the tip.
23:05amalloyafaik you have to choose between the sledgehammer and the chopsticks here - clojure doesn't have a lot of in-between ways to parse integers
23:08amalloyi'm not sure you have to be certain it's safe numeric input, though. call read-string and check number?
23:09amalloydisable read-eval if it would be a problem for the user to eval arbitrary code in your app; if they're only hurting themselves, don't worry about it
23:20amalloy&(doc sync)
23:20sexpbot⟹ "Macro ([flags-ignored-for-now & body]); transaction-flags => TBD, pass nil for now Runs the exprs (in an implicit do) in a transaction that encompasses exprs and any nested calls. Starts a transaction if none is already running on this thread. Any uncaught exception... http://gist.github.com/867860