#clojure log - Mar 12 2011

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

1:50 amalloy: sritchie: postwalk-replace?

1:56 waxrose: greetings

1:57 brehaut: morning waxrose

1:57 waxrose: Morning brehaut . :)

2:00 sritchie_: amalloy: hey, can I ask for an example usage?

2:00 amalloy: &(use 'clojure.walk)

2:00 sexpbot: ⟹ nil

2:01 amalloy: &(postwalk-replace {4 5} {1 {2 {4 5} {8 {9 4}}}})

2:01 sexpbot: java.lang.ArrayIndexOutOfBoundsException: 3

2:01 amalloy: oops

2:01 &(postwalk-replace {4 5} {1 {2 {4 5} {8 {9 4}} 10}})

2:01 sexpbot: ⟹ {1 {2 {5 5}, {8 {9 5}} 10}}

2:02 sritchie_: hey, that's exactly what I was looking for

2:03 oh, well, almost

2:03 that swaps keys, I wanted to swap values

2:03 amalloy: it did both

2:04 i included one of each on purpose

2:04 sritchie_: ah, I see

2:05 so, the use here is replacing default values in a map with custom values -- I wanted a function that swaps out k-v pairs

2:05 let me grab what I ended up writing...

2:09 gah, I swapped it out for something simpler, in the end, and didn't check in the file with that function

2:10 in any case, I wrote something that mapped across all values in my default-config map and did the replace for each sub-map

2:11 not a general solution, but it got the job done

2:24 amalloy: sritchie_: 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

2:25 waxrose: lol

2:30 amalloy: sritchie_: have you looked at cascalog? i saw a presentation on it recently that made me weep with joy after having worked with hadoop

2:35 brehaut: cascalog looks like 6 kinds of awesome

2:38 amalloy: brehaut: 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

2:39 brehaut: ive gladly never had to write hadoop by hand

2:43 amalloy: brehaut: instead you...?

2:43 brehaut: dont use hadoop

2:46 amalloy: k. your "by hand" qualifier made me wonder

2:46 brehaut: oh sorry

2:47 * amalloy has spent months writing should-be-trivial code in java+hadoop

2:49 brehaut: ive never had to process enough data that hadoop would be a good idea

2:56 amalloy: it rarely is a *good* idea. but sometimes it is the least bad idea

3:00 brehaut: haha

3:14 sritchie_: hey, sorry, I'm back

3:14 yes!

3:14 I'm using cascalog, it's amazing

3:14 I'm working on a hadoop crate for pallet, now

3:14 the goal is to allow cascalog queries to run on distributed clusters, all controlled by pallet

3:16 amalloy: haha, and yes, good guess on the config trinity

3:21 ejackson: sritchie: that would be pretty groovy

3:23 amalloy: sritchie_: 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?

3:25 sritchie_: amalloy: you'd have to write a thrift tap for cascading, but that's about it

3:25 amalloy: oh, interesting. i think there's already one, since nmarz had his stuff defined in thrift but didn't really go into how it integrated

3:27 sritchie_: then, (?<- (stdout) [?penguin-name ?max] ((thrift-tap penguin-dir) ?penguin-name ?height) (cascalog.ops/max ?height :> ?max))

3:27 or, probably, (?<- (stdout) [?penguin-name ?max] ((thrift-tap penguin-dir) ?penguin) (penguin-attrs ?penguin :> ?name ?height) (cascalog.ops/max ?height :> ?max))

3:28 s/?penguin-name ?name

3:28 s/?penguin-name/?name

3:28 hmm, screwing that up

3:29 amalloy: the sed?

3:29 ? is a modifier

3:30 sritchie_: ah, okay

3:41 amalloy: s/\?/this

3:41 sexpbot: <amalloy> this is a modifier

3:42 amalloy: if you actually cared to make it work :P

3:43 sritchie_: s/\?penguin-name/\?name

3:43 it's been too long! and I think everyone here gets the idea :)

3:52 amalloy: *chuckle*

3:52 the s/foo/bar form only works on your most recent mesage

3:52 $sed -sritchie_ s/gets.*/wishes we would quit going on about penguins

3:52 sexpbot: <sritchie_> it's been too long! and I think everyone here wishes we would quit going on about penguins

3:53 sritchie_: sexpbot: took the words right out of my mouth

10:04 gfrlog: is there a summary somewhere of what's new in 1.3?

10:04 or does that wait till the full release?

10:05 fliebel: gfrlog: There is a changelog included in the messages about the lates alpha releases.

10:05 gfrlog: where are these messages?

10:06 fliebel: mailing list

10:06 gfrlog: okay, thanks

10:06 TimMc: fliebel: Where can I find changes from 1.1 to 1.2?

10:07 Same place?

10:07 fliebel: Don't know, but let me know when you find it.

10:07 TimMc: OK.

10:08 I'm a little alarmed to see breaking changes on minor version bumps... without a highly visible changelog.

10:09 gfrlog: I 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:10 does 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:10 fliebel: gfrlog: I think the former, but there might be some back magic to do it deep down in java land.

10:11 gfrlog: suddenly clojure is a lot less like ruby

10:11 probably a good thing ultimately :-/

10:12 fliebel: gfrlog: I hadn't the impression there was a lot of similarity?

10:12 gfrlog: there's not; but they at least both had the property that you could reach deep into somebody's code and change arbitrary things

10:13 very useful for hacking, and very scary for people who like guarantees

10:13 fliebel: gfrlog: Can you make + do * in Clojure? I mean, outside of binding, and outside of your own namespace?

10:14 gfrlog: well binding is what I was referring to

10:14 so it's diff from ruby in that it's thread-local and dynamically scoped rather than a global change

10:14 but similar capabilities and concerns

10:14 perhaps less concerns than the ruby case

10:15 in fact I think ruby is working on a new feature that would make changes like that more scoped

10:15 fliebel: gfrlog: That would be very backwards incompatible, wouldn't it?

10:16 gfrlog: fliebel: the way I stated it, yes. I doubt they're actually writing it that way

10:16 e.g., maybe add a new keyword for redeffing in a local context; dunno

10:16 if I could remember the name they gave the tactic, I could probably google it

10:17 I guess adding a new keyword is a bit backwards incompatible as well :)

10:17 is "reserved word" a legitimate definition of "keyword" or was I being confusing there?

10:18 spewn: gfrlog: Monkey patching?

10:18 gfrlog: spewn: no, that's not what I'm thinking of. I think that's just a general term for redeffing

10:18 ooh

10:18 um

10:18 refinements maybe?

10:19 $google ruby refinements

10:19 sexpbot: First out of 14100 results is: Ruby Refinements: An Overview of a New Proposed Ruby Feature

10:19 http://www.rubyinside.com/ruby-refinements-an-overview-of-a-new-proposed-ruby-feature-3978.html

10:19 gfrlog: ah hah

10:19 the example given uses a presumably new keyword "refine"

10:20 I would imagine it's okay to be backwards incompatible if it's aimed at Ruby 2.0

10:23 ApeShot: So what is the deal with lein and swank and emacs?

10:23 fliebel: I wonder what message passing would do to functional programming. Silly thought probably… You know, Smalltalk without the objects.

10:23 ApeShot: I just set up a new lein project, added the swank dependency in project.clj

10:24 and I thought that is just what I did in other projects

10:24 but lein swank doesn't work in the new project

10:24 gfrlog: fliebel: erlang?

10:24 ApeShot: The documentation on github says that I don't need a swank dependency

10:24 But it seems like I do

10:25 TimMc: lein deps?

10:25 (on the off-chance...)

10:27 ApeShot: TimMc: just tried that

10:27 TimMc: Maybe there is some problem with lein deps and local libraries? It seems to hang on trying to fetch my "utils" project

10:27 Not hang, but die

10:28 TimMc: I have a separate project for utilities, which I believe i'm supposed to put a symlink to in the checkouts directory

10:28 TimMc: Do I also need to put it in my project.clj file?

10:29 TimMc: I believe so.

10:29 ApeShot: That seems to be the problem

10:29 TimMc: Isn't checkouts there so you can do work in two projects at once?

10:29 ApeShot: I just *removed* it from project.clj, ran lein deps, and it works

10:29 TimMc: yes

10:30 I rarely work on utils by itself

10:30 It fills up as I write other projects

10:30 TimMc: OK, then you need it in project.clj

10:30 ApeShot: If I put it in there, lein deps can't run

10:30 It says it can't find the project

10:30 TimMc: I guess that narrows it down.

10:31 ApeShot: However, if I take it out, then run lein deps and start up clojure, the project can use the utils

10:31 So clojure can find the utils

10:31 But then if I try to compile the project, it says it can't find them again

10:32 How should I specify a local project linked in checkouts in the project.clj?

10:33 I'm not super java ecosystem literate

10:34 TimMc: But you have this working in other projects?

10:37 ApeShot: I can develop with swank in other projects, but not compile to a single jar

10:37 Same thing happens, it complains it can't find the dependencies corresponding to the project in checkouts

10:38 TimMc: Ah. Can't help you there, haven't used checkout-deps myself.

10:39 ApeShot: Maybe I need to build and install the utilities before doing lein deps in a project which depends on them

10:41 Oh well

10:41 I can develop, at least

10:41 I'll just cross this bridge when I need to distribute

10:42 It seems to me that project management is the most complicated part of any project

10:42 which is weird

10:43 It seems to me that project dependency information is implicit in the source code of the project

10:43 Why can't compilers just figure it all out

10:43 TimMc: heh

10:43 Versioning.

10:43 gfrlog: and write the code

10:43 ApeShot: Well, maybe the mistake is to not force programmers to indicate versioning when they include libraries

10:44 Each version is essentially a different library

10:44 You could have a central repository, or just expect libraries to be on the path somewhere

10:44 gfrlog: but that would imply you could use two versions of the same library

10:44 ApeShot: Why not?

10:45 gfrlog: cause they have identical namespaces

10:45 to make it work library authors would have to change their namespaces at each release

10:45 ApeShot: No, there namespaces are version qualified

10:45 gfrlog: now you have to change your code every time you upgrade your deps

10:45 TimMc: ApeShot: Then objects passed around in your code would have ambiguous semantics.

10:45 gfrlog: unless the compiler auto-aliases

10:46 but it can't auto-alias if you're using two versions of the same lib

10:46 TimMc: There is a package management system that allows multiversion installs, by the way.

10:46 ApeShot: How often would people realistically want to use two version of the same libary in the same context, though?

10:46 gfrlog: which you probably would be, without even knowing it

10:46 TimMc: ApeShot: Via dependencies.

10:46 gfrlog: ApeShot: not conciously

10:46 it'd happen indirectly

10:46 ApeShot: TimMc: well, you're sort of in the shit then either way

10:46 TimMc: Indeed.

10:47 gfrlog: no more libraries! All code reuses will henceforth be done inline.

10:47 ApeShot: The forth people have something to say about this

10:47 They think its best to just rewrite everything every time

10:47 gfrlog: sudo apt-get insert libxml2-dev

10:50 TimMc: ApeShot: https://secure.wikimedia.org/wikipedia/en/wiki/Nix_package_manager

10:50 ApeShot: It 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:50 Instead of sticking one's head in the sand about it

10:50 gfrlog: TimMc: what's with the https for wikipedia?

10:50 TimMc: gfrlog: That's my default.

10:50 ApeShot: Yeah, I was thinking about the Nix package manager

10:51 TimMc: ApeShot: That's what major version bumps are for.

10:51 gfrlog: TimMc: a service they have for people concerned about snooping?

10:51 ApeShot: TimMc: well, given that we spend a lot of time thinking about lib versions, maybe the current practices could stand some revision

10:51 TimMc: gfrlog: Yeah, though I have an extension that redirects me to the HTTPS version of every site it knows about.

10:52 ApeShot: I'm just miffed that Clojure apparently isn't following SemVer.

10:53 ApeShot: TimMc: SemVer?

10:53 TimMc: http://semver.org/

10:53 Semantic versioning.

10:53 Clojure should be at a 0.y.z version right now.

10:54 Alternatively, 1.1, 1.2, and 1.3 should have been called 1.0, 2.0, and 3.0.

10:56 ApeShot: TimMc: I am down with SemVer, I think

11:30 TimMc: Does Leiningen allow range dependencies?

11:34 User`: hm

11:35 what's currently popular way of making web apps in clojure?

11:38 fliebel: TimMc: It does

11:39 User`: Anything that uses Ring goes. :)

11:39 joodie: I like ring (+ some compojure stuff) for web apps. I think the Ring part is the most important.

11:39 fliebel: Moustache and Enlive are cool as well

11:40 User`: I was thinking about implementing servlet through proxy using enlive for html templating

11:40 then I would deploy the servlet on glassfish or something

11:40 fliebel: User`: There is a Ring wrapper for deploying as a servlet?

11:41 (minus the question mark)

11:41 User`: well I want the container goodies too

11:41 security and stuff

11:42 how do you generally limit access to pages user shouldn't be accessing

11:42 fliebel: User`: Using ring midleware.

11:42 joodie: I 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:44 but then, I try to stay as far away as possible from the servlet API anyway.

12:10 avdi: beating my head against (use ...) here

12:11 I think I've worked out that it takes an array, unlike what is shown in "Programming Clojure"

12:11 joodie: @avdi: in (ns (use ...)) ?

12:12 erm.. (ns (:use ..))

12:12 avdi: joodie: no ns. Just working at the REPL, trying to copy what I see in Programming Clojure

12:12 Here's my current conundrum:

12:12 user=> (use ['clojure.contrib.repl-utils])

12:12 java.lang.IllegalStateException: source already refers to: #'clojure.repl/source in namespace: user (NO_SOURCE_FILE:0)

12:12 user=> (use ['clojure.contrib.repl-utils :as ru])

12:12 java.lang.Exception: Unable to resolve symbol: ru in this context (NO_SOURCE_FILE:30)

12:12 user=> (use ['clojure.contrib.repl-utils :as 'ru])

12:12 java.lang.IllegalStateException: source already refers to: #'clojure.repl/source in namespace: user (NO_SOURCE_FILE:0)

12:12 1. Can't just use it because of some conflict

12:13 2. Can't seem to alias it using an unquoted symbol

12:13 3. Can't seem to alias it with a quoted symbol either

12:13 Very confused.

12:13 joodie: if you just want to alias it, use (require ..) instead

12:13 raek: avdi: when calling the use-function, you often quote the whole argument: (require '[clojure.contrib.repl-utils :as ru])

12:14 (then you don't have to quote each symbol)

12:14 avdi: I'd really like a way to load and alias at the same time, hence use

12:15 joodie: note that (use '(bla :as bla)) will still try to import all the vars into the current namespace. so you should use require instead.

12:15 avdi: Ah. Right. Gotcha.

12:15 raek: avdi: 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:15 joodie: or (use '(bla :only [....]))

12:15 raek: (or was it leiningen that did that)

12:16 don't use lists there

12:16 avdi: OK, require works better. Thanks :-)

12:16 raek: vectors are for options, lists are for shared prefixes

12:17 (since having a list there doesn't work)

12:18 (use 'foo.a 'foo.b 'foo.c) = (use '(foo a b c))

12:19 (use 'foo.a '[foo.b :only [x]] 'foo.x) = (use '(foo a [b :only [x]] c))

12:26 angerman: anyone 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:26 It's quite likely that it's smooth but there's no derivative.

12:33 mids: angerman: can you provide a little more context?

12:35 angerman: I'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:36 In 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:37 So I basically have (obj-fn [sol]) -> quality of solution.

12:38 I 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:17 TimMc: *crickets*

13:23 angerman: How expensive is the quality function?

13:23 angerman: a few ms

13:24 just a bunch of matrix multiplications and then some convexity tests, area and circumflex calculations. Nothing that dramatic.

13:27 TimMc: And the parameter space is one-dimensional?

13:27 angerman: yes.

13:27 x + t d

13:27 TimMc: but not bounded?

13:27 angerman: t \in [A,B]

13:27 at least I think I can construct an upper and lower bound.

13:33 hv: can a macro know the name of its calling namespace?

13:34 angerman: hv: maybe *ns*?

13:35 raek: hv: like an ordinary function would do it (ns-name *ns*)

13:35 hv: will that be the calling ns or the ns the macro/function is defined in?

13:36 raek: hv: that depends on whether you put that call in the macro code, or in the code that the macro returns

13:37 (defmacro foo [] (let [x (ns-name *ns*)] `(print ~x))) vs (defmacro foo [] `(print (ns-name *ns*)))

13:38 hv: raek: thanks :)

13:42 waxrose: Morning every one.

13:47 TimMc: hey, waxrose

13:50 waxrose: TimMc, howdy partner

13:51 How's the pipeline project going?

13:51 TimMc: Well, I pushed out 0.1.0-SNAPSHOT

13:51 It seems to work.

13:51 I named it org.timmc/feedback

13:51 waxrose: cool, I'll check it out in a little while.

13:52 Would you happen to know a good library to help create a graphed chart?

13:53 I may need to do it in JavaScript till I become better in Clojure. :/

13:55 Scala: I want to use Vim for clojure development, should I use VIMClojure or slimv?

13:57 waxrose: I've heard good things about VimClojure, not sure about slimv.

13:57 Scala: waxrose: Okiedokes

13:57 waxrose: Why not use both?

13:58 Scala: Are they exclusive?

13:58 O_o

13:59 waxrose: I meant, just try both till you decided which one fits your goals best.

14:03 Scala: waxrose: Yeah I want to minimize experimentation for now since I'm just getting started with a new language though

14:08 TimMc: Scala: Very good idea.

14:09 Scala: TimMc: Do you have any other suggestions

14:09 I've never worked with anything on the JVM so I don't know if it's expected for me to know anything already

14:09 TimMc: I 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:10 Scala: TimMc: That sounds horrible lol

14:10 TimMc: I totally failed to learn any of Emacs, Scheme48, and the internals of this parser generator. :-P

14:10 waxrose: lol

14:10 Scala: Haha yeah

14:10 TimMc: With 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:11 Scala: I'm already very comfortable with Vim at this point fortunately

14:11 waxrose: I 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:11 ?

14:11 Derander: I switch back and forth between editors every couple of years

14:11 TimMc: Scala: So just use vim and leiningen, and worry about integrated REPLs later.

14:11 Scala: leiningen?

14:11 clojurebot: http://github.com/technomancy/leiningen

14:11 Scala: okay

14:12 Derander: hahahaha. that was nice of clojure bot

14:12 Scala: oh ahhaa I didn't realize that wasn't you

14:12 TimMc: lemme check something:

14:12 why?

14:12 clojurebot: why not?

14:12 TimMc: heh

14:12 waxrose: Scala, As long as you are comfortable with your editor is really all that matters.

14:12 Scala: yeah

14:13 TimMc: Emacs is ideal for s-expression languages, but is a learning project of its own.

14:13 waxrose: TimMc, So you failed to learn emacs and scheme48? lol

14:13 TimMc: yup

14:13 Scala: I was mostly just wondering if I should use something like RVM or VirtualEnv (ocming from ruby/python) when using clojure

14:13 TimMc: And the continuation-passing macro style.

14:13 waxrose: I learned both fairly fast but I am a slacker so I have been forgetting some of it.

14:14 I've been doing too much Html 5 and JavaScript.

14:14 TimMc: Scala: 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:14 waxrose: TimMc, RVM is for Ruby.

14:14 tomoj: Scala: lein, cake

14:15 there isn't really an equivalent to RVM because we just started that way in the first place

14:15 TimMc: Scala: Cake is another build tool for Clojure, similar in basic usage to Leiningen.

14:15 tomoj: clojure is just a jar that gets downloaded into your project dir

14:16 Scala: Oh

14:16 TimMc: Both are super-easy to use, once you get used to how Clojure namespaces are mapped to files and directories.

14:16 Scala: Ah that's not bad, that's what python does

14:16 * waxrose cringes @ python

14:17 Scala: haha why

14:17 waxrose: I was doing Ruby for a little while and the Ruby Confs I've been to have made me dislike the snake.

14:17 Scala: Ah

14:18 TimMc: Personally, I think Python is fun.

14:18 Scala: There's too much implicitness in ruby for my liking

14:18 waxrose: Plus I don't like Zed Shaw.

14:18 amalloy: "<TimMc> Scala: Very good idea" - i intend to take this out of context and use it as blackmail

14:18 TimMc: ha!

14:18 Scala: ahha

14:19 Tim are you a scala lover now!! lols

14:19 waxrose: lol

14:19 TimMc, Finish your pipeline project before you get blackmailed!

14:19 TimMc: waxrose: It's basically done.

14:19 * waxrose spoke too soon.

14:19 Scala: I've never used scala yet, I've been debating between clojure and scala but ended up picking clojure

14:19 waxrose: amalloy, Greetings.

14:19 TimMc: I won't declare 1.0.0 until I'm sure it works for my dependant project, though.

14:20 waxrose: Well 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:20 Scala: I'm mostly interested in learning a lisp

14:20 I wanna give game development a shot

14:20 amalloy: waxrose: which two?

14:21 waxrose: Well there is always ansi-common lisp, SICP.. and a few others

14:21 TimMc: Scala: 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:22 waxrose: amalloy, The Joy of Clojure and Clojure in Action

14:22 TimMc: Don't pattern on my code too much, though -- I'm still somewhat of a beginner.

14:22 waxrose: Who is writing the latter?

14:22 waxrose: amalloy, I work part time at B&N so I already have them pre-ordered.

14:22 TimMc, Amit Rathore

14:22 zoldar: ,(eval `(-> {:yes {:yes 1}} ~@[:yes :yes]))

14:22 waxrose: TimMc, http://www.manning.com/rathore/

14:22 clojurebot: DENIED

14:23 zoldar: ouch

14:23 TimMc: waxrose: Yeah, but what's their *real* name? :-P

14:23 amalloy: waxrose: 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:23 waxrose: amalloy, I meant in physical form. :D

14:23 amalloy: TimMc: i met amit on thursday. he's probly real

14:23 zoldar: is there some cleaner way to go through nested maps when key path is given as seq ?

14:23 TimMc: amalloy: Amit is just his meatspace name.

14:24 amalloy: zoldar: {assoc,update,dissoc}-in

14:24 TimMc: I was curious if he had a True Name, aka IRC handle.

14:24 amalloy: i don't think so

14:24 zoldar: amalloy, without modifying

14:24 amalloy: get-in

14:24 knew i'd missed on :P

14:24 *one

14:25 zoldar: thanks! missed that one too

14:25 waxrose: The physical copy of JoC will be in my store on the 26th I believe and goes on the floor on the 28th.

14:25 paraseba: zoldar: get-in update-in

14:25 amalloy: waxrose: worried nobody will buy it so you're just throwing it on the floor?

14:26 TimMc: :-P

14:26 waxrose: amalloy, 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:26 TimMc: grimy little paws

14:26 waxrose: gremlins >.>

14:27 * amalloy imagines parents bringing sick kids to B&N so they have something to throw up on

14:27 waxrose: lol

14:27 happens

14:28 I work in the Cafe' but people will grab TONS of books, good quality/just released, and stack them high then just leave them.

14:28 they get all torn up

14:28 That is why I always get the books before they go on the floor.

14:30 tomoj: TimMc: pipeline?

14:31 TimMc: tomoj: https://github.com/timmc/feedback

14:31 It's a behavioral simulator utility for sequential logic circuits.

14:32 Very 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:32 waxrose: TimMc, Are you on spring break yet?

14:32 TimMc: waxrose: Already past.

14:33 waxrose: Aww, I just started mine. I plan on reading 4 books in that time. Cancun is for losers!

14:33 j/k :)

14:33 TimMc: Haha, I spent my whole spring break on the couch writing Clojure. :-)

14:33 No regrets.

14:34 waxrose: lol I want to finish ansi common lisp, javascript book, reread sicp, and practical/programming clojure

14:35 let the slackers have their fun, I'm pre-paring for Clojure Conj

14:37 TimMc: Hmm, 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:38 tomoj: TimMc: cool

14:39 amalloy: TimMc: depends which end you want

14:40 and 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:42 &((juxt peek pop) [1 2 3])

14:42 sexpbot: ⟹ [3 [1 2]]

14:42 TimMc: Oh hey, didn't know about peek and pop.

14:43 I think I have some stack code that needs those.

14:44 amalloy: TimMc: peek and pop are last and butlast, except that they're not crazy-slow and only work on vectors

14:44 or...##(peek '(1 2 3))

14:44 sexpbot: ⟹ 1

14:44 amalloy: okay they work on whichever end is most convenient. nice

14:45 TimMc: There's no push. :-(

14:45 amalloy: TimMc: conj

14:45 TimMc: I mean, conj works, but...

14:45 amalloy: TimMc: if you want some help i can write (def push conj) for you

14:47 raek: speaking about stacks... is there any fn for getting a seq of a stack in "pop order"?

14:47 amalloy: raek: rseq?

14:48 $findfn [1 2 3 4] [4 3 2 1]

14:48 sexpbot: [clojure.core/rseq clojure.core/reverse]

14:48 TimMc: amalloy: But it's not symmetrical for lists.

14:48 raek: I was thinking about one that is data structure independent

14:48 amalloy: ah, i see

14:49 best you can do is probably a custom multimethod

14:50 raek: I was thinking 'bout (defn stack-seq [coll] (lazy-seq (when (seq coll) (cons (peek coll) (stack-seq (pop coll))))))

14:51 would be nice to have something like iterate, but with a predicate for when to stop

14:53 amalloy: raek: isn't that just (take-while (complement pred) (iterate f n))?

14:54 tsdh: Hi. Is there a way to make private functions accessible in the test namespace?

14:55 raek: ok, 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:56 amalloy: raek: that sounds more like unfold

14:57 tsdh: a good wall hack is to access the var objects directly: (#'myns/private-fn args)

14:57 raek: amalloy: what does unfold do?

14:57 amalloy: raek: https://gist.github.com/805583

14:57 tsdh: amalloy: Ah, great

14:58 raek: amalloy: yes. that's exactly it.

14:58 which languages does it exist in? haskell?

14:58 amalloy: yeah

14:58 and others, presumably

14:58 TimMc: tsdh: There's a snippet of code that will refer *all* private vars...

14:59 tsdh: https://groups.google.com/group/clojure/msg/66f15396411e49e9

15:00 amalloy: raek: and apparently F# has it

15:01 TimMc: amalloy: Yay! https://github.com/timmc/CS4300-HW3/blob/master/src/timmcHW3/history.clj#L58

15:01 amalloy: heh

15:02 tsdh: TimMc: Oh, that's nice.

15:02 amalloy: oh noes, your undo buffer is linear, not a tree

15:02 TimMc: amalloy: Just wait until my program's state history is backed by git. :-P

15:02 raek: (def stack-seq (partial unfold (juxt peek pop) empty?))

15:03 amalloy: oh nice

15:04 raek: I wonder how a tree-based (or DAG-based?) history navigation would look like in a web browser

15:04 amalloy: $google time travel with vim

15:04 sexpbot: First out of 39300 results is: qBang Solutions Blog - Travel Back Vim Time

15:04 http://blog.qbangsolutions.com/travel-back-vim-time/

15:04 amalloy: man. google never finds what i want

15:04 raek: I 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:06 amalloy: raek: repurpose the dropdown-ish thing on the Forward button to "slide" sideways in the tree

15:07 raek: amalloy: yeah, that'd be cool.

15:07 I wonder what "the dropdown-ish thing" should look like

15:07 amalloy: what do you mean?

15:08 raek: you were thinking about a menu where each item represents a branch?

15:08 amalloy: yeah

15:08 it's already the case that you get a dropdown when you rightclick the forward button

15:09 the entries in it are just fairly useless

15:09 raek: ah, so instead of squeezing those "old" entries into each item, you simply have something else there...

15:09 amalloy: right

15:09 TimMc: The back button dropdown (as it currenty stands) is quite useful for badly-behaved web pages.

15:10 amalloy: TimMc: indeed

15:10 but not the forward dropdown

15:10 raek: I'm currently implementing a client for the Gopher protocol

15:10 TimMc: However, the browser should handle that by not allowing redirects until after a timeout from hitting the back button.

15:10 raek: maybe I could experiment with this in that project

15:10 TimMc: agreed

15:11 TimMc: I guess you don't have that problem in Gopher.

15:12 raek: exactly :)

15:12 TimMc: raek: Alt-tab provides an interesting template, where holding down Alt gives you a list of windows to scroll through with tab.

15:13 Imagine Alt+[up,down,left,right] to navigate a horizontal tree. (grows to the right)

15:13 amalloy: TimMc: sounds good to me

15:13 alt+left/right already do that

15:14 TimMc: Now, there might be some dissonance with the tree-structured directories the user is browsing... hmm.

15:14 amalloy: wut?

15:15 TimMc: Doesn't Gopher provide a tree-structured view?

15:15 raek: conventionally, yes

15:15 but each directory item is allowed to point to any other directory

15:16 TimMc: OK, that's what I thought.

15:16 It has symlinks. :-)

15:16 raek: but the directories of a gopher server are most often organized in a hierarchial manner

15:16 amalloy: oh we're talking about gopher now. i don't know anything about gopher :P

15:16 raek: it's a very small protocol

15:17 ekoontz: sigh.. (difference '(a b) '(b c))

15:17 raek: after reading the wikipedia article, you know enough to implement it

15:17 ekoontz: how do i do it in clojure?

15:18 TimMc: ,(difference (set '(a b)) (set '(b c)))

15:18 clojurebot: java.lang.Exception: Unable to resolve symbol: difference in this context

15:18 TimMc: ,(clojure.set/difference (set '(a b)) (set '(b c)))

15:18 clojurebot: #{a}

15:18 ekoontz: Thanks a ton TimMc :)

15:18 TimMc: ekoontz: Oh, and '#{a b c}

15:18 ekoontz: i love the clojurebot too

15:18 TimMc: ,#{'a 1 'c}

15:18 ekoontz: didn't know about that

15:18 clojurebot: #{1 a c}

15:18 ekoontz: ,(list 4 5 6)

15:18 clojurebot: (4 5 6)

15:19 ekoontz: ,(clojure.set/difference (set '(a b)) (set '(b c)))

15:19 clojurebot: #{a}

15:19 Geisteskrankh: ,+

15:19 clojurebot: #<core$_PLUS_ clojure.core$_PLUS_@15ee9d9>

15:20 TimMc: ekoontz: Just make sure you (:require ...) or (:use ...) clojure.set in your code -- it is available by default only in some environments.

15:20 ekoontz: ,(clojure.set/difference '#(a b) (set '(b c)))

15:20 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IPersistentSet

15:20 TimMc: ekoontz: Braces, not parens.

15:20 amalloy: ekoontz: #{a b}, not #(a b)

15:20 ekoontz: thanks TimMc yeah

15:20 ,(clojure.set/difference '#{a b} (set '(b c)))

15:20 clojurebot: #{a}

15:20 ekoontz: cool

15:21 TimMc: ekoontz: I also highly recommend the ClojureDocs site: http://clojuredocs.org/clojure_core/clojure.set/difference

15:22 ekoontz: thanks TimMc; good reference, better than what i was using (google) :)

15:22 amalloy: there's also sexpbot's findfn:

15:22 $findfn '#{a b} '#{b c} '#{a}

15:22 sexpbot: [clojure.set/difference]

15:22 TimMc: The search function has some trouble with hyphens, but other than that it it great.

15:23 amalloy: not so useful here cause what you didn't know about was sets, but for later

15:23 TimMc: s​/it it/it is/

15:24 ekoontz: yeah clojure is a little more type-strict than common lisp

15:24 so that takes some getting used to

15:25 TimMc: ekoontz: WHen you work in the realm of sequences and collections, it usually doesn't matter, though.

15:25 You only have to drop down to set for set operations, for instance.

15:25 amalloy: ekoontz: 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:26 ekoontz: i like the key value pairs..

15:26 {:foo 42 :bar 99}

15:26 amalloy: &(let [s #{1 2 4 8}] (filter s (range 10)))

15:26 sexpbot: ⟹ (1 2 4 8)

15:56 amalloy: seriously? firefox has a history-tree extension, but i can't find one for chrome

15:56 waxrose: lol

15:56 Did you check their app mall?

15:57 amalloy: maybe? i haven't been using chrome for long

15:57 waxrose: Btw, Fx 4 beta 13 pre is great.

15:57 Much smaller interface.

15:58 amalloy, https://chrome.google.com/webstore?hl=en-US ?

15:59 amalloy: well, i found an Asteroids extension. i guess that's cool

16:00 waxrose: The beta Fx looks similiar to chromium but I think if you compile it, it's so much quicker.

16:00 User`: hm how are protocols invoked

16:01 amalloy: User`: like normal functions

16:02 raek: User`: how you invoke its methods, or how they are implemented?

16:02 User`: I mean

16:02 if I have protocol that have fn called foo

16:02 and then call (foo x)

16:03 how is this different than a normal fn

16:03 I don't understand the concept

16:04 raek: User`: the protocoll does not specify what code gets executed when you call it

16:04 User`: I know

16:05 but if I implement a protocol

16:05 how is that different from writing those same fns without being a part of protocol implementation

16:06 they do the same thing

16:06 amalloy: User`: it's a lot like interfaces in java

16:06 raek: the code that uses the protocol does not have to know what implementation is used

16:08 so, lets assume the clojure stack functions are protocol functions: (defprotocol Stack (conj [coll value]) (peek [coll]) (pop [coll]))

16:08 joodie: User`: protocols can have multiple implementations, and which implementation is called depends on the *arguments* provided to the call.

16:08 waxrose: amalloy, 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:08 User`: ok, how that different from multimethod that dispatches on class of first parameter

16:09 amalloy: User`: it's conceptually the same

16:09 but jvm can optimize protocols better

16:09 User`: so if I define a protocol that has a fn with same name as existing fn what happens?

16:10 raek: if the fn is in your namespace, it will be overwritten

16:10 amalloy: User`: namespacing takes care of it

16:10 raek: if the fn is some unrelated namespace, then there is no collision

16:11 User`: so if I make protocol with fn named first then with call (first x) I dispatch on the class of x

16:11 raek: if 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:11 User`: yes

16:11 User`: what happens when nothing implements a protocol for that type

16:11 * joodie is busy removing code and adding documentation.

16:11 raek: you get an exception

16:12 stuart halloway explains protocols and how they differ from multimethods in this video: http://vimeo.com/11236603

16:12 also, protocols group functions together.

16:12 User`: how does clojure find all implementations floating around? by normal symbol lookup in the current context?

16:13 raek: the code that implements it has to use the protocol var (and changes something in it, iirc)

16:13 ,(do (defprotocol P) P)

16:13 clojurebot: DENIED

16:13 raek: &(do (defprotocol P) P)

16:13 sexpbot: ⟹ {:on-interface sandbox7565.P, :on sandbox7565.P, :sigs {}, :var #'sandbox7565/P, :method-map {}, :method-builders {}}

16:13 User`: ok, what does reify do then?

16:14 raek: it's like a one-off deftype

16:14 it creates an object that implements the given protcolols with the given method implementations

16:14 much like 'proxy' does for java interfaces

16:14 joodie: ah, that's good to know. haven't spend enough time looking through the protocol docs.

16:15 User`: so reify returned object also has data fields or something?

16:16 raek: it can close over local variables, but does not have explicit fields, like deftype and defrecord

16:16 joodie: protocols only specify methods, AFAIK. if you want to store date, use closures

16:16 from the docs @ http://clojure.org/protocols:

16:16 (foo

16:16 (let [x 42]

16:16 (reify P

16:16 (foo [this] 17)

16:16 (bar-me [this] x)

16:16 (bar-me [this y] x))))

16:17 raek: (defprotocol Pair (the-one [x]) (the-other [x])) (let [x 1, y 2] (reify Pair (the-one [_] x) (the-other [_] y)))

16:18 User`: but this object created by reify, I can't see what's its dispatch

16:19 when does a call to the-one dispatch to this implementation, returned by reify

16:19 raek: it's an object of a new unique type

16:20 User`: (def p (reify Pair ...)) HERE --> (the-one p)

16:20 User`: 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:21 raek: yes, it's an implementation unique to that object

16:21 joodie: User`: but that's what dispatch IS. !?

16:21 User`: :D

16:22 I get it, it's basically an anonymous interface implementation

16:22 raek: cgrand uses protocols very beautifully: http://vrac.cgrand.net/DSL.pdf

16:22 User`: exactly

16:23 angerman: so {:keys […], :or {…}} does not make the arity 0?

16:26 ok, I failed to get this right. sorry

16:44 zoldar: is there a way to make "(read)" act as expected in SLIME?

17:11 Somelauw: clojurebot (Math/min 5 Double/POSITIVE_INFINITY)

17:11 Or what is the bot called again?

17:12 zoldar: ,(Math/min 5 Double/POSITIVE_INFINITY)

17:12 raek: Somelauw: clojurebot evals utterances beginning with a comma

17:12 amalloy: Somelauw: prefix your command with , or &

17:12 raek: and sexpbot those with a &

17:12 Somelauw: , (Math/min 5 Double/POSITIVE_INFINITY)

17:12 clojurebot, (Math/min 5 Double/POSITIVE_INFINITY)

17:12 amalloy: clojurebot isn't here now apparently

17:12 Somelauw: & (Math/min 5 Double/POSITIVE_INFINITY)

17:12 sexpbot: java.lang.IllegalArgumentException: No matching method found: min

17:12 Somelauw: Yes, that was the thing that confused. Why that error?

17:12 Since

17:13 & (Math/min 5 6)

17:13 sexpbot: ⟹ 5

17:13 Somelauw: So what is wrong with infinity?

17:13 amalloy: Somelauw: nothing is, you're just mixing types

17:13 Somelauw: & (Math/min 5.0 Double/POSITIVE_INFINITY)

17:13 sexpbot: ⟹ 5.0

17:14 Somelauw: I thought java was able to implicitely cast ints to floats.

17:15 & (Math/min 3.5 Double/POSITIVE_INFINITY)

17:15 sexpbot: ⟹ 3.5

17:16 joodie: & (Math/min 1 1.5)

17:16 sexpbot: java.lang.IllegalArgumentException: No matching method found: min

17:16 amalloy: does paredit have a command to turn a (f b c) into (f a b c)?

17:20 joodie: amalloy: don't think so. it's quite a specific modification

17:21 amalloy: joodie: it seems like it would be useful more often than the current backwards-slurp, which gives you (a f b c)

17:21 since f is already "known" to be a function

17:21 joodie: amalloy: hmmm... maybe

17:21 I tend to use M-s a lot as it is.

17:22 and I'd rather have a command to turn (a (b c d)) into (a c d)

17:22 amalloy: not sure how M-s is useful in this context

17:22 joodie: you already have that command

17:23 put point before c, and M-<UP>

17:23 joodie: oooh

17:23 thanks

17:24 amalloy: welcome

17:26 joodie: doesn't emacs have some sort of "swap words" command that might work correctly in lisp modes?

17:26 then you could just slurp in the a and then swap f and a

17:27 amalloy: joodie: yeah, #emacs just came up with that as well

17:27 hiredman: clojurebot: ping?

17:28 clojurebot: PONG!

17:28 hiredman: testing indexing

17:28 joodie: well, maybe you'll just have to define you own keybinding to do both commands. :)

17:28 hiredman: ~search for testing

17:28 clojurebot: #<HttpHostConnectException org.apache.http.conn.HttpHostConnectException: Connection to http://localhost:9200 refused>

17:28 joodie: it's emacs, you

17:28 're SUPPOSED to make it incomprehensible to other users :)

17:30 amalloy: joodie: i'll just rebind C-M-<LEFT> and damn anyone who expects it to do this crazy thing it currently does

17:37 Somelauw: Is emacs the most popular editor for clojure?

17:37 Since it seems to be very popular for lisplike languages for some reason.

17:38 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:39 Chousuke: it's also written in a dialect of lisp, which probably has something to do with its popularity in lisp circles.

17:39 joodie: and of course, being able to extend the editor in a lisp helps :)

17:39 raek: it has a tradition of interactive development

17:39 hiredman: ~search for indexing

17:39 clojurebot: <#clojurebot:hiredman> indexing test

17:39 User`: I develop in emacs because that's what clojurebox uses

17:39 I tried eclipse plugins

17:39 hiredman: ~search for emacs

17:39 clojurebot: <#clojure:User`> I develop in emacs because that's what clojurebox uses

17:39 <#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:39 User`: but they didn't work at all

17:40 no autocomplete

17:40 waxrose: I think it keeps you thinking about lisp when you can extend lisp emacs.

17:40 in*

17:41 instead of your mind wandering off to some thing else

17:41 joodie: I 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:41 waxrose: I build Emacs from source every night. :/

17:41 raek: does anyone know how to make slime print the evaluated result in the repl instead of the minibuffer when pressing C-M-x?

17:43 anyway, interactive development in Clojure was the reason I started to use emacs :)

17:43 now I use it for everything

17:44 hiredman: so just an fyi clojurebot is indexing #clojure now

17:44 raek: well, not like RMS

17:44 amalloy: Somelauw: emacs is built in lisp, for lisp. the language integration is incredible

17:44 not having to rely on the mouse is pretty awesome too once you get the hang of it

17:45 waxrose: raek, I started using Emacs mostly out of spite for my UNIX 101 teacher who was a vim fan boy.

17:45 amalloy: haha

17:45 Somelauw: I can already live without mouse.

17:45 joodie: raek: you can redefine the slime-message function to print somewhere else.

17:45 Somelauw: Since I am a vim user.

17:46 waxrose: Install StumpWm then you have a Hands free, lisp built window manager.

17:46 chouser: hiredman: indexing?

17:46 hiredman: writes to elasticsearch

17:46 joodie: but it would take a bit more than that to get it to work right

17:46 amalloy: my 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:46 Somelauw: But since few lisp programmers seem to use vim, I was wondering if emacs might be better for that specific language.

17:46 waxrose: amalloy, hahahahahahahahahhaha!

17:47 hiredman: ~search for sender:chouser

17:47 clojurebot: <#clojure:chouser> hiredman: indexing?

17:47 waxrose: Somelauw, Use what you feel most comfortable with.

17:47 amalloy: hiredman: looks nice

17:48 i 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:48 joodie: waxrose: for tabbed WMs, I prefer i3 at the moment.

17:48 hiredman: results 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:48 you can page

17:49 waxrose: joodie, I'm actually using dwm now since StumpWm annoys me too much.

17:49 Would be nice to have a clojure wm.

17:49 Somelauw: Is StumpWm the same as Awesome but then with lisp?

17:49 hiredman: would need a java xlib binding

17:49 waxrose: Somelauw, It's the same as Ratpoison built in lisp.

17:51 joodie: I 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:51 so i3 is perfect for me.

17:52 Somelauw: I would think that a webbrowser that completely ignores the mouse you probably can't even use firefox or openoffice.

17:52 I would think that a window manager that completely ignores the mouse you probably can't even use firefox or openoffice.

17:52 waxrose: I get easily distracted so I try to keep every thing oriented in the same environment.

17:52 amalloy: Somelauw: i went without a mouse for a month recently

17:53 it's not that hard

17:53 joodie: I should try that

17:53 waxrose: It doesn't ignore the mouse, you can use it if you want.

17:53 amalloy: i 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:53 Somelauw: I like to work without touching the mouse but my webbrowser frequently requires me to.

17:54 joodie: my main "keep everything the consistent" action was to configure alt/meta/super to work the same on my macbook and my linux desktop

17:54 hiredman: a few guys at work use http://conkeror.org/

17:54 amalloy: Somelauw: tab+enter to click on links. for pages with too many links to conveniently tab through, C-f <link text> ESC RET

17:54 waxrose: That 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:55 very fast

17:55 * joodie doesn't have a numpad: http://geekhack.org/attachment.php?attachmentid=15692&d=1298899029

17:56 waxrose: joodie, That looks like a vim keyboard.

17:56 joodie: it works amazingly well with emacs too :)

17:56 amalloy: joodie: blurg. i'm willing to accept spending some horizontal space to make it easy to type numbers

17:56 joodie: I just don't want to have to reach for a mouse when I need one

17:57 and number typing on the top row is easily learned

17:57 zoldar: joodie, nice - I own a filco tenkeyless, but I'm not that great at touch typing to go with blanks ;)

17:58 joodie: zoldar, ooh good one. I've been meaning to try those.

17:58 amalloy: joodie: 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:58 joodie: I'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:59 amalloy: yeah, as long as you have JF indexed you're all set. my keyboardis under the desk; i can't even see the keys

18:01 fbru02: ,(doc letfn)

18:01 clojurebot: "([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:06 rata_: 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:06 technomancy: hiredman: ISTR finding a java xlib binding once upon a time

18:06 amalloy: rata_: fnparse

18:06 technomancy: I'm not patient enough to write a WM though

18:07 rata_: amalloy: mmm you're right

18:08 didn't think about it

18:10 amalloy: (rep* (not-followed-by (lit-conc-seq ['@])) anything) looks like a good start

18:33 User`: ,(doc rep*)

18:33 clojurebot: It's greek to me.

18:33 amalloy: User`: fnparse

18:36 User`: rata_: how about (take-while (fn [x] (not (re-find #"@\d\d" x))) sequenc)

18:36 clojurebot: 2009:Jan:29:16:03:17 <hiredman> I call Xiphojura

18:36 rata_: User`: that's for strings, not seqs

18:37 User`: I thought you wanted to take all elements until you find a certain string

18:38 amalloy: User`: rata_ is trying to generalize regexps to non-strings

18:38 by the way, cgrand also has a neat regex library, i think

18:39 rata_: yes, but it compiles to j.l.Regex

18:39 amalloy: sure

18:39 not what you're looking for, but possibly relevant

18:40 rata_: amalloy: fnparse is probably what I want, but I'll think first of a simpler approach

18:40 User`: ,(doc fnparse)

18:40 clojurebot: Huh?

18:40 amalloy: $google fnparse

18:40 sexpbot: First out of 247 results is: joshua-choi/fnparse - GitHub

18:40 https://github.com/joshua-choi/fnparse

18:42 User`: interesting

18:43 amalloy: User`: 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:47 a few data pairs and five lines of parser logic, and it can read roman numerals

18:52 User`: hm interesting

18:52 say...why do you have tokens (x, m etc) as quoted symbols instead of just putting them in " " ?

18:53 joodie: User`: in clojure in general?

18:54 because strings are just lists of characters, while symbols and lists etc are objects in their own right

18:54 it's tied to the read/eval stage of interpretation/compilation.

18:55 amalloy: joodie: i think he means my code

18:55 User`: i just didn't want to type "" over and over

18:55 so i put them in a quoted list and then mapped (str) over them to turn them into strings

18:56 User`: ah convenience then

18:56 amalloy: yeah

18:56 plus it arguably makes the pair-definitions more readable

18:57 User`: that's cool... I'll have to really get into this to make a parser for something like a special configuration files

18:57 amalloy: User`: better still, don't use special configuration files :)

18:57 Somelauw: maybe make clojure compile to native machinecode

18:58 amalloy: just make your configuration file a .clj file you can read or load, and tada, you have a map

18:58 hiredman: joodie: Strings are not just lists of characters

18:59 ,(->> (class "foo") .getMethods (map #(.getName %)))

18:59 clojurebot: ("hashCode" "compareTo" "compareTo" "indexOf" "indexOf" "indexOf" "indexOf" "equals" "toString" "length" ...)

19:00 joodie: yeah sure.

19:00 clojure strings are java strings, with random access reads.

19:00 hiredman: joodie: 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:01 if 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:02 joodie: I 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:03 Somelauw: Maybe you can create java from clojure and use gnu to compile the java to machine code.

19:03 hiredman: the reads strings as Strings, infact it reads them using a StringBuilder

19:03 joodie: IOW, the difference between "(a b c)" and '(a b c)

19:03 Somelauw: string and quoted list

19:03 amalloy: Somelauw: gcj is woefully useless

19:05 joodie: And 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:11 User`: people told me to use Ring for webapps instead of servlets...then why does ring have servlet module?

19:11 Somelauw: why is it useless

19:11 joodie: User`: because then you can use ring in a standard java web server.

19:12 User`: I thought Ring WAS the server

19:12 brehaut: User`: ring is firstly an interface

19:12 joodie: ring is not a server. it's an abstraction on http request/response

19:12 brehaut: User`: secondly a set of adapters to existing servers

19:13 and thirdly a set of standard tools for working with http and surrounding ecosystem

19:13 User`: but according to tutorials it seems that it works just fine in combination with jetty even without this servlet package

19:14 joodie: basically, a ring-based system should be portable to most web servers - even ones that don't implement the servlet API.

19:15 see ring-jetty-adapter vs ring-servlet

19:15 brehaut: User`: it does

19:15 User`: so the servlet package is for Ring to appear as servlet to webserver, not for my app to be a servlet

19:15 brehaut: User`: but if you want to AOT compile a ring app to be hosted as a WAR in a servlet container

19:16 User`: do I have to do any gen-class stuff in my own code to have it AOT compile

19:16 being able to make a WAR appeals to me tremendously

19:16 brehaut: i think how it is AOT compiled varies on your project/build tool

19:18 User`: what I'm asking in essence is: do I have to gen-class which extends Servlet or does the ring do that

19:18 brehaut: i am quite content with an embeded jetty so ive never gone looking

19:18 User`: ok

19:18 technomancy: make love, not war.

19:18 joodie: same here.

19:18 User`: war has the advantage that you can use paid hosting and send them war updates

19:19 joodie: but I think that ring-servlet takes care of most of the glue.

19:19 User`: i'm using leiningen for build tool and to do any AOT

19:19 TimMc: technomancy: Do you suppose there's a WAR-file generator called "love"? Or perhaps instead a competing format?

19:19 User`: maybe "peace"

19:20 War and Peace by Dostojevski :P

19:20 or did I screw that one up :D

19:20 brehaut: User`: 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:21 User`: crap, so AOT doesn't work at all?

19:21 technomancy: TimMc: there better be

19:21 brehaut: User`: i didnt say that, only that the servlet utils dont do any themselves

19:22 User`: WAR will require that there is some kind of class that extends servlet in there also with appropriate web.xml deployment descriptor

19:22 brehaut: User`: go nuts: https://github.com/alienscience/leiningen-war

19:23 User`: :D I'm not that skilled yet, to be writing my own libraries

19:24 brehaut: my bad, that link itself suggests https://github.com/weavejester/lein-ring

19:25 TimMc: User`: Writing what libraries?

19:25 ieure: User`, brehaut, Having _just_ gone through both lein-war and lein-ring, use lein-ring.

19:26 It rules. Lein-war brings nothing to the table.

19:26 brehaut: User`: there is an associated blog http://weavejester.com/getting-started-with-lein-ring

19:26 ieure: Lein-ring made ma a WAR file that I successfully deployed to EC2 with Elastic Beanstalk. I came in my pants a little.

19:26 brehaut: i didnt need to know that

19:27 User`: lein-ring dev-dep just downloaded whole Ring

19:27 ieure: I also came in brehaut’s pants.

19:27 User`: do I have to put it under dependecies of a project too?

19:27 ieure: User`, No.

19:27 User`: or at least the stuff it downloads?

19:27 the Ring stuff?

19:27 ieure: No.

19:28 brehaut: User`: weavejesters tutorial has ring/ring-core in deps and lein-ring in dev-deps

19:28 ieure: I had [ring/ring-jetty-adapter "0.3.5"] in the main deps, but I think that Compojure pulls all that stuff in.

19:28 User`: I currently have some parts of ring in my deps, do I need that?

19:28 brehaut: User`: I would think you do

19:29 User`: 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:29 Maybe?

19:30 TimMc: ieure: 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:30 brehaut: technomancy can probably clarify but you dev dependancies dont get packed into your .?ar files

19:30 User`: I know they usually don't

19:30 brehaut: they only exist in your dev enviroment

19:30 ieure: TimMc, Indeed. I was much more impressed with lein-ring, which worked out of the box, first time, no extra work necessary.

19:30 User`: but if you have a special lein job, it's probably possible

19:30 ieure: It also has a dev server which is very slick.

19:31 TimMc: ieure: Ah, nice.

19:31 ieure: Not having attempted to hack on Clojure webapps in a while, I’m _really_ pleased with how far things have come.

19:32 User`: hm....

19:33 why am I having multiple versions of some jars in my dev lib folder?

19:33 I have clojure 1.1 and clojure 1.2

19:33 seancorfield: do: lein clean, deps

19:33 see what's left after that

19:34 User`: same

19:34 no change

19:34 seancorfield: maybe stuff you're depending on has different clojure dependencies?

19:34 User`: possibly

19:36 http://pastebin.com/AKmvJyvv

19:37 here's my configuration and contents of my dev libs folder

19:37 brehaut: User`: enlive is at 1.0.0 now

19:38 User`: how do I update that

19:38 brehaut: drop -SNAPSHOT from the version string in your project.clj

19:38 and then lein deps

19:38 (although any lein command mgiht trigger it if its sees it has changed

19:40 User`: but now I have 2 jars lol

19:40 wtetzner: lein clean; lein deps

19:41 User`: lein clean does nothing it seems

19:41 never deletes anything

19:41 screw it I'll delete the folders

19:42 wtetzner: rm -rf lib; lein deps

19:42 seancorfield: lein clean always clears my lib folder... wonder why it doesn't do it for you?

19:42 User`: no idea

19:43 but deleting the folder then rerunning deps worked

19:43 brehaut: lein version ?

19:43 User`: it didn't even download the jars

19:43 I wonder where it got them lol

19:43 brehaut: if they are in your ~/.m2 cache it wont

19:43 wtetzner: ~/.m2/repository

19:43 clojurebot: excusez-moi

19:43 seancorfield: hmm, you know, now i just tried lein clean on a project, it didn't empty lib

19:44 brehaut: maybe tis just a placebo command now

19:44 danieljomphe: I don't think clean would do that, although it would definitely delete compiled files (target)

19:44 seancorfield: it does remove the classes folder tho'

19:44 User`: right :)

19:45 seancorfield: so... rm -rf lib; lein deps :)

19:45 danieljomphe: sometimes it's useful to rm -rf the libs to get rid of multiple old versions of a lib

19:47 oh, I believe I was wrong; I just tried and it appears lib is deleted

19:52 so if it's not deleted for you, it may be that you have something open that locks one of the files in lib?

19:54 TimMc: On Linux, that shouldn't result in the file still being accessible -- it should appear to be deleted.

19:57 technomancy: deps deletes the jars from lib before proceeding, so having clean do it is redundant

19:59 danieljomphe: oh 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:34 brundle: newbie question http://pastebin.com/7Fj9dY6y

21:36 specifically I want to know if I can avoid the flatten->partition steps

21:38 zakwilson: How does the overhead on Clojure maps compare to say... Java hashtables?

21:38 (size, not speed, to clarify)

21:53 ysph: i'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:53 tomoj: ysph: seen gloss yet?

21:53 ysph: no

21:54 tomoj: https://github.com/ztellman/gloss not sure if it will match your needs

21:54 ysph: but i'm glad that you've pointed it out to me

21:54 tomoj: documentation is pretty bare still it seems

21:54 oh, the introduction in the wiki isn't bad

21:55 Chousuke: ysph: in general I think you should avoid using lists in DSLs unless the expressions actually get evaluated as code.

21:55 ysph: the let and the for in that example would be evaluated

21:56 Chousuke: I mean the (5 bits) thing

21:56 ysph: ah, good point

21:56 tomoj: brundle: one way is (mapcat (juxt identity reverse) x)

21:56 ysph: i was thinking of that as a shortcut for (repeat 5 bits)

21:57 Chousuke: you could just make a bits function

21:57 and have (bits 5)

21:57 ysph: probably

21:57 Chousuke: it's backwards but that's not too bad

21:57 ysph: anyhow, i'll check out gloss

21:57 thanks for the feedback

21:57 tomoj: gloss won't like 5 bits unless there are 3 after it

21:58 bytes can be split but not across frames afaik

21:58 ysph: i do need something that can handle arbitrary splits

21:58 tomoj: i.e. you can't read 5 bits and then start reading the rest as if they were bytes

21:59 ysph: in this case, what's read for the rest is determined by the value contained within the first five bits

21:59 tomoj: I _think_ trying to do that with gloss will probably be harder than writing your own

22:00 ysph: hence the (:nbits bits), to indicate substituting :nbits with the value previously read

22:04 tomoj: brundle: also (interleave x (map reverse x))

22:05 brundle: tomoj - thank you very much

22:25 nickik: How can it be that when I use lein run it takes about 200ms but when I use an uberjar it takes 750ms?

22:26 tomoj: neat key?

22:27 nickik: ?

22:27 tomoj: nevermind

22:27 your nick happens to look like it means something

22:28 with lein run, maybe it only loads the jars when needed? while with the uberjar, it has to load everything at startup? guessing.

22:29 nickik: It 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:30 tomoj, I only use clojure nothing else in this example.

22:30 tomoj: no contrib? no idea then.

22:31 nickik: I going to try with a normal jar.

22:49 Isn'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:52 TimMc: nickik: I guess you could use read-string if you were certain it was safe numeric input.

22:52 But that's quite a sledgehammer.

22:55 nickik: mmhh 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:05 amalloy: afaik 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:08 i'm not sure you have to be certain it's safe numeric input, though. call read-string and check number?

23:09 disable 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:20 &(doc sync)

23:20 sexpbot: ⟹ "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

Logging service provided by n01se.net