#clojure logs

2012-05-20

00:07amalloyi'm pretty sure a type with 100 instance variables is a disaster
00:10rifeunless they are stored in a list?
02:07muhoois there anything like ring-mock that does cookies?
02:08muhooi need to test a bunch of login crap, and it'd be great to do it from in the repl and clojure test rather than having to rely on something external
02:51muhoovar quoting is making me crazy
02:51muhoo(= POST--fubar--baz (:POST--fubar--baz @noir.core/route-funcs)) ==> true
02:52muhoo(var POST--fubar--baz) ==> #'foo.test/POST--fubar--baz
02:52muhoobut!
02:52muhoo(var (:POST--fubar--baz @noir.core/route-funcs)) => ASSPLODE!
02:52muhooCaused by: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol
02:52ibdknoxit's not a var
02:53ibdknoxit's a function
02:54ibdknoxvar is also a macro that only takes symbols :)
02:54muhooah, that's what it is then
02:54muhoodammit
02:57muhoometadata attaches to the var, so if you assign a function to a map, only the function goes in there, not the var, and metadata goes bye-bye
02:58muhooafaict, anyway
02:58muhoounless you do {:foo #'thething} i guess
03:13muhooi got it! about 10 hours of work for this: https://www.refheap.com/paste/2801
03:14McMartinWhat does the ~ mean? I think I recognize the rest of that syntax.
03:16muhooMcMartin: ~ is a reader macro that means unquote
03:16muhooMcMartin: http://clojure.org/cheatsheet
03:17McMartinAha
03:17muhoomost of the punctuation stuff is at the bottom, under "reader macros"
03:17McMartinGot it
03:17McMartinMy initial get-feet-wet project involved translating an ancient GW-BASIC program into Clojure in a way that minimized use of variables.
03:18McMartinThis may not have been the greatest idea, but I *have* managed to write a 23-clause let binding.
03:18McMartinStatic single assignment: not just for breakfast anymore
03:18muhoothat must have been barrels of fun.
03:18McMartinIt's been an interesting challenge in several ways, and it's gotten me familiar with the many differences from Scheme (my only previous Lisp)
03:20McMartin(And it's a 'spreadsheet game' so this was basically replacing a big chunk of code that involved computing new values for a bunch of variables, so that's now a function that does that in a let and then shoves the relevant results into a map to return)
03:21muhoonice. i'll bet after a while you'll figure out a way to rewrite it more functionally without the lets.
03:23McMartinWell
03:23McMartinThese *are* functional
03:23McMartinThere's two places where I needed swap!
03:23McMartinOr swap!.
03:23McMartinBut those are I/O-based "ratchets" for "do this thing the first time it happens and never again", so I'm OK with hat.
03:23McMartin*that
03:24McMartinThe rest were "here are the 8 things that the user has given us, now give us back the 15 or so outputs to feed into the next turn"
03:24McMartinPut that into a loop-recur on "status" with appropriate escapes for victory or failure, success
03:31amalloyMcMartin: you can use ##(doc delay) for "do this once"
03:31lazybot⇒ "Macro ([& body]); Takes a body of expressions and yields a Delay object that will invoke the body only the first time it is forced (with force or deref/@), and will cache the result and return it on all subsequent force calls. See also - realized?"
03:32McMartinThat's pretty dirty >_>
03:32amalloythat's...more or less what they're for
03:32McMartinFor one-shot I/O?
03:33amalloywell, not exactly, i guess. but for things you want to do at most once
03:51muhoohmm, seems like memoize. though i haven't had reason to use either yet.
03:51McMartinYeah, memoizing the results of a specific println seems like a sleazetastic move to me.
03:52McMartinHey, success, woo
03:52McMartinThis looks like it's working
03:52McMartinHowever, I did need to use Math/ceil so I don't get to just point it at ClojureScript for the web adaptation.
03:53muhooMath.floor in js?
03:54muhoojs/Math.floor i suppose
03:54McMartinOh, nice
03:54McMartinYeah, that'd do in the one place it matters.
03:55McMartinDoes it also have a ceil to go with floor?
03:55muhooyep
04:02fliebelNeither Java or JS Clojure provide rational versions of those, right? Like ##(rationalize (Math/sqrt 12))
04:02lazybot⇒ 4330127018922193/1250000000000000
04:05fliebel... there is an infinite number of natural number, but there are more rational numbers, and even more real numbers.
04:07fliebelUnfair... ##(rationalize (Math/PI)) I had hoped it'd day something like 22/7
04:07lazybot⇒ 3141592653589793/1000000000000000
04:09amalloyfliebel: it said something pretty close to 22/7
04:12fliebelamalloy: i can make any float into a rational n.dddddd => ndddddd/1000000
04:14fliebelAlso, (count natural-numbers) = Double/POSITIVE_INFINITY, (count real-numbers) = Double/POSITIVE_INFINITY so Double/POSITIVE_INFINITY < Double/POSITIVE_INFINITY = true
04:17amalloy&(== Double/POSITIVE_INFINITY Double/POSITIVE_INFINITY)
04:17lazybot⇒ true
04:17amalloyoh right, it's NaN that acts weird
04:23fliebelamalloy: In what way?
04:24amalloycomparisons with NaN always return false, iirc. it's not true in clojure (which is technically incorrect IEEE stuff, i think), because clojure implements (>= x y) as (not (< x y))
04:24amalloy&(< NaN NaN)
04:24lazybotjava.lang.RuntimeException: Unable to resolve symbol: NaN in this context
04:24amalloy&(< Double/NaN Double/NaN)
04:24lazybot⇒ false
04:25amalloy&(< Double/NaN 5)
04:25lazybot⇒ false
04:25amalloy&(> Double/NaN 5)
04:25lazybot⇒ false
04:25amalloy&(>= Double/NaN 5)
04:25lazybot⇒ false
04:25amalloyokay, maybe i'm wrong about clojure being incorrect. anyway, point is NaN acts weird
04:37muhoobatNaN
04:39muhoo&(str (clojure.string/join (repeat 16 Double/NaN)) ", Batman!")
04:39lazybot⇒ "NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN, Batman!"
04:45michaelr`BaNaNa
05:31ghengisI have a question
05:31ghengiswhy don't people use this form of the unless macro:
05:31ghengis(defmacro unless [a-test then else]
05:31ghengis (if (not (eval a-test)) `(do ~then) `(do ~else)))
05:32AimHereBecause that evaluates the test at compile time
05:32AimHereIf your test gives different results when running, then your macro will be wrong
05:33ghengisaha! i wondered because it works in the repl
05:34ghengisthx much!
06:15gtuckerkelloggi'm having some trouble with slime
06:15gtuckerkelloggwhen I run inf-lisp (set to "clj") I get a repl just fine
06:16gtuckerkelloggwhen I run M-x slime
06:18raekgtuckerkellogg: is there any reason you want to start slime this way, or do you just want to get started using the simplest method?
06:18gtuckerkelloggno reason at all
06:20raekthe simplest method I know of is to _only_ install clojure-mode in emacs (i.e. no slime packages), install swank-clojure/lein-swank in leiningen and use M-x clojure-jack-in from emacs
06:20raekalso, inferior lisp and slime are two separate ways to use a repl in emacs
06:21gtuckerkelloggraek, i use clojure-jack-in with leiningen projects all the time, that works great.
06:21gtuckerkelloggbut what I want to do is run clojure from outside of leiningen as wll
06:21gtuckerkelloggin particular, from within org-mode src blocks
06:22raekhow are you going to set up the classpath? have you written a custom script?
06:24raekgtuckerkellogg: setting up inferior lisp is easy. M-x customize-variable RET inferior-lisp-program RET
06:24gtuckerkelloggraek, I can use inf-lisp as well
06:24gtuckerkelloggwhat I can't seem to do is connect the org-mode clojure source blocks to the inf-lisp process
06:24raekthere you can put the path to your clojure launcher script
06:24gtuckerkelloggwhich is why I tried slime
06:25raekif you use slime you need to start a swank server in a clojure process
06:26gtuckerkelloggso for that i need the swank-clojure package?
06:26raekyes
06:26gtuckerkellogg(which doesn't seem to be on marmalade)
06:27raekgtuckerkellogg: it isn't. it's a clojure library
06:27raekyou need to make a "clj" script that puts swank-clojure on the classpath and executes a function in it on startup
06:28raekhttps://github.com/technomancy/swank-clojure
06:28gtuckerkelloggthanks!
06:28raekthen you need to tell slime to connect to the port you started the swank server on
06:28raekM-x slime-connect
06:29raekadditionally, you need to set the encoding since slime defaults to ISO 8859-1 and swank-clojure uses the more sane UTF-8
06:30raekM-x customize-variable RET slime-net-coding-system RET <enter "utf-8-unix">
06:30raek(this step is done automatically by clojure-jack-in)
06:30raekif you don't set that option, then slime will crash when you print a non-ascii character in the repl
06:32raekgtuckerkellogg: this is the entry point the swank-clojure shell wrapper uses: https://github.com/technomancy/swank-clojure/blob/master/src/swank/swank.clj#L105
06:33gtuckerkelloggraek, that's extremely helpful, thank you
06:51tordmorHi! I found this weird behaviour on a 4clojure problem that I don't understand:
06:51tordmor> (apply / '(16 8))
06:51tordmoris 2
06:51tordmor(apply (first '(/ 16 8)) '(16 8))
06:51tordmoris 8
06:52tordmordoes anybody know what is going on?
06:53Bronsa,(apply (first '(/ 16 8)) '(16 8))
06:53clojurebot8
06:54tomoj,('/ 16 8)
06:54clojurebot8
06:54tordmoralso works with other operations
06:54tordmorahhhhh
06:54Bronsaoh.
06:54tomoj,('/ {'/ 2} 8)
06:54clojurebot2
06:54tordmorit doesn't recognize it as function
06:54Bronsait does 'get'
06:54tordmorbecause it's still quoted
06:54Bronsa(get '/ 16 8)
06:54Bronsa,(get '/ 16 8)
06:54clojurebot8
06:55tomojright, it's just like a keyword
06:56tomoj,(:foo 16 8)
06:56clojurebot8
06:56tordmor,(apply ~(first '(/ 16 8)) '(16 8))
06:56clojurebot#<IllegalStateException java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.core/unquote>
06:57tomoj,(doc resolve)
06:57clojurebot"([sym] [env sym]); same as (ns-resolve *ns* symbol) or (ns-resolve *ns* &env symbol)"
06:58tomoj,(apply (resolve '/) [16 8])
06:58clojurebot2
06:58tordmortomoj, Thank you, that's what I need
06:59tordmordamn! I can't use resolve in 4clojure :(
06:59tordmorI'll use a map to resolve it.
07:00tomojthat's better even if resolve were allowed, I think
07:01tordmoryes, might be faster for limited operations.
08:07madsyDoes byte-array convert each element in the collection to a byte, or does it treat each element as multiple bytes?
08:08madsyI need to convert a collection of floats from the range [0 65535] into signed shorts, represented as byte[]. That seems a bit tricky to do from Clojure.
08:09madsyI guess I could cast to short, and then split it into two bytes with bit masking
08:11hyPiRionSo the casting would be like ##(short 65535.0)?
08:11lazybotjava.lang.IllegalArgumentException: Value out of range for short: 65535.0
08:13hyPiRionWell, that doesn't sound "easy".
08:13madsyhyPiRion: Well, the "real" data consists of shorts, but the javax.sound.sampled expects it as byte[]
08:14madsySo you would get one LSB and one MSB
08:14madsyBut, I think I know a way. But it's clumsy.
08:14hyPiRionI would make a function which takes in a float and returns a vector, mapcatted the floats with the fn.
08:15hyPiRionThen finally just spit it into an array with (into-array Byte/TYPE %)
08:16madsyWouldn't into-array just coerse a type into a single byte?
08:16madsyBecause that's what I want to avoid.
08:18hyPiRionWhat do you mean?
08:18hyPiRion,(seq (into-array Byte/TYPE (map byte (range 10))))
08:18clojurebot(0 1 2 3 4 ...)
08:19hyPiRion,(into-array Byte/TYPE (map byte (range 10)))
08:19clojurebot#<byte[] [B@1f67043>
08:19madsy,(seq (into-array Byte/TYPE (map byte (range 255 260))))
08:19clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Value out of range for byte: 255>
08:20madsyI need something like this (defn split-short [x] (let [lsb (bitwise-and x 255) msb (bitwise-and (bit-shift-right x 8) 255)] ... )
08:21madsyAnd store both parts
08:21hyPiRionAh, so 255 -> -1 then
08:21madsySure. There is no unsigned in Java afaik
08:22madsyThe important thing is to store the previous whole range as a group of multiple bytes.
08:22hyPiRionIt's kind of unexpected that (byte 255) doesn't work though, because it does in Java. =/
08:22hyPiRionWell, maybe not unexpected, but it makes stuff more complicated.
08:24hyPiRion,(ubyte 255)
08:24clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ubyte in this context, compiling:(NO_SOURCE_PATH:0)>
09:03madsyhyPiRion: Jeez.. the range for byte is annoying indeed
09:05hyPiRionmadsy: It is kind of weird though. I thought things like short -> byte coercion would be simple.
09:07hyPiRionAh!
09:07hyPiRionmadsy: ##(unchecked-byte 255)
09:07lazybot⇒ -1
09:08hyPiRionShould also work for shorts: ##(unchecked-short 65535)
09:08lazybot⇒ -1
09:10madsyhyPiRion: Nice! Thank you so much
09:11hyPiRionmadsy: You're welcome :)
09:14madsyhyPiRion: I ended up with: (into-array Byte/TYPE (flatten (map #([(highest-byte %) (lowest-byte %)]) coll))
09:16hyPiRionLooks good. (into-array Byte/TYPE (flatten (map (juxt highest-byte lowest-byte) coll)) will do the same thing (take a look at how juxt works).
09:16hyPiRionYou can also change the (flatten (map into (mapcat, I think that is more efficient.
09:16tomojthat can't be right
09:16tomoj,(#([1 %]) 2)
09:17clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector>
09:17tomojyou need ##((#(vector 1 %) 2)) there
09:17lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: PersistentVector
09:17madsyOh, yeah I forgot about juxt
09:18hyPiRion,(seq (into-array Byte/TYPE (mapcat (juxt + -) (map byte (range 10)))))
09:18clojurebot(0 0 1 -1 2 ...)
09:18tomoj,byte-array
09:18clojurebot#<core$byte_array clojure.core$byte_array@a86868>
09:19hyPiRiontomoj: ##(doc byte-array)
09:19lazybot⇒ "([size-or-seq] [size init-val-or-seq]); Creates an array of bytes"
09:21hyPiRionSo, in fact, you can compress the whole thing down to (byte-array (mapcat (juxt highest-byte lowest-byte) coll)
09:28xumingmingv_i met a weird issue about lein
09:29xumingmingv_one of clj file depends on another clj file, let's name it a.clj
09:29xumingmingv_but lein does not schedule a.clj to compile first
09:30xumingmingv_so i got an exception like xxxx class not be found..
09:31hyPiRionWhat version of Lein and Clojure do you use? Do you import the dependency through a :use or a :require?
09:32xumingmingv_i use :import
09:32xumingmingv_i defined a java class (:gen-class) in a.clj
09:32xumingmingv_for java interop
09:32xumingmingv_lein 1.7.1
09:33xumingmingv_1.4.0
09:33raekxumingmingv_: do you require the namespace too?
09:33xumingmingv_raek, no
09:33raekimport only sets up an alias for the class name. it does not cause anything to be loaded.
09:34xumingmingv_so if i need to import a class defined in clj file, i need to :use or :require that clj file first?
09:34raekxumingmingv_: yes
09:37xumingmingv_rake, thanks a lot, really helped!
09:37xumingmingv_rake, thanks a lot, really helped
09:38xumingmingv_… xchat changed my words…
09:38xumingmingv_raek, thanks!
09:39xumingmingv_one more question, for example a.clj depends on b.clj, but from the output of leon, a.clj is compiled first, then b.clj is compiled, why?
09:41xumingmingv_león -> lein, xchat's auto-correction seems annoying
09:43raekxumingmingv_: the compiler begins to compile a, but when it reaches the ns form it will compile b (if it hasn't been compiled already). when b is done it will resume compiling a.
09:44raekcompiling is just executing the top-level expressions
09:44raekand storing the generated bytecode
09:53ambrosebsI'm looking for a graph of the Clojure collection hierarchy
09:54ambrosebshas anyone seen one around?
09:54ambrosebsWriting in on ye ol' paper
09:54Bronsahttps://github.com/Chouser/clojure-classes ?
09:55jonasenambrosebs: https://github.com/Chouser/clojure-classes/blob/master/graph-w-legend.png
09:55ambrosebsepic!
09:55ambrosebsthx
09:55Bronsathe png is not updated
09:55Bronsause the svg
10:05ambrosebsBronsa: cheers
10:32lynaghk`ping: cemerick
10:32cemericklynaghk`: hi :-)
10:32lynaghk`cemerick: hey chas, how's it going?
10:33cemerickPretty good. On vacation.
10:33lynaghk`cemerick: oh, boss! Chillin' in #clojure from the beach?
10:33cemerickCambridge at the moment, waiting to hear from Sam and Edmund, actually. :-)
10:33cemerickBeaches were earlier this year.
10:34lynaghk`Sam & Edmund, you'll probably need to save your energy to keep up with those two
10:35cemerickPer usual.
10:35cemericklynaghk`: so, what's cooking?
10:35lynaghk`cemerick: I'm moving forward a bit on that lawyertron project you saw, and I wanted to ask you if you'd used any solid exception notification stuff on clojure/heroku stack. I'd like to start aggregating things like when certain futures timeout or raise exceptions.
10:35cemerickAh, nope. I'm fundamentally a heroku noob.
10:36lynaghk`get emails when stuff blows up, &c. I've used New Relic on a Rails stack, but that's pretty much it in terms of adv. perf/uptime monitoring
10:38lynaghk`cemerick: ok, thanks. I'll keep digging around.
10:38cemerickThere's lots of options though, most (all?) unrelated to heroku. Presumably, you could bring your own? I always get antsy about thinking about such things in a vendor-specific way, though.
10:40lynaghk`cemerick: yeah. My needs are pretty limited too. Mostly I want something that is easy to setup and understand, and will let me know what stuff is blowing up.
10:41cemericklynaghk`: I used cloudkick for a while ~18 mos ago. They've been bought though, so I don't know where that's headed.
12:06madsyCould someone help me with a code snippet? I have an IllegalArgumentException (Illegal Format) I have no idea where comes from
12:07madsyNone of the classes I use is supposed to throw that
12:07madsyhttps://gist.github.com/2758323
12:09gfredericksmadsy: side note; I don't think importing java.lang.Math is necessary
12:09madsyOh, hm. I guess javax.sound.sampled.Clip throws it. Still, I see nothing wrong with the arguments
12:09madsygfredericks: Oh, thanks
12:12gfredericksbut I don't see anything notable at a glance :/
12:13banseljajHey guys. I have been trying out the "Programming Clojure" book, and I wanted the latest version of clojure from git. I have cloned it and ran "mvn package" but I can't seem to be able to use leiningen with it. any ideas?
12:17madsybanseljaj: If you get the latest version of leiningen, it should fetch Clojure 1.4 for you automatically
12:17banseljajmadsy: I have leiningen 1.7. also, isn't 1.5 the latest one for Clojure?
12:18madsybanseljaj: Oh, that might be. I haven't checked.
12:18ForNeVeR1.5 is devel version.
12:18madsyThere is a 2.0 of Leiningen. 1.7 is the old one
12:18ForNeVeRAre you sure you want it?
12:18banseljajForNeVeR: Newbie. So I'll stick with the stable
12:18reximForNeVeR: O_o
12:19ForNeVeRbanseljaj: so use 1.4 from lein, and you'll be okay.
12:19ForNeVeRrexim: no u.
12:19reximForNeVeR: yes me.
12:19ForNeVeR//_~
12:19banseljajForNeVeR: How do I check clojure's version? (version)?
12:20gfredericks,*clojure-version*
12:20ForNeVeRbanseljaj: `lein repl` and then *clojure-version*
12:20clojurebot{:interim true, :major 1, :minor 4, :incremental 0, :qualifier "master"}
12:21gfredericks,(type #queue [])
12:21clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag queue>
12:21gfredericks,(type #bytes [])
12:21clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: No reader function for tag bytes>
12:22banseljajuser=> ,*clojure-verision* ; java.lang.Exception: Unable to resolve symbol: *clojure-verision* in this context (NO_SOURCE_FILE:0)
12:22banseljajForNeVeR: I get the above error.
12:22ForNeVeRbanseljaj: remove ,
12:22ForNeVeR, for talking with clojure-bot
12:22clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.core/for, compiling:(NO_SOURCE_PATH:0)>
12:23ForNeVeR,'(yes sir)
12:23clojurebot(yes sir)
12:23twhumeI have a sequence of predicate functions (suitable for "filter") and want to run them against a candidate sequence and return the first one that fails. What would be the most idiomatic way to do this in Clojure?
12:23banseljajForNeVeR: Same error when I remove the ","
12:23ForNeVeRbanseljaj: it cannot be!
12:23banseljajForNeVeR: Sorry. typo
12:23banseljajOkay. It says I have 1.2.1
12:24ForNeVeRSomewhat old version.
12:24banseljajCan multiple versions of clojure reside on the same system?
12:24raekbanseljaj: yes. leiningen takes care of that.
12:24madsybanseljaj: I don't see why not.
12:25raekeach project specifies its own version
12:25banseljaj,(str "banseljaj" \space "is" "...")
12:25clojurebot"banseljaj is..."
12:25madsyJust give them different version number names
12:25banseljajIn the project.clj?
12:25raekyes
12:25banseljajAh.
12:25banseljajI apologize if I am being too noobish. I tend to learn more by asking rather than reading.
12:25raekthis is similar to virtualenv in python-land
12:26banseljajor rvm in ruby
12:26raekclojure is unconventional, so don't be ashamed
12:27banseljajYes. I feel like I am learning programming from scratch.
12:27banseljajIs it common to make seperate project directories to work on different projects, and downloading clojure using lein each time?
12:27gfredericksForNeVeR: the comma wouldn't mess him up; it's just whitespace
12:28ForNeVeRgfredericks: aw, you right.
12:28raekbanseljaj: yes. each version of clojure you use is only downloaded once, though
12:28banseljajI mean Should I use "lien new play-around" and use that project for my usual testing and fooling around?
12:28raekyeah
12:28ForNeVeRSry, I just came from evil-flooded common lisp land.
12:29ForNeVeRComma is significant there.
12:29raekthat might feel a bit odd, but there's not any simpler way currently in lein
12:29banseljajThanks raek, ForNeVeR, madsy.
12:29raekcake had a "global project"
12:29banseljajYou guys mind if I stick around here? :)
12:29gfredericks~guards
12:29clojurebotSEIZE HIM!
12:29raeklein hasn't got any global project yet, because no one has bothered adding that
12:31banseljajthen what is the default clojure version that is run when I use lein repl? My current install obviously uses the one that it installed with programming clojure source.
12:32raekbanseljaj: if you run `lein repl` outside a project, you get whatever clojure version leiningen uses internally
12:32ForNeVeRbanseljaj: that's okay. You may install another version of clojure with any project.
12:32ForNeVeRAnd get that version of clojure repl.
12:33raekif you run `lein repl` within a project, you get the clojure version specified in the corresponding project.clj
12:33banseljajOkay. So apparently leiningen uses Clojure 1.2 internally.
12:34raeklein repl outside a project is mainly there for when you quickly want to try something in a clojure repl
12:34banseljajOh. Nice.
12:35banseljajI come from a ruby background and it is second nature for me to fire an irb session to test my code.
12:35raekbanseljaj: yes, lein 1.x uses clojure 1.2. lein 2.x uses 1.3 or 1.4 (not sure)
12:35banseljaj~guards
12:35clojurebotSEIZE HIM!
12:35raekbanseljaj: when developing in clojure you often keep a repl open during the whole session
12:36raekand purely functional code is often very easy to test in a repl
12:37banseljajleiningen is a standard tool for clojure development, I gather?
12:38raekbanseljaj: yes. clojure the language comes as a jvm library.
12:38raekfrom the author of leiningen himself:
12:38raek"For work I use Leiningen a lot. A lot of people get confused when working with Clojure because Clojure itself is just a library rather than an application, and they expect to interact directly with it. Leiningen is that application that you interact with directly."
12:39raekhttp://phil.hagelberg.usesthis.com/
12:40raekit's a bit sad that clojure.org doesn't mention Leiningen in big bold letter on the front page
12:40raeksince it is the de-facto tool
12:43Borkduderaek: I think clojure 1.4
12:44Borkduderaek: and now I'm sure
12:44raekah, probably changed in preview4
12:49banseljajIt's my opinion, as a beginner, that clojure needs a more stream lined approach to install. :( the current approach might turn people off.
12:50wkmanirebanseljaj: What would you change to make it better?
12:51banseljajHmm. I am totally willing to actually do this stuff.
12:51banseljajFor one, I would see if we can package a JVM + clojure library as a single package with most deps.
12:52banseljajfurthermore, as leiningen is already the standard tool, I'll probably include that in the main install package too.
12:52banseljajI think it should be easy to do in *nix distros.
12:52banseljajAnd the last thing, which would take a lot more time, is that I would fork emacs to make a clojure specific editor.
12:52wkmanireI've done the install on both linux and windows. On linux it was a lot easier.
12:53banseljajyeah. on linux it's just sudo yum/apt-get install leiningen
12:53Iceland_jackbanseljaj: not quite, most people recommend against that
12:54wkmanireI think the emacs part is unecessary. You could provide a script that configures an existing emacs installation with clojure-mode and paredit-mode and install swank-slime.
12:55banseljajWell, I wouldn't know about that. I am still learning emacs.
12:56banseljajOverall, Clojure is my first lisp. And I like it. a LOT
12:56banseljaj:D
12:57banseljajI sometimes hate ubuntu
12:57wkmanirebanseljaj: I wouldn't make light of forking emacs. he he
12:57wkmanireIt isn't a simple project.
12:58wkmanireBut if you install the major modes that you need and the swank slime package then you've got a perfect editor for hacking clojure.
12:59wkmanirebanseljaj: I'm new to clojure too by the way.
12:59banseljajwkmanire: woo. Another newbie. :) *shakes hands*
13:00banseljajwkmanire: Well, The question would be how to get all the needed packages. :)
13:00wkmanirelein handles most things.
13:00wkmanirePractically *all the things*
13:01wkmanireAs far as setting up emacs modes, that is all pretty simple.
13:02wkmanireYou just have to download the required .el files, put them in your site-lisp folder, then update your ~/.emacs configuration file to include the .el files in your load path.
13:02wkmanireYou could probably use package-mode too to install the modes from marmalade.
13:03banseljajwkmanire: Yeah. I'm gonna use emacs starter kit
13:03wkmanireLots of options. In the case of setting up emacs, I would only suggest writing a tutorial. There already are tutorials for most things.
13:03banseljajis maven repo down or some thing? Lein is not downloading the list.
13:08madsyFunky.. my problem seems to be OpenJDK's fault :/
13:15raekbanseljaj: if you decide to make a stream lined installer for "clojure", please make sure you know how clojure development is done in practice first
13:16raekif you use leiningen (which most people do), there is no need to install clojure or any libraries.
13:17raeksince those are handled as project dependencies
13:23madsySigh.. so javax.sound.sampled is broken in Linux with OpenJDK. Is there something else I can use for sound which actually works?
13:28banseljaj<raek> banseljaj: if you decide to make a stream lined installer for "clojure", please make sure you know how clojure development is done in practice first -- I shall keep that in mind. Until I know enough, I will not venture into contributing crucial pieces of software
13:30wkmanirehe he he
13:30wkmanirebanseljaj: I say shoot for the sky.
13:30wkmanireIf it's good, it'll stick
13:30wkmanireif it isn't, you'll find out why.
13:30Borkdudebanseljaj: what would you install? a jdk ?
13:31banseljajBorkdude: I'd probably use a standlone jdk installed just for clojure. I seem to remember one such package using this kind of approach. just can't remember which it was.
13:31devngood weekend all
13:32wkmanireHidevn
13:32banseljaj,(str "Hi " 'devn)
13:32clojurebot"Hi devn"
13:32Borkdudebanseljaj: what would be useful maybe is a small linux distro with a jdk + some pre-configured IDEs like Eclipse + counterclockwise/leiningen, Emacs, Netbeans, IntelliJ and a version of leiningen thoroughly tested
13:33wkmanireBorkdude: Now that sounds like awesome.
13:33Borkdudebanseljaj: so people can just load that up in their favorite VM program to get to work real quick
13:33banseljajBorkdude: In my expreience, that would be rather easy to build than my solution. :D
13:34wkmanireCompletely removes all barriers to entry except for knowing how to either install an OS or load a VM.
13:34banseljajWell, I can't promise anything to the community but I think I should have something capable of running and failing in about two months or so. :D
13:34BorkdudeVirtualBox is free and runs on linux/OSX/windows
13:34banseljajwkmanire: Well, that can be handled quite easily.
13:35Borkdudeyou would just have to provide an image for that with all good defaults set
13:35raekbanseljaj: please do contribute! but don't forget to gather feedback from other clojurians...
13:35banseljajYeah. an iso, cross compiled.
13:35Borkdudelabrepl already installed, + other nice things
13:35wkmanireBorkdude: labrepl?
13:35banseljajraek: No. I'd work in secret on this. and take over the world. :D
13:36BorkdudeClubuntuj ? ;)
13:36banseljajwkmanire: it's a clojure lab web app
13:36wkmanireBorkdude: That hurt my eyeballs.
13:36banseljajBorkdude: ubuntu is not a good candidate IMO
13:36devnBorkdude: it was used in the pragprog training by rich and stu ages ago
13:36devni havent looked at it in awhile, but it was maintained once upon a beard
13:36Borkdudecljarch linux
13:37wkmanirePlain old debian+clojure. Clebian.
13:37banseljajWell, I'm gonna build a very basic setup and I'll report her.
13:37wkmanireClojure and debian for the plebians.
13:37banseljajClebian is a nice name. :D
13:37banseljajBut we need one with a flair. :D
13:37banseljajOne that is not a blatant ripoff. :P
13:38matessimmy copy of Clojure programming arrived NOW!
13:38matessimTIEM for world domination
13:38matessimbut first, we read.
13:38banseljajWhat would be funny is if it's named clebian but it's based on fedora. :D
13:38devnI like Clebian
13:38banseljajmatessim: CONGRATULATION!
13:39Borkdudewkmanire: cljnux
13:39devnaw bummer, clebian wouldn't be spelled right: "plebeian"
13:40devnplus it has negative connotations
13:40devnso nevermind
13:40Borkdudeclojuxt
13:40devnjuxtify
13:40banseljajLambda?
13:40Borkdudeor just "clojure linux"
13:41banseljajBorkdude: Boooooring!
13:41devnor just "linux with clojure in it"
13:41devnif it doesnt have a super sweet name we cant get people who try anything with a sweet name to download it
13:41raekwhat would this distro contain?
13:41banseljajKappanix
13:41banseljajKappa = klojure
13:41wkmanire:(
13:41devnit sort of sounds like kernel panics
13:42devnkappanix
13:42BorkdudeDamn functional linux
13:42raeka JVM, leiningen + swank-clojure, emacs + emacs-starter-kit + clojure-mode?
13:42banseljajraek: Latest Clojure, OPen jdk, labrepl, and IDEs already set up for use with Clojure
13:42wkmanireDFL has the CLJ and the JVM and the FUN!
13:42devn"Cloy"
13:42raekbanseljaj: what do you mean by latest clojure?
13:42wkmanireBorkdude: ^
13:42devnCloy would be a cool distro name
13:43banseljajraek: The latest stable release preinstalled and updatable using lein
13:43banseljajdevn: Cloy is nice'
13:43devnnono wait
13:43devni got it
13:43devncloister.
13:43Borkdudecloy?
13:43devndone and done.
13:43raekbanseljaj: how would you use this installed clojure version?
13:43devncloy means to disgust with an excess of richness or sweetness
13:43uvtcbanseljaj, on Debian-based systems, it's pretty easy to apt-get install openjdk-6-jdk, then grab lein and start working. Maybe I'm not understanding what problem you're trying to solve.
13:43banseljajjava -cp local-version.jar
13:44devncloister is a convent, monastery, college, or cathedral
13:44jonhi love this idea of a clojurating system
13:44progolambdax
13:44banseljajuvtc: the problem is to get a unified standard starting system that lets you start with repl immediately
13:44Borkdudelinuxen… a clojure linux distro to get started without setting your hair on fire
13:44raekpersonally, I'm sceptical to going back to "java -cp clojure.jar" or "clojure scripts"
13:44raeknow that we have Leiningen
13:44Borkdudeleinuxen
13:45Borkdudeor leinux
13:45devnleinux
13:45uvtcbanseljaj, `lein new foo; cd foo; lein repl` is pretty immediate though.
13:45banseljajthe good names so far: Leinuxen, lambdax, cloister and kappanix
13:45devnim still going with cloy or cloister, because then you get carcassonne fans as a two for one
13:45raekwell, I can appect this: alias clojure='lein repl'
13:46BorkdudeI like leinux as a tribute to leiningen… I don't know carcasonne
13:46banseljajuvtc: Not on windows. and that still doesn't set up the different editors/IDE
13:46banseljajuvtc: Just bouncing ideas. :)
13:46uvtcbanseljaj, Ah.
13:46banseljaj<Borkdude> I like leinux as a tribute to leiningen… -- +1
13:47devncloister just wins -- sorry, but im stuck in the mud on that name
13:47devn:)
13:47raekbanseljaj: I think the "java -cp ..." approach is bad for noobs, since becomes significanly complicated when need to done any of:
13:47banseljajdevn: Two votes for Leinux. :P
13:47banseljajraek: noobs would just use a shortcut on the desktop.
13:47wkmanireWhat did I miss?
13:47raek1) load code from source files (!)
13:48wkmanireMay laptop ate all the battery.
13:48raek2) use external libraries
13:48raek3) integrate with editors
13:48jonhdevn: i to think cloister is win
13:48jonhtoo
13:49banseljajwkmanire: the good names so far: Leinuxen, lambdax, cloister and kappanix
13:49banseljajraek: that's the idea.
13:49raekbanseljaj: be sure to include documentation on how to begin "real development"...
13:50banseljajraek: A local mirror of docs and sources would be nice. :)
13:50raekwe get a lot of people in this channel who are halfway though implementing their own Leiningen because they started with one of the "clojure scripts"
13:51banseljajAlso, if there is a good open source book, or one that can be released with the linux, that'd make it frickin complete
13:51wkmanirebanseljaj: Well, there are some really good books
13:51raekbanseljaj: a link to the Leiningen readme on the desktop
13:51raekessential.
13:52wkmanireand the authors are in #clojure all of the time.
13:52wkmanireSo their books tend to get recommended.
13:52wkmanireI'm currently working through Cemerick's new book on my kindle.
13:53jonhwhich book is that?
13:53BorkdudeI think a VM would be nice to try things out without installing things on your machine (IDEs) and see how it should work if it works (not if it doesn't work on your own machine because of some weird thing)
13:54devnjonh: joy of clojure, clojure programming, programming clojure, practical clojure
13:54devni mean honestly without exception the authors of books hang out in here at one time or another
13:54devnbut id say joy of clojure and clojure programming have the most presence as of late
13:55Borkdudethe thing I learned so far from CP is that Ruby has a really weird synta
13:55Borkdudex
13:56wkmanireBorkdude: Yes it do.
13:56wkmanireBorkdude: Very oddish. But I'd still take ruby's syntax over C++ any day. :D
13:56wkmanireAnd I'm not even a rubyist. I fell in with the Python camp.
13:57Borkdudewkmanire: I like Python's syntax better
13:57banseljajBorkdude: I don't find it weird. but then again, ruby was my first language.♥
13:57wkmanirebanseljaj: Ahhh, first love.
13:57Borkdudewkmanire: one thing in Python though: variables introduced in for loops are global, wtf?
13:58banseljajBorkdude: Python's syntax *is* cleaner. I personally don't work well with indentation. :(
13:58Borkdudebanseljaj: GW Basic was my first language
13:58Borkdudethen Turbo Pascal
13:58Borkdudeno first Turbo Basic
13:59banseljajBorkdude: GW BASIC was the forst one I did, but never did actual programming, i.e problam solving, until ruby.
13:59BorkdudeI was so happy when I could compile my own executables… :-)
13:59banseljajBorkdude: that feeling is indeed awesome. :D
14:00banseljajAs programmers go, I belong to the breed that has a profession that has nothing to do with programming. :D
14:00jonhdevn: thanks, I just started clojure a few days ago and purchased the joy of clojure; so far so good :P)
14:01Borkdudebanseljaj: what is your profession?
14:01banseljajI'm 99% doctor.
14:01banseljaj(meaning months away from graduation)
14:01Borkdudebanseljaj: doctor meaning PhD? in what field?
14:02banseljajDoctor meaning MD. Specializing in psychiiatry
14:02banseljajs/Psychiiatry/Psychiatry
14:02Borkdudebanseljaj: ah ok
14:03Borkdudebanseljaj: maybe you can do a research on clojure as a therapy or why it is so addictive ;)
14:03jonhso you can help us after we go clinically insane
14:03jonhor that
14:03banseljajI think jonh's idea is better. :P
14:04banseljajClojure Therapy: A new frontier in recovering Imperative/Object-Oriented Programmers.
14:04Borkdudebanseljaj: I have a mutability trauma…
14:05Borkdudebanseljaj: can you help me?
14:05banseljajBorkdude: take a seat and tell me where it touched you.
14:05wkmanire99% doctor? Is that contagious?
14:05Borkdudebanseljaj: I think we have to go back to my childhood, GW BAsic
14:06wkmanireBorkdude: I started with QBasic.
14:06wkmanire:D It was awesome.
14:06banseljajwkmanire: Nope. :)
14:06jonhcan i get a "shut up and take my money!!!" ?
14:06uvtcuh oh, Borkdude is regressing. :)
14:06Borkdudewkmanire: I also used that, in the later versions of DOS
14:06wkmanireBorkdude: I print'd, circle'd, line'd and pset'd the night away.
14:06wkmaniremany many weekends.
14:06banseljajGW BASIC was the thing that hooked me on computers. :)
14:07wkmanireBorkdude: Have you ever seen the QBasic Nerd video on youtube?
14:07Borkdudewkmanire: no
14:07wkmanireIt is practically the anthem of my childhood.
14:07wkmanirehold on, I'll link it for you
14:07Borkdude(on a sidenote, has anyone tried microcontroller programming as a hobby here?)
14:07wkmanireBorkdude: http://www.youtube.com/watch?v=Mal6XbN5cEg
14:09banseljajBorkdude: Nope. I didn't actually have my own computer till 2003.
14:11Borkdudewkmanire: you didn't make this video, did you? ;)
14:11wkmanireCan I use tags with clojure in emacs?
14:11wkmanireBorkdude: No, it wasn't me actually.
14:11wkmanireI wish it were.
14:11wkmanireBorkdude: Pretty kick ass though right?
14:11banseljajwkmanire: Is that you? :D
14:12wkmanireNo, I'm much prettier with my bald head and red beard.
14:12banseljaj:D
14:12Borkdudewkmanire: well, it reminds me of my childhood as well, but it doesn't included mod tracker software and floppy disks
14:12webbenwkmanire: Good grief. via that video. people still program stuff in qbasic: http://www.qbasicstation.com/
14:12clojurebotprofiles in clj-http is https://gist.github.com/1846759 an example of the profiles feature in Leiningen 2
14:13Borkdudewkmanire: http://www.youtube.com/watch?v=6RpB41Txa9M
14:15BorkdudeI never had the fun I had in programming as a kid in GW BASIC until I discovered Common Lisp and now Clojure though
14:15wkmanireBorkdude: Cool video.
14:16wkmanirewebben: I still hack a little QB when I'm feeling nostalgiac.
14:16wkmanirewebben: Usually with a few beers.
14:17Borkdude.bat scripts are nostalgia and also still reality (leiningen ;))
14:17Borkdudeshow me your autoexec.bat and I'll show my .emacs/init.el? :
14:17Borkdude:P
14:18banseljajI never did .bat scripts.
14:18banseljajWindoze is for video games. :)
14:18BorkdudeI wonder what would attract kids to programming when growing up with Windows right now
14:19wkmanireI want to browse through use's of a particular function in a project.
14:19Borkdudeclearly in the 80ies it was GW Basic on DOS
14:19wkmanirecan I set up tags to do that with clojure?
14:19Borkdudemaybe Apple had something like it too? I didn't know much people with Apples then
14:19wkmanireBorkdude: Back in the day you could actually produce a box-on-the-shelf quality video game by yourself as a 16 year old.
14:19wkmanireBorkdude: That was pretty attractive.
14:20wkmanireNot really feasible anymore.
14:20Borkdudewkmanire: maybe the web is now more attractive, javascript?
14:20Borkdudewkmanire: what would a child try to make I mean just for fun
14:20misislavskiWhat's a good alternative to (format) in ClojureScript?
14:20wkmanire"Oh wow! I make some text appear on the screen look at that!" -- 16 year old in the 80`s
14:21wkmanire"THis is so lame! How do I do 3d stuff?" -- 16 year old in 2012.
14:21Bronsalol
14:21Borkdudewkmanire: I wrote programs on paper when I was 12 and bored with arithmetic, I used to type it over when I arrived home
14:21wkmanireBorkdude: Yes, I think Javascript is probably the winner of today. You can make things work on your mobile phone appendage.
14:22banseljajI agree.
14:22eggsbyBorkdude: were they BASIC programs
14:22Borkdudeeggsby: yes, including line numbers
14:22eggsby:p
14:22wkmanireAhhh.. Beginners All Purpose Symbolic Instruction Language. I still remember the acronym.
14:22banseljajI attracted my little cousins to OOP by setting them up at irb.
14:23eggsbymy first language was js then java
14:23banseljajeggsby: You are closer to my age then. :D
14:24Borkdudeeggsby: banseljaj what age are we talking?
14:25banseljajDragon Age, Obviously
14:25wkmanireLooks like ctags works on lisp.... I hope it works on clojure.
14:25eggsbyI'm 23, I'd wager you're late 30s early to mid 40s Borkdude ?
14:25Borkdude31
14:25eggsby:(
14:25wkmanireNope, it looks for defun
14:25wkmanire:(
14:26wkmanireeggsby: What do you wager for me? Hmm? hmm?
14:26Borkdudeeggsby: why :( ?
14:26eggsbycause my guess was incorrect!
14:26banseljaj+this year
14:27banseljajwkmanire: You are like 35 OSLT
14:27banseljaj+/- 5
14:27raekwkmanire: have you tried using M-. with slime?
14:27BorkdudeI remember seeing Java for the first time… public static void main(String [] args) wtf?
14:28eggsbyhonestly, I was interested in programming in highschool, so I took a java class.. it really turned me off
14:28Borkdudeit didn't really invite me to explore any further
14:28eggsby'why is there so much ceremony just to do this simple thing'
14:28Borkdudethey should have used GW BASIC for web applications… GW BASIC EE
14:29banseljajI read "SAMS teach yourself java in 24 hours'. I got distracted around hour 8, never went back. :(
14:30eggsbysmalltalk webdev
14:30Borkdudebanseljaj: did they recommend 24 hours in one go? ;)
14:30raekwkmanire: it probably doesn't use etags/ctags under the hood, but provide a similar interface
14:30eggsbyevery url is an object
14:30wkmanireeggsby: 26
14:30wkmanire ha ha
14:30wkmanireraek: Looking, sorry for the delay. Had to discipline my offspring.
14:31wkmanireraek: M-. definition not found.
14:31wkmanireeggsby: I started young. 12 years old or so.
14:31raekwkmanire: which version of swank-clojure / lein-swank do you use?
14:31eggsbynice
14:32eggsbyI didn't get serious about dev until about 3 years ago
14:32raekand did you use clojure-jack-in or another approach?
14:32wkmanireraek: Yes, that's what I used.
14:32pandeirowkmanire: are you from MT originally?
14:32wkmanireraek: I forgot which version of swank-clojure I have, how do I check that?
14:33wkmanirepandeiro: Não. I was born in Texas and grew up in Las Vegas.
14:33raekwkmanire: if you use lein 1.x, check your ~/.lein/plugins/ directory
14:33wkmanire1.4.2
14:33raekhrm
14:34pandeirowkmanire: ah ok, you don't sound like an ESLer come to think of it
14:34raekalso, M-. requires the code to be loaded before it can find it. have you required all involved namespaces?
14:34wkmanirepandeiro: He he. No. English was my first language. I am fluent in portuguese too.
14:34wkmanirepandeiro: I started learning about 4 years ago.
14:34wkmanireraek: I would do that from the repl?
14:34pandeiroyou moved to brasil 4 years ago?
14:35raekwkmanire: (require 'my.namespace)
14:35wkmanirepandeiro: No, 3 months ago. But I've been visiting every year.
14:35pandeirocool, i moved down here when i was 22, 8 years ago
14:35raekafter that, M-. should be able to find all functions in that namespace and all namespaces it uses, etc
14:35raekC-c C-k in the buffer does the same thing
14:35raek(the source file buffer)
14:36wkmanireraek: ha ha ha, I know how to load a namespace. I mean if I require everything from the REPL will it do the trick?
14:36raekyes
14:36raekah, sorry. I misread what you said... :-)
14:36wkmanirepandeiro: Where from?
14:37raekwkmanire: M-. works for me with swank-clojure-1.4.2
14:37eggsbyI just watched that documentary 'wasteland', so beautiful
14:37eggsbyyou seen it wkmanire ?
14:37pandeirowkmanire: southern california
14:38wkmanirepandeiro: Interesting. Why'd you move to Brazil?
14:38wkmanireDo you have Brazillian parents?
14:38wkmanireraek: No luck so far.
14:38pandeirowkmanire: no, Brazilian wife and now a Brazilian kid :)
14:39wkmanirepandeiro: I'm about to marry one myself.
14:39banseljaj<Borkdude> banseljaj: did they recommend 24 hours in one go? ;) Nope. But i sure took it that way. :D
14:39pandeirooh good luck with that
14:39raekwkmanire: does it work if you put the point inside let in a (let [...] ...) and press M-. ?
14:39pandeiro;(
14:39pandeirothat was supposed to be a ;) but freud etc..
14:39wkmanireWe're still working on the kid. It's hard work. :D
14:39raekwkmanire: I just realized a thing. what clojure-mode version do you use?
14:39pandeiroyeah for me it was 'um chute um gol'
14:40wkmanireha ha ha ha
14:40raekM-: (clojure-mode-version) RET
14:40wkmanire1.11.5
14:40raeksame as mine...
14:41wkmanireraek: I'm obviously doing it wrong.
14:41wkmanire:/
14:41wkmanirepandeiro: We're working on the I129F visa. One month to go in the wait.
14:41BorkdudeThe nice thing in Python is that you can make smileys to get things from indexed collections, s = 1, X = [1,2,3], X[:-s]
14:41wkmanirepandeiro: I'm so tired of all of this visa crap.
14:41raekwkmanire: C-h k M-. shows the help for slime-edit-definition for me. what does it show for you?
14:42wkmanireraek: Same.
14:42raek:/ indeed
14:42wkmanireIt's just telling me definition not found for whatever I try it on.
14:43pandeirowkmanire: having a kid was the easiest way for me to normalize; i was here 5 years illegally before that
14:43raekwkmanire: in the repl or in a source file buffer?
14:43pandeiroprocess was relatively painless actually
14:43wkmanirepandeiro: Damn. Hell of a risk, that.
14:43wkmanirepandeiro: We're trying to live in the states though, not Brazil.
14:43wkmanireraek: IN the source file buffer.
14:44raekwkmanire: and M-. on the word "let" fails too?
14:44wkmanireraek: No, that works.
14:44pandeirowkmanire: that is definitely more complicated.. was hard for my partner to get a visa
14:45wkmanirepandeiro: Mine was turned down on the tourist visa, which is why I'm here now.
14:45raekok, so then it works (partially). it just cannot find your own definitions?
14:45wkmanirepandeiro: This fiancé visa aughta work out though.
14:45wkmanireraek: Yeah. I'm working on refheap. Raynes asked me to add to the API.
14:46raekwkmanire: and you ran C-c C-k in the buffer?
14:46wkmanireraek: but I'm having trouble getting refheap.models.api to load in the REPL.
14:46wkmanireraek: error: java.lang.AssertionError: Assert failed: (connection? conn), compiling:(paste.clj:22
14:47raekwkmanire: ok, this sounds like an issue with the refheap code and not with M-.
14:48wkmanireraek: Agreed.
14:49wkmanirepandeiro: Recently the US government relaxed quite a bit with Brazilians entering the country. I'm hoping that will help our case too.
14:49wkmanirepandeiro: You'd think it'd be enough to fall in love right?
14:49wkmanireThat was the easiest part. *sigh*
14:49pandeirowkmanire: now that brasil's coming along yeah, dont think either country will require a visa soon
14:49wkmanireraek: Thank you for your help.
14:50wkmanirepandeiro: The two countries only stand to gain by working together.
14:52pandeirowkmanire: good luck with your process, i'm sure it'll work out. if you're ever in SP drop me a line. email is nick @gmail
14:53wkmanirepandeiro: I usually pass through sp entering and leaving the country.
14:53wkmanireBut I've only left the airport once.
14:53wkmanire:D thanks for the invitation though. I'm sure I'll end up in sp for more than a day eventually.
14:55banseljajHmm. labrepl won't run. I wonder why it throwsa a ClassNotFoundException
15:11Borkdudehow does keynote compare to powerpoint on mac, is it easier to use etc? any experience?
15:11BorkdudeI'm asking this because I copy pasted some clojure code to powerpoint which turns out very urgly
15:11Borkdudeugly
15:11Borkdudeand I can't get the highlighting in order
15:12banseljajBorkdude: Interop between them is tough.
15:12banseljajbut PP is pretty awesome in its own right
15:13ghengisi can usually preserve syntax coloring when cutting and pasting from eclipse -> word/lotus notes, etc
15:13Borkdudeghengis: did you try Eclipse -> Powerpoint?
15:14ghengisnope
15:14Borkdudeghengis: I always have to fix the indenting and coloring
15:14Borkdudeghengis: but maybe I'm doing something stupid
15:14ghengisi haven't used powerpoint in ages
15:15BorkdudeI use latex/beamer for other presentations but in this one I want to be able to change the code in a wysiwyg fashion
15:19ghengisall I know is that eclipse is one of the few editors that preserves coloring on the clipboard
15:20banseljajBorkdude: There is a Latex editor that also has WYSIWYG
15:20banseljajIn othernews, suddenly lein has stopped working
15:23ghengisso i asked last night, why this implementation of unless is bad
15:23ghengis (defmacro unless [atest then else] (if (eval atest) then else))
15:24Bronsa(defmacro unless [atest then else] `(if ~atest ~then ~else))
15:24Bronsawell
15:24Bronsa(defmacro unless [atest then else] (list 'if atest then else))
15:24Bronsaghengis: defmacro should produce a list
15:25raekghengis: one reason it is bad is because it does not behave the same as Bronsa's definition
15:25banseljajUmm. Guys, halp. lein and lein2 refuse to run repl.
15:25ghengisin the repl, it works, but i understand in compilation, it's different
15:25Borkdudebanseljaj: what OS are you on?
15:26banseljajBorkdude: Linux. ubuntu 12.04
15:26Bronsawell, ghengis's unless does the conditional at compile-time
15:26raekghengis: don't you expect <a> in (if <a> <b> <c>) to be evaluated each time the if is evaluated?
15:26Borkdudebanseljaj: does it look like this issue? https://github.com/technomancy/leiningen/issues/582
15:26raekghengis: note that (let [x 1] (unless (= x 1) ... ...)) fails, because x is not avaiable there
15:27raekall expressions passed to eval are evaluated as if they were on the top level
15:27Borkdudebanseljaj: in other words, a hanging REPL
15:27raek(so you can't use any local variables)
15:27banseljajBorkdude: Nope. It just crashes even before repl starts.
15:27ghengisyeah, i see now
15:28raekbanseljaj: can you post the stackrace (or other error message) you get?
15:28ghengisraek: that's a good test
15:28banseljajJust a minute
15:28raekghengis: a macro like that can be useful, but I wouldn't name it "unless". "compile-time-unless" would perhaps be better
15:29banseljajraek, Borkdude:https://gist.github.com/9088572fce73895b60a0 --this shows everyhting I did
15:30Borkdudebanseljaj: don't call your project clojure
15:30banseljajOh.
15:30banseljaj*facepalm*
15:31raekyeah, the project name interacts with the clojure runtime in surprising ways...
15:31banseljajThat was my problem?
15:31wkmanireraek: Turned out to be a problem with me. Not even a problem with refheap.
15:31wkmanireraek: I didn't load a needed dependency.
15:32raekbanseljaj: when you created a project called "clojure", leiningen created a file called clojure/core.clj. this file shadows all definitions of clojure.core
15:32banseljajYes. it works now.
15:32banseljajraek: Ahh.
15:33banseljajraek and Borkdude, thanks. :)
15:33raekso 1) don't choose a project name that is already taken 2) don't choose a project name that is the same as a function in clojure.core
15:34raek2) causes problems if you name your project "test"
15:35banseljajI am now going to set up emacs for y laptop. :)
15:36wkmanirebanseljaj: There is no try.
15:36wkmanirebanseljaj: There is only `do
15:36raekbanseljaj: make sure you follow the official docs (clojure-mode)
15:37raeknever trust the first result on google on how to setup your clojure dev tools
15:37banseljajraek: I was gonna get the emacs starter kit
15:37Raynesraek: Boy, don't you be talkin' bout my code now.
15:38raekbanseljaj: good choice
15:38RaynesIt was actually just the mongodb connection hadn't been set up because server.clj hadn't been loaded.
15:38raekthen the clojure emacs install process is just M-x package-install RET clojure-mode RET
15:41raekthen install swank-clojure using the steps in its readme and you're all set
15:42banseljajraek: Thanks. :)
15:43madsyDo I have to do something special to access static members inside nested class in a class?
15:43Raynesraek: I expect a written apology in my P.O. box by Tuesday.
15:43madsy(Foo/Bar Baz.Bal.someStaticVariable)
15:43madsyBaz.Bal isn't found even though I imported Baz
15:53muhoois there a lein-ish tool to search all the clj files in a classpath for a particular string or function?
15:54muhooi mean, i could write in bash in a few minutes, and might do, but if there were already something inside lein to do it, that'd be neat
16:00muhooarrrgh, found it. compojure 1.0.4 requires ring-core 1.1.0, but couch-session requires ring-core 1.0.0, so that is what is getting pulled in https://www.refheap.com/paste/2804
16:01muhoois this a bug in lein, or in maven, or do i have something misconfigured?
16:04arohnermuhoo: that's kind of the design of maven
16:05pandeiromuhoo: i had that the other day but didn't have time to investigate.. gave up on couch-session for now.. i had bumped the version numbers a while ago but it doesn't work with ring 1.1.0
16:05arohnerchanging the order of your deps will change which one wins, I think
16:05arohnera more clear solution is to use :excludes in your deps
16:05arohnersorry, :exclusions [foo/bar baz/baz]
16:08muhoopandeiro: hmm, thanks, you may have saved me hours of going around in circles!
16:09muhoobut couch session store is in my critical path, so, if it don't work, i'ma gonna hafta fix it. *sigh*
16:10muhooit's only like > 100 loc anyway
16:10muhoo< 100
16:10muhooinfix operators confuse me now
16:14pandeiromuhoo: i am planning on doing that this week too if time permits, the previous ring/clutch bump only needed a few small changes
16:20muhoopandiero: should we coordinate on that then? do you have a fork of it or are you working on sritchie's?
16:20michaelr`if jswat doesn't show any locals and watches what does it mean? I've connected it to a java program
16:23muhoopandeiro: nm, i see you in the commit history
16:23pandeiromuhoo: i had a fork but deleted it after sritchie merged my changes back... i will fork again now, try to hit this on wednesday probably? unless you do it for us :)
16:26muhooi'd like to get to it before wednesday. if i fix it for then, i'll send both you and sritchie a pull request
16:26muhooif not, we can connect then, sure
16:28pandeiromuhoo: if it turns out to be something complicated, let me know here and i'll take a look earlier.. i just have a deliverable for this tuesday
16:29muhoosounds good, thanks
16:40raekmadsy: the java language hides something here. the Bal class name is acutally Baz.Bal
16:40raeksorry, is actually Baz$Bal
16:41raekso you need to import that class and then write Baz$Bal/someStaticVariable
16:43raek(this is mentioned briefly under "The Dot special form" at http://clojure.org/java_interop)
16:49ghengisi think this is my problem in a nutshell
16:49ghengisi need a macro like (make-let [a b c] [1 2 3] (+ a b c)) => 6
16:49ghengiswhere make-let expands to:
16:49ghengis(let [a 1 b 2 c 3] (+ a b c))
16:50Vinzentghengis, why do you need that?
16:51ghengisfor a larger macro i'm writing
16:51Vinzentwhy can't the larger macro generate [a 1 b 2 c 3] if it can generate [a b c] and [1 2 3]?
16:51ghengisi want to accept forms like [a b c] and bind them to values taken from a list
16:51clojureboteg, https://github.com/clojure/tools.logging is the new version of clojure.contrib.logging
16:52madsyraek: Thanks
16:52gfredericks(defmacro make-let [a b & cs] `(let [~@(mapcat vector a b)] ~@cs))
16:52raekghengis: why not (let [[a b c] [1 2 3]] (+ a b c)) ?
16:52Vinzentghengis, it actually sounds like destructing
16:52Vinzentah, yeah
16:52ghengisoh my
16:52ghengisthat's brilliant :)
16:52ghengisat least from my perspective :)
16:53ghengisi think that'll work great
16:53gfredericksI like raek's idea. not sure who you're reacting to.
16:53ghengisraek
17:01pandeirowhere does lein-cljsbuild stash the google closure lib and clojurescript?
17:18emezeskeAnyone know if there's a mirror for the clojure JIRA workflow doc (http://dev.clojure.org/display/design/JIRA+workflow) ?
17:18emezeskeSeems down right now
17:18emezeskeNevermind, google cache seems recent
17:50fmwI get No matching field found: getRoot for class clojure.lang.Var when running tests from emacs using clojure-swank in Clojure 1.3.0 and 1.4.0. Does anyone have a fix for this? I'm running swank-clojure 1.4.4
17:54raekfmw: are you sure you don't have multiple swank versions in ~/.lein/plugins/ or that no deps pull in another version into lib/?
17:55fmwraek: let me check.
17:55raekI recall having seen this error before, but I think it has been fixed
17:56fmwraek: yes, I've seen it before too and I think it has been fixed too - it turns out I have an old version in ~/.lein/plugins so let me check what happens when I remove it!
17:59fmwraek: ok, I removed the old file, removed my libs/ directory in my project directory and ran lein clean, but still getting the error. I guess some old version must be lurking around still.
18:01madsyIs there a better way to iterate over Java arrays than this? https://gist.github.com/2759686
18:01madsyMy input order is pretty weird :)
18:01raekfmw: a dependency could pull in an old version. does swank-clojure appear in lib/ after you do a lein deps?
18:01madsyI'm probably missing something which was made specifically for this. amap, doseq or something
18:01amalloymadsy: just call seq on the array? i can't even find the code your asking about in that swarm of printlns
18:02amalloy*you're. oh god
18:02raek(doseq [element array] ...operations...) works for java arrays too
18:02fmwraek: yes, it seems there is a 1.4.0 version in lib/ for some reason, instead of 1.4.4
18:02emezeskemadsy: You should use doseq instead of for/map (which are lazy)
18:03emezeskemadsy: Also, (do (println ...) nil) is equivalent to just (println ...)
18:03madsyemezeske: Yeah, I was just confused about the order.
18:03raekfmw: one thing you can do is to add an :exclusions entry to your project.clj
18:03madsyWhich probably is caused by the laziness
18:03madsyThanks again
18:04raekfmw: and instruct the library author to remote swank-clojure from the library project.clj
18:04raekplugins and profiles are better suited for stuff like swank
18:04fmwraek: I'm guilty of putting it in my project.clj too, I realize that this is not good now ;)
18:05raekfmw: well, it used to be the correct way to do it... :-)
18:06raekthe swank-clojure readme lists the current best practices for using it
18:06raekwhich differs a bit depending on your lein version
18:09fmwraek: ah, so putting it in :plugins for project.clj is not a problem?
18:09fmwbecause they are not pulled in if you're project is a dependency?
18:11raekfmw: I think so. but ideally you should put swank-clojure in your user profile
18:11raeksince it's not really specific the project, but to your setup
18:13raekso in lein2, you'd have {:user {:plugins [[lein-swank "1.4.4"]]}} in your ~/.lein/profiles.clj file
18:13fmwraek: yes, I'm trying that now. thanks!
18:13raekwith lein1, you install the plugin using "lein plugin install ..." and it ends up in the ~/.lein/plugins/ directry
18:14raekwhich seems to be what you had
18:15raekI always forget whether the :plugins option was backported to lein 1.x
18:15fmwraek: ok, thats what I did now. still getting the error, so restarting emacs just to be sure
18:22bderooms_what does the io! macro do exactly? I expected (io! (dosync (println 4) (+ 4 5))) to return an error
18:23metellusI think the goal is to keep things with side effects from happening inside a dosync
18:24amalloy&(dosync (io!))
18:24lazybotjava.lang.ClassNotFoundException: clojure.core
18:24amalloydamn it, lazybot
18:24amalloy,(dosync (io!))
18:24clojurebot#<IllegalStateException java.lang.IllegalStateException: I/O in transaction>
18:24bderooms_ah so you wrap all io in 'io!'
18:24bderooms_to make sure it doesn't accidentally happen in a transaction?
18:24amalloy,(doc io!)
18:24clojurebot"([& body]); If an io! block occurs in a transaction, throws an IllegalStateException, else runs body in an implicit do. If the first expression in body is a literal string, will use that as the exception message."
18:24metellusexactly
18:25bderooms_k, I interpreted it as 'evaluate a transaction to check each operation and error if its IO'
18:32fmwraek: now swank won't start at all, I'm just going to start with a clean leiningen install
18:33raekfmw: just wipe the ~/.lein/plugins/ and the project lib/ directories
18:33raekand do a "lein plugin install swank-clojure 1.4.2" if you are on lein 1.x
18:33raekand then a lein deps
18:33fmwraek: yes, I saw that on the lein-swank github page
18:34fmwso I'm going to try and upgrade to lein2
18:34raekyou need to update your project.clj file too
18:34raekfmw: anyway, when debugging these kind of things it's very usefule to inspect the output of "lein classpath"
18:35raekif you see swank-clojure (or lein-swank) there twice, you also see the full path
18:36raek(at least in lein 1.x. in lein 2 you can do "lein deps :tree" instead)
18:52fmwraek: I'm on lein2 now, there is no mention of lein-swank in my classpath or lein deps :tree. swank jack-in works again now, but I still get the error
18:54fmwI'm pretty confident I'm on lein-swank 1.4.4 now, since sudo find / -name lein-swank only return /home/fmw/.m2/repository/lein-swank/lein-swank/ which just contains 1.4.4
18:57raekfmw: the same error?
18:57raek(getRoot something)
18:58fmwraek: yes, No matching field found: getRoot for class clojure.lang.Var
18:58raekoh, wait. could this be a clojure-mode issue?
18:59raekfmw: what does M-: (clojure-mode-version) print?
18:59fmwraek: 1.10.0
19:00raekfmw: that could be it. try upgrading
19:01raek1.11.5 is the latest
19:05fmwraek: on clojure-mode 1.11.5 now, but still the same error
19:09raekfmw: is the only one swank on `lein classpath`?
19:10nmishrahi
19:10fmwraek: oddly enough, there is no mention of swank at all on lein classpath
19:10nmishrainstalled lein2.0.0-preview4
19:10raekfmw: what libraries are you using, and with which clojure version?
19:11nmishraand my clojure version in project.clj is 1.4
19:11nmishrabut lein2 repl gives the version as 1.3.0
19:11nmishrawhat am I doing wrong ?
19:12fmwraek: see https://github.com/fmw/alida/blob/master/project.clj
19:12raeknmishra: I have heard that bad-behaving dependencies can pull in an older version
19:13raekfmw: also, :dev-dependencies does not exist in lein2
19:13fmwraek: yes, just figured out that it wasn't including those packages when I ran lein test
19:13raekfmw: and you should put lein-swank in your ~/.lein/profiles.clj
19:13nmishraI have a brand new project
19:13nmishra(defproject svm4HN/svm4HN "1.0.0-SNAPSHOT"
19:13nmishra :min-lein-version "2.0.0"
19:13nmishra :dependencies [[org.clojure/clojure "1.4.0"]]
19:13nmishra :description "FIXME: write description")
19:13nmishrathats what it looks like..
19:13fmwraek: was just to mention this is an old version, without the :plugins
19:13raekfmw: there's a `lein precate` command
19:14fmwdidn't push the current version yet
19:15raeknmishra: when do you get 1.3.0? with lein repl inside the project?
19:15nmishrayes
19:15nmishralein2 repl
19:15raeknot outside the project?
19:15nmishranope
19:15nmishraoutside I get 1.4
19:16raekok, that sounds weird
19:17raekfmw: I'm confused. are you using lein2 with profiles and plugins, or are you using lein1 with lein plugin install?
19:17nmishraI am using lein2 with profiles and plugins
19:17raeknmishra: that one was for fmw...
19:17nmishraI still have lein1 installed ..but I upgraded using https://github.com/technomancy/leiningen/wiki/Upgrading
19:18nmishrasorry
19:18raeknmishra: and you restarted clojure after you made any changes to the project.clj file?
19:18raekit is really weird that such a small project should behave this way
19:19nmishragoing to try this..remove the project and generate it with lein2
19:19nmishrasee if that makes any difference
19:20raekif your project.clj looks exactly like what you posted, I can't imagine what's wrong...
19:20fmwraek: http://paste.lisp.org/display/129552
19:20raekthat project.clj should work in both lein1 and lein2 (if you remove the :min-lein-version, that is)
19:20fmwthat is my new project.clj (shouldn't have linked to the old one, but I thought you just needed to know the packages)
19:21raekfmw: ah, a dependency pulled in an old version swank, right?
19:22raekyou should add swank-clojure to :exclusions too
19:22fmwraek: I'm not sure what caused that, but I'll try that
19:22raekyou said before that swank-clojure 1.4.0 appeared in lib/
19:22raekbut that was your project?
19:22fmwyes
19:23fmwraek: its not there anymore, though
19:23raeka library of yours, or this project.clj file?
19:24nmishraI don't know..
19:24nmishrait's a brand new project
19:25fmwraek: it wasn't my project that pulled it in, my project said 1.4.4 and it was still running some old version I had installed manually because I was still on lein 1
19:25fmwraek: I assume 1.4.4 wouldn't have worked in the first place, with lein1, but not sure.
19:27fmwraek: its not there, anymore, though, so it doesn't matter.
19:29raeknmishra: doing "lein2 new foo", changing 1.3.0 to 1.4.0 in foo/project.clj and then "lein2 repl" in foo/ gives me a 1.4.0 repl...
19:29raeknmishra: are you using any plugins or anything?
19:29nmishraI am not..
19:29nmishrathis is a brand new project
19:29fmwraek: I don't know where my current swank is coming from, though, I've only got it in a single place and with 1.4.4, but it isn't listed in my lein classpath output
19:30nmishrathe only thing I haven't done yet..is completely wipe my git source folder and start fresh with lein2
19:30nmishralet me try that
19:30raekI wonder what lein command clojure-jack-in uses
19:30raekmaybe it uses your 1.x lein
19:31fmwraek: I removed that
19:31nmishraThat did it
19:31nmishradon't know why it happened though
19:31nmishrathanks
19:32raekand in what file does [lein-swank ...] exist now?
19:32raekhave you removed the .lein/plugins dir
19:32raek?
19:32nmishraQUIT
19:33raeknmishra: also, you don't need to install via git. you can download the preview lein scripts
19:33nmishrathanks . I will do that
19:33raeknmishra: and I think you are looking for /quit :-)
19:33fmwraek: yes, I've removed the plugins directory
19:34raekfmw: and you upgraded clojure-mode?
19:34lewanghello
19:34fmwraek: yes
19:35lewangis this a good place to ask a newb question or should i go to stackoverflow?
19:35raekso M-: (clojure-mode-version) yields 1.11.5 now?
19:35nmishrafat fingered
19:35raeklewang: here is fine
19:35nmishrathanks
19:35fmwraek: hmm, there still is ~/.m2/repository/swank-clojure/swank-clojure/1.4.0/ somehow!
19:36raekyeah, that's just the maven cache. it shouldn't case any problems
19:36lewangcool. What's the idiomatic way to define true-times where "(true-times 4)" yields true 4 times and nil thereafter?
19:37fmwraek: ~/.m2/repository/lein-swank/lein-swank/1.4.4/ is the only version of lein swank it has
19:37raeklewang: a sequence like (true true true true) or (true true true true nil nil nil ...)?
19:37fmwI removed the maven cache earlier, so it shouldn't be tehre
19:37raekfmw: ah, so something is pulling it back?
19:37raekfmw: try running "lein deps :tree"
19:37lewangraek: sorry, no. "(true-times 4)" should return a function.
19:37fmwraek: possibly, but let me confirm
19:38fmwraek: its not in deps :tree, but I'll check it again
19:38raeklewang: so it should maintain state?
19:38lewangyes, i guess taht's my question. keep in mind i don't understand monads fully yet please. :)
19:39raeklewang: in this case it's very simple to write a non-pure (but fully thread-safe) function
19:40raeklewang: (defn true-times [n] (let [state (atom 0)] (> (swap! state inc) n)))
19:40muhooi'm writing a macro which is doing a naughty thing: it needs to call functions which are defined in the calling namespace, not in the macro's namespace. how can i call a function in a macro without it being fully qualified?
19:41raeklewang: sorry, got the condition backwards... should be (<= (swap! state inc) n)
19:41muhooin other words, (defmacro fubar [] (somefunc-in-calling-ns)) .
19:41raekit will return 'true' the first n times and 'false' from then on
19:42muhooit macroexpands out to ns.of.macro/somefunc-in-calling-ns, which doesn't of course exist
19:42raekmuhoo: yes that is naughty. you have to make sure the name of the function is outside any syntax-quote
19:42raekso instead of `(... (f ...) ...) you need to do `(... (~'f ...) ...)
19:43raekbut there is probably a more elegant solution to your problem...
19:44raekfmw: I'm out of advice and I need to go, but try asking in #leiningen, the leiningen mailing list, and/or create an issue at swank-clojure on github
19:44muhooraek: ah ~' that'll do. yes, it's ugly, but if it works, it works.
19:44fmwraek: thanks a lot for the effort, though. I really appreciate it and you helped me upgrade to lein2 too!
19:44raeknp
19:45lewangraek: thanks.
19:45muhooraek: fyi, https://www.refheap.com/paste/2812 , so far so #'good, for some value of #'good
19:45raeklewang: sorry, the previous code is all wrong. I'm, getting tired. (defn true-times [n] (let [state (atom 0)] (fn [] (> (swap! state inc) n))))
19:46raek(defn true-times [n] (let [state (atom 0)] (fn [] (<= (swap! state inc) n))))
19:46timvisherhey all
19:46raeklast correction now?
19:46lewangraek: I was just rephrasing the q in case I asked it badly. ;)
19:47timvisherhow would one go about printing all the docstrings for a namespace? Something like `(find-doc "<namespace-prefix>/.*")` that worked
19:47gfrederickstimvisher: just the publics okay?
19:48lewangraek: thanks. that worked. Would a monad also solve this?
19:48raekmuhoo: note that eval'ed code cannot use local variables
19:48gfredericks,(->> clojure.walk quote ns-publics vals (map meta) (map doc) (map count))
19:48clojurebot#<CompilerException java.lang.RuntimeException: Can't take value of a macro: #'clojure.repl/doc, compiling:(NO_SOURCE_PATH:0)>
19:49raek...from the context where the eval call is at
19:49gfredericks,(->> clojure.walk quote ns-publics vals (map meta) (map :doc) (map count))
19:49clojurebot#<RuntimeException java.lang.RuntimeException: java.lang.Exception: No namespace: clojure.walk found>
19:49gfredericks,(->> clojure.string quote ns-publics vals (map meta) (map :doc) (map count))
19:49clojurebot(44 34 138 107 34 ...)
19:49gfrederickstimvisher: there we go ^
19:50timvishergfredericks: ah-hah
19:50timvishernice. :)
19:51raekmuhoo: you should probably eval the url in the macro like this: `(do (defpage [:post ~(str (:view-url fsettings) "add")] ...) ...)
19:51raekeval in a macro sounds very suspicious
19:51muhooraek: i tried that, and i'd prefer it. it didn't work, for some reason
19:52raekah, fsettings is not evaluated...
19:52muhoothis whole thing is a huge experiment anyway
19:53raek(def fsettings { ... }) (defmacro def-form-pages [] `(... ~(str (:view-url fsettings) "add") ... )) on the other hand...
19:54raeklewang: monads are not very common in clojure
19:54raekthey are not included in the core language
19:55raeksince clojure does not enforce function purity, you can always resort to side-effects when you need to
19:56raekmy experience with the combination of clojure and monads is basically non-existing, so I can't really answer the question
19:56timvisherwhat does the `#'` reader macro do?
19:56gfredericks,(read-string "#'foo")
19:56clojurebot(var foo)
19:57raektimvisher: it expands to (var foo), where var is a special form. (var foo) evaluates to the var object itself instead of its value
19:57raekthis can be done since global variables are reified as objects in clojure
19:58timvisherhmm... so if i were trying to turn an instance of that (as in (->> ns-publics vals)) into the symbol itself, how might I do that?
19:58timvisherread?
19:59raekit's often used to embed a callback function in a data structure when you want to be able to redefine the var and make sure all callbacks are updated too
20:00raektimvisher: use the name in (keys ...ns-publics...)
20:01gfrederickstimvisher: yeah if you want the symbol get it from the ns-publics map; that'll mean you can't use ->> so slickly anymore :)
20:01raekI think there is an undocumented java method too
20:02gfrederickssomething more like (for [[sym var] (ns-publics 'clojure.string)] [sym (-> var meta :doc)])
20:03raektimvisher: ah, the name is also in the metadata of the var
20:03muhooraek: ah, that worked, thanks
20:04McMartinIs there a way to set up leiningen to build multiple applications out of the same source tree?
20:05emezeskeMcMartin: There's a plugin that might help: https://github.com/kumarshantanu/lein-sub
20:06McMartinemezeske: This looks like just what I was looking for, thanks
20:14muhooMcMartin: you could always write an 8088 emulator in clojure to run the gw-basic program directly :-)
20:17McMartinThis way it's easier to write psychopathic AIs and plug them into the world model.
20:18muhooheh, or clojurescript http://www.bluishcoder.co.nz/js8080/
20:18McMartinHeh
20:18McMartinActually, turning this particular little game into a webapp via ClojureScript was my main goal
20:18McMartinThen I got distracted by the opportunity for rampant AIs.
20:18McMartinIt's a city-sim sort of game, but it turns out that until you hit various instant-lose conditions, it's actually more economical to let your population starve and use some of the savings to entice new immigration
20:19McMartinCOME TO WESTERN ELBONIA, WHERE YOU TOO CAN DIE OF STARVATIO
20:19McMartinN
20:19muhooi think the donner party used that strategy
20:20McMartinThey just took the population hit
20:20McMartinI haven't worked out whether it's actually a good idea to deliberately crash your population to the edge of losing the game early on or not.
20:23muhoojust put in a feedback loop where the news of starving population causes immigrants to avoid the place like the plague? anyway, sounds like a fun project.
20:24muhoomy god, this macro is not only turning into a disaster, it *must* turn into a disaster in order to work. time to start over with a different approach.
20:24McMartinHeh
20:25McMartinWell, there's also the minor issue that citizens are actually a drain on the economy and if it weren't for tourism money the place wouldn't be colonizable at all - the sustainable population is about a quarter of what the instant-loss condition population is.
20:25McMartinSo it's a game about delaying the inevitable
20:26muhoolife is a game of delaying the invevitable.
20:26McMartinThis also had that 20-odd element let clause where it static-single-assignments up three pages of BASIC
20:26McMartinhttps://gist.github.com/2760021
20:26muhoothe job of humans is to fight entropy
20:26McMartinYeah, but these particular humans are really bad at it
20:28timvisherraek, gfredericks: boo, i was trying to use `(map doc...` over them but map doesn't work with macros. any way to apply doc to each of the symbols in turn?
20:29gfredericks(->> clojure.string quote ns-publics vals (map meta) (map (juxt :name :doc)))
20:29gfrederickstimvisher: ^ that not do it for you?
20:30timvisherwell, it gets the docstrings but really what I want is the exact behavior of doc
20:30timvisheri should've been more specific in my first specification
20:30timvisher;)
20:30timvisherlike i said, find-doc does what i want except that i can't filter for everything in a namespace
20:31timvisherone of the main reasons i jump out to the source code site or to clojuredocs or something is just to browse the api
20:31timvisherthis sort of behavior would keep me at the repl more often, which would be nice
20:31gfrederickswell doc is side-effects
20:31gfredericksso what you want is doseq I think
20:31gfrederickswhich will work fine with the macroness of doc
20:35timvishergfredericks: `(doseq [x (->> clj-time.core quote ns-publics keys (map (partial str "time/")) (map symbol))] (prn x))` works fine but when I s/prn/doc it says it can't find the var, i'm guessing because the macro prevents expansion?
20:39gfredericksoh poop right
20:39gfrederickssorry I was wrong because I'm stupid
20:40gfredericksyeah probably writing a macro is the easiest way to do that
20:41timvishergfredericks: `(doseq [x (->> clj-time.core quote ns-publics vals)] (print-doc x))`
20:41timvishergood 'ol `macroexpand-1` to the rescue! ;)
20:42timvisheri do find the docs utilities to be lacking a bit in ease of use, although i suppose they are fairly simple ;)
21:02timvisherwould someone mind mentioning me real quick? i'm trying to test out an erc feature
21:02wkmaniretimvisher: Mention you?
21:02wkmaniretimvisher: What do you mean by that timvisher?
21:02timvisherlol
21:02timvisherexactly what you did
21:02timvisherand it works!
21:02timvisher:)
21:02wkmaniretimvisher: Is this what you meant timvisher? timvisher?
21:02wkmaniretimvisher: What feature are you testing?
21:02timvishernow emacs beeps! i can't believe i never noticed the erc match customizations
21:03wkmaniretimvisher: How do I does that too?
21:03wkmanireI want beeps
21:03wkmanirefound it
21:04timvisher`M-x customize-group RET erc match RET` enable erc-beep-on-match in the erc text matched hook
21:04timvisherwkmanire: whew, you're fast ;)
21:05wkmaniretimvisher: What sound file formats are supported?
21:05wkmanirewav?
21:05timvisheroh i have no idea, i'm assuming when it says beep it means to run the emacs beep function
21:05timvisherwhich you can customize elsewhere
21:05dnolennon-higher order keyword invoke got >10X faster in CLJS master
21:05wkmanireI'm looking here, you can choose all kinds of sound optons.
21:05wkmanireErc Sound
21:06timvishercan't remember how
21:06timvisherdnolen: good work
21:07timvisherwkmanire: that looks fancy
21:08wkmaniretimvisher: The sound stuff?
21:09timvisheryep
21:09timvishererc track looks interesting too
21:10wkmanirewhat's that do?
21:10timvisherlooks like maybe a supercharged watch of sorts?
21:10timvishernot sure
21:11timvishererc's functionality is mind-blowing
21:11replsosLLVM-clojure
21:11emezeskednolen: Awesome! I just wrote some code that does a lot of that and wants to be faster
21:19pandeirois there any cljs testing lib out there yet?
21:22dnolenemezeske: yeah common case should be a lot faster. still pondering higher order case.
21:29wkmanireKick ass!
21:29wkmanireMy son just put his shorts on!
21:29emezeskednolen: I'm not sure what a higher-order keyword invocation looks like
21:29hyPiRionHow is the new ns-bindings for require again?
21:29emezeskepandeiro: You can get pretty far with phantomjs and assert, in my experience
21:29hyPiRionThe one which replaces use.
21:29emezeskepandeiro: Or just V8 if it's not a web app
21:30dnolenemezeske: (map :foo seq-of-maps)
21:31emezeskednolen: Ahhh, I see, so only direct (:foo ...) invocations are optimized?
21:31pandeiroemezeske: i will look into phantom, i saw it mentioned in the cljsbuild repo examples... i would love to be able to write the tests in clojure though
21:31emezeskepandeiro: PhantomJS is just an environment in which to run the tests
21:32emezeskepandeiro: You still write them in clojurescript
21:32pandeiroah i see, cool
21:32dnolenemezeske: yes
21:32emezeskednolen: Does (:foo ...) get turned into a static-fn ?
21:32dnolenemezeske: higher-order case needs more thought
21:32dnolenemezeske: no, wrapped in a new Keyword type.
21:32emezeskednolen: Ah, cool
21:33emezeskepandeiro: PhantomJS is just a headless browser, so you can do tests on clojurescript stuff that needs e.g. a DOM to work correctly
21:34emezeskepandeiro: The cljsbuild advanced example does have a few lines of JS to tell PhantomJS to load the clojurescript JS. I've pondered writing that glue code in cljs itself, but there's not much to gain by doing that
21:34emezeskepandeiro: So I guess you could say the hand-written JS just bootstraps the cljs test code
21:36pandeiroemezeske: i guess i'm actually more perplexed by how to test a bunch of async functions, regardless of language
21:37emezeskepandeiro: Yeah, that can get really tricky
21:38emezeskepandeiro: I've found mocking useful when things get super async. I don't know if there's a good solution for mocking cljs calls, though (midje is clj only)
21:39replsosIt's more on the "secret weapon" side of Paul Graham's programming language taxonomy
21:56gfredericksemezeske: it took me several seconds not to read the end of your last msg as a sexp
21:57gfredericks&'(midge is clj only)
21:57lazybot⇒ (midge is clj only)
21:57McMartinHrm. I'm poking around at ClojureScript, but I'm not really seeing any tutorials for interacting with DOMs, JS generally, etc.
21:58McMartinIs that out there or is one expected to more or less go off and learn by example?
22:00gfrederickstutorials might be rather light yet; I've used domina and liked it
22:12ambrosebsis it a good idea to assume that (= (class (conj anything a)) (class (conj anything a b c d e f g h)))
22:13yoklovMcMartin: its basically the same as in javascript
22:13scottj,(= (class (conj [] 1)) (class (conj #{} 1)))
22:13clojurebotfalse
22:13yoklovscottj: different as
22:13yokloverr
22:13yoklovanythings
22:13ambrosebs:) Actually, don't ArrayMaps convert to hashmaps?
22:13scottjyoklov: ahh, misunderstood question
22:14ambrosebsSo it doesn't look like a good assumption
22:14gfredericks,(class {})
22:14clojurebotclojure.lang.PersistentArrayMap
22:15gfredericks,(class (apply conj {} (map vector (range 200) (range 200))))
22:15clojurebotclojure.lang.PersistentHashMap
22:15ambrosebsThat's fine. I'm finding a type signature for conj
22:15ambrosebsI just need to note an ArrayMap can conj to either ArrayMap or HashMap
22:17ambrosebsfor those interested, I'm parameterising IPersistentCollection to hold info about cons, first, rest and empty
22:18ambrosebs(IPersistentCollection obj-to-cons cons-result empty first rest)
22:18emezeskegfredericks: heh ^_^
22:19ambrosebsso IPersistentCollection$EmptyList is (All [a] (IPersistentCollection a (Cons a IPersistentCollection$EmptyList) Nothing IPersistentCollection$EmptyList))
22:19ambrosebs:)
22:19ambrosebsso I'm going thru each class and typing them as so
22:21emezeskeMcMartin: If you've used js before, you might like jayq
22:35alex_baranoskydoes anyone know what is the preferred way to shell out in Clojure these days?
22:36TimMcalex_baranosky: The question is, do you need access to the in/out streams?
22:37alex_baranoskyI think no for this case… but I'm interested to know the differences
22:38alex_baranoskyaha, clojure.java.shell - http://richhickey.github.com/clojure/clojure.java.shell-api.html
22:38lazybotNooooo, that's so out of date! Please see instead http://clojure.github.com/clojure/clojure.java.shell-api.html and try to stop linking to rich's repo.
22:38alex_baranoskythanks lazy bot :)
22:39xeqialex_baranosky: https://github.com/Raynes/conch ?
22:52amalloysomeday i'll add a feature to lazybot that can cause rich's github page to issue an http 301
23:04muhoohmm, nested defns are allowed, it seems. are they considered.... evil?
23:04muhooi.e. (defn fubart [y] (defn baz [x] (str y " baz " x)))
23:06gfredericksin clojure there's not much of a distinction between top level and inside-of-something
23:06gfredericksif it's not evil it's at least awful
23:06gfredericksooh try putting a (ns) inside a (defn)
23:07emezeskemuhoo: I don't know if that's considered "evil", but it is almost certainly never what someone wants to do
23:07emezeskemuhoo: E.g. newcomers expect that to create a nested-in-scope function
23:07emezeskemuhoo: When in reality fubart is going to redefine baz at the top level every time it's called
23:08muhooit looks like that's the case. damn
23:09muhooi've exhausted most of the options here, not sure what to do next
23:09emezeskemuhoo: What's your goal?
23:09jasonjcknmuhoo: letfn for nested-scope function
23:09jasonjcknor let with lambdas
23:09muhooi'm trying to write something that will create a bunch of boilerplate pages for CRUD in noir
23:09muhoodefpage is a macro
23:10muhooit generates a function, then adds that function to the noir state atoms
23:11emezeskemuhoo: My experience has been that once I go beyond the basic "define a single page" step, that I find it easier to use compojure directly than to use Noir
23:11muhooi thought about that.
23:12emezeskeI actually wrote a macro I called defcrud that builds a full RESTful API for me using compojure
23:12muhoothere's a noir.core/custom-handler* function, but it uses this same defpage parse-args business
23:12muhooemezeske: really? is it somewhere i could look at it?
23:12emezeskeI wish... I keep wanting to open source it, but haven't had time
23:12muhoothat's very much along the lines of what i'm trying to do, except i need to do it with forms
23:12muhooemezeske: are you using noir?
23:13emezeskemuhoo: I used to, but eventually I just dropped it because I was building my own abstractions
23:13emezeskemuhoo: Which it kind of sounds like you are doing as well
23:14muhooi might do some hack like writing the whole business as a compojure app, then just wrapping the noir app in it
23:14muhoothe whole thing has turned out to be a harder problem than i thought it'd be.
23:15emezeskeThe nice thing about compojure is that routes are just functions, so your defcrud thing could just return a compojure handler
23:15emezeskeNo macros necessary
23:15emezeskeI dunno, there might be some sweet way to do it with Noir as well
23:15muhooright, then i could add only one handler instead of 5
23:15muhooi think there is, thanks, that gives me some hope
23:17muhooah, noir.core/compojure-route !
23:17emezeskeThat's a promising name!
23:17muhooit's 3 lines, and seems to do exactly what i want.
23:18muhoowill try. that would be sweet.
23:18emezeskeGood luck sir
23:20Raynesmuhoo: What is this defpage hack crap?
23:20ambrosebsAnother question on collection invariants: does (= (-> any-coll empty class) (-> any-coll empty rest class))
23:20ambrosebsI think this probably holds
23:21gfredericks,(-> [3] empty class)
23:21clojurebotclojure.lang.PersistentVector
23:21gfredericks,(-> [3] empty rest class)
23:21clojurebotclojure.lang.PersistentList$EmptyList
23:21ambrosebs:)
23:22ambrosebsok, maybe not, cheers
23:22gfredericksmaps will do something similar I think
23:23gfredericks,(for [x [3] {3 3} #{3} '(3)] (= (-> x empty class) (-> x empty rest class)))
23:23clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: for requires an even number of forms in binding vector in sandbox:>
23:23gfredericks,(for [x [[3] {3 3} #{3} '(3)]] (= (-> x empty class) (-> x empty rest class)))
23:23clojurebot(false false false true)
23:24ambrosebsSo I need to be more specific with my types. I assumed I could infer the "empty rest case" from the type of "empty" for that type
23:24ambrosebsbut it's not consistent
23:25gfredericksrest mucks with things
23:26gfredericks,(rest "foo")
23:26clojurebot(\o \o)
23:26gfredericks,(empty "foo")
23:26clojurebotnil
23:27gfredericks,(empty 12)
23:27clojurebotnil
23:27banseljajHmm. Guys, do clojurians need DB servers?
23:29gfredericksIt is a truth universally acknowledged that a single man in possession of a good clojure must be in want of a DB server.
23:29ambrosebsgfredericks: wat ... (empty 12)
23:30ambrosebssometimes nil punning goes too far :P
23:30gfredericksnil punning?
23:31ambrosebsslightly wrong context, but http://clojure.org/lazy#Making%20Clojure%20Lazier--The%20victim%20-%20nil%20punning
23:33banseljajAnd which is the preferred DB server for Clojurians/
23:33xeqibanseljaj: like using clojure.java.jdbc, korma, clutch, or something similar?
23:33banseljajxeqi: Ahh. Okay. :)
23:34banseljajI am asking in context of the discussion here a few hours ago about a Linux for Clojure dev. A Plug-in replacement clojure development environment
23:34banseljajOne that can be fired from a VM, for instance.
23:35technomancywhat does replacement mean in this context?
23:35banseljajtechnomancy: I recognize you. :D
23:35technomancyhello
23:35banseljajHi.
23:35banseljajAnd sorry, Replacement was the wrong word.
23:37banseljajIn its bare default, my distro has leiningen, a JDK and aall the editors configured for lisp/clojure. (emacs, eclipse, vim etc)
23:38banseljajAnd the associated paraphernalia. an offline browsable doc, some simple text editors, a gui, an IRC client.
23:38banseljajpeople here were interested in it. in fact, they told me to make it. :)
23:39technomancyyou could spend all day adding databases and someone would still feel left out
23:39amalloyi don't think (empty 12) returning nil has anything to do with nil punning. if (rest 12) returned nil, then maybe, but...
23:40technomancythat said, postgres is probably the place to start
23:40RaynesAnd if you add mongodb, everyone will be afraid to touch it.
23:41ambrosebsamalloy: true, just the first phrase that came to mind
23:41Raynesamalloy is a walking correction service.
23:41gfredericksso the word "pun" here refers to the double meaning of nil as empty and falsy?
23:41amalloyRaynes: i'm sitting down. duh
23:42RaynesYou could be standing outside and still see that damned tv of yours.
23:42amalloybut i agree, there are a few cases where it seems clojure goes too far in silently accepting "crazy" argument types
23:43banseljajtechnomancy: The most used and the second most use should suffie on the basic instal
23:43ambrosebsgfredericks: that's my interpretation. Nil punning is usually about return values, not argument values tho
23:43banseljajs/instal/install
23:43amalloy,((juxt keyword :foo empty) 10)
23:43clojurebot[nil nil nil]
23:43ambrosebsgfredericks: I was a bit lazy, but hey, you learnt something ;)
23:44gfredericksheck yes I did. It's really weird to read stuff from old-clojure days
23:44amalloygfredericks: like halloway being astonished that sets are functions
23:45technomancybanseljaj: for people getting started with Clojure, Couch or Redis would be my second pick.
23:45ambrosebsamalloy: and not just boolean ones in Clojure yay!
23:45RaynesI was pretty astonished myself.
23:45technomancysince they'll be unlikely to be working with huge datasets
23:45banseljajtechnomancy: thanks.
23:46amalloyambrosebs: i'd rather they returned booleans
23:46muhooRaynes: my CRUD-generating stuff
23:46gfredericksamalloy: ambrosebs I was about to say the same thing
23:46technomancyamalloy: but... c.c/some
23:46muhooRaynes: i'm going to go with compojure-routes instead
23:46Raynesamalloy: Why?
23:46amalloyi don't really like some either :P. i'd like it to be more like find-first
23:46muhoobut i learned a lot about macros, what they are, and what the aren't, so no big loss
23:47banseljajHmm. I think gnome is too much for a window manager, lxde might be better
23:47ambrosebsamalloy: what's find-first?
23:47amalloyambrosebs: (fn [pred coll] (first (filter pred coll)))
23:47Raynes&(first (filter true? [1 2 3 true 4]))
23:47lazybot⇒ true
23:47technomancyif it's meant to be used as a VM, just have people SSH in. you'll save tons of disk space =)
23:48amalloyRaynes: because you can't *actually* use sets as existence checkers, in case one of the elements is false or nil
23:48amalloyi never want to do something like: "oh, let's *map* this set over a collection" - just use it in filter or whatever, i only care about truthiness of the result, and so as things are now i have to use contains? instead to be correct
23:49banseljajtechnomancy: :D Well, it is also meant to be used as a stand-alone distro. locally installed. :)
23:49technomancybanseljaj: too bad distros aren't composable
23:49ambrosebsamalloy: how can u distinguish between a found nil and a not-found in find-first?
23:49banseljajtechnomancy: that's a clojure joke?
23:50RaynesWhoa. The 'u' bomb.
23:50banseljajI'm still a noob in clojure. :)
23:50amalloyambrosebs: the same issue exists for c.c/some
23:50amalloyjust shaped slightly differently
23:50ambrosebsamalloy: exactly, what's the advantage?
23:50amalloy,(some even? (range))
23:50clojurebottrue
23:50amalloynot very dang helpful. i wanted the first even number
23:51ambrosebsamalloy: ah
23:51Raynesamalloy: You should write your own language dude.
23:51amalloywhat would i do with a "language dude"?
23:51banseljaj,(true)
23:51clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.IFn>
23:51banseljaj,(true? true)
23:51clojurebottrue
23:51ambrosebsI'm usually halfway to writing (some #(and (pred %) %) ...)
23:51amalloyexactly
23:51RaynesYou could write a grammar checker.
23:52banseljajamalloy: Ask him to do your work and chill. :D
23:52technomancybanseljaj: not specific to clojure, but commonly-used terminology around here
23:52banseljaj*nod*
23:52amalloybut, ambrosebs, that doesn't work if you want your predicate to return truthy for an input of nil/false
23:52banseljajtechnomancy: I'm forking your code as soon as I am competent enough. :) I WILL REPLACE YOU! :D
23:53ambrosebsamalloy: :) and that's the point I stop using some
23:53amalloyright! if it were instead find-first, you could just use it :P
23:54ambrosebsfind-first + not-found parameter would solve all worries, right?
23:54amalloy*nod*
23:54banseljajtechnomancy: I'm prone to such jokes. Don't mind me. :)
23:55amalloyanyway, i have similar experiences with sets. i can *almost* use them the way i want
23:55technomancyemezeske: do you know how much of the browser-repl stuff is specific to the fact that browsers can't have server sockets?