#clojure log - Dec 06 2011

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

0:06 devn: Raynes: #chicken

0:19 http://www.ccs.neu.edu/home/samth/

0:19 ^-Great page with lots about typed Racket

0:20 spoon16: guidance question

0:21 I have a function with a parameter… I'd like the caller to be able to call the function with different types as the value for the param String, enum instance, or keyword

0:22 what is the idiomatic way of normalizing that parameter?

0:22 right now I'm thinking (fn [p] (let [np (normalize-param p)] (println p)))

0:26 (defn normalize-param [p] (cond (instance? String) p (instance? Keyword) (name p) (instance? EnumType) (.valueOf p)))

0:26 good, bad, ugly?

0:28 cgag: i'm interested in the answer that as well

0:44 amalloy: spoon16: you only want to switch on type/class?

0:45 spoon16: amalloy, yes

0:45 amalloy: (defprotocol MyParam (fix-up [x])) (extend-protocol MyParam, String (fix-up [x] x), clojure.lang.Named (fix-up [x] (name x))) and so on

0:46 spoon16: I thought that might be the way to go

0:46 amalloy: that dispatch is fast and also extensible by clients

0:46 spoon16: in my mind protocols are heavier and I struggle to understand when they should be used

0:46 ok

0:49 amalloy: spoon16: fwiw, if you were to write it as a cond, a condp would be clearer and shorter: (condp instance? x, String x, clojure.lang.Named (name x))

0:50 spoon16: nice

0:50 didn't know about condp

0:50 thanks

1:07 amalloy: https://gist.github.com/1436973

1:07 is that right?

1:08 amalloy: spoon16: sure, though the duplication in kw/string is gross. just have the keyword impl depend on the string impl: (country-id [c] (country-id (name c)))

1:09 spoon16: good thinking

1:09 fixed

3:45 Blkt: good morning everyone

3:46 ejackson: Hello hello.

3:51 Blkt: :D

5:05 Fossi: grrr. hitting a bug/quirk in deftype/method_impl_cache again

5:05 somehow our appengine app sometimes seems to reload incompletely :/

5:16 kral: namaste

5:18 ejackson: and good luck !

6:22 ambrosebs: ,(let [form '(+ 1 1)] `~form)

6:22 clojurebot: (+ 1 1)

6:22 ambrosebs: how can I get (clojure.core/+ 1 1) from that?

6:22 ie. qualified symbols

6:24 clgv: ambrosebs: you can map resolve on the symbos of the form

6:24 &(resolve '+)

6:24 lazybot: java.lang.SecurityException: You tripped the alarm! resolve is bad!

6:25 clgv: ,(resolve '+)

6:25 clojurebot: #'clojure.core/+

6:25 ambrosebs: sounds like a job for walk

6:25 clgv: in case it's nested, yes ;)

6:26 ambrosebs: clgv: yes, its general

8:32 how can I get the namespace of a var?

8:34 samaaron: so i /n

8:34 yangsx: ,(namespace +)

8:35 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.core$_PLUS_ cannot be cast to clojure.lang.Named>

8:35 ambrosebs: ,(namespace #'+)

8:35 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.Named>

8:35 ambrosebs: that's more what I'm after

8:35 ,(str #'+)

8:35 clojurebot: "#'clojure.core/+"

8:36 raek: ,(.symbol #'+)

8:36 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: symbol for class clojure.lang.Var>

8:36 raek: ,(.sym #'+)

8:36 clojurebot: +

8:36 raek: ,(.ns #'+)

8:36 clojurebot: #<Namespace clojure.core>

8:37 ambrosebs: :)

8:37 what I really want is converting the var to a symbol

8:37 I assumed there was no direct way

8:38 raek: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L128

8:39 ,(symbol (.name (.ns #'+)) (.sym #'+))

8:39 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String>

8:39 ambrosebs: raek: excellent

8:39 raek: ,(symbol (.name (.ns #'+)) (str (.sym #'+)))

8:39 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String>

8:39 raek: ,(symbol (str (.name (.ns #'+))) (str (.sym #'+)))

8:39 clojurebot: clojure.core/+

8:39 ambrosebs: raek: awesome!

8:40 raek: feels a bit hackish

8:40 ambrosebs: these are dark corners of Clojure, symbol manipulation/conversion

8:41 raek: btw, what is this scenario when you need to go from var to symbol?

8:41 ambrosebs: I'm writing a static type checker

8:41 clojurebot: http://www.assembla.com/wiki/show/clojure/Datatypes

8:41 lazybot: Assembla is deprecated. Use http://dev.clojure.org

8:41 raek: correctionbot...

8:42 Borkdude: ,`+

8:42 clojurebot: clojure.core/+

8:42 ambrosebs: I'm basically attempting to resolve a symbol to see if it already refers to a var

8:43 because I add my type annotations before each function is defined

8:43 raek: but then you already have the symbol?

8:43 ambrosebs: raek: :) I'll get my thoughts together in a gist

8:44 Borkdude: ,(doc resolve)

8:44 clojurebot: "([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"

8:45 ambrosebs: hmm yes, I'm probably solving the wrong problem

8:45 although I did try resolve, I can't remember why I didn't use it

8:45 back to the drawing board..

8:45 raek: ambrosebs: do you know about the magical &env macro argument?

8:45 ambrosebs: yes

8:46 give me a minute, resolve should work...

8:47 raek: so with resolve and &env, you should be able to chck whether a symbol represents a var, and if so get access to it

8:47 (and its metadat)

8:47 resolve returns nil if the symbols is a local

8:47 *symbol

8:48 ambrosebs: I'm maintaining a map from qualified symbols to types

8:48 all I want is to work out if an unqualified symbol (which I know is global) points to an existing var

8:49 and then add the qualified symbol to the map

8:49 raek: (resolve 'foo)

8:49 ,(resolve 'foo)

8:49 clojurebot: nil

8:49 raek: ,(resolve 'conj)

8:49 clojurebot: #'clojure.core/conj

8:49 ambrosebs: yes, resolve looks perfect

8:49 it should work

8:49 raek: beware of classes:

8:49 ,(resolve 'Object)

8:49 clojurebot: java.lang.Object

8:50 raek: resolve returns either nil, a var, or a class

8:51 ambrosebs: oh

8:52 raek: to handle these cases you could write a protocol and extend it for nil, clojure.lang.Var, and java.lang.Class

8:53 well, this is just an implementation detail. there are other ways to do it too :-)

8:54 ambrosebs: Should my global type map be from symbols to types?

8:54 my rationale was that if a var is uninterned, I'd need a symbol to represent the var anyway

8:56 raek: how do you represent types of functions?

8:57 and when do you populate this global map?

8:57 sound like you are adding type information for vars before they are defined

8:58 ambrosebs: raek: yes, that correct

8:59 function types are a deftype with a field of a list of arities

9:00 (Fn (IntegerT IntegerT -> IntegerT) (FloatT -> FloatT))

9:02 raek: one neat thing that clojure offers is that you can store metadata on vars

9:02 to me var metadata sounds like a good place to keep type information for a global value

9:03 clgv: ambrosebs: you are adding typechecks to clojure?

9:03 ambrosebs: raek: here's what I want type annotations to look like

9:03 https://github.com/frenchy64/typed-clojure/blob/master/src/typed_clojure/core.clj#L262

9:04 clgv: :)

9:04 T adds a type annotation at compile time

9:05 raek: ambrosebs: you can use ater-meta! to attach that type info directly on the var

9:05 just intern it first

9:06 ambrosebs: can you intern vars from different namespaces?

9:07 ooo that's cool

9:07 raek: (defmacro T [s ...] `(do (intern *ns* ~s)) (alter-meta (resolve ~s) assoc :type ...)))

9:07 ambrosebs: that won't work, I want it at compile time

9:07 raek: there are multiple ways to do this

9:08 you can intern the var in the macro, you can do it in the code that the macro expands to

9:08 ambrosebs: interesting

9:09 raek: (defmacro T [s ...] (do (intern *ns* s) `(alter-meta ~(resolve s) assoc :type ...)))

9:09 ambrosebs: if I intern a var, will a (def ..) override the definition?

9:09 raek: or even (defmacro T [s ...] (do (intern *ns* s) (alter-meta (resolve s) assoc :type ...) nil))

9:09 ambrosebs: yes

9:09 ,(doc intern)

9:09 clojurebot: "([ns name] [ns name val]); Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var."

9:10 raek: def always overwrite the var value

9:10 but it keeps any old metadata

9:11 ambrosebs: raek: I guess I'm only interested in the metadata

9:11 raek: I guess you want T to not change the value (if it exists), but always change the metadata

9:12 ambrosebs: exactly

9:14 raek: ambrosebs: "The var will adopt any metadata from the name symbol." <-- this only seems to be the case when the var didn't exist before the call to intern. you might need to use alter-meta!.

9:16 ambrosebs: is a var is mutable? are any changes global side effects?

9:20 clgv: I would love "function arity inference" in the clojure compiler. that should be possible in most cases.

9:21 that would eliminate a lot of runtime errors when refactoring code

9:22 or plain writing new code and making arity errors^^

9:44 raek: ambrosebs: yes. when you call def, intern, alter-var-root!, or alter-meta! you directly mutate the var

9:45 these mutations should not happen after the application is initialized, though

9:45 (except when you are fixing bugs)

9:48 ambrosebs: raek: I wonder if keeping a separate map has advantages?

9:48 it seems redundant now you've mentioned the metadata on vars

9:50 what about adding type metadata to Classes? I haven't thought it through myself

9:51 raek: Classes cannot have metadata

9:52 ambrosebs: it seems a global map from symbols to types would generalize var and class type annotations

9:53 raek: but you could think of a Class as a typedefinition...

9:53 ambrosebs: exactly :)

9:53 you can see I haven't thought that far

9:54 raek: if the type (in your system) of a Class is always the same, you don't need to store any type info on the class itself

9:54 you only need a function from Class to type

9:55 ambrosebs: ah

9:55 that makes sense

9:56 yes, it's just a value

9:56 raek: exactly

9:56 ambrosebs: aha :)

9:57 licenser: Raynes: just reading your post to tentacles :) nicely written

9:59 ambrosebs: raek: I was confused by intern returning classes

10:00 raek: hmm

10:00 I think I got that wrong

10:00 I meant resolve

10:01 raek: it might be simpler to just ignore the java interop parts of clojure in the beginning

10:01 ambrosebs: yes

10:02 are local bindings vars too?

10:03 raek: no

10:04 but the compiler will give you a map of all locals in &env, so they are easy to recognize

10:05 hrm. the env parameter of resolve must have been added in clojure 1.3

10:07 ambrosebs: that's cool

10:08 I'm using the ClojureScript analyzer to parse the forms. I could probably use the env info the analyzer gives

10:09 Bahman: Hi all!

10:11 raek: it's really amazing that you can add these kind of features to a language in the form of a library

10:12 ambrosebs: raek: oh yea, generalizing the analyzer a little, and this kind of thing will be very nice

10:12 It requires surprisingly few changes to analyze Clojure code

10:15 It's mostly deleting code, too

10:47 raek: metadata in vars seems to work nicely

10:56 licenser: so quiet!

11:01 goodiebo_: is there a built-in functions for inverting a hash-map?

11:06 raek: goodiebo_: yes, check out clojure.set/map-invert

11:07 goodiebo_: raek: perfect thanks

11:11 how about a function that will replace keys using another map? (replace-keys {:id [1 2]} {:id :ID}) => {:ID [1 2]} ?

11:13 ahh walk/prewalk-replace works nicely

11:14 blakesmith: If I have a RandomAccessFile, is there a function that will read n bytes from the file and return a list of bytes?

11:14 goodiebo_: hmm no, i don't want it to be recursive like walk does. Just one level...

11:37 blakesmith: To follow up on my earlier question, is there a more idiomatic way to achieve this? https://gist.github.com/1438863

11:38 nachtalp: blakesmith: you want to read exactly n bytes from the stream?

11:38 blakesmith: Yes.

11:41 jlf: hi all, i encountered a problem in clojure-mode version 1.11.4 (from marmalade) where clojure-jack-in was failing due to the (search-forward "(run-hooks 'slime-load-hook) ; on port") form in clojure-eval-bootstrap-region failing. i worked around it by changing the search expression, which got me to the repl, but i'm wondering if this is a known issue or if some other code might be stale and causing this search failure.

11:42 nachtalp: blakesmith: one moment...

11:47 blakesmith: nachtalp: I found line-seq, which allows you to use 'take' for the number of lines. Is there something akin that allows you to 'take' a number of bytes?

11:48 nachtalp: blakesmith: the problem is that nothing in inputstream guarantees that you can read a certain number of bytes - also, your code doesn't check for the return value -1 (ie end of stream)

11:48 blakesmith: Ah, good call.

11:49 nachtalp: blakesmith: there's the possibility to read directly into a byte array, but that also doesn't guarantee that the array will be filled after reading...

11:55 blakesmith: nachtalp: I guess I was going for something like Ruby's IO#read. http://www.ruby-doc.org/core-1.8.7/IO.html#method-c-read. I'm trying to learn the more idiomatic Clojure way to do file i/o with bytes.

11:55 As opposed to reading lines, which doesn't work for the file type I'm trying to read.

12:09 nachtalp: blakesmith: i'm not aware of a built-in that does that, so you might be stuck with java interop there..

12:10 blakesmith: Cool, thanks a ton for your help!

12:38 manutter: hrmph, can't seem to get off the ground with cgrand's parsley

12:39 does the phrase "shift/reduce conflict" send a chill down anyone else's spine? :)

12:39 I'm just trying to write a simple parser to read a comma-separated list of words: "foo" or "foo,bar" or "foo,bar,baz"

12:40 can't seem to find any parsley grammar that does anything but throw shift/reduce exceptions on compile.

12:46 tmountain: is there a way to determine which protocols a given record implements?

12:49 manutter: hmm, there's satisfies?, if you know a specific protocol you want to look for

12:50 tmountain: ^^

12:51 tmountain: manutter: that's exactly what I was looking for, thanks!

12:51 manutter: cool :)

13:03 woot, figured out parsley: (p/parse :list #{:word [:list "," :word]}, :word #"a-z")

13:03 I was trying [:word "," :list], but that's the shift/reduce gotcha. The list has to come first.

14:01 goodieboy: what would be the most idiomatic way to change keys like this? {:1 11 :2 22} => {1 11 2 22}

14:02 Raynes: &(into {} (for [[k v] {:1 11 :2 22}] [(name k) v]))

14:02 lazybot: ⇒ {"1" 11, "2" 22}

14:02 Raynes: Well.

14:02 Close enough.

14:02 technomancy: clojure.walk/stringify-keys

14:03 goodieboy: ahh i see

14:03 technomancy: err--wait no

14:03 there's no numericize-keys

14:03 Raynes: &(into {} (for [[k v] {:1 11 :2 22}] [(Long. (name k)) v]))

14:03 lazybot: ⇒ {1 11, 2 22}

14:03 goodieboy: yeah that's it ok

14:03 Raynes: I really just didn't want to make that LONGer. Get it, LONGer?

14:03 goodieboy: eheh :)

14:03 thanks!

14:06 technomancy: clojurebot: core?

14:06 clojurebot: idiomatic clojure uses dashes to separate words

14:06 technomancy: clojurebot: core is what you put in a namespace when you can't think of a better way to avoid single-segment namespaces.

14:06 clojurebot: You don't have to tell me twice.

14:06 technomancy: ^ fair?

14:07 licenser: technomancy Raynes a loa :) I have a new bright idea for lein - even so I am not sure if it is possible with the underlaying maven stuff

14:08 how about 'optional dependencies' like if I use clojureql I will most likely either want postgres or mysql drivers, how if it would be possible to give such kind of options in your project.clj (in this case for clojureql)

14:09 technomancy: licenser: I've thought of that, but I can't think of a good way for consumers to specify which one they want that's any better than just adding the dependency for themselves

14:09 I think it's a documentation issue more than anything else.

14:10 licenser: it is, so it still would be cool

14:10 technomancy: if a dependency is optional, you don't get it unless you specify that you want it. if you specify that you want it, what's the point of the optional dependency?

14:10 licenser: you could give them a simple text choice: hey we suggest you install 1) postgres-jdbc 2) mysql-jdbc 0) don't do anything.

14:10 technomancy: I don't want dependency fetching to ever be an interactive task.

14:11 it needs to work reliably unattended

14:11 licenser: I can understand that :)

14:11 technomancy: I wish I had a good solution to the problem though, because I understand where you're coming from.

14:12 licenser: how about integrating it into lein search?

14:12 as in make lein search interactive

14:12 or allow it to be interactive

14:12 could even do incremental search stuff or so ^^

14:12 zerokarmaleft: technomancy: was it you that opined that satnav was a better word than GPS?

14:13 technomancy: zerokarmaleft: yeah. also the British pronunciation of "dancing" puts ours to shame.

14:13 licenser: yeah, maybe lein search could drill down into focusing on a specific artifact or something?

14:13 licenser: *nods*

14:13 zerokarmaleft: technomancy: excellent, then you'll love this => http://www.youtube.com/watch?v=FMiLQwKLSQM

14:13 osa1: I'm being disconnected from SLIME instantly when I run `clojure-jack-in`, anyone has any ideas?

14:14 technomancy: zerokarmaleft: aw yeah; nice

14:14 osa1: I'm using this version: http://common-lisp.net/project/slime/

14:14 licenser: like you run lein search --interactive (to preserve the old behavior) and get a input where you can start typing and it starts filtering the artifacts it knows slowly then when you have found what you want you 'select' it and it presents you with the option to add it, or select some 'optional' dependencies

14:15 clojure-jack-in is really great if it works :P

14:16 osa1: sorry no clue I am always happy when it works and just clean and restart everything if it doesn't

14:17 technomancy: osa1: jack-in is meant to only support a single connection at a time

14:18 so it should drop your connections while it starts a new one.

14:18 osa1: technomancy: I'm running emacs, opening a project, and then M-x clojure-jack-in. I have only one connection

14:19 technomancy: you mean it connects successfully and then disconnects?

14:20 osa1: I updated swank-clojure via and now I can't start swank server(got stuck in "Starting swank server...")

14:20 technomancy: yeah

14:20 technomancy: make sure you're on the latest clojure-mode (1.11.4) and swank-clojure (1.3.3) and paste the contents of *swank*, I guess

14:21 osa1: ok, now I'm upgrading lein..

14:21 (I'm not sure why I'm doing that..)

14:21 licenser: osa1: because you are desperate ;)

14:21 osa1: whatever, let's upgrade clojure-mode

14:21 licenser: also update your BIOS when you are at it ^^

14:22 * licenser is not helpful today

14:26 jlf: osa1: do you see something like ``error in process filter: Search failed: "(run-hooks 'slime-load-hook) ; on port"'' in *Messages* by chance?

14:27 osa1: jlf: no

14:27 jlf: so much for that theory

14:28 osa1: great, and now I'm getting huge java traceback when I run lein

14:28 reinstall!

14:29 technomancy: osa1: make sure you have only one swank-clojure in ~/.lein/plugins

14:29 there was a bug in earlier versions of lein that allowed two to sneak in there and mess things up

14:29 osa1: actually I've just deleted ~/.lein

14:30 I'm reinstalling rightnow

14:30 right now*

14:34 technomancy: here's the error I'm getting with updated swank-clojure and clojure-mode: http://imgur.com/hxe50

14:34 technomancy: that's not an error

14:34 osa1: so is it ok? because my clojure repl's not working

14:35 I'm still getting disconnected after a few seconds on repl

14:35 technomancy: wait, did you say you installed slime from common-lisp.net?

14:35 osa1: technomancy: yes, I'm using it for common lisp

14:36 technomancy: osa1: that's not going to work; you need a specific version for clojure.

14:36 jack-in will load that version, but if you have additional config for a different version it could easily interfere

14:36 osa1: technomancy: hmm, can I use this version for common lisp and clojure specific version for clojure?

14:36 2 slime installations

14:37 technomancy: I don't know the specifics about CL, but the best way to do it is to just not load any CL-specific code at Emacs launch time; load it when you're going to work on CL

14:38 a single Emacs instance can't have both versions loaded, but running M-x clojure-jack-in will load in the clojure one on-demand, so all you have to do is get the CL stuff out of the way and don't try to use them both in the same instance

14:39 osa1: technomancy: I don't think I'm this good at emacs, maybe I can just copy different slime folders while I'm working on clojure or common lisp(since I'm not working with both at the same time)

14:40 technomancy: osa1: you don't need any Emacs configuration for clojure apart from clojure-mode

14:44 osa1: technomancy: sorry, I didn't get it, this page https://github.com/technomancy/swank-clojure says swank-clojure lets SLIME connect clojure projects and links to common-lisp.net's SLIME page, I installed my SLIME from linked page, and still can't connect to SLIME, what should I do?

14:45 technomancy: osa1: don't install your own copy of slime, just use the one that comes with swank-clojure

14:45 I'll fix the readme to remove that link, since it's a bit misleading

14:46 osa1: ok, I'm commenting my slime configuration in my emacs config

14:47 technomancy: great, it worked! thank you very much

14:48 now all I need is finding a way to use my slime installation when I'm working with common lisp, maybe I should ask in #emacs

14:48 wow, my autocomplete settings are working too :)

14:50 how can I load repl-utils in clojure 1.3?

14:56 zerokarmaleft: (use 'clojure.repl)

15:42 PPaul: is there something like clojure.walk for javascript?

15:56 ckirkendall`: PPaul: treewalker

15:56 or nodeiterator

15:56 PPaul: thanks!

15:56 cus i'm rolling my own and sucking at it

15:57 ckirkendall`: PPaul: only problem it only works in newer browsers

15:57 PPaul: that's no good

15:58 clojure's walk is like 100 lines of code for 10 functions

15:58 it can't be so much more difficult in js

15:58 even a less featured version will do

15:58 also, i don't care about the DOM

15:58 if that means anything

15:59 brehaut: PPaul: it's almost an inherintly sucky thing to have to write in JS given the difficulty of working out what the type of anything is

15:59 PPaul: i know

15:59 i know :(

15:59 there aren't too many types, though

15:59 i'm using underscore, so that's sorta taken care of

16:00 lucian: using CoffeeScript also helps

16:01 not knowing the type of something isn't necessarily bad, seeing how object construction works in javascript

16:01 PPaul: i rather use clojure script than coffee script

16:01 lucian: for me, the terrible bits are 1) lack of ints with automatic promotion to bigints and 2) implicit type coercions

16:02 PPaul: i've seen coffee script stuff, and i don't think it's much of an improvement over js

16:02 ckirkendall`: PPaul: what type do you need to support

16:02 lucian: PPaul: it keeps the good bits

16:02 PPaul: i don't need to support types, someone else brought this up :P

16:02 i need to walk

16:03 i can walk, i have a demo working using a transformer that returns it's node.... but when i start doing real transformations stuff fucks up

16:03 makes me want to use clojue :)

16:03 abaranosky_: does anyone have suggestions for how the Midje learning experience (tutorials, examples, doc, etc) could be improved? We'd like to hear your thoughts: http://groups.google.com/group/midje/browse_thread/thread/5c27253f3fdb53b6

16:04 ckirkendall`: PPaul: clojurescript included clojure.walk

16:04 PPaul: i know

16:05 lucian: PPaul: just use that then, if you dislike JS that much

16:06 PPaul: i will attempt to

16:06 got some big projects in js now...

16:16 ckirkendall`: Is there anyone out there that knows a good way to unit test clojurescript code?

16:19 jcromartie: this is useful: (defn shuffles [coll] (lazy-seq (concat (shuffle coll) (shuffles coll))))

16:21 hiredman: jcromartie: (mapcat shuffle (repeat coll))

16:21 jcromartie: I didn't realize mapcat was lazy

16:21 nice

16:21 you win

16:24 PPaul: most of the seq functions are lazy

16:38 y3di: you cant interact with java libraries in clojureCLR right?

16:39 babilen: Hi all. I am looking for a good way/library to deal with file paths. I am under the impression that I want to use Java 7's Path, but unfortunately (Paths/get "/etc") does not work, while (Paths/get (URI/create "file:///etc")) does. Apart from that I am also not sure if I really want to introduce a dependency on Java 7. What's the common approach in the Clojure community?

16:40 I am probably doing something wrong with (Paths/get "/etc") and would like to understand why it throws a "java.lang.String cannot be cast to java.net.URI" exception as well.

16:40 technomancy: babilen: depends on what you need that java.io.File doesn't provide, I guess

16:42 babilen: technomancy: Well, I'd like to be able to normalise paths, join them, access system specific information such as User's home directories, ...

16:42 goodieboy: anyone know of a good validation library/dsl, something to be used in a web app?

16:42 ibdknox: goodieboy: Noir includes a validation library

16:42 technomancy: babilen: clojure.java.io/file can join; .getAbsolutePath can normalize, and (System/getProperty "user.home") will get you the third =)

16:43 amalloy: File does all of those things, except that it's not clear what "joining" paths means

16:43 goodieboy: ibdknox: I'll check that out thanks

16:43 technomancy: or maybe .getCanonicalPath?

16:43 amalloy: technomancy: probably canonical

16:43 ibdknox: goodieboy: http://webnoir.org/tutorials/forms

16:44 amalloy: depends what he wants, i guess

16:44 technomancy: it does raise a good point that there's not really a way to specify dependence on jdk 1.7

16:45 goodieboy: ibdknox: interesting thanks. i'll give it a try

16:46 babilen: amalloy, technomancy: Ok, great. By joining paths I essentially mean something that would behave like (join "/etc/" "X11") → "/etc/X11" - I am also a bit used to the following behaviour (join "/etc/X11" "/usr/local" "bin") → "/usr/local/bin" but that is no requirement

16:46 technomancy: babilen: yeah, c.j.io/file will raise an exception if anything but the first arg is absolute

16:47 apart from that you should be god

16:47 good

16:47 ibdknox: lol

16:47 technomancy: can I be god?

16:47 babilen: Normalise would do something like (normalise "~/bin/../lib") → "/home/$USER/lib"

16:47 technomancy: "behold my godlike powers of ... being able to construct portable file paths!"

16:47 amalloy: babilen: that's basically canonicalization, except i don't think it does ~ substitution

16:48 technomancy: babilen: there's no support for $USER or ~ afaik though

16:48 amalloy: because ~ is a valid filename character; converting it is something your shell does, not the filesystem

16:48 pjstadig: JVM is not unix

16:48 technomancy: which is dumb

16:48 pjstadig: JNU?

16:49 babilen: I don't think it does. I can happily use c.j.io/file, just wanted to ask if I am just not seeing the obvious.

16:49 * pjstadig registers jnu.org

16:49 babilen: amalloy: I agree

16:49 ibdknox: all permutations up to 5 letters are taken I believe

16:49 amalloy: technomancy: plz to propose alternative? i think (java.io.File. "~") has to represent a file named ~ inside your cwd

16:50 technomancy: amalloy: probably the way to go is to have a convenience method plus a low-level method that treats everything literally

16:50 ibdknox: amalloy: (defn awesomer-file [f] ....

16:50 amalloy: ibdknox: are you saying all 26^5 five-letter domain names are registered?

16:51 ibdknox: for .com, I believe so

16:51 it may be 4

16:51 amalloy: i just checked slkur.com/org, and that is free for the taking

16:51 technomancy: not for long!

16:51 ibdknox: lol

16:52 amalloy: hm. same for slku.com. that is, the dns lookup failed. is there something wrong with my methodology or are you just wrong?

16:52 babilen: Ok, any idea why (Paths/get "/etc") throws the aforementioned exception?

16:52 ibdknox: amalloy: doesn't mean they point anywhere

16:52 amalloy: babilen: usually when someone has this issue it's because jdk7 has vararg methods you're using wrong

16:53 ibdknox: amalloy: http://www.dotsauce.com/2007/11/02/four-letter-domains-all-registered/

16:53 dated 2007

16:53 amalloy: yeah, i see they have a whois

16:53 babilen: amalloy: That is indeed the case (vararg method) - But where is my mistake?

16:53 ibdknox: amalloy: and a better way to determine if a domain is owned

16:53 http://domai.nr/

16:54 amalloy: ibdknox: if i owned all these retarded names i'd at least have the decency to resolve them to

16:54 ibdknox: haha

16:54 amalloy: those jackasses should be required to have a legitimate site or give them up :p

16:54 jcromartie: (defn expand-path [p] (.replace p "~" (get (System/getenv) "HOME")))

16:54 done

16:54 * wink is happy with his 3-letter .org

16:55 ibdknox: wink: what do you have?

16:55 babilen: jcromartie: Ta

16:55 amalloy: jcromartie: ~amalloy/foo

16:55 jcromartie: amalloy: who does that?

16:55 nobody

16:55 that's who

16:55 ibdknox: lol

16:55 amalloy: wrong, bro

16:55 ibdknox: could just check if there's a slash after it

16:55 amalloy: and also, that is unix-only. you want (System/getProperty "user.home")

16:55 ibdknox: go go regex

16:55 wink: ibdknox: f5n.org (and also .de)

16:56 amalloy: wink: three-"letter"

16:56 wink: pfff :)

16:56 ibdknox: yeah :p

16:56 wink: character then

16:56 amalloy: ~vararg

16:56 clojurebot: It's greek to me.

16:57 amalloy: clojurebot: Vararg methods on the JVM |are| really just methods that take an array of the appropriate type as the last argument. To call them, you need to construct an array (say, String[]) with into-array, and pass that.

16:57 clojurebot: Ik begrijp

16:57 amalloy: babilen: ^

16:57 ibdknox: ~vararg

16:57 clojurebot: Vararg methods on the JVM are really just methods that take an array of the appropriate type as the last argument. To call them, you need to construct an array (say, String[]) with into-array, and pass that.

16:58 amalloy: man, suddenly i'm tempted to surround that into-array with a ##doc so lazybot will chime in too. pretty sure that's a bad idea

16:58 ibdknox: amalloy: we have to stall the singularity as long as possible

16:58 babilen: amalloy: That feels wrong, but thanks a lot! (I would have expected it to work as above)

16:59 amalloy: well. you can expect what you want, but vararg methods are not real

17:02 TimMc: timmc.org was the smallest I could get.

17:02 * babilen beholds the beauty of (Paths/get "/etc" (into-array [""]))

17:02 TimMc: tim.mc would probably require establishing a corporation in Monaco, and I don't speak French.

17:03 ibdknox: apparently all the chris grangers of the world are either basketball team managers or photographers and they all wanted websites :p

17:04 amalloy: babilen: you can wrap that up in a macro or function, if you want

17:04 ibdknox: chris-granger.com was the best I could do

17:05 licenser: watching Tron I kind of feel bad about using the garbage collector :(

17:05 ibdknox: lol

17:06 babilen: amalloy: Well, I will not use it as I don't want to depend on 7, but follow your suggestions above. Just wanted to understand what I was doing wrong so that I can deal with similar situations in the future.

17:06 TimMc: licenser: Let's set up a "home for retired objects" in your RAM.

17:06 licenser: TimMc: yes something like that, I mean perhaps we can make like a retirement home on taps or something along the line

17:06 amalloy: (defn real-varargs [f required-count] (fn [& args] (let [[before after] (split-at required-count args)] (apply f (concat before [(into-array after)]))))) (def paths (real-varargs #(Paths/get % %2) 1)) or something like that

17:07 licenser: or we ship them in the cloud

17:07 everything is better when you do cloud with it.

17:07 babilen: amalloy: Splendid, thanks!

17:08 amalloy: does that actually work? i don't have 7, just kinda threw it together

17:08 licenser: I wonder if "to cloud" will become a word just as "to google"

17:15 babilen: amalloy: I will try it in a second and let you know. -- First I want to understand what my misconceptions about varargs were and decide if a jdk7 dependency is acceptable.

17:19 amalloy: babilen: rewrote it as a macro, which is slightly more convenient to use: https://gist.github.com/1440296

17:20 you might need to add an option to specify what class of array to create; for example if you need to pass an Object[] but the first element is a String

17:39 babilen: amalloy: You are most kind and it works perfectly with the addition of said option.

18:20 technomancy: so... this happened: https://github.com/technomancy/lein-heroku

18:22 ibdknox: technomancy: short of the procfile, lein noir new blah spits out something that pushes to heroku cleanly

18:22 amalloy: (defn ps:restart) ;; you monster

18:23 technomancy: ibdknox: yeah, the skeleton stuff is just to help folks follow along with the devcenter tutorials.

18:47 rien: Raynes: dude, are you there?

18:47 Raynes: rien: Dude. I am.

18:48 rien: heh. listen, I'm trying to get in touch with nixeagle

18:48 about his cool uhm... no-name emacs buffer online thingy

18:48 Raynes: Man, I was looking for that a couple of days ago.

18:48 Couldn't find it.

18:48 rien: then I found in some clojure logs that he was going to package that up and you were in talks with him

18:48 aww

18:48 Raynes: Anyways, he never comes around anymore.

18:49 licenser: dude dude dude, you two sound like a train

18:49 rien: oh so he used to be here?

18:49 Raynes: You can probably get in touch with him on github.

18:49 rien: I know him from #lisp

18:49 Raynes: https://github.com/nixeagle

18:49 rien: I sent him an email on his .org domain which is barren

18:49 yeah I found that, look over all his repos, it's not there :) so I'll send him a message I guess

18:49 but did he ever get around to packaging it up?

18:49 Raynes: I don't think he did.

18:50 rien: so the people that wanted it are still waiting for it? if we have a quorum that might motivate him :)

18:51 ieure: :( https://github.com/nixeagle/pokemon-online

18:51 Raynes: Yeah, he's a big pokeguy.

18:51 rien: I guess I'll send him a message. I hate to bother people

18:51 ieure: Jesus.

18:52 This is the sound of me judging.

18:52 Raynes: He does crazy AI stuff with pokemon.

18:52 ibdknox: lol

18:52 ieure: Hahahaha

18:52 Raynes: rien: I still want it.

18:52 rien: Raynes: do you have a github account? I could mention your username on the message. just one guy wanting something isn't very motivating

18:52 Raynes: rien: http://github.com/Raynes

18:53 rien: will do. the-kenny also wanted it, and nullman too

18:54 Raynes: It probably wouldn't be too hard to do again if you knew a little elisp-fu. technomancy will write it for us. He writes anything he is ever asked to write.

18:54 technomancy: I think you got that backwards

18:56 the-kenny: What do I want? :)

18:56 rien: hahah

18:56 brehaut: thats a bit yakov smirnoff isnt it?

18:56 rien: hey the-kenny, do you still want that emacs buffer publishing code (sorry, that never had an official name, I'm doing my best to describe it)

18:56 okay, maybe not my best

18:57 the-kenny: rien: for gist.el? Yeah, that would be useful for me

18:57 (and a few other people I know too)

18:57 rien: no, not that

18:57 I'm talking about that nixeagle website thing where you could see his emacs buffer live

18:58 the-kenny: Ahhh

18:59 That one would be cool too :)

18:59 sorry, saw gist.el in your github account.

19:01 rien: okay, three now. do you have a github account?

19:03 Raynes: rien: I think you're doing okay. I'd just ask him if he would, at the very least, point out where the code is and put it on Github if it isn't already there. You (or somebody else) can handle the packaging and such if he doesn't feel like it.

19:03 He's a nice guy. He'll probably do it.

19:04 rien: yep, I only talked to him very briefly and he seemed a nice guy. but I understand people sometimes don't have the time to do everything they'd like to

19:05 the-kenny: rien: Yup, github.com/the-kenny Sadly, I don't have much time lately :(

19:05 Raynes: Join the club.

19:05 ibdknox: Can I be the president of the club?

19:06 jodaro: ibdknox: do you have time for that?

19:06 rien: I don't have time to be appointing people president

19:06 ibdknox: jodaro: shit

19:06 no.

19:06 jodaro: i know, right?

19:07 heh

19:07 one kid to the other: no no, get the laser jetpack, its way better! that one sucks!

19:08 the-kenny: Gnah. We need slime-dream: A library to interact with a running repl from inside a dream.

19:09 jodaro: the-kenny: i was thinking of something similar yesterday while eating a sandwich for lunch, wishing i could test some code out without needing my hands since they were busy.

19:09 rien: Raynes: message sent. now we wait

19:09 the-kenny: jodaro: Got an iPhone 4s? Maybe Siri can help us

19:09 jodaro: siri, write bug free code.

19:10 the-kenny: Siri, open slime repl on mymachine:4663 and write some cool stuff

19:11 Fun fact: The name of my neighbor's daughter is Siri

19:13 jodaro: so many jokes to make

19:13 so little time

19:16 the-kenny: rien: Thanks for taking up on the subject. Keep me updated :) Have to go to bed now. Long day at university tomorrow.

19:16 rien: I will

19:19 the-kenny: good night :)

19:26 rien: night!

19:45 alexbaranosky: does anyone use clojure-refactoring w/ their Emacs? I'm an Emacs noob and would love to hear how you use it

20:01 _ulises: I'm trying to practise writing macros and I'm having issues writing a macro that returns a fn with options args

20:02 would anybody mind giving me a hand? This is what I have: http://pastebin.com/KMrdxv9c

20:02 which of course does not work.

20:02 alexbaranosky: I installed the emacs starter kit with emacs 24, now when I do `M-x clojure-jack-in` I'm getting an error: (error "Could not start swank server: That's not a task. Use \"lein help\" to list all tasks.

20:02 ")

20:03 _ulises, let me see

20:03 _ulises, you didn't define msg

20:03 _ulises: alexbaranosky: thanks. Regarding your error, you may want to install the swank leiningen plugin? I'm just guessing as I just use the old style with slime-connect, etc.

20:04 alexbaranosky: when I do a lein help, swank is listed under the options

20:04 _ulises: alexbaranosky: indeed I haven't. That was my poor attempt at defining varargs so that they can be used in the body of the function :(

20:07 alexbaranosky: _ulises, maybe something more like this?: http://pastebin.com/GY7fHu4s

20:08 (hello [arg1 arg2] (print "hi") (print "mom")) ????

20:08 hiredman: alexbaranosky: generally means you don't have swank-clojure installed (should be installed as a plugin)

20:08 alexbaranosky: hiredman, thanks, will look into that

20:08 _ulises: alexbaranosky: thanks!

20:09 amalloy: _ulises: you have to decide *how* the varargs will be available to the user. do you want to introduce a variable named msgs in their scope, or let them decide how to destructure, or what?

20:09 _ulises: hum, wait

20:10 amalloy: well, I want the macro to return a function which takes a variable number of arguments and then the user's code can ref. those by name, e.g. msgs

20:10 so, ideally the macro would return (fn [& msgs] ( ... user code that may use msgs ... ))

20:11 I just replaced my msgs with msgs# which works, but then that becomes inaccessible in the user code :(

20:11 amalloy: _ulises: what i'm getting at is, how does the symbol "msgs" get chosen? you just made it up now, but your macro can't guess what you want. you have to decide to have it always named msgs, or let the user specify names, or whatever

20:12 _ulises: amalloy: not sure I'm following, but I wouldn't mind if it was always named msgs

20:12 e.g. ((hello (println msgs) "foo" "bar") ; prints ("foo" "bar")

20:13 ach, missing a parens

20:13 amalloy: okay. so that is definitely something you can do, but clojure does try to discourage it because it's the cause of some subtle errors in other macro languages

20:13 _ulises: oh, right.

20:13 amalloy: (defmacro hello [& body] `(fn [~'msgs] (println ~'msgs) ~@body))

20:14 alexbaranosky: so now you've got a snazzy new anaphoric macro :)

20:14 _ulises: heh

20:15 alexbaranosky: or am I wrong, I'ms still a bit stupid with macros :)

20:15 amalloy: nah, you're right

20:15 _ulises: indeed

20:15 amalloy: but beware: even chuck norris double-checks when he introduces anaphora

20:15 _ulises: I was reading the anaphora macro in the JOC book and thought "hey, this is what I need"

20:16 and I even had in one of my versions ~'msgs but it didn't compile :/

20:16 anyway, thanks for your help amalloy and alexbaranosky

20:16 alexbaranosky: no problem

20:16 licenser: _ulises: one way to allow what you want would declaring msgs and then binding it inside the function

20:16 alexbaranosky: it's fun

20:17 licenser: another one would be to allow the unser to name the variable themselves - which is quite nice

20:17 _ulises: licenser: along the lines of `(fn [foo#] (binding [msgs foo#] ... ))?

20:18 amalloy: licenser: indeed, but then users will be tempted to try and destructure it themselves, which makes it rather hard for you to figure out what things to print

20:18 eg, they may decide to name it not msgs but [msg1 msg2]

20:18 licenser: _ulises: yap along this lines, just need to declare msgs first and usually it would be called *msgs* I think

20:18 _ulises: yeah

20:18 well, not sure it makes sense in the context of what I'm trying to do

20:18 amalloy: fwiw i think having a dynamic variable and binding it is nuts

20:18 licenser: ah I see what you mean yes but you can work around that by giving it an additional internal name

20:19 _ulises: so, this macro is called hello right now but it should be called handler, and this creates a handler for a message. I'm writing a mega-simplified actors lib.

20:19 licenser: just to be sure, are we actually discussing the case of the hallo function or is that a example for something

20:19 alexbaranosky: hiredman: strangely I ran `lein plugin install swank-clojure 1.3.3` then `M-x clojure-jack-in` from Emacs and got the same error message... do I need to restart Emacs?

20:19 licenser: heh wow you can read minds _ulises

20:19 _ulises: so it may not make sense to have the user name the msgs parameter

20:19 hehe

20:20 licenser: will the user ever have to know the name for msgs?

20:20 I mean in the example given there would be no need for that I think - or I miss it

20:20 _ulises: it'll be msgs

20:20 eh?

20:20 licenser: I mean is there a reason not to use msgs#

20:21 of cause the user won't be able to use it then but does he need to?

20:21 and yay for actors - go erlang go!

20:21 alexbaranosky: _ulises, why not instead use a function that wraps functions, but printing the args before calling the inner function?

20:21 _ulises: yes, indeed, using msgs# means the user's code cannot inspect the messages received

20:21 this is the pong actor: http://pastebin.com/jVyRT0eM

20:21 licenser: ah I see what you are planning

20:22 _ulises: with amalloy's shiny handler macro

20:22 licenser: and you need something like debug printing

20:23 _ulises: not me

20:23 I wanted to be able to write handlers that inspect the message further

20:23 licenser: (defmacro hello [[msgs-name] & body] `(fn [msgs#] (println msgs#) (let [~msgs-name msgs#] ~@body)))

20:24 how about something like that

20:24 _ulises: that would work...

20:24 lemme test that

20:24 licenser: you then could do ((hello [[msg1 msg2]] (println msg1)) "bla" "blubber")

20:25 I like the give the user parameters thing because he actually can do destucting ^^

20:25 it feels more like a function declaration that way

20:25 geez this medication isn't fun -.-

20:26 _ulises: yes

20:26 licenser: :)

20:27 _ulises: updated pong http://pastebin.com/tnur0N0s

20:27 licenser: (defmacro hello [[msgs-name] & body] `(fn [& msgs#] (println msgs#) (let [~msgs-name msgs#] ~@body)))

20:27 this is the correct code

20:28 otherwise you can't use more then one param

20:28 _ulises: yes, I used your code as is

20:29 licenser: but the first one was wrong ;)

20:29 _ulises: oh!

20:29 licenser: you could not call (h "bla" "blubb"

20:29 )

20:29 _ulises: yes, the fn definition

20:29 licenser: only one parameter was allowed :)

20:30 also I think there is a pattern matching library for clojure might want to look into that

20:30 _ulises: actually, that is fine, since I foresee messages being along the lines of {:msg msg :payload data}

20:30 licenser: since it will make it more erlangy

20:30 _ulises: yeah, well, this is just a toy, not trying to write this for any serious use :)

20:30 licenser: awww

20:30 _ulises: it might be an excuse to learn the patter matching lib though

20:30 licenser: _ulises ! ping

20:31 _ulises: licenser ! "try jobim for an actors lib"

20:31 licenser: _ulises ! "I don't want an actors lib I have my erlang for that!"

20:31 _ulises: hehe indeed

20:31 licenser: clojure is for nice single system high cores concurrency

20:31 and it is darn good for that

20:32 erlang is an entire different domain, and it is darn good for that

20:32 I love both, and since they aren't girls they don't go and say "but you can't love two!"

20:32 _ulises: hah

20:33 licenser: erlang and clojure can happily coexist, it is like an open relation ship with us ^^

20:33 like today I had some intercourse with erlang - so it wasn't very good, the build tool mess they have is taking a lot of fun out of things

20:33 _ulises: well eff me ...

20:34 alexbaranosky: when does one use Mix slime, and when do you use M-x clojure-jack-in ?

20:34 _ulises: licenser: turns out I'm quite digging your macro

20:34 licenser: :)

20:34 _ulises: I am glad to hear that

20:34 _ulises: alexbaranosky: I use slime-connect after having run lein swank

20:34 licenser: usually slime connect should only be needed if you connect to a remote slime server

20:34 alexbaranosky: I can connect to slime, but I don't really understand when you would use clojure-jack-in

20:35 licenser: as long as the project is local and a lein project the jack in thing is nice

20:35 alexbaranosky: ok

20:35 licenser, for somer eason jack-in isn't working, but slime is

20:35 licenser: jack in is (in my eyes) better for anything local since you don't have to run lein swank and block a console window

20:35 alexbaranosky: I just installed Emacs 24 with Technomancyy's blog

20:35 _ulises: licenser: turns out you can do this http://pastebin.com/XSZHh6Py

20:35 ibdknox: emacs 24 includes technomancy's blog now?

20:36 that's pretty neat

20:36 I wonder how they keep it up to date

20:36 licenser: ibdknox: git :P

20:36 alexbaranosky: ibdknox, I appreciate the attempt

20:36 licenser: alexbaranosky: in what way isn't it woring?

20:37 on c'mon alexbaranosky it was a quite funny comment I could laugh

20:37 ibdknox: by the way totally great work with pinot!

20:37 alexbaranosky: I usually type much stupider things than that though. I think he jumped the gun )

20:37 licenser: ^^

20:37 ibdknox: licenser: haha thanks

20:38 licenser: alexbaranosky: he does not mean any harm, usually people here are a funny bunch ^^ I am sure we have laughed a lot about ibdknox in the past too

20:38 * _ulises just realised that now that one can write more complex handlers using this shiny new macro, actually, fn would do the tricks :/

20:38 licenser: _ulises: hm?

20:38 alexbaranosky: can I see the new macro? link?

20:39 _ulises: I realised when I thought "hey, this handler thing looks like fn, maybe users could even write docstrings for their handlers ... oh wait."

20:39 licenser: *laughs*

20:39 alexbaranosky: licenser, I get this error message: (error "Could not start swank server: That's not a task. Use \"lein help\" to list all tasks.

20:39 ")

20:39 _ulises: alexbaranosky: (defmacro hello [[msgs-name] & body] `(fn [& msgs#] (println msgs#) (let [~msgs-name msgs#] ~@body)))

20:39 licenser: alexbaranosky: update lein, do lein clean

20:39 alexbaranosky: which seems to suggest it isn't installed as a lein plugin... but it is

20:39 licenser: _ulises: the reason why you wanted to macro was that you cold do stuff with the message before it is handed to user hand ?

20:40 and you have to have a file open in the project you want to jack in to

20:40 _ulises: licenser: nah, the print thing was my gettho debugging techniques

20:40 licenser: _ulises ! stone

20:40 _ulises: mailbox full

20:40 licenser: darn it

20:40 _ulises: too much hatemail already

20:40 licenser: ^^

20:41 alexbaranosky: _ulises, I still think you could probably just be writing a function that wraps another function, no?

20:41 _ulises: alexbaranosky: handlers are nothing but functions really

20:41 I wanted to pretify the code

20:41 so that you'd have {:message (handler (do urface))} as opposed to {:message (fn [& msg] (urface))}

20:42 licenser: how I love that you call it !- :P

20:42 _ulises: all those & # % make clojure look like perl

20:42 hah

20:42 yeah, well

20:42 licenser: how about making receive a macro?

20:42 _ulises: that's my next step

20:43 right now receive is an fn that returns an fn

20:43 alexbaranosky: _ulises, ahhh I see, a way I like to write that kind of macro is to write the function version first, then write a simple macro that calls the function version - like this: https://github.com/AlexBaranosky/Utilize/blob/master/src/utilize/testutils.clj

20:43 licenser: http://pastebin.com/index/XSZHh6Py

20:43 something like that

20:44 alexbaranosky: _ulises, see the do-at macro and the do-at function

20:44 _ulises: licenser: how's that different from what I have right now?

20:44 alexbaranosky: _ulises, correction do-at* function

20:44 licenser: _ulises: it looks more erlangy?

20:44 _ulises: alexbaranosky: yeah :)

20:44 licenser: oh no it does not, it ignored my changes ::(

20:45 _ulises: phew

20:45 licenser: http://pastebin.com/qW4HmFKZ

20:45 _ulises: I was squinting like hell here just to find the differences

20:45 I even thought you'd be trolling me

20:45 :'(

20:45 licenser: http://pastebin.com/13NsmYNK

20:46 _ulises: I feel so bad now

20:46 well actually, no I don't

20:46 :P

20:46 might be the meds so

20:46 _ulises: </troll>

20:46 anyway, that's the future plan for receive, yes, looks much nicer

20:46 licenser: =)

20:47 _ulises: I was thinking today in the shower whether one could even get away with [:msg -> (handler ...)]

20:47 licenser: I wonder if you could write clolang a clojure to erlang converter :P

20:47 _ulises: or just use erjang?

20:47 licenser: why the [] then

20:47 _ulises: no need for the [] really

20:47 licenser: [:msg {args}] -> body body body body

20:47 well where args is a horribly bad example

20:48 you could parse that up to the next thing that is a 'vector' -> and be done with it and really have it look like erlang :P

20:48 won't even need a do any more

20:49 and you could actually place a ',' after every body part, and a ; at the end and it still would be valid clojure

20:49 hah

20:49 _ulises: in theory it doesn't need a do

20:49 hehe

20:49 right, I was about to say that I should go to bed as I have work tomorrow

20:49 but now I need to finish this

20:49 licenser: http://pastebin.com/PXCyXfxN

20:49 _ulises: and add the pattern matching lib. Where can I find it?

20:49 licenser: and you COULD get away with this

20:50 _ulises: licenser ^^^^^^^^

20:50 I just wrote that in the pastebin :D

20:50 licenser: _ulises: I have no clue I think it is clojure.match

20:50 _ulises: thanks

20:50 licenser: https://github.com/clojure/core.match

20:51 that would make it look sooo erlangy :P they even have _

20:52 _ulises: yes

20:52 now please put the crack pipe away from me?

20:52 licenser: no crack pipe cough medicine

20:53 and I am under the dose my doctor described - I hate the stuff :(

20:53 but yes sleep is good, I start to feel really wired anyhow, night night and alexbaranosky I am sorry that we could not help with your jack-in try to catch technomancy tomorrow, he knows a lot. I think he actually helped every single clojure-jack-in user to set it up ^^

20:53 well with that words,

20:53 nighy night people

20:53 _ulises: enjoy licenser thanks for the help

20:54 jodaro: man

20:54 _ulises: there should be commans and & in that sentence

20:54 jodaro: that was a damn fine baklava

20:54 _ulises: *jealousy*

20:54 jodaro: at a cafe

20:55 technomancy: alexbaranosky: does it happen on every project?

20:55 alexbaranosky: I've only tried it once, let me try another

20:55 technomancy, (just got it set up)

20:57 technomancy, looks like it worked on a small toy project I tried it on

20:58 technomancy: alexbaranosky: make sure your other project doesn't have an old version of swank (or any version of swank, really) in dev-deps

20:58 alexbaranosky: that's probably the issue

21:00 technomancy, the culprit I suspect?: :dev-dependencies [[swank-clojure "1.2.1"]

21:00 technomancy: yeah, project deps always take precedence over user-level deps because they're more specific

21:00 get rid of that nonsense

21:01 alexbaranosky: I've got to ask the other committer if somehow he's using it, but yeah, at least locally I'll torch it

21:01 technomancy: tell him I told you to get rid of it. =)

21:01 that belongs as a user-level plugin anyway; it should never be in project.clj unless you intend to use it in production.

21:01 alexbaranosky: will do, that should give me the muscle I need ^^

21:02 It's probably old cruft from a time it made sense

21:02 or at least made MORE sense

21:02 technomancy: oh sure; leiningen didn't always have user-level plugins

21:03 alexbaranosky: the project is Midje, which has been around a while

21:09 jodaro: i do love me some destructuring, i'll tell you what

21:10 alexbaranosky: jodaro, amen to that

21:11 jodaro: just ripped out a bunch of let crap

21:11 by destructurifying the hell out of the params

21:11 and its way cleaner

21:12 alexbaranosky: technomancy, removed it from project file, then ran lein deps, but still isn't working... could there be a swank-related artifact lying around causing trouble?

21:14 duck1123: delete lib/dev/

21:15 alexbaranosky: duck1123, didnt help

21:15 ls

21:23 so far I am not impressed with Emacs must figure out what I'm missing

21:25 thought paredit seems nice

21:25 zerokarmaleft: alexbaranosky: give it at least a month

21:25 alexbaranosky: zerokarmaleft, I feel like it is missing some things I want

21:25 stupid stuff

21:26 like the ability to holdctrl-shift and right arrow to select a chunk of text

21:26 maybe the Emacs cheatsheets I'm finding aren't being exhaustive

21:28 duck1123: alexbaranosky: C-space to set the start mark, then arrow to the wnd, that's how you select in emacs

21:28 to the end

21:29 alexbaranosky: duck1123, are there any ways to select code chunks incrementally?

21:29 say by sexp ?

21:30 duck1123: If there are commands to move by sexp, I don't use them

21:30 C-h m is your friend when in an unfamiliar mode

21:31 zerokarmaleft: paredit's nav by sexp is C-M-f and C-M-b

21:32 alexbaranosky: zerokarmaleft, nice! Can you select as well as use them for nevigation?

21:33 zerokarmaleft: any nav used after setting a mark C-space expands or contracts the region

21:34 alexbaranosky: zerokarmaleft, ahhh got it, make sense

21:49 is there a plugin for emacs to give me a kind of project navigation tree?

22:05 TimMc: alexbaranosky: Holding down shift while using some navigation keys will do selection.

22:05 But yeah, C-space is the general case.

22:06 amalloy: alexbaranosky: C-M-space

22:06 TimMc: Pretty soon you'll be using M-x paredit-convolute-sexp and stuff like a pro.

22:07 * amalloy <3 convolute-sexp

22:08 TimMc: amalloy: I've actually started using it. Pretty sweet.

22:10 amalloy: another thing i like, not paredit-related, is C-u space

22:11 er, C-u C-space

22:11 TimMc: ?

22:12 amalloy: eg: "hm, need to add a :require". M-< to top of file...edit...C-u C-space, and i'm back where i left off

22:13 see also set-mark-command-repeat-pop, so that you can hit C-u and then just pound on C-space a few times till it gets you back to where you meant to be

22:14 TimMc: "mark ring"

22:14 Time to do some reading.

22:14 amalloy: TimMc: well, it's like the kill ring, but for marks

22:15 you can pretend it's a stack without missing much

23:00 ihodes: hmmm forgetting the name of the fn that keeps the intermediate stages of the reduce operation...

23:01 amalloy: $findfn + (range 4) [0 1 3 6]

23:01 lazybot: [clojure.core/reductions]

23:02 ihodes: exccccellllent thank you

23:04 ambrosebs: $findfn 1 2

23:04 lazybot: [clojure.core/unchecked-inc-int clojure.core/unchecked-inc clojure.core/inc clojure.core/inc']

23:04 ihodes: ah and one more higher-order, changes the arity on the fn without changing anything else?

23:04 ambrosebs: wow

23:06 amalloy: ihodes: you probably mean partial, but that's a pretty poor description of it :P

23:07 ihodes: amalloy: no, i mean allowing a fn like rest to take 2 argument, but not doing anything with the second

23:07 amalloy: i don't think that's anywhere in core?

23:07 but it sounds neat, go ahead and write it

23:08 ihodes: amalloy: ah i must be thinking of something in haskell...

23:08 a simple enough thing to write or fudge though

23:13 amalloy: hah, ambrosebs, i didn't realize we had so many variants on inc

23:13 ambrosebs: amalloy: where does findfn live?

23:14 amalloy: $google raynes github findfn

23:14 ambrosebs: $findfn 1 1 1

23:14 lazybot: [Raynes/lein-findfn - GitHub] https://github.com/Raynes/lein-findfn

23:14 [clojure.core/max-key clojure.core/unchecked-multiply clojure.core/bit-or clojure.core/cond clojure.core/dosync clojure.core/sync clojure.core/char-escape-string clojure.core/* clojure.core/with-loading-context clojure.core/bit-and clojure.core// clojure.core/unche... https://gist.github.com/1441431

23:15 amalloy: haha max-key. that's great

23:15 ambrosebs: ha!

23:16 amalloy: stupid google. the one you want is https://github.com/Raynes/findfn

23:17 ambrosebs: ah

23:17 amalloy: $findfn [1 2 3] 3 ; i love when rand-nth makes the result list

23:17 lazybot: [clojure.core/last clojure.core/count clojure.core/peek]

23:17 ambrosebs: :)

23:17 static type annotations would probably help the efficiency of that library

23:18 which is what I'm working on right now

23:18 amalloy: ambrosebs: yes, i am super in favor of your efforts to get type information

23:18 though i'm more interested in functional purity than argument/return types

23:18 TimMc: ,(doc max-key)

23:18 clojurebot: "([k x] [k x y] [k x y & more]); Returns the x for which (k x), a number, is greatest."

23:19 ambrosebs: I just need some help annotating `seq`

23:19 amalloy: TimMc: most importantly, (max-key k x) is always x; k never gets called

23:19 ambrosebs: xD

23:20 TimMc: $findfn :whatever :something :something

23:20 lazybot: [clojure.core/max-key clojure.core/cond clojure.core/dosync clojure.core/sync clojure.core/char-escape-string clojure.core/with-loading-context clojure.core/*clojure-version* clojure.core/case clojure.core/min-key clojure.core/and clojure.core/locking clojure.core/... https://gist.github.com/1441441

23:22 TimMc: &(*clojure-version* :lol :wut)

23:22 lazybot: ⇒ :wut

23:22 licenser: heh

23:24 TimMc: Oh, haha! It's a map, so it's going for the default value.

23:24 &(*clojure-version* :major :lol)

23:24 lazybot: ⇒ 1

23:26 ihodes: well that's awful. tmux can't run properly in with TERM=xterm-256color, and without that TERM, emacs looks cruddy in tmux. sigh.

23:28 amalloy: ihodes: ask technomancy, i'm sure he knows how to make emacs run in tmux

23:29 jlf: ihodes: or on #tmux

23:29 ihodes: good ideas.

23:31 vivekn: I'm new to Clojure. How do I start a script in the repl in Clojure from the terminal?

23:32 Raynes: ambrosebs: I will not accept patches that improve findfn in any way. It doesn't deserve it.

23:32 ambrosebs: Raynes: :)

23:33 ihodes: vivekn: this page as what you need; let me/us know if it's not clear (that could be the case!) http://clojure.org/repl_and_main but also look into https://github.com/technomancy/leiningen for when you get going.

23:33 ambrosebs: it would be a good test for type annotations tho

23:33 ihodes: vivekn: most people use leiningen (or Cake, but let's not make things too complicated yet)

23:34 vivekn: from the resource, in simple answer to your question: java -cp clojure.jar clojure.main /path/to/myscript.clj arg1 arg2 arg3

23:35 licenser: Raynes: you don't like findfn?

23:35 Raynes: ihodes: You don't have to mention cake anymore.

23:36 vivekn: ihodes: Thanks, but I tried that before. It didn't work as expected. I'll look into leiningen

23:36 licenser: the cake is a lie!

23:36 Raynes: ihodes: You considering mentioning it complicated was the nail in the coffin -- we've decided to work on Leiningen instead.

23:36 You live with that now, boy.

23:36 ihodes: Raynes: <3

23:37 Raynes: But seriously, you don't have to mention it anymore. It's old software. ;)

23:37 ihodes: Raynes: noted. i've been "outta the game" for a few months

23:37 licenser: Raynes: cake will become the new i.e. 6 :P

23:37 Raynes: ihodes: https://groups.google.com/forum/#!msg/clojure-cake/GG7DbCQmmW4/Uh7IdWNFmdwJ to get you up to speed.

23:38 ihodes: Raynes: danke

23:38 Raynes: ihodes: https://groups.google.com/d/msg/leiningen/WnnQIZipG5E/pYhp59aMXTQJ And this.

23:39 licenser: Raynes: you have those links lying around somewhere or are you just very good at googling?

23:39 jodaro: wow

23:39 1323232749702

23:39 unix time is all about 32 right now

23:40 ihodes: licenser: they're on his desktop, waiting...

23:40 jodaro: that has to mean something profound

23:40 licenser: ^^

23:40 nice timing

23:40 jodaro: or ominous

23:57 ambrosebs: raek: I'm having a problem with `def` overwriting my metadata from alter-meta!

23:57 that's expected, right?

23:58 ,(intern *ns* 'a)

23:58 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

Logging service provided by n01se.net