#clojure logs

2011-12-06

00:06devnRaynes: #chicken
00:19devnhttp://www.ccs.neu.edu/home/samth/
00:19devn^-Great page with lots about typed Racket
00:20spoon16guidance question
00:21spoon16I 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
00:22spoon16what is the idiomatic way of normalizing that parameter?
00:22spoon16right now I'm thinking (fn [p] (let [np (normalize-param p)] (println p)))
00:26spoon16(defn normalize-param [p] (cond (instance? String) p (instance? Keyword) (name p) (instance? EnumType) (.valueOf p)))
00:26spoon16good, bad, ugly?
00:28cgagi'm interested in the answer that as well
00:44amalloyspoon16: you only want to switch on type/class?
00:45spoon16amalloy, yes
00:45amalloy(defprotocol MyParam (fix-up [x])) (extend-protocol MyParam, String (fix-up [x] x), clojure.lang.Named (fix-up [x] (name x))) and so on
00:46spoon16I thought that might be the way to go
00:46amalloythat dispatch is fast and also extensible by clients
00:46spoon16in my mind protocols are heavier and I struggle to understand when they should be used
00:46spoon16ok
00:49amalloyspoon16: 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))
00:50spoon16nice
00:50spoon16didn't know about condp
00:50spoon16thanks
01:07spoon16amalloy: https://gist.github.com/1436973
01:07spoon16is that right?
01:08amalloyspoon16: 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)))
01:09spoon16good thinking
01:09spoon16fixed
03:45Blktgood morning everyone
03:46ejacksonHello hello.
03:51Blkt:D
05:05Fossigrrr. hitting a bug/quirk in deftype/method_impl_cache again
05:05Fossisomehow our appengine app sometimes seems to reload incompletely :/
05:16kralnamaste
05:18ejacksonand good luck !
06:22ambrosebs,(let [form '(+ 1 1)] `~form)
06:22clojurebot(+ 1 1)
06:22ambrosebshow can I get (clojure.core/+ 1 1) from that?
06:22ambrosebsie. qualified symbols
06:24clgvambrosebs: you can map resolve on the symbos of the form
06:24clgv&(resolve '+)
06:24lazybotjava.lang.SecurityException: You tripped the alarm! resolve is bad!
06:25clgv,(resolve '+)
06:25clojurebot#'clojure.core/+
06:25ambrosebssounds like a job for walk
06:25clgvin case it's nested, yes ;)
06:26ambrosebsclgv: yes, its general
08:32ambrosebshow can I get the namespace of a var?
08:34samaaronso i /n
08:34yangsx,(namespace +)
08:35clojurebot#<ClassCastException java.lang.ClassCastException: clojure.core$_PLUS_ cannot be cast to clojure.lang.Named>
08:35ambrosebs,(namespace #'+)
08:35clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.Named>
08:35ambrosebsthat's more what I'm after
08:35ambrosebs,(str #'+)
08:35clojurebot"#'clojure.core/+"
08:36raek,(.symbol #'+)
08:36clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: No matching field found: symbol for class clojure.lang.Var>
08:36raek,(.sym #'+)
08:36clojurebot+
08:36raek,(.ns #'+)
08:36clojurebot#<Namespace clojure.core>
08:37ambrosebs:)
08:37ambrosebswhat I really want is converting the var to a symbol
08:37ambrosebsI assumed there was no direct way
08:38raekhttps://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Var.java#L128
08:39raek,(symbol (.name (.ns #'+)) (.sym #'+))
08:39clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String>
08:39ambrosebsraek: excellent
08:39raek,(symbol (.name (.ns #'+)) (str (.sym #'+)))
08:39clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String>
08:39raek,(symbol (str (.name (.ns #'+))) (str (.sym #'+)))
08:39clojurebotclojure.core/+
08:39ambrosebsraek: awesome!
08:40raekfeels a bit hackish
08:40ambrosebsthese are dark corners of Clojure, symbol manipulation/conversion
08:41raekbtw, what is this scenario when you need to go from var to symbol?
08:41ambrosebsI'm writing a static type checker
08:41clojurebothttp://www.assembla.com/wiki/show/clojure/Datatypes
08:41lazybotAssembla is deprecated. Use http://dev.clojure.org
08:41raekcorrectionbot...
08:42Borkdude,`+
08:42clojurebotclojure.core/+
08:42ambrosebsI'm basically attempting to resolve a symbol to see if it already refers to a var
08:43ambrosebsbecause I add my type annotations before each function is defined
08:43raekbut then you already have the symbol?
08:43ambrosebsraek: :) I'll get my thoughts together in a gist
08:44Borkdude,(doc resolve)
08:44clojurebot"([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"
08:45ambrosebshmm yes, I'm probably solving the wrong problem
08:45ambrosebsalthough I did try resolve, I can't remember why I didn't use it
08:45ambrosebsback to the drawing board..
08:45raekambrosebs: do you know about the magical &env macro argument?
08:45ambrosebsyes
08:46ambrosebsgive me a minute, resolve should work...
08:47raekso with resolve and &env, you should be able to chck whether a symbol represents a var, and if so get access to it
08:47raek(and its metadat)
08:47raekresolve returns nil if the symbols is a local
08:47raek*symbol
08:48ambrosebsI'm maintaining a map from qualified symbols to types
08:48ambrosebsall I want is to work out if an unqualified symbol (which I know is global) points to an existing var
08:49ambrosebsand then add the qualified symbol to the map
08:49raek(resolve 'foo)
08:49raek,(resolve 'foo)
08:49clojurebotnil
08:49raek,(resolve 'conj)
08:49clojurebot#'clojure.core/conj
08:49ambrosebsyes, resolve looks perfect
08:49ambrosebsit should work
08:49raekbeware of classes:
08:49raek,(resolve 'Object)
08:49clojurebotjava.lang.Object
08:50raekresolve returns either nil, a var, or a class
08:51ambrosebsoh
08:52raekto handle these cases you could write a protocol and extend it for nil, clojure.lang.Var, and java.lang.Class
08:53raekwell, this is just an implementation detail. there are other ways to do it too :-)
08:54ambrosebsShould my global type map be from symbols to types?
08:54ambrosebsmy rationale was that if a var is uninterned, I'd need a symbol to represent the var anyway
08:56raekhow do you represent types of functions?
08:57raekand when do you populate this global map?
08:57raeksound like you are adding type information for vars before they are defined
08:58ambrosebsraek: yes, that correct
08:59ambrosebsfunction types are a deftype with a field of a list of arities
09:00ambrosebs(Fn (IntegerT IntegerT -> IntegerT) (FloatT -> FloatT))
09:02raekone neat thing that clojure offers is that you can store metadata on vars
09:02raekto me var metadata sounds like a good place to keep type information for a global value
09:03clgvambrosebs: you are adding typechecks to clojure?
09:03ambrosebsraek: here's what I want type annotations to look like
09:03ambrosebshttps://github.com/frenchy64/typed-clojure/blob/master/src/typed_clojure/core.clj#L262
09:04ambrosebsclgv: :)
09:04ambrosebsT adds a type annotation at compile time
09:05raekambrosebs: you can use ater-meta! to attach that type info directly on the var
09:05raekjust intern it first
09:06ambrosebscan you intern vars from different namespaces?
09:07ambrosebsooo that's cool
09:07raek(defmacro T [s ...] `(do (intern *ns* ~s)) (alter-meta (resolve ~s) assoc :type ...)))
09:07ambrosebsthat won't work, I want it at compile time
09:07raekthere are multiple ways to do this
09:08raekyou can intern the var in the macro, you can do it in the code that the macro expands to
09:08ambrosebsinteresting
09:09raek(defmacro T [s ...] (do (intern *ns* s) `(alter-meta ~(resolve s) assoc :type ...)))
09:09ambrosebsif I intern a var, will a (def ..) override the definition?
09:09raekor even (defmacro T [s ...] (do (intern *ns* s) (alter-meta (resolve s) assoc :type ...) nil))
09:09raekambrosebs: yes
09:09raek,(doc intern)
09:09clojurebot"([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."
09:10raekdef always overwrite the var value
09:10raekbut it keeps any old metadata
09:11ambrosebsraek: I guess I'm only interested in the metadata
09:11raekI guess you want T to not change the value (if it exists), but always change the metadata
09:12ambrosebsexactly
09:14raekambrosebs: "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!.
09:16ambrosebsis a var is mutable? are any changes global side effects?
09:20clgvI would love "function arity inference" in the clojure compiler. that should be possible in most cases.
09:21clgvthat would eliminate a lot of runtime errors when refactoring code
09:22clgvor plain writing new code and making arity errors^^
09:44raekambrosebs: yes. when you call def, intern, alter-var-root!, or alter-meta! you directly mutate the var
09:45raekthese mutations should not happen after the application is initialized, though
09:45raek(except when you are fixing bugs)
09:48ambrosebsraek: I wonder if keeping a separate map has advantages?
09:48ambrosebsit seems redundant now you've mentioned the metadata on vars
09:50ambrosebswhat about adding type metadata to Classes? I haven't thought it through myself
09:51raekClasses cannot have metadata
09:52ambrosebsit seems a global map from symbols to types would generalize var and class type annotations
09:53raekbut you could think of a Class as a typedefinition...
09:53ambrosebsexactly :)
09:53ambrosebsyou can see I haven't thought that far
09:54raekif 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
09:54raekyou only need a function from Class to type
09:55ambrosebsah
09:55ambrosebsthat makes sense
09:56ambrosebsyes, it's just a value
09:56raekexactly
09:56ambrosebsaha :)
09:57licenserRaynes: just reading your post to tentacles :) nicely written
09:59ambrosebsraek: I was confused by intern returning classes
10:00ambrosebsraek: hmm
10:00ambrosebsI think I got that wrong
10:00ambrosebsI meant resolve
10:01raekit might be simpler to just ignore the java interop parts of clojure in the beginning
10:01ambrosebsyes
10:02ambrosebsare local bindings vars too?
10:03raekno
10:04raekbut the compiler will give you a map of all locals in &env, so they are easy to recognize
10:05raekhrm. the env parameter of resolve must have been added in clojure 1.3
10:07ambrosebsthat's cool
10:08ambrosebsI'm using the ClojureScript analyzer to parse the forms. I could probably use the env info the analyzer gives
10:09BahmanHi all!
10:11raekit's really amazing that you can add these kind of features to a language in the form of a library
10:12ambrosebsraek: oh yea, generalizing the analyzer a little, and this kind of thing will be very nice
10:12ambrosebsIt requires surprisingly few changes to analyze Clojure code
10:15ambrosebsIt's mostly deleting code, too
10:47ambrosebsraek: metadata in vars seems to work nicely
10:56licenserso quiet!
11:01goodiebo_is there a built-in functions for inverting a hash-map?
11:06raekgoodiebo_: yes, check out clojure.set/map-invert
11:07goodiebo_raek: perfect thanks
11:11goodiebo_how about a function that will replace keys using another map? (replace-keys {:id [1 2]} {:id :ID}) => {:ID [1 2]} ?
11:13goodiebo_ahh walk/prewalk-replace works nicely
11:14blakesmithIf I have a RandomAccessFile, is there a function that will read n bytes from the file and return a list of bytes?
11:14goodiebo_hmm no, i don't want it to be recursive like walk does. Just one level...
11:37blakesmithTo follow up on my earlier question, is there a more idiomatic way to achieve this? https://gist.github.com/1438863
11:38nachtalpblakesmith: you want to read exactly n bytes from the stream?
11:38blakesmithYes.
11:41jlfhi 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:42nachtalpblakesmith: one moment...
11:47blakesmithnachtalp: 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:48nachtalpblakesmith: 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:48blakesmithAh, good call.
11:49nachtalpblakesmith: 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:55blakesmithnachtalp: 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:55blakesmithAs opposed to reading lines, which doesn't work for the file type I'm trying to read.
12:09nachtalpblakesmith: i'm not aware of a built-in that does that, so you might be stuck with java interop there..
12:10blakesmithCool, thanks a ton for your help!
12:38manutterhrmph, can't seem to get off the ground with cgrand's parsley
12:39manutterdoes the phrase "shift/reduce conflict" send a chill down anyone else's spine? :)
12:39manutterI'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:40manuttercan't seem to find any parsley grammar that does anything but throw shift/reduce exceptions on compile.
12:46tmountainis there a way to determine which protocols a given record implements?
12:49manutterhmm, there's satisfies?, if you know a specific protocol you want to look for
12:50manuttertmountain: ^^
12:51tmountainmanutter: that's exactly what I was looking for, thanks!
12:51manuttercool :)
13:03manutterwoot, figured out parsley: (p/parse :list #{:word [:list "," :word]}, :word #"a-z")
13:03manutterI was trying [:word "," :list], but that's the shift/reduce gotcha. The list has to come first.
14:01goodieboywhat would be the most idiomatic way to change keys like this? {:1 11 :2 22} => {1 11 2 22}
14:02Raynes&(into {} (for [[k v] {:1 11 :2 22}] [(name k) v]))
14:02lazybot⇒ {"1" 11, "2" 22}
14:02RaynesWell.
14:02RaynesClose enough.
14:02technomancyclojure.walk/stringify-keys
14:03goodieboyahh i see
14:03technomancyerr--wait no
14:03technomancythere's no numericize-keys
14:03Raynes&(into {} (for [[k v] {:1 11 :2 22}] [(Long. (name k)) v]))
14:03lazybot⇒ {1 11, 2 22}
14:03goodieboyyeah that's it ok
14:03RaynesI really just didn't want to make that LONGer. Get it, LONGer?
14:03goodieboyeheh :)
14:03goodieboythanks!
14:06technomancyclojurebot: core?
14:06clojurebotidiomatic clojure uses dashes to separate words
14:06technomancyclojurebot: core is what you put in a namespace when you can't think of a better way to avoid single-segment namespaces.
14:06clojurebotYou don't have to tell me twice.
14:06technomancy^ fair?
14:07licensertechnomancy 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:08licenserhow 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:09technomancylicenser: 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:09technomancyI think it's a documentation issue more than anything else.
14:10licenserit is, so it still would be cool
14:10technomancyif 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:10licenseryou could give them a simple text choice: hey we suggest you install 1) postgres-jdbc 2) mysql-jdbc 0) don't do anything.
14:10technomancyI don't want dependency fetching to ever be an interactive task.
14:11technomancyit needs to work reliably unattended
14:11licenserI can understand that :)
14:11technomancyI wish I had a good solution to the problem though, because I understand where you're coming from.
14:12licenserhow about integrating it into lein search?
14:12licenseras in make lein search interactive
14:12licenseror allow it to be interactive
14:12licensercould even do incremental search stuff or so ^^
14:12zerokarmalefttechnomancy: was it you that opined that satnav was a better word than GPS?
14:13technomancyzerokarmaleft: yeah. also the British pronunciation of "dancing" puts ours to shame.
14:13technomancylicenser: yeah, maybe lein search could drill down into focusing on a specific artifact or something?
14:13licenser*nods*
14:13zerokarmalefttechnomancy: excellent, then you'll love this => http://www.youtube.com/watch?v=FMiLQwKLSQM
14:13osa1I'm being disconnected from SLIME instantly when I run `clojure-jack-in`, anyone has any ideas?
14:14technomancyzerokarmaleft: aw yeah; nice
14:14osa1I'm using this version: http://common-lisp.net/project/slime/
14:14licenserlike 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:15licenserclojure-jack-in is really great if it works :P
14:16licenserosa1: sorry no clue I am always happy when it works and just clean and restart everything if it doesn't
14:17technomancyosa1: jack-in is meant to only support a single connection at a time
14:18technomancyso it should drop your connections while it starts a new one.
14:18osa1technomancy: I'm running emacs, opening a project, and then M-x clojure-jack-in. I have only one connection
14:19technomancyyou mean it connects successfully and then disconnects?
14:20osa1I updated swank-clojure via and now I can't start swank server(got stuck in "Starting swank server...")
14:20osa1technomancy: yeah
14:20technomancymake 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:21osa1ok, now I'm upgrading lein..
14:21osa1(I'm not sure why I'm doing that..)
14:21licenserosa1: because you are desperate ;)
14:21osa1whatever, let's upgrade clojure-mode
14:21licenseralso update your BIOS when you are at it ^^
14:26jlfosa1: do you see something like ``error in process filter: Search failed: "(run-hooks 'slime-load-hook) ; on port"'' in *Messages* by chance?
14:27osa1jlf: no
14:27jlfso much for that theory
14:28osa1great, and now I'm getting huge java traceback when I run lein
14:28osa1reinstall!
14:29technomancyosa1: make sure you have only one swank-clojure in ~/.lein/plugins
14:29technomancythere was a bug in earlier versions of lein that allowed two to sneak in there and mess things up
14:29osa1actually I've just deleted ~/.lein
14:30osa1I'm reinstalling rightnow
14:30osa1right now*
14:34osa1technomancy: here's the error I'm getting with updated swank-clojure and clojure-mode: http://imgur.com/hxe50
14:34technomancythat's not an error
14:34osa1so is it ok? because my clojure repl's not working
14:35osa1I'm still getting disconnected after a few seconds on repl
14:35technomancywait, did you say you installed slime from common-lisp.net?
14:35osa1technomancy: yes, I'm using it for common lisp
14:36technomancyosa1: that's not going to work; you need a specific version for clojure.
14:36technomancyjack-in will load that version, but if you have additional config for a different version it could easily interfere
14:36osa1technomancy: hmm, can I use this version for common lisp and clojure specific version for clojure?
14:36osa12 slime installations
14:37technomancyI 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:38technomancya 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:39osa1technomancy: 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:40technomancyosa1: you don't need any Emacs configuration for clojure apart from clojure-mode
14:44osa1technomancy: 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:45technomancyosa1: don't install your own copy of slime, just use the one that comes with swank-clojure
14:45technomancyI'll fix the readme to remove that link, since it's a bit misleading
14:46osa1ok, I'm commenting my slime configuration in my emacs config
14:47osa1technomancy: great, it worked! thank you very much
14:48osa1now 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:48osa1wow, my autocomplete settings are working too :)
14:50osa1how can I load repl-utils in clojure 1.3?
14:56zerokarmaleft(use 'clojure.repl)
15:42PPaulis there something like clojure.walk for javascript?
15:56ckirkendall`PPaul: treewalker
15:56ckirkendall`or nodeiterator
15:56PPaulthanks!
15:56PPaulcus i'm rolling my own and sucking at it
15:57ckirkendall`PPaul: only problem it only works in newer browsers
15:57PPaulthat's no good
15:58PPaulclojure's walk is like 100 lines of code for 10 functions
15:58PPaulit can't be so much more difficult in js
15:58PPauleven a less featured version will do
15:58PPaulalso, i don't care about the DOM
15:58PPaulif that means anything
15:59brehautPPaul: 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:59PPauli know
15:59PPauli know :(
15:59PPaulthere aren't too many types, though
15:59PPauli'm using underscore, so that's sorta taken care of
16:00lucianusing CoffeeScript also helps
16:01luciannot knowing the type of something isn't necessarily bad, seeing how object construction works in javascript
16:01PPauli rather use clojure script than coffee script
16:01lucianfor me, the terrible bits are 1) lack of ints with automatic promotion to bigints and 2) implicit type coercions
16:02PPauli've seen coffee script stuff, and i don't think it's much of an improvement over js
16:02ckirkendall`PPaul: what type do you need to support
16:02lucianPPaul: it keeps the good bits
16:02PPauli don't need to support types, someone else brought this up :P
16:02PPauli need to walk
16:03PPauli 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:03PPaulmakes me want to use clojue :)
16:03abaranosky_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:04ckirkendall`PPaul: clojurescript included clojure.walk
16:04PPauli know
16:05lucianPPaul: just use that then, if you dislike JS that much
16:06PPauli will attempt to
16:06PPaulgot some big projects in js now...
16:16ckirkendall` Is there anyone out there that knows a good way to unit test clojurescript code?
16:19jcromartiethis is useful: (defn shuffles [coll] (lazy-seq (concat (shuffle coll) (shuffles coll))))
16:21hiredmanjcromartie: (mapcat shuffle (repeat coll))
16:21jcromartieI didn't realize mapcat was lazy
16:21jcromartienice
16:21jcromartieyou win
16:24PPaulmost of the seq functions are lazy
16:38y3diyou cant interact with java libraries in clojureCLR right?
16:39babilenHi 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:40babilenI 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:40technomancybabilen: depends on what you need that java.io.File doesn't provide, I guess
16:42babilentechnomancy: Well, I'd like to be able to normalise paths, join them, access system specific information such as User's home directories, ...
16:42goodieboyanyone know of a good validation library/dsl, something to be used in a web app?
16:42ibdknoxgoodieboy: Noir includes a validation library
16:42technomancybabilen: clojure.java.io/file can join; .getAbsolutePath can normalize, and (System/getProperty "user.home") will get you the third =)
16:43amalloyFile does all of those things, except that it's not clear what "joining" paths means
16:43goodieboyibdknox: I'll check that out thanks
16:43technomancyor maybe .getCanonicalPath?
16:43amalloytechnomancy: probably canonical
16:43ibdknoxgoodieboy: http://webnoir.org/tutorials/forms
16:44amalloydepends what he wants, i guess
16:44technomancyit does raise a good point that there's not really a way to specify dependence on jdk 1.7
16:45goodieboyibdknox: interesting thanks. i'll give it a try
16:46babilenamalloy, 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:46technomancybabilen: yeah, c.j.io/file will raise an exception if anything but the first arg is absolute
16:47technomancyapart from that you should be god
16:47technomancygood
16:47ibdknoxlol
16:47ibdknoxtechnomancy: can I be god?
16:47babilenNormalise would do something like (normalise "~/bin/../lib") → "/home/$USER/lib"
16:47technomancy"behold my godlike powers of ... being able to construct portable file paths!"
16:47amalloybabilen: that's basically canonicalization, except i don't think it does ~ substitution
16:48technomancybabilen: there's no support for $USER or ~ afaik though
16:48amalloybecause ~ is a valid filename character; converting it is something your shell does, not the filesystem
16:48pjstadigJVM is not unix
16:48technomancywhich is dumb
16:48pjstadigJNU?
16:49babilenI 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:49babilenamalloy: I agree
16:49ibdknoxall permutations up to 5 letters are taken I believe
16:49amalloytechnomancy: plz to propose alternative? i think (java.io.File. "~") has to represent a file named ~ inside your cwd
16:50technomancyamalloy: probably the way to go is to have a convenience method plus a low-level method that treats everything literally
16:50ibdknoxamalloy: (defn awesomer-file [f] ....
16:50amalloyibdknox: are you saying all 26^5 five-letter domain names are registered?
16:51ibdknoxfor .com, I believe so
16:51ibdknoxit may be 4
16:51amalloyi just checked slkur.com/org, and that is free for the taking
16:51technomancynot for long!
16:51ibdknoxlol
16:52amalloyhm. same for slku.com. that is, the dns lookup failed. is there something wrong with my methodology or are you just wrong?
16:52babilenOk, any idea why (Paths/get "/etc") throws the aforementioned exception?
16:52ibdknoxamalloy: doesn't mean they point anywhere
16:52amalloybabilen: usually when someone has this issue it's because jdk7 has vararg methods you're using wrong
16:53ibdknoxamalloy: http://www.dotsauce.com/2007/11/02/four-letter-domains-all-registered/
16:53ibdknoxdated 2007
16:53amalloyyeah, i see they have a whois
16:53babilenamalloy: That is indeed the case (vararg method) - But where is my mistake?
16:53ibdknoxamalloy: and a better way to determine if a domain is owned
16:53ibdknoxhttp://domai.nr/
16:54amalloyibdknox: if i owned all these retarded names i'd at least have the decency to resolve them to 127.0.0.1
16:54ibdknoxhaha
16:54ibdknoxamalloy: those jackasses should be required to have a legitimate site or give them up :p
16:54jcromartie(defn expand-path [p] (.replace p "~" (get (System/getenv) "HOME")))
16:54jcromartiedone
16:55ibdknoxwink: what do you have?
16:55babilenjcromartie: Ta
16:55amalloyjcromartie: ~amalloy/foo
16:55jcromartieamalloy: who does that?
16:55jcromartienobody
16:55jcromartiethat's who
16:55ibdknoxlol
16:55amalloywrong, bro
16:55ibdknoxcould just check if there's a slash after it
16:55amalloyand also, that is unix-only. you want (System/getProperty "user.home")
16:55ibdknoxgo go regex
16:55winkibdknox: f5n.org (and also .de)
16:56amalloywink: three-"letter"
16:56winkpfff :)
16:56ibdknoxyeah :p
16:56winkcharacter then
16:56amalloy~vararg
16:56clojurebotIt's greek to me.
16:57amalloyclojurebot: 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:57clojurebotIk begrijp
16:57amalloybabilen: ^
16:57ibdknox~vararg
16:57clojurebotVararg 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:58amalloyman, 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:58ibdknoxamalloy: we have to stall the singularity as long as possible
16:58babilenamalloy: That feels wrong, but thanks a lot! (I would have expected it to work as above)
16:59amalloywell. you can expect what you want, but vararg methods are not real
17:02TimMctimmc.org was the smallest I could get.
17:02TimMctim.mc would probably require establishing a corporation in Monaco, and I don't speak French.
17:03ibdknoxapparently all the chris grangers of the world are either basketball team managers or photographers and they all wanted websites :p
17:04amalloybabilen: you can wrap that up in a macro or function, if you want
17:04ibdknoxchris-granger.com was the best I could do
17:05licenserwatching Tron I kind of feel bad about using the garbage collector :(
17:05ibdknoxlol
17:06babilenamalloy: 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:06TimMclicenser: Let's set up a "home for retired objects" in your RAM.
17:06licenserTimMc: yes something like that, I mean perhaps we can make like a retirement home on taps or something along the line
17:06amalloy(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:07licenseror we ship them in the cloud
17:07licensereverything is better when you do cloud with it.
17:07babilenamalloy: Splendid, thanks!
17:08amalloydoes that actually work? i don't have 7, just kinda threw it together
17:08licenserI wonder if "to cloud" will become a word just as "to google"
17:15babilenamalloy: 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:19amalloybabilen: rewrote it as a macro, which is slightly more convenient to use: https://gist.github.com/1440296
17:20amalloyyou 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:39babilenamalloy: You are most kind and it works perfectly with the addition of said option.
18:20technomancyso... this happened: https://github.com/technomancy/lein-heroku
18:22ibdknoxtechnomancy: short of the procfile, lein noir new blah spits out something that pushes to heroku cleanly
18:22amalloy(defn ps:restart) ;; you monster
18:23technomancyibdknox: yeah, the skeleton stuff is just to help folks follow along with the devcenter tutorials.
18:47rienRaynes: dude, are you there?
18:47Raynesrien: Dude. I am.
18:48rienheh. listen, I'm trying to get in touch with nixeagle
18:48rienabout his cool uhm... no-name emacs buffer online thingy
18:48RaynesMan, I was looking for that a couple of days ago.
18:48RaynesCouldn't find it.
18:48rienthen I found in some clojure logs that he was going to package that up and you were in talks with him
18:48rienaww
18:48RaynesAnyways, he never comes around anymore.
18:49licenserdude dude dude, you two sound like a train
18:49rienoh so he used to be here?
18:49RaynesYou can probably get in touch with him on github.
18:49rienI know him from #lisp
18:49Rayneshttps://github.com/nixeagle
18:49rienI sent him an email on his .org domain which is barren
18:49rienyeah I found that, look over all his repos, it's not there :) so I'll send him a message I guess
18:49rienbut did he ever get around to packaging it up?
18:49RaynesI don't think he did.
18:50rienso the people that wanted it are still waiting for it? if we have a quorum that might motivate him :)
18:51ieure:( https://github.com/nixeagle/pokemon-online
18:51RaynesYeah, he's a big pokeguy.
18:51rienI guess I'll send him a message. I hate to bother people
18:51ieureJesus.
18:52ieureThis is the sound of me judging.
18:52RaynesHe does crazy AI stuff with pokemon.
18:52ibdknoxlol
18:52ieureHahahaha
18:52Raynesrien: I still want it.
18:52rienRaynes: do you have a github account? I could mention your username on the message. just one guy wanting something isn't very motivating
18:52Raynesrien: http://github.com/Raynes
18:53rienwill do. the-kenny also wanted it, and nullman too
18:54RaynesIt 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:54technomancyI think you got that backwards
18:56the-kennyWhat do I want? :)
18:56rienhahah
18:56brehautthats a bit yakov smirnoff isnt it?
18:56rienhey 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:56rienokay, maybe not my best
18:57the-kennyrien: for gist.el? Yeah, that would be useful for me
18:57the-kenny(and a few other people I know too)
18:57rienno, not that
18:57rienI'm talking about that nixeagle website thing where you could see his emacs buffer live
18:58the-kennyAhhh
18:59the-kennyThat one would be cool too :)
18:59the-kennysorry, saw gist.el in your github account.
19:01rienokay, three now. do you have a github account?
19:03Raynesrien: 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:03RaynesHe's a nice guy. He'll probably do it.
19:04rienyep, 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:05the-kennyrien: Yup, github.com/the-kenny Sadly, I don't have much time lately :(
19:05RaynesJoin the club.
19:05ibdknoxCan I be the president of the club?
19:06jodaroibdknox: do you have time for that?
19:06rienI don't have time to be appointing people president
19:06ibdknoxjodaro: shit
19:06ibdknoxno.
19:06jodaroi know, right?
19:07jodaroheh
19:07jodaroone kid to the other: no no, get the laser jetpack, its way better! that one sucks!
19:08the-kennyGnah. We need slime-dream: A library to interact with a running repl from inside a dream.
19:09jodarothe-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:09rienRaynes: message sent. now we wait
19:09the-kennyjodaro: Got an iPhone 4s? Maybe Siri can help us
19:09jodarosiri, write bug free code.
19:10the-kennySiri, open slime repl on mymachine:4663 and write some cool stuff
19:11the-kennyFun fact: The name of my neighbor's daughter is Siri
19:13jodaroso many jokes to make
19:13jodaroso little time
19:16the-kennyrien: Thanks for taking up on the subject. Keep me updated :) Have to go to bed now. Long day at university tomorrow.
19:16rienI will
19:19the-kennygood night :)
19:26riennight!
19:45alexbaranoskydoes anyone use clojure-refactoring w/ their Emacs? I'm an Emacs noob and would love to hear how you use it
20:01_ulisesI'm trying to practise writing macros and I'm having issues writing a macro that returns a fn with options args
20:02_uliseswould anybody mind giving me a hand? This is what I have: http://pastebin.com/KMrdxv9c
20:02_uliseswhich of course does not work.
20:02alexbaranoskyI 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:02alexbaranosky")
20:03alexbaranosky_ulises, let me see
20:03alexbaranosky_ulises, you didn't define msg
20:03_ulisesalexbaranosky: 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:04alexbaranoskywhen I do a lein help, swank is listed under the options
20:04_ulisesalexbaranosky: 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:07alexbaranosky_ulises, maybe something more like this?: http://pastebin.com/GY7fHu4s
20:08alexbaranosky(hello [arg1 arg2] (print "hi") (print "mom")) ????
20:08hiredmanalexbaranosky: generally means you don't have swank-clojure installed (should be installed as a plugin)
20:08alexbaranoskyhiredman, thanks, will look into that
20:08_ulisesalexbaranosky: thanks!
20:09amalloy_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_uliseshum, wait
20:10_ulisesamalloy: 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_ulisesso, ideally the macro would return (fn [& msgs] ( ... user code that may use msgs ... ))
20:11_ulisesI just replaced my msgs with msgs# which works, but then that becomes inaccessible in the user code :(
20:11amalloy_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_ulisesamalloy: not sure I'm following, but I wouldn't mind if it was always named msgs
20:12_ulisese.g. ((hello (println msgs) "foo" "bar") ; prints ("foo" "bar")
20:13_ulisesach, missing a parens
20:13amalloyokay. 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_ulisesoh, right.
20:13amalloy(defmacro hello [& body] `(fn [~'msgs] (println ~'msgs) ~@body))
20:14alexbaranoskyso now you've got a snazzy new anaphoric macro :)
20:14_ulisesheh
20:15alexbaranoskyor am I wrong, I'ms still a bit stupid with macros :)
20:15amalloynah, you're right
20:15_ulisesindeed
20:15amalloybut beware: even chuck norris double-checks when he introduces anaphora
20:15_ulisesI was reading the anaphora macro in the JOC book and thought "hey, this is what I need"
20:16_ulisesand I even had in one of my versions ~'msgs but it didn't compile :/
20:16_ulisesanyway, thanks for your help amalloy and alexbaranosky
20:16alexbaranoskyno problem
20:16licenser_ulises: one way to allow what you want would declaring msgs and then binding it inside the function
20:16alexbaranoskyit's fun
20:17licenseranother one would be to allow the unser to name the variable themselves - which is quite nice
20:17_uliseslicenser: along the lines of `(fn [foo#] (binding [msgs foo#] ... ))?
20:18amalloylicenser: 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:18amalloyeg, they may decide to name it not msgs but [msg1 msg2]
20:18licenser_ulises: yap along this lines, just need to declare msgs first and usually it would be called *msgs* I think
20:18_ulisesyeah
20:18_uliseswell, not sure it makes sense in the context of what I'm trying to do
20:18amalloyfwiw i think having a dynamic variable and binding it is nuts
20:18licenserah I see what you mean yes but you can work around that by giving it an additional internal name
20:19_ulisesso, 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:19licenserjust to be sure, are we actually discussing the case of the hallo function or is that a example for something
20:19alexbaranoskyhiredman: 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:19licenserheh wow you can read minds _ulises
20:19_ulisesso it may not make sense to have the user name the msgs parameter
20:19_uliseshehe
20:20licenserwill the user ever have to know the name for msgs?
20:20licenserI mean in the example given there would be no need for that I think - or I miss it
20:20_ulisesit'll be msgs
20:20_uliseseh?
20:20licenserI mean is there a reason not to use msgs#
20:21licenserof cause the user won't be able to use it then but does he need to?
20:21licenserand yay for actors - go erlang go!
20:21alexbaranosky_ulises, why not instead use a function that wraps functions, but printing the args before calling the inner function?
20:21_ulisesyes, indeed, using msgs# means the user's code cannot inspect the messages received
20:21_ulisesthis is the pong actor: http://pastebin.com/jVyRT0eM
20:21licenserah I see what you are planning
20:22_uliseswith amalloy's shiny handler macro
20:22licenserand you need something like debug printing
20:23_ulisesnot me
20:23_ulisesI wanted to be able to write handlers that inspect the message further
20:23licenser(defmacro hello [[msgs-name] & body] `(fn [msgs#] (println msgs#) (let [~msgs-name msgs#] ~@body)))
20:24licenserhow about something like that
20:24_ulisesthat would work...
20:24_uliseslemme test that
20:24licenseryou then could do ((hello [[msg1 msg2]] (println msg1)) "bla" "blubber")
20:25licenserI like the give the user parameters thing because he actually can do destucting ^^
20:25licenserit feels more like a function declaration that way
20:25licensergeez this medication isn't fun -.-
20:26_ulisesyes
20:26licenser:)
20:27_ulisesupdated pong http://pastebin.com/tnur0N0s
20:27licenser(defmacro hello [[msgs-name] & body] `(fn [& msgs#] (println msgs#) (let [~msgs-name msgs#] ~@body)))
20:27licenserthis is the correct code
20:28licenserotherwise you can't use more then one param
20:28_ulisesyes, I used your code as is
20:29licenserbut the first one was wrong ;)
20:29_ulisesoh!
20:29licenseryou could not call (h "bla" "blubb"
20:29licenser)
20:29_ulisesyes, the fn definition
20:29licenseronly one parameter was allowed :)
20:30licenseralso I think there is a pattern matching library for clojure might want to look into that
20:30_ulisesactually, that is fine, since I foresee messages being along the lines of {:msg msg :payload data}
20:30licensersince it will make it more erlangy
20:30_ulisesyeah, well, this is just a toy, not trying to write this for any serious use :)
20:30licenserawww
20:30_ulisesit might be an excuse to learn the patter matching lib though
20:30licenser_ulises ! ping
20:31_uliseslicenser ! "try jobim for an actors lib"
20:31licenser_ulises ! "I don't want an actors lib I have my erlang for that!"
20:31_uliseshehe indeed
20:31licenserclojure is for nice single system high cores concurrency
20:31licenserand it is darn good for that
20:32licensererlang is an entire different domain, and it is darn good for that
20:32licenserI love both, and since they aren't girls they don't go and say "but you can't love two!"
20:32_uliseshah
20:33licensererlang and clojure can happily coexist, it is like an open relation ship with us ^^
20:33licenserlike 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_uliseswell eff me ...
20:34alexbaranoskywhen does one use Mix slime, and when do you use M-x clojure-jack-in ?
20:34_uliseslicenser: turns out I'm quite digging your macro
20:34licenser:)
20:34licenser_ulises: I am glad to hear that
20:34_ulisesalexbaranosky: I use slime-connect after having run lein swank
20:34licenserusually slime connect should only be needed if you connect to a remote slime server
20:34alexbaranoskyI can connect to slime, but I don't really understand when you would use clojure-jack-in
20:35licenseras long as the project is local and a lein project the jack in thing is nice
20:35alexbaranoskyok
20:35alexbaranoskylicenser, for somer eason jack-in isn't working, but slime is
20:35licenserjack in is (in my eyes) better for anything local since you don't have to run lein swank and block a console window
20:35alexbaranoskyI just installed Emacs 24 with Technomancyy's blog
20:35_uliseslicenser: turns out you can do this http://pastebin.com/XSZHh6Py
20:35ibdknoxemacs 24 includes technomancy's blog now?
20:36ibdknoxthat's pretty neat
20:36ibdknoxI wonder how they keep it up to date
20:36licenseribdknox: git :P
20:36alexbaranoskyibdknox, I appreciate the attempt
20:36licenseralexbaranosky: in what way isn't it woring?
20:37licenseron c'mon alexbaranosky it was a quite funny comment I could laugh
20:37licenseribdknox: by the way totally great work with pinot!
20:37alexbaranoskyI usually type much stupider things than that though. I think he jumped the gun )
20:37licenser^^
20:37ibdknoxlicenser: haha thanks
20:38licenseralexbaranosky: 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:38licenser_ulises: hm?
20:38alexbaranoskycan I see the new macro? link?
20:39_ulisesI realised when I thought "hey, this handler thing looks like fn, maybe users could even write docstrings for their handlers ... oh wait."
20:39licenser*laughs*
20:39alexbaranoskylicenser, I get this error message: (error "Could not start swank server: That's not a task. Use \"lein help\" to list all tasks.
20:39alexbaranosky")
20:39_ulisesalexbaranosky: (defmacro hello [[msgs-name] & body] `(fn [& msgs#] (println msgs#) (let [~msgs-name msgs#] ~@body)))
20:39licenseralexbaranosky: update lein, do lein clean
20:39alexbaranoskywhich seems to suggest it isn't installed as a lein plugin... but it is
20:39licenser_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:40licenserand you have to have a file open in the project you want to jack in to
20:40_uliseslicenser: nah, the print thing was my gettho debugging techniques
20:40licenser_ulises ! stone
20:40_ulisesmailbox full
20:40licenserdarn it
20:40_ulisestoo much hatemail already
20:40licenser^^
20:41alexbaranosky_ulises, I still think you could probably just be writing a function that wraps another function, no?
20:41_ulisesalexbaranosky: handlers are nothing but functions really
20:41_ulisesI wanted to pretify the code
20:41_ulisesso that you'd have {:message (handler (do urface))} as opposed to {:message (fn [& msg] (urface))}
20:42licenserhow I love that you call it !- :P
20:42_ulisesall those & # % make clojure look like perl
20:42_uliseshah
20:42_ulisesyeah, well
20:42licenserhow about making receive a macro?
20:42_ulisesthat's my next step
20:43_ulisesright now receive is an fn that returns an fn
20:43alexbaranosky_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:43licenserhttp://pastebin.com/index/XSZHh6Py
20:43licensersomething like that
20:44alexbaranosky_ulises, see the do-at macro and the do-at function
20:44_uliseslicenser: how's that different from what I have right now?
20:44alexbaranosky_ulises, correction do-at* function
20:44licenser_ulises: it looks more erlangy?
20:44_ulisesalexbaranosky: yeah :)
20:44licenseroh no it does not, it ignored my changes ::(
20:45_ulisesphew
20:45licenserhttp://pastebin.com/qW4HmFKZ
20:45_ulisesI was squinting like hell here just to find the differences
20:45_ulisesI even thought you'd be trolling me
20:45_ulises:'(
20:45licenserhttp://pastebin.com/13NsmYNK
20:46licenser_ulises: I feel so bad now
20:46licenserwell actually, no I don't
20:46licenser:P
20:46licensermight be the meds so
20:46_ulises</troll>
20:46_ulisesanyway, that's the future plan for receive, yes, looks much nicer
20:46licenser=)
20:47_ulisesI was thinking today in the shower whether one could even get away with [:msg -> (handler ...)]
20:47licenserI wonder if you could write clolang a clojure to erlang converter :P
20:47_ulisesor just use erjang?
20:47licenserwhy the [] then
20:47_ulisesno need for the [] really
20:47licenser[:msg {args}] -> body body body body
20:47licenserwell where args is a horribly bad example
20:48licenseryou 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:48licenserwon't even need a do any more
20:49licenserand you could actually place a ',' after every body part, and a ; at the end and it still would be valid clojure
20:49licenserhah
20:49_ulisesin theory it doesn't need a do
20:49_uliseshehe
20:49_ulisesright, I was about to say that I should go to bed as I have work tomorrow
20:49_ulisesbut now I need to finish this
20:49licenserhttp://pastebin.com/PXCyXfxN
20:49_ulisesand add the pattern matching lib. Where can I find it?
20:49licenserand you COULD get away with this
20:50_uliseslicenser ^^^^^^^^
20:50_ulisesI just wrote that in the pastebin :D
20:50licenser_ulises: I have no clue I think it is clojure.match
20:50_ulisesthanks
20:50licenserhttps://github.com/clojure/core.match
20:51licenserthat would make it look sooo erlangy :P they even have _
20:52_ulisesyes
20:52_ulisesnow please put the crack pipe away from me?
20:52licenserno crack pipe cough medicine
20:53licenserand I am under the dose my doctor described - I hate the stuff :(
20:53licenserbut 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:53licenserwell with that words,
20:53licensernighy night people
20:53_ulisesenjoy licenser thanks for the help
20:54jodaroman
20:54_ulisesthere should be commans and & in that sentence
20:54jodarothat was a damn fine baklava
20:54_ulises*jealousy*
20:54jodaroat a cafe
20:55technomancyalexbaranosky: does it happen on every project?
20:55alexbaranoskyI've only tried it once, let me try another
20:55alexbaranoskytechnomancy, (just got it set up)
20:57alexbaranoskytechnomancy, looks like it worked on a small toy project I tried it on
20:58technomancyalexbaranosky: make sure your other project doesn't have an old version of swank (or any version of swank, really) in dev-deps
20:58alexbaranoskythat's probably the issue
21:00alexbaranoskytechnomancy, the culprit I suspect?: :dev-dependencies [[swank-clojure "1.2.1"]
21:00technomancyyeah, project deps always take precedence over user-level deps because they're more specific
21:00technomancyget rid of that nonsense
21:01alexbaranoskyI've got to ask the other committer if somehow he's using it, but yeah, at least locally I'll torch it
21:01technomancytell him I told you to get rid of it. =)
21:01technomancythat belongs as a user-level plugin anyway; it should never be in project.clj unless you intend to use it in production.
21:01alexbaranoskywill do, that should give me the muscle I need ^^
21:02alexbaranoskyIt's probably old cruft from a time it made sense
21:02alexbaranoskyor at least made MORE sense
21:02technomancyoh sure; leiningen didn't always have user-level plugins
21:03alexbaranoskythe project is Midje, which has been around a while
21:09jodaroi do love me some destructuring, i'll tell you what
21:10alexbaranoskyjodaro, amen to that
21:11jodarojust ripped out a bunch of let crap
21:11jodaroby destructurifying the hell out of the params
21:11jodaroand its way cleaner
21:12alexbaranoskytechnomancy, 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:14duck1123delete lib/dev/
21:15alexbaranoskyduck1123, didnt help
21:15alexbaranoskyls
21:23alexbaranoskyso far I am not impressed with Emacs must figure out what I'm missing
21:25alexbaranoskythought paredit seems nice
21:25zerokarmaleftalexbaranosky: give it at least a month
21:25alexbaranoskyzerokarmaleft, I feel like it is missing some things I want
21:25alexbaranoskystupid stuff
21:26alexbaranoskylike the ability to holdctrl-shift and right arrow to select a chunk of text
21:26alexbaranoskymaybe the Emacs cheatsheets I'm finding aren't being exhaustive
21:28duck1123alexbaranosky: C-space to set the start mark, then arrow to the wnd, that's how you select in emacs
21:28duck1123to the end
21:29alexbaranoskyduck1123, are there any ways to select code chunks incrementally?
21:29alexbaranoskysay by sexp ?
21:30duck1123If there are commands to move by sexp, I don't use them
21:30duck1123C-h m is your friend when in an unfamiliar mode
21:31zerokarmaleftparedit's nav by sexp is C-M-f and C-M-b
21:32alexbaranoskyzerokarmaleft, nice! Can you select as well as use them for nevigation?
21:33zerokarmaleftany nav used after setting a mark C-space expands or contracts the region
21:34alexbaranoskyzerokarmaleft, ahhh got it, make sense
21:49alexbaranoskyis there a plugin for emacs to give me a kind of project navigation tree?
22:05TimMcalexbaranosky: Holding down shift while using some navigation keys will do selection.
22:05TimMcBut yeah, C-space is the general case.
22:06amalloyalexbaranosky: C-M-space
22:06TimMcPretty soon you'll be using M-x paredit-convolute-sexp and stuff like a pro.
22:08TimMcamalloy: I've actually started using it. Pretty sweet.
22:10amalloyanother thing i like, not paredit-related, is C-u space
22:11amalloyer, C-u C-space
22:11TimMc?
22:12amalloyeg: "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:13amalloysee 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:14TimMc"mark ring"
22:14TimMcTime to do some reading.
22:14amalloyTimMc: well, it's like the kill ring, but for marks
22:15amalloyyou can pretend it's a stack without missing much
23:00ihodeshmmm forgetting the name of the fn that keeps the intermediate stages of the reduce operation...
23:01amalloy$findfn + (range 4) [0 1 3 6]
23:01lazybot[clojure.core/reductions]
23:02ihodesexccccellllent thank you
23:04ambrosebs$findfn 1 2
23:04lazybot[clojure.core/unchecked-inc-int clojure.core/unchecked-inc clojure.core/inc clojure.core/inc']
23:04ihodesah and one more higher-order, changes the arity on the fn without changing anything else?
23:04ambrosebswow
23:06amalloyihodes: you probably mean partial, but that's a pretty poor description of it :P
23:07ihodesamalloy: no, i mean allowing a fn like rest to take 2 argument, but not doing anything with the second
23:07amalloyi don't think that's anywhere in core?
23:07amalloybut it sounds neat, go ahead and write it
23:08ihodesamalloy: ah i must be thinking of something in haskell...
23:08ihodesa simple enough thing to write or fudge though
23:13amalloyhah, ambrosebs, i didn't realize we had so many variants on inc
23:13ambrosebsamalloy: where does findfn live?
23:14amalloy$google raynes github findfn
23:14ambrosebs$findfn 1 1 1
23:14lazybot[Raynes/lein-findfn - GitHub] https://github.com/Raynes/lein-findfn
23:14lazybot[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:15amalloyhaha max-key. that's great
23:15ambrosebsha!
23:16amalloystupid google. the one you want is https://github.com/Raynes/findfn
23:17ambrosebsah
23:17amalloy$findfn [1 2 3] 3 ; i love when rand-nth makes the result list
23:17lazybot[clojure.core/last clojure.core/count clojure.core/peek]
23:17ambrosebs:)
23:17ambrosebsstatic type annotations would probably help the efficiency of that library
23:18ambrosebswhich is what I'm working on right now
23:18amalloyambrosebs: yes, i am super in favor of your efforts to get type information
23:18amalloythough i'm more interested in functional purity than argument/return types
23:18TimMc,(doc max-key)
23:18clojurebot"([k x] [k x y] [k x y & more]); Returns the x for which (k x), a number, is greatest."
23:19ambrosebsI just need some help annotating `seq`
23:19amalloyTimMc: most importantly, (max-key k x) is always x; k never gets called
23:19ambrosebsxD
23:20TimMc$findfn :whatever :something :something
23:20lazybot[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:22TimMc&(*clojure-version* :lol :wut)
23:22lazybot⇒ :wut
23:22licenserheh
23:24TimMcOh, haha! It's a map, so it's going for the default value.
23:24TimMc&(*clojure-version* :major :lol)
23:24lazybot⇒ 1
23:26ihodeswell that's awful. tmux can't run properly in with TERM=xterm-256color, and without that TERM, emacs looks cruddy in tmux. sigh.
23:28amalloyihodes: ask technomancy, i'm sure he knows how to make emacs run in tmux
23:29jlfihodes: or on #tmux
23:29ihodesgood ideas.
23:31viveknI'm new to Clojure. How do I start a script in the repl in Clojure from the terminal?
23:32Raynesambrosebs: I will not accept patches that improve findfn in any way. It doesn't deserve it.
23:32ambrosebsRaynes: :)
23:33ihodesvivekn: 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:33ambrosebsit would be a good test for type annotations tho
23:33ihodesvivekn: most people use leiningen (or Cake, but let's not make things too complicated yet)
23:34ihodesvivekn: from the resource, in simple answer to your question: java -cp clojure.jar clojure.main /path/to/myscript.clj arg1 arg2 arg3
23:35licenserRaynes: you don't like findfn?
23:35Raynesihodes: You don't have to mention cake anymore.
23:36viveknihodes: Thanks, but I tried that before. It didn't work as expected. I'll look into leiningen
23:36licenserthe cake is a lie!
23:36Raynesihodes: You considering mentioning it complicated was the nail in the coffin -- we've decided to work on Leiningen instead.
23:36RaynesYou live with that now, boy.
23:36ihodesRaynes: <3
23:37RaynesBut seriously, you don't have to mention it anymore. It's old software. ;)
23:37ihodesRaynes: noted. i've been "outta the game" for a few months
23:37licenserRaynes: cake will become the new i.e. 6 :P
23:37Raynesihodes: https://groups.google.com/forum/#!msg/clojure-cake/GG7DbCQmmW4/Uh7IdWNFmdwJ to get you up to speed.
23:38ihodesRaynes: danke
23:38Raynesihodes: https://groups.google.com/d/msg/leiningen/WnnQIZipG5E/pYhp59aMXTQJ And this.
23:39licenserRaynes: you have those links lying around somewhere or are you just very good at googling?
23:39jodarowow
23:39jodaro1323232749702
23:39jodarounix time is all about 32 right now
23:40ihodeslicenser: they're on his desktop, waiting...
23:40jodarothat has to mean something profound
23:40licenser^^
23:40licensernice timing
23:40jodaroor ominous
23:57ambrosebsraek: I'm having a problem with `def` overwriting my metadata from alter-meta!
23:57ambrosebsthat's expected, right?
23:58ambrosebs,(intern *ns* 'a)
23:58clojurebot#<Exception java.lang.Exception: SANBOX DENIED>