#clojure log - Mar 20 2012

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

0:00 muhoo: speaking of dubstep, bassnectar apparently had a hand in designing that controller.

0:00 * gfredericks doesn't even know what a controller is

0:01 muhoo: gfredericks: it's a device you use to trigger overtone :-)

0:01 gfredericks: oh so it's like a repl

0:01 * gfredericks can't come up with a joke about ActionController::Base

0:03 muhoo: i had a bit of a revelation when i realized that a kline in supercollider is basically a lazy seq

0:05 * gfredericks goes off to read and wait for the flight

0:06 TimMc: muhoo: I'm still trying to figure out synth vs. inst

0:19 rhc: Raynes: (if you care.. or anyone else) here is what i was working on as a learning exercise: https://github.com/matthavener/KrailjOS

0:26 muhoo: i really should dive in to overtone. i suspect that instead of feeling like a total idiot, as i do in for example 4clojure, i might be on familiar territory working with oscillators, filters, synths, control voltages and midi and such.

0:48 supercollider running, connected to my existing jackd setup. repl launched. overtone in the hizzy.

1:04 scottj: arohner: couldn't the pdf of your slides, don't know if it's only my machine.

1:05 Raynes: rhc: Nice!

1:05 arohner: scottj: accidentally the whole word?

1:05 Raynes: rhc: Did you have any problems with irclj?

1:06 arohner: scottj: hrm. I'm getting an error too. I'll try re-uploading

1:14 scottj: I've re-uploaded, here https://github.com/arohner/clojurewest2012-slides/commit/584ea79a0280278a0b11091b04b8fb4086e6a2d3

1:15 scottj: arohner: works, thanks

1:32 aphyr: Got an opinion question; should a network client (just a wrapper around a socket with open/do-some-io/close operations) be an immutable or mutable object?

1:34 IMHO it will make multi-caller coordination easier if I handle locking within the client itself and allow it to be mutable

1:34 But I want to check and see if there's a preferred, immutable pattern.

1:34 tomoj: what do you mean by "mutable"?

1:34 in clojure/java terms

1:35 aphyr: Mutable in the sense that a client object has internal, changeable state like which socket it wraps.

1:35 tomoj: e.g. do you mean implementing some mutable object in java and using it from clojure?

1:35 aphyr: I was thinking about writing it as a deftype, actually.

1:35 tomoj: using that funky option that lets you go mutable?

1:35 or just using e.g. atoms?

1:35 aphyr: Probably atoms.

1:36 Though maybe I'll just write a mutable java client and wrap it with a clojure protocol.

1:36 Just curious what the pure-clojure approach would look like

1:37 tomoj: I can't really imagine what you are imagining, so I'm not sure, but if you did stick atoms in a deftype, you don't have to handle locking, and it's not exactly mutable

1:38 groovemonkey: I just want to say that I LOVE Clojure.

1:38 Good night!

1:39 aphyr: (let [opened (open client)] (send opened some-msg) (close client))

1:39 vs

1:39 (open client) (send client some-msg) (close client)

1:40 Basically a question of where the responsibility for coordinating access belongs; with the callers, or with the client itself, I guess.

1:40 tomoj: synchronous io?

1:41 aphyr: The underlying socket ops do have to be synchronized.

1:41 (just to prevent parallel invocations from writing their messages over each other)

1:42 _ato: (with-open [conn (open "someserver")] (send conn "hello!"))

1:42 tomoj: and the threads all block on writes/reads

1:42 aphyr: Strictly speaking no, the protocol supports both synchronous and async operations.

1:43 tomoj: the interfaces above wouldn't work for async, would they?

1:43 aphyr: No, that's a simple example.

1:43 The async version would probably return a future from (send client)

1:44 tomoj: if you need to support async io you might look at aleph/lamina

1:44 aphyr: I'm writing this to replace an aleph client. :)

1:44 Performance issues.

1:44 tomoj: ah, just curious, which version were you using?

1:44 aphyr: latest snapshot

1:45 ztellman and I were talking a couple weeks ago, know he's made significant improvements to lamina but aleph is on the back burner ATM

1:45 tomoj: I was trying to remember recently whether the perf rewrite of lamina already is in place for that aleph snapshot.. do you happen to know?

1:45 ah

1:46 aphyr: Basically I want to implement this sucker in java, in pure clojure, and on top of aleph

1:46 Then I can benchmark and determine which is worth supporting

1:46 tomoj: hmm.. "pure clojure"

1:46 aphyr: <sigh>

1:46 tomoj: that means writing a new netty wrapper or bare nio?

1:46 aphyr: Yeah, either a netty handler or on top of DatagramSocket & friends

1:47 I've already got my netty UDP server written and it smokes the pants off lamina

1:47 tomoj: in pure clojure?

1:47 aphyr: by like 2 orders of magnitude, haha

1:47 Clojure wrapping netty handler with proxy, yeah

1:47 tomoj: cool

1:47 aphyr: I figure that's a pretty good tradeoff for my sanity vs performance

1:48 620K ops/sec

1:49 tomoj: so here you have multiple client threads sharing one udp socket?

1:49 aphyr: Yeah. Well, later it's gonna be a connection pool

1:49 But for now one socket

1:50 tomoj: I guess it is still unclear how to do this kind of stuff in pure clojure..

1:51 aphyr: Yeah, in fact most of the clojure IO I see in the wild is just calling into mutable java objects

1:51 tomoj: I mean, lamina is one attempt, and there are a few others, but I've gotten the impression that people think the design problem hasn't really been solved well yet

1:51 aphyr: Which I think makes sense, for performance and code clarity

1:52 Yeah, and lamina is the other big one. I think Lamina itself has a ton of potential, even if aleph is immature at present.

1:53 tomoj: have you seen cljque?

1:53 aphyr: No! *googles

1:53 tomoj: https://github.com/stuartsierra/cljque/

1:54 I don't know what a client looks like there

1:54 or.. would look like? not sure if it's even that far yet

1:54 aphyr: Yeah... the discussion on async events is fascinating too

1:55 tomoj: I tried to grok cljque a while back but gave up for now

1:56 aphyr: urrrgh, more problems than answers, haha

1:56 Maybe I'll dive into the pure-java client for now, see if that clears my mind any

1:58 tomoj: I really want to understand conal elliot's frp, and I see some similarity to cljque in it, but he's way above my head

2:08 devn: cljque is a lot of thinking

2:08 lamina is a lot of thinking

2:08 cljque has inspirations that stem from the RX framework a la Erik Meijer

2:10 tomoj: we have a partial rx port floating around here

2:10 I don't really like the idea of a direct port

2:10 devn: clojurescript one has some FRP in it

2:10 clojurebot: Titim gan éirí ort.

2:11 tomoj: as in, events and behaviors?

2:12 devn: *nod*

2:12 it's *inspired* by FRP

2:12 that doesnt mean it embodies it exactly, mind you

2:14 muhoo: the aliens have landed

2:14 (demo 60 (sin-osc [(mouse-x 500 5000) (mouse-y 100 1000)]))

2:15 tomoj: whereabouts?

2:15 muhoo: on the moon http://www.youtube.com/watch?v=eJDJ1ALa9Eo

2:15 tomoj: heh, I mean, where is the frp in one?

2:16 oh, dispatch.cljs?

2:16 muhoo: frp?

2:16 fiberglas-reinforced plastic?

2:17 tomoj: so just events, no behaviors

2:17 the ways in which behaviors would be useful are still mostly obscure to me

2:28 emezeske: muhoo: functional reactive programming

2:54 muhoo: emezeske: thanks

4:36 sorenmacbeth: could someone help me out calling this macro from a function

4:36 https://gist.github.com/39313f6f35935a2e27a3

4:37 the class-name var in the let binding isn't getting eval'd

4:37 when passed to the macro. I know it has something to do with compile time vs macro expansion time

4:37 but I can't figure out how to make it work

5:00 Sindikat: hello everyone! i try to do 'clojure-jack-in' in Emacs, but get errors "Debugger entered--Lisp error: (error "Could not start swank server: ;;; Bootstrapping bundled version of SLIME; please wait...". Emacs version 24.0.94.1

5:12 i previously did "lein plugin install swank-clojure 1.3.4"

5:15 hoeck: sorenmacbeth: so the task of bootstrap-schema is to define a couple of defn's? Should that happen at the time you start the application?

5:16 sorenmacbeth: yes

5:16 hoeck: correct

5:17 hoeck: sorenmacbeth: so it depends on the programs input at startup, or is it always the same?

5:18 sorenmacbeth: hoeck: it depends on a some Java classes that may change

5:19 Sindikat: nevermind i found the solution

5:21 hoeck: sorenmacbeth: then I think mk-property-tap should be a function returning the taps, and bootstrap-schema should be a macro calling mk-property-tap, emitting these defs

5:23 sorenmacbeth: hoeck: that might be fine expect that mk-property-tap is naming the functions it's defining names on the params, which a defn can't do

5:24 hoeck: sorenmacbeth: mk-property-tap should return the code for these defns

5:25 sorenmacbeth: hoeck: ah, return an anonymous fn and then name it in bootstrap-schema you mean

5:25 hoeck: no, just the code

5:25 and then, in a macro, call the function (which returns the code)

5:26 tomoj: sorenmacbeth: what is it exactly a defn can't do?

5:26 use `/~/~@?

5:26 hoeck: $((fn [x] `(defn ~x [] 'foo)) 'a)

5:27 where are the bots?

5:27 Sindikat: how to find documentation on defproject macro using clojure repl?

5:27 sorenmacbeth: Sindikat: defproject is part of leiningen

5:27 clgv: ,((fn [x] `(defn ~x [] 'foo)) 'a)

5:27 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

5:28 clgv: &((fn [x] `(defn ~x [] 'foo)) 'a)

5:28 lazybot: ⇒ (clojure.core/defn a [] (quote clojure.core/foo))

5:28 clgv: clojurebot seems to be ill, still

5:28 hoeck: sorenmacbeth: you don't have to wrap all your code-generating functions as macros. Just write a function which returns the code and then use a defmacro to call this function at compiletime

5:28 &((fn [x] `(defn ~x [] 'foo)) 'a)

5:28 lazybot: ⇒ (clojure.core/defn a [] (quote clojure.core/foo))

5:29 sorenmacbeth: hoeck: ok, I think I understand

5:29 hoeck: thanks for the help

5:29 hoeck: sorenmacbeth: youre welcome

5:30 Sindikat: hmm

5:30 when i try to 'clojure-jack-in' in Emacs, i get this error: "error in process filter: Symbol's value as variable is void: slime-clj" what does that mean?

5:33 sorenmacbeth: hoeck: ha, all I had to do was change mk-property-tap to defn instead of defmacro and it worked fine

5:34 hoeck: sorenmacbeth: great, thats actually good style, generating code with a couple of small functions and only use the defmacro to call them

5:34 jtoy: I'm a clojure newb, i am just testing my code with leon repl and vim, when I change the code, i must quit the repl and reload it to see my changes, how do i fix this?

5:42 llasram: jtoy: For your current env, check out the the :reload and :reload-all flags to require

5:43 jtoy: But you'll probably want to integrate vim with your REPL

5:43 jtoy: llasram: ok, thanks, ill research some more

5:51 silly question, how do I tell clojure to return a list of 1? (1) doesn't work

5:52 llasram: Idiomatically, you usually will want a vector: &[1]

5:52 Er,

5:52 [1]

5:53 But you can quote a list: '(1)

6:11 tomoj: I forgot about cucumber in clojure

6:12 Sindikat: why doesn't (require 'clojure.contrib) work in repl?

6:13 llasram: lazybot: contrib?

6:13 Man, I wish I remembered how to trigger it's snippet

6:14 clgv: ~contrib

6:14 clojurebot: Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

6:14 llasram: Ah!

6:14 Thank you, clgv :-)

6:14 clgv: topics on clojurebot are always via ~

6:14 llasram: Got it

6:14 * llasram files that data away

6:14 raek: Sindikat: there is no namespace called "clojure.contrib"

6:14 Sindikat: does that render all references to (require 'clojure.contrib) in Programming Clojure unusable? :)

6:15 clgv: Sindikat: no, not at all. just use clojure 1.2.1 and contrib 1.2.0 and play with those examples

6:15 raek: you have to require the specific namespace you want to use, for instance clojure.contrib.base64

6:16 Sindikat: are you using leiningen? if not, you should. you can tell it to use the older versions of clojure and contrib for your project.

6:16 Sindikat: raek: i try to (require 'clojure.contrib.str-utils), says it's not in classpath

6:16 raek: Sindikat: then you can follow the tutorial or book you are reading

6:16 Sindikat: how did you start clojure?

6:16 (contrib is not included in clojure itself)

6:16 Sindikat: i did

6:17 raek: Sindikat: you use leiningen?

6:17 Sindikat: lein plugin install swank-clojure 1.3.4 then in emacs clojure-jack-in

6:17 raek: Sindikat: ok, you need to add clojure-contrib to the project.clj file

6:17 the default project.clj template does not include it

6:18 Sindikat: also, clojure.contrib.str-utils has been deprecated in favor of clojure.string since clojure 1.2

6:18 Sindikat: now it looks like :dependencies [[org.clojure/clojure "1.3.0"][org.clojure/clojure-contrib "1.3.0"]])

6:18 raek: Sindikat: there is no monolithic contrib for clojure 1.3

6:18 monolithic contrib has been split up into separate projects

6:19 Sindikat: anyway, i want to have the latest code, i can manage inconsistencies

6:19 raek: so you can either adapt to the new approach (recommended if you are writing something new) or use an older version of clojure and contrib (perhaps easier if you want to follow a book, etc)

6:20 Sindikat: as clgv mentioned, this page lists the new projects: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

6:21 Sindikat: raek: so what is the recommended behavior? list dependencies in project.clj then run lein deps?

6:21 raek: yes

6:22 Sindikat: btw, why does 'lein search foo' takes forever? i have lein 1.7.0

6:22 raek: does it say that it is downloading the index?

6:23 it has to download the maven index once, and that takes a *long* time

6:23 Sindikat: yep

6:24 raek: the latest [group/artifact "version"] info should be mentioned in the readme of the dependency

6:33 Sindikat: trying to find anything about (doc) function on clojure.org, nothing

6:34 llasram: Sindikat: It's unfortunate, but the clojure.org site isn't all that useful. For annotated online documentation, I recommend http://clojuredocs.org/

6:35 Although it doesn't have any more than the doc tring for `doc', unfortunately http://clojuredocs.org/clojure_core/clojure.repl/doc

6:36 Sindikat: llasram: in slime repl (doc ...) doesn't work: "Unable to resolve symbol: doc in this context"

6:36 _ato: I think it was moved to clojure.repl in 1.3

6:36 http://clojure.github.com/clojure/clojure.repl-api.html#clojure.repl/doc

6:36 llasram: Ah, try first: (use '[clojure.repl :only [doc]])

6:37 Or maybe even just (use 'clojure.repl)

6:37 Sindikat: why doesn't (require 'clojure.repl) (clojure.repl.doc 'clojure.string) work?

6:38 _ato: clojure.repl/doc

6:39 Sindikat: cool, thanks

6:48 _ato: Clojure uses "namespace/name", similar I guess to the way some other languages might write it "Clojure::REPL.doc". Whereas Java tends to use "." for everything, like "clojure.repl.doc" which is sort of weird when you think about as there's no way to distinguish where the package ends and the class begins (hence I guess the capitalized class naming scheme). The whole "clojure.repl" could be a class or just the "clojure" could be a class and "repl" a static field

6:51 kij: Hey, could this: http://www.youtube.com/watch?v=-xJl22Kvgjg (source maps) work with clojurescript ?

6:57 _ato: kij: I think that's been on the clojurescript todo list from the beginning, it was mentioned a lot around the initial release. Probably nobody has implemented it yet as the browser support didn't exist (until now?)

7:36 solussd: any suggestions for a compelling example of clojure multimethods to demonstrate to a group of c# programmers?

7:48 si14: is there any reasonable library for dealing with datetime objects in clojurescript?

8:05 and yes, it looks like there aren't ordered maps in cljs.

8:07 it's very, very sad.

8:10 jaen: solussd: can't think of anything else than writing an equivalent of a visitor pattern with multimethods, dunno if that's compelling

8:10 sharat87: si14, what aspect of Date objects are you concerned with, won't any js libraries (with a few macros) do?

8:11 solussd: yeah… problem is showing the feature off without also introducing several other clojure features that would only serve to confuse/distract from the main point

8:12 currently ripping off the 'coerce' example from 'programming clojure' (thanks stuart!)

8:12 sharat87: solussd, also, there is a good one in the "Joy of Clojure" book

8:13 llasram: solussd: My go-to example is usually serialization. You can have multiple serializer functions which are all independent from each other and from their implementations for any given type. All completely orthogonal through multimethods or protocols

8:13 solussd: llasram: hah. yeah, I'm actually using serialization to demonstrate protocols and records

8:14 llasram: Ah, ok :-)

8:15 raek: solussd: you could make a simple expression evaluator

8:16 something like (eval-expr '(- (* a 2) 1) {'a 3}) => 5

8:16 it doesn't treally make use of the "multi" part of multimethods

8:17 solussd: hmm. how does that take advantage of multimethods though

8:17 yeah

8:17 llasram: solussd: If you're already explaining protocols, then you could just hand-wave multimethods as a complete generalization of argument-based polymorphic dispatch with similarly independent implementations. But I guess you want a concrete example?

8:18 solussd: llasram: yeah, I think the coerce example will work fine

8:36 how can I get a list of java interfaces implemented by a type in clojure?

8:37 raek: solussd: call supers on the class

8:37 &(supers (class '(1 2 3)))

8:37 lazybot: ⇒ #{clojure.lang.ASeq java.util.Collection clojure.lang.Sequential java.lang.Object clojure.lang.Seqable clojure.lang.IPersistentCollection clojure.lang.Counted java.util.List java.io.Serializable clojure.lang.ISeq clojure.lang.IPersistentList clojure.lang.IPersistent... https://refheap.com/paste/1231

8:37 solussd: thanks

8:38 raek: in my expression example the relevant types are java.lang.Number, clojure.lang.Symbol, and clojure.lang.ISeq

8:54 si14: sharat87: ok, maybe it will be enough.

8:54 sharat87: just wondering if there is something already done.

8:55 sharat87: si14, cljs is fairly new, so there is a small chance that would exist. I haven't used cljs seriously enough, so I wouldn't know. Maybe you should make one ;)

9:19 true_droid: :as works only in let? I get an error when trying to define a function like this: (defn fun ([x y :as lst] …))

9:21 raek: true_droid: yes. you can compare (fn [x y z] ...) to (let [x ... y ... z ...] ...). the parameters are destructured separately

9:22 true_droid: but you can also use &

9:23 (defn fun [&[x y :as lst]] ...)

9:23 llasram: ooh, nice hack

9:23 raek: then the function can also take any number of arguments (not only 2)

9:24 including zero and one arguments

9:27 true_droid: raek: it's a nice syntax, but the semantic changes depending on the ways args are passed

9:27 http://pastebin.com/N6fijqat

9:30 llasram: true_droid: The normal multi-implementation dispatch is based on number of arguments. You're circumventing that by taking any number of arguments as a seq so you can destructure it. If you need both, you'll need to write your own dispatch logic using multimethods

9:30 But that wouldn't be too difficult

9:33 true_droid: llasram: I see, thanks for the explanation

9:34 could anyone take a look at this implementation of mergesort and point out obvious blunders? https://gist.github.com/2135276

9:38 I've just found one myself: I should split-at into vectors prior to (map mergesort …) so that each recursive call gets a vector that can be counted in O(1)

9:39 but, it might take an O(n) to put a seq into a vector, right?

9:40 these seqs are tricky to get right

9:55 clgv: true_droid: not that tricky. putting the seq in the vector means realizing completely. Hence, O(n) effort.

9:57 true_droid: clgv: yeah, it makes sense. I guess it's better to pass the input seq to a subfunction which in turn takes an additional 'count' argument

9:58 we can then perform arithmetics on that argument and leave the sequence alone

9:59 clgv: true_droid: (if (seq xs) ...) is the idiomatic version of (if (nil? (next xs)) ...)

9:59 true_droid: ah well you have to switch the then and else case

9:59 raek: (empty? xs) is also defined as (not (seq xs))

10:00 clgv: true_droid: you can shorten that 'if to (when (seq xs) ...do...sorting...)

10:00 except if you really need to return an empty seq if 'xs was empty

10:01 true_droid: thanks, raek and clgv, I'll remember that

10:01 clojurebot: I don't understand.

10:01 clgv: clojurebot: why?

10:01 clojurebot: Why is the ram gone is <reply>I blame UTF-16. http://www.tumblr.com/tagged/but-why-is-the-ram-gone

10:16 rhc: Raynes: no problems so far, though I did notice there's no way to distinguish between a user saying ACTION something and a user doing /me ACTION

10:44 lynaghk: pandeiro: C2's basic (unify!) function works in ClojureScript, but there are some issues with clojure/clojurescript code sharing that I need to work out for the helpers (scales, &c.)

10:45 Also, the CLJS isn't packaged in the snapshot JAR, so if you want to use it you'll need to include it as a lein checkout.

10:46 gfredericks: is there a clean way to created a namespaced keyword dynamically?

10:46 rhc: Raynes: err, ACTION something and /me something

10:46 gfredericks: i.e., without repeating the ns-name as a fragile string literal

10:46 I assume (keyword (str *ns*) "foo") wouldn't work

10:46 pandeiro: lynaghk: i copied the cljs src straight into my project's src dir, the problem is the cassowary dep -- i think c2.layout needs it?

10:48 lynaghk: yes, but everything in c2.layout is within a big (comment) block = )

10:48 pandeiro: lynaghk: oh am i using stale c2? :)

10:48 lynaghk: pandeiro, yeah, it sounds like you might be.

10:49 clgv: gfredericks: why not?

10:49 lynaghk: CLJS stuff will hopefully be much cleaner within the next fortnight or so.

10:49 clgv: &(keyword (str *ns*) "foo")

10:49 lazybot: ⇒ :sandbox6997/foo

10:49 pandeiro: lynaghk: hmm, actually the ns declares the dep

10:49 that's what's tripping of the google compiler

10:49 lynaghk: dont worry bout it

10:49 i figured youd be documenting the cljs side of things soon

10:50 TimMc: &(with-meta :foo {:bar true})

10:50 lazybot: java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.IObj

10:50 lynaghk: pandeiro: I just pushed a fix.

10:50 TimMc: OK, good.

10:50 lynaghk: pandeiro: we're using c2 on two client projects right now, so any cljs cleanup will be for purely selfish motives don't worry = )

10:51 pandeiro: lynaghk: well allow me to reap the benefits then :)

10:51 lynaghk: any idea what i'd need to change to modify the choropleth example to a map of brazil?

10:52 i got the shapefiles i needed, turned them into lean ("lean") geoJSON

10:52 lynaghk: There is a world map in the Vomnibus depedency

10:52 oh, if you already have that then you're pretty much set.

10:52 pandeiro: yah i needed municipal data

10:52 yeah i got it

10:52 but the problem i have are the coordinates

10:52 is that just as simple as modifying one of the vals in alpers?

10:52 eg coordinates?

10:52 lynaghk: if you can do it in clj, that would be cleaner since it is all working in there.

10:52 gfredericks: clgv: I assume that when you call that function from another namespace that *ns* would not be what you expect

10:52 pandeiro: lynaghk: sure i will do it there

10:52 my problem is that brazil shows up way down south in the svg

10:53 since the alpersUsa is oriented to show the US at its lat/lng i imagine

10:53 clgv: gfredericks: what exactly are you doing? you can also do (keyword any-string "foo")

10:53 lynaghk: in c2.geo.core there is a (geo->svg) function that will take a projection and a geoJSON structure (in clojure, not JSON) and return SVG path data (for use with svg path's d attribute)

10:53 pandeiro: lynaghk: cool i will check that out first

10:54 lynaghk: pandeiro: the albers constructor takes kwargs for origin and parallels, so you can centre it on brazil

10:54 gfredericks: clgv: just assembling a ::foo dynamically to avoid repetition; but just realized I know a way to run it at code-load time instead of every time the function is called, so that'll be good enough

10:54 TimMc: gfredericks: *ns* is a var -- it should take the value of the top-level namespace.

10:54 pandeiro: lynaghk: beautiful that's what i needed, thanks

10:55 lynaghk: pandeiro: np. If you do anything particularly clever with it be sure to send me a link so I can start collecting a community-examples page.

10:55 gfredericks: TimMc: so if I say (ns foo) (defn make-keyword [] (keyword (str *ns*) "haha")) (ns bar) (make-keyword); what'll I get?

10:55 TimMc: &(require '[clojure.string :as s])

10:55 lazybot: ⇒ nil

10:55 gfredericks: well

10:55 TimMc: &::s/foo

10:55 lazybot: java.lang.RuntimeException: Invalid token: ::s/foo

10:55 pandeiro: lynaghk: i'm just starting out with vis but i got some interesting data from the brazil 2010 pop census i am going to be playing with

10:55 gfredericks: (ns bar (:use foo)) I should have said

10:55 pandeiro: i'll definitely show you what i come up with

10:56 lynaghk: pandeiro: rad, good luck

10:56 TimMc: gfredericks: Try it and tell me!

10:56 gfredericks: TimMc: you betcha!

10:56 * gfredericks grumbles about not being able to use TimMc as his personal repl

10:57 gfredericks: did you know that before computers the word "repl" referred to a person?

10:57 TimMc: ha

10:57 gfredericks: version control required a whole team of secretaries

10:58 RickInGA: if & triggers lazybot and , triggers clojurebot, what is the prefix to trigger TimMcbot?

10:58 gfredericks: TimMc: yes indeed the *ns* has changed to bar

10:58 TimMc: CHOCOLATE

10:58 RickInGA: CHOCOLATE(+ 1 2)

10:58 gfredericks: so the function returns :bar/haha

10:59 TimMc: RickInGA: 3

11:00 RickInGA: nice... kind of high latency though

11:00 TimMc: It's greek to me.

11:00 gfredericks: TimMc: spin up another instance of TimMcBot for higher throughput

11:00 TimMc: Oh, sorry - I thought you were addressing me.

11:03 clgv: gfredericks: I still dont get what your actual problem is^^

11:03 gfredericks: clgv: so what I will end up doing is creating a helper function like (def make-keyword (partial keyword (str *ns*)))

11:04 which has a different behavior from (defn make-keyword [s] (keyword (str *ns*) s))

11:24 clgv: gfredericks: thats because partial is a function. so the current value at definition time is passed to partial and not the variable *ns*

11:25 gfredericks: clgv: yes; my original question was how do I avoid the behavior of the latter

11:25 clojurebot: Cool story bro.

11:25 clgv: gfredericks: defn ^^

11:26 gfredericks: clgv: I was hoping there was a simpler way to get the compile-time namespace

11:26 but it seems a helper function or macro is the only way

11:27 clgv: compile-time namespace of what? you have different compilation times in your scenario: compilation of the helper and compilation of the call to the helper...

11:27 gfredericks: clgv: of the helper

11:28 the namespace of the file I'm creating the keyword in

11:28 there's really only one namespace I'm concerned about, I just know that by runtime *ns* will be something else

11:28 TimMc: Man, a bare #= does weird things on the REPL.

11:28 gfredericks: so I can't get anything interesting from *ns* at runtime

11:29 clgv: gfredericks: and why do you have to use *ns* then. you could also just use partial with the string of the only *ns* you consider for that

11:29 gfredericks: CHOCOLATE#=(str "foo")

11:29 clgv: you mean with a string literal?

11:29 clgv: yeah

11:30 gfredericks: clgv: I wanted to avoid the repetition; avoid bugs that would creep in if I ever changed the ns

11:30 clgv: ah kk

11:30 pelleb: My oauth2 provider library is starting to reach a usable state. I'd really love feedback. https://github.com/pelle/clauth

11:31 TimMc: gfredericks: SANBOX DENIED

11:49 gfredericks: technomancy: where are all your fabeled alternate paredit bindings? they don't seem to be in your dotfiles repo

12:06 juhu_chapa: Hi clojurians, Any help to use leiningen with a socks proxy?

12:16 sritchie: cemerick: sent you a pull request

12:16 cljs views worked great, btw

12:16 cemerick: ad-hoc-views seems broken, unfortunately

12:16 cemerick: on cloudant, you mean?

12:16 or everywhere?

12:16 sritchie: cemerick: locally as well

12:17 I filed a ticket with my error

12:17 cemerick: hum; ok

12:17 sritchie: using the cljs maven artifact works great, though

12:17 cemerick: thanks for the pull req, I'll take a look tomorrowish

12:21 dammit, fliebel had a pull req on the same topic a month ago, but I never got an email for it, either

12:21 github notifications are so g.d. broken

12:21 fliebel: cemerick: ??

12:21 lazybot: fliebel: What are you, crazy? Of course not!

12:21 ibdknox: cemerick: yeah they are :(

12:22 cemerick: fliebel: the pull req you sent a month ago on cluch-clojurescript: I didn't know about it, because I didn't get a mail about it

12:22 fliebel: cemerick: I didn;t know about it either, let me check what i did :)

12:22 cemerick: sritchie just redid it likely for no reason

12:23 sritchie: fliebel: whoops, didn't see htat

12:23 cemerick: ibdknox: it was one thing when I was getting spammed, it's another when I don't even know about pull reqs and people end up duplicating work unnecessarily.

12:23 fliebel: cemerick: Oh, that, right...

12:24 ibdknox: we used github at RFZ, and most of the time it worked great, but it was never clear what would and would not send an email

12:24 so things ended up misplaced at times :/

12:25 cemerick: fliebel, sritchie: I'm sorry for the snafu.

12:26 sritchie: better be, you bastard

12:26 fliebel: snafu?

12:26 cemerick: ibdknox: I've got all the notification checkboxes on, nothing in the spams, and I get other less valuable github emails constantly.

12:26 sritchie: cemerick: just kidding, deleting a few directories is no problem :)

12:27 cemerick: well, it's unnecessary

12:27 Contributions are too valuable to lose to not getting an email out to the repo owner.

12:28 fliebel: I wonder if it's just broken, or part of some magic workflow... In case your name is Linus Tovalds.

12:32 Karl_dscc: hi, i have a question... is it correct that the funktion 'into acts this way: http://pastebin.com/WtU9ZxER ? ...i am just confused that it handles a vector different to a list

12:33 sritchie: Karl_dscc: looks like it's conjing each element of the second list onto the first

12:33 ,(conj '(1 2 3) 4)

12:33 Hali_303: hi!

12:34 clojurebot: (4 1 2 3)

12:34 raek: Karl_dscc: yes. (into x y) is the same as (reduce conj x y), and conj will do different thing depdending on the type of x

12:34 gfredericks: Karl_dscc: I think it's somewhat the point of into that it treats different structures differently

12:35 raek: also, the type of the second argument to 'into' is not relevant, except that it must be seqable

12:35 Hali_303: I've got a series of tests and if a test passes I'd like to add a key-val to a map. Are there some built-in function that will help me implement this?

12:35 raek: Hali_303: try 'assoc'

12:36 &(assoc {:a 1, :b 2} :c 3)

12:36 lazybot: ⇒ {:c 3, :a 1, :b 2}

12:36 TimMc: Hali_303: and or

12:36 or rather, and

12:36 raek: for the conditional part, use if

12:36 TimMc: Hali_303: What happens if a test fails?

12:37 raek: (if some-test (assoc m ....) m)

12:37 Hali_303: the rest should be still evaluated and added

12:37 so I was thinking about using the -> operator, I just don't know how to combine the if into the assoc

12:38 raek: -> is just a shorthand notation. you need to be able to express it without -> first

12:38 Hali_303: raek: oh I see, i should just return the input map

12:38 ok, thanks :)

12:38 I'll try

12:39 raek: you can do something like (let [m0 ..., m1 (if x (assoc m0 ...) m0), m2 (if y (assoc m1 ...) m1)] ...m2...)

12:39 this resembles assignment in imperative languages a bit

12:40 dgrnbrg: how do i set the JVM that lein uses?

12:40 technomancy: dgrnbrg: JAVA_CMD

12:40 environment var

12:40 kurtharriger: When using emacs and clojure-jack-in is it possible to have it automatically run a clj file to do common tasks like (use 'clojure.repl) and define few helper functions?

12:40 dgrnbrg: technomancy: thanks

12:40 Hali_303: yes.. I guess i still think imperatively, because I forgot to think about the case when if returns the map unchanged :)

12:41 dgrnbrg: technomancy: I point that at java, and it'll pick up javac too?

12:41 technomancy: I don't know; maybe

12:41 ibdknox: java logging is retarded

12:42 RickInGA: ibdknox: have you ever used korma with a .dbf?

12:43 ibdknox: what's a .dbf?

12:43 RickInGA: foxpro free table

12:43 I take it that's a no :)

12:43 technomancy: kurtharriger: it should run the :repl-init ns, but it can't affect *ns*

12:43 ibdknox: haha no :)

12:43 RickInGA: in theory, if there's a jdbc driver for it, it would maybe work

12:44 RickInGA: what keys are acceptable for defdb? will :connectionstring work?

12:44 clgv: technomancy: is a 1.7 update with the "(if (windows?)" patch out yet?

12:45 technomancy: clgv: waiting to see if anyone else has other issues that should make it in, but should be out by the end of the week

12:46 Hali_303: if there some setting in paredit to show the pair of the parenthesis the cursor is currently on?

12:47 * gfredericks seconds Hali_303's question

12:47 ibdknox: RickInGA: it needs these: https://refheap.com/paste/1235

12:47 raek: Hali_303: does show-paren-mode do what you want?

12:48 gfredericks: raek: it does what _I_ want!

12:48 Hali_303: raek: yes :) thanks

12:49 I tought that paredit will do it by itself

12:50 RickInGA: ibdknox: I found an example for connecting to .dbf in java here: http://stackoverflow.com/questions/8064937/what-is-the-best-opensource-dbf-driver-for-java

12:51 ibdknox: I am not sure how fox specifications translate to Korma. I may have to get it working without korma first, and then try and adapt later

12:51 ibdknox: RickInGA: subprotocol: odbc:Driver={Microsoft dBASE Driver (*.dbf)};DefaultDir=E

12:51 RickInGA: subname: \\db

12:52 I think

12:52 RickInGA: ibdknox: thanks, I will try that

12:53 clgv: technomancy: good to hear :)

13:00 pandeiro: ibdknox: i went and hacked the cljs-template to use noir 1.3 beta 1 and it breaks because of hiccup i think... stacktrace is weird though

13:00 i changed out the requirements in views/common and main and still it is looking for hiccup.page-helpers

13:00 ibdknox: pandeiro: ah, I should go change that for the latest hiccup, but yes that's probably the issue

13:01 pandeiro: wish i could help but i'm kinda stumped by this, stacktrace points to app.server:1

13:02 ibdknox: pandeiro: just change hiccup.page-helpers to hiccup.page

13:02 pandeiro: ibdknox: yeah did that

13:02 ibdknox: still broken? hm

13:02 one sec

13:04 technomancy: clgv: https://github.com/technomancy/leiningen/issues/455 is also blocking 1.7.1

13:06 clgv: technomancy: just tried that one on Ubuntu and cant reproduce

13:07 technomancy: clgv: apparently it's specific to java7

13:07 ibdknox: pandeiro: ah, the issue is in noir-cljs

13:07 pandeiro: fixing

13:08 clgv: technomancy: that might be the cause. I am still using java 6

13:08 pandeiro: ibdknox: interesting, i was thinking it might be somewhere in noir

13:12 ibdknox: pandeiro: use noir-cljs 0.3.0

13:14 pandeiro: ibdknox: you put it on clojars before even updating github?

13:14 RickInGA: ibdknox: looks like I am running into a driver issue unrelated to korma. I think when (if) I get my driver fixed, I should be able to use what you told me to work with Korma. Thanks for the help.

13:14 pandeiro: ibdknox: nm :)

13:15 ibdknox: sometimes I do

13:18 pandeiro: it would be cool if grep could look through jars

13:19 dan_b: unzip -c foo.jar | grep # ?

13:19 actualyl -p might be better than -c

13:20 pandeiro: dan_b: yeah but no comparison between that and `grep -r needle`

13:20 dan_b: true

13:24 hagna: can I write to #<URL jar:file:...> or should I not bother

13:26 seemed like a good place for application configuration data

13:35 sorenmacbeth: can someone tell me how to get this function to actually execute the Cons, instead of just returning it?

13:35 https://gist.github.com/a3445412323faa490f3a

13:36 TimMc: sorenmacbeth: defmacro

13:37 (defmacro def-edge-tap ...)

13:38 sorenmacbeth: TimMc: I make it a defn because the params I'm passing to mk-edge-tap are inside a let binding, so it passes in the vars themselves and not their eval'd equivalents

13:39 TimMc: sorenmacbeth: So put that (let [md ...]) inside the syntax quote.

13:39 Make sure to gensym# the bindings.

13:40 sorenmacbeth: TimMc: ahhh, I see

13:40 TimMc: I'll try that

13:40 TimMc: cheers

13:40 TimMc: :-)

13:48 Hali_303: is there any article on error handling in clojure? eg. if there is a function that cannot calculate any result, should I throw an exception or return nil?

13:49 eg. the function parses a string, but the parse fails

13:51 emezeske: Hali_303: The idiomatic thing to do is almost always to return nil I think

13:51 Hali_303: It's much easier to do an "if-let" when calling a function than to do a try..catch

13:52 hagna: emezeske: yeah no kidding

13:54 Hali_303: emezeske: true

13:56 raek: Hali_303: in some cases it makes sense to return nil, but when it doesn't, use the "slingshot" library

13:56 something like it will probably be merged into clojure eventually

13:57 I think parsing is a case where it makes sense

13:58 cemerick: raek: did you ever end up writing an openid auth library/wrapper?

13:58 ibdknox: cemerick: Raynes has something I thikn

13:58 raek: cemerick: no, are you sure it was me?

13:58 cemerick: ibdknox: I think he opted for BrowserId; but hey, if Raynes has something, I'm all ears.

13:59 ibdknox: ah

13:59 raek: (I did think about it at some point, though)

13:59 cemerick: raek: http://clojure-log.n01se.net/date/2010-07-25.html

13:59 ibdknox: I think you're right

14:00 cemerick: I'd very much like to avoid trying to integrate spring-security with ring-jetty-adapter

14:08 pandeiro: ibdknox: is there any need for the lein-cljsbuild plugin when using the cljs-template?

14:09 ibdknox: pandeiro: if you're doing crossovers, yeah. I mainly included it for ease of starting a repl, though I added a repl ns that makes that painless

14:10 pandeiro: ah it already has a repl ns?

14:11 ibdknox: (noir.cljs.repl/browser)

14:11 run that from a normal lein repl

14:11 and you're off to the races

14:12 pandeiro: would it be possible for me to add that to :repl-init in the project.clj i wonder

14:15 cool that works

14:17 ibdknox: that would be neat with profiles

14:17 pandeiro: how do you mean?

14:17 ibdknox: create a cljs profile that runs that whenever you start the repl

14:17 lein2's profiles

14:18 then I could add that to the template by default

14:18 and you could start either a cljs repl or a normal one depending on which profile you use

14:19 pandeiro: how do you specify that? in the project clj?

14:20 ibdknox: are you using lein2?

14:20 pandeiro: nope not yet

14:20 do you recommend making the jump already?

14:20 ibdknox: ah, it's only for lein2. But yeah, you'd just specify it in the project.clj

14:20 not quite yet

14:20 you could install it side-by-side

14:20 pandeiro: ibdknox: imo it's simple enough to have a (browser) invocation to jump from clj to cljs repl

14:21 ibdknox: yep

14:21 I agree for now :)

14:21 pandeiro: i just like not having to change namespace

14:21 (and remember which namespace the repl fns are in)

14:23 sorenmacbeth: in the following macro, how can I get fn-name# to expand to in binding?

14:23 https://gist.github.com/6e5207df3c22fc7db19e

14:23 I don't what the name of the defn to be fn-name__auto__234234

14:24 s/what/want/

14:25 I want to be the symbol that fn-name# is bound to

14:25 tomoj: ~fn-name# ?

14:25 clojurebot: Excuse me?

14:26 tomoj: hmm

14:26 that won't work though, eh

14:26 sorenmacbeth: tomoj: it says it can't resolve fn-name#

14:26 tomoj: I feel vaguely like there's a ` in the wrong place

14:27 should the (let [md# ..]) be quoted? I feel vaguely like it should be unquoted

14:28 dnolen: sorenmacbeth: manual gensym outside syntax-quote

14:28 tomoj: no need for a gensym?

14:28 dnolen: sorenmacbeth: you don't want fn-name to be gensym, then don't

14:29 sorenmacbeth: dnolen: I think I follow you

14:30 dnolen: know of an example I could look at off-hand?

14:32 tomoj: sorenmacbeth: this seems closer https://gist.github.com/f8fb9171f39fb4ebf5d2

14:32 still at least a bit wrong

14:32 (with a (list* 'do (for ...)) it should be good?

14:33 sorenmacbeth: tomoj: that doesn't work (was near my first attempt) because the params I'm passing to the macro are inside a let binding

14:33 dnolen: I need ~property-class to be inside the syntax-quote because the param is passed inside a let binding in some cases

14:34 tomoj: you mean that property-class needs to be evaluated?

14:34 sorenmacbeth: tomoj: yeah

14:38 Hali_303: this is strange: in clj-time, there is a function called interval, that accepts two datetimes. however, it does not accept a datetime and a duration, as the original java library. is this intended?

14:38 dnolen: Hali_303: oversight probably

14:51 Hali_303: back to error handling in clojure: if I signal an error by returning nil, how does the developer know where/what is causing the problem without firing up a debugger?

14:53 dnolen: Hali_303: signaling an error by returning nil probably not a good idea, use another unique value and document it.

14:53 Hali_303: if the developer doesn't handle it, it's not your problem - you documented it

14:55 Hali_303: dnolen: what do you mean by unique value?

14:55 dnolen: Hali_303: ::my-unique-value, or if you're paranoid (def my-unqiue-value (Object.))

14:55 Hali_303: dnolen: oh i see

14:58 dnolen: actually by reading the clojure library sources, i had the same feeling, that usually functions dont care if they fail. The problem is, how to debug what is causing the actualy problem? maybe i'm not used to reading enough clojure stack traces..

14:58 gfredericks: is the who-calls function in swank-clojure supposed to be working?

14:58 sorenmacbeth: dnolen: I'm still stuck. If you get a chance to whip up an example or something to push me along the way, I'm be very grateful.

14:58 devn: gfredericks: i believe so...

14:59 dnolen: Hali_303: there's a lot of noise in Clojure stacktraces but they are very precise.

14:59 technomancy: gfredericks: well...

14:59 sorta

14:59 gfredericks: I get "error in process filter: Wrong type argument: char-or-string-p, nil"

14:59 technomancy: it's not really much smarter than grep

14:59 gfredericks: I tried loading the file as well, same thing

15:01 Hali_303: dnolen: i see, well..

15:01 gfredericks: technomancy: "slightly smarter than grep" is probably good enough for me

15:02 Hali_303: thank you all, cu l8r

15:02 technomancy: gfredericks: no, I think you need "slightly smarter than grep and not broken".

15:02 gfredericks: technomancy: what? do they make those??!

15:02 * gfredericks rushes off to pre-order

15:06 tomoj: sorenmacbeth: well, I'm stumped

15:07 sorenmacbeth: tomoj: me too. thanks for taking a shot at it

15:07 tomoj: I think I ended up giving up and doing some hack with eval when I was in a situation somewhat like yours, with protobuf

15:08 yep: ";; TODO eval?!"

15:09 TimMc: sorenmacbeth: What's the latest paste URL?

15:09 Oh, found it.

15:09 sorenmacbeth: https://gist.github.com/6e5207df3c22fc7db19e

15:12 TimMc: Ah, I see. You've got a defn inside a for block. That can't end well.

15:13 sorenmacbeth: Does (macroexpand-1 '(mk-property-tap ...)) give a reasonable result, or does it error?

15:13 sorenmacbeth: TimMc: it doesn't error

15:14 TimMc: Anyhow, you're trying to mix expansion time and runtime stuff.

15:14 sritchie: sorenmacbeth: we hacked w/ eval as well

15:14 tomoj: huh, is there no way around it or it's just hard?

15:14 sorenmacbeth: TimMc: yeah

15:14 sritchie: not sure, that was nathanmarz when he was learning clj

15:15 TimMc: sorenmacbeth: That for block depends on a value, but it's goingto run outside the macro (that is, at runtime)

15:15 sritchie: sorenmacbeth: you'll probably have to quote those cascalog symbols

15:17 tomoj: maybe it's not a hack to use eval to reflect on thrift

15:17 sritchie: sorenmacbeth: use ~'?symbol-name or ~'_ for cascalog symbols

15:18 sorenmacbeth: sritchie: I though so too, but it seems to work

15:18 sritchie: cool

15:18 sorenmacbeth: sritchie: I'm not sure how to go about hacking this up with eval

15:20 TimMc: sorenmacbeth: Looks like you need runtime values from md, f, val-id, val-name, and fn-nme

15:20 so the syntax-quote needs to get pushed down to just be around teh defn again

15:20 sorenmacbeth: TimMc: what I'm doing now is moving the entire for loop out of the macro and into the calling fn

15:21 TimMc: Not sure that helps...

15:21 tomoj: if you (eval property-class) etc, it seems to get easier?

15:21 sorenmacbeth: TimMc: yeah, so now the syntax-quote is just around defn and there is no let

15:21 tomoj: but that seems funny

15:21 TimMc: sorenmacbeth: Re: moving the for loop... you're still trying to mix runtime and expand-time info without eval.

15:22 The macro expand will happen before that for loop ever runs.

15:22 tomoj: huh, doing eval'ing property-class etc would just be like making it into a function instead of a macro, no?

15:22 sorenmacbeth: TimMc: like so: https://gist.github.com/899a400cd837369d306d

15:23 dsantiago: Is it possible to hint a function to return a primitive?

15:24 pjstadig: dsantiago: i think only as long or double

15:24 ferd: hey... Anybody knows how to configure swank/slime to show metadata con macro expansion? I tried (set! *print-meta* true) on the slime repl to no avail

15:24 dsantiago: That's fine.

15:26 ferd: dsantiago: hey: sell me clojure-csv. Why would I use it over clojure/data.csv? (honestly, I haven't tried them, but was just about to)

15:27 technomancy: you can contribute to it without signing paperwork

15:27 sorenmacbeth: TimMc: here is the macro and the calling fn: https://gist.github.com/899a400cd837369d306d

15:27 Bronsa: lol

15:28 TimMc: sorenmacbeth: mk-prop-tap is going to get 'id 'name 'val-id 'val-name, the symbols

15:28 dsantiago: ferd: I don't know. I've maintained clojure-csv since 2009, and offered it for inclusion in contrib. I was ignored, and they later wrote their own thing to put in. I believe clojure-csv has more configurability in what inputs it accepts.

15:28 Raynes: technomancy: Hahaha

15:28 dsantiago: I'm actually working on performance enhancements as we speak.

15:29 rindolf: Hi all. I'm getting an exception with this program - how can I fix it? http://paste.debian.net/160439/

15:29 sorenmacbeth: TimMc: even though they are unquoted inside the syntax quote?

15:29 ferd: dsantiago: thanks. From the docs, looks like clojure-csv will be my first pick

15:29 TimMc: sorenmacbeth: Doesn't matter. The macro receives syntax, not data values.

15:30 sorenmacbeth: TimMc: damn, right.

15:30 dsantiago: ferd: Send me a note or file an issue on github if you have any problems, I can usually turn things around pretty quickly.

15:31 ferd: dsantiago: awesome. Thanks again

15:32 sorenmacbeth: TimMc: so is what I'm trying to do impossible?

15:33 TimMc: Semi-impossible.

15:33 sorenmacbeth: TimMc: I need to write a defn and use eval all over the place

15:34 TimMc: Dunno, I'd have to study the problem in context. :-/

15:37 sorenmacbeth: TimMc: no worries, that's for the help

15:37 tomoj: do you have an example of hacking something like that up using veal's?

15:37 evals

15:38 but veals would be cool too

15:48 joegallo: I can't believe anybody would do programming with veals. Those little baby lambdas shouldn't be cooped up and killed young just so you can program!

15:48 rindolf: Hi all. I'm getting an exception with this program - how can I fix it? http://paste.debian.net/160439/

15:48 sorenmacbeth: joegallo: lulz

15:49 joegallo: rindolf: i think you are trying to set the root binding of a var with set!. it doesn't work like that.

15:49 rindolf: joegallo: OK.

15:49 joegallo: then how can I have mutable state?

15:50 amalloy: joegallo: you act like you've never questioned where the meat in #() sandwiches comes from. you are yourself a prime beneficiary of lambda veal!

15:50 joegallo: well, the simplest change to your program would be to put an atom in that var, and turn off the dyanmic.

15:50 Raynes: You can use refs or atoms, but you aren't even close to needing mutable state for this.

15:50 joegallo: Raynes++

15:51 rindolf: :-S

15:51 eggsby: lol

15:51 I'm noticing that the code I write in clojure isn't as pretty or elegant as the code others write in clojure, very sad

15:51 on the other hand I set up autoexpect and it makes tdd a joy

15:52 jakemcc`: glad you like it

15:52 Raynes: rindolf: (doseq [s (repeatedly read-line)] (println s))

15:54 rindolf: Raynes: thanks! That works.

15:55 Raynes: (loop [] (let [s (read-line)] (println s) (recur))) is another way to do it. You don't have to modify a anything. Even better: (loop [] (println (read-line)) (recur)).

15:55 amalloy: (repeatedly #(println (read-line)))

15:56 rindolf: How do I terminate on end-of-file?

15:58 tomoj: (while (when-let [l (read-line)] (println l) l)) ? :/

15:58 I think I've probably used while like 3 times total

15:59 Raynes: amalloy: Yeah, dunno why but the doseq felt 'better' there. I guess I'm used to separating side effects and functions that generate sequences, but they're the same in this case.

15:59 tomoj: sorenmacbeth: nope, sorry, my eval hack is in a significantly different context

16:00 I mean.. same basic problem of tangled eval/expand scopes probably caused by basically the same situation (reflecting on protobuf instead of thrift), but they're tangled up in different ways

16:01 sorenmacbeth: tomoj: ok, I'm off to learn about veal then ;-)

16:13 melipone: how can I convert from a java array I created with make-array to a list of vectors so that I can make an incanter matrix?

16:17 TimMc: melipone: 2D array?

16:17 (map seq ...) oughtta be enough

16:18 melipone: TimMc: yes

16:19 TimMc: okay, thanks, that works

16:24 licoresse: ~reify

16:24 clojurebot: excusez-moi

17:08 pandeiro: is there a lib that can match similar (not identical) strings?

17:09 TimMc: E.g. Levenshtein distance?

17:10 pandeiro: TimMc: no idea but sounds promising :)

17:10 lynaghk: pandeiro: I've used this in the past, dunno if there is a clojure wrapper: http://secondstring.sourceforge.net/

17:11 technomancy: incanter has a levenshtein implementation in like 20 lines

17:11 Raynes: I sure wish there was an oauth library that wasn't abandoned.

17:11 technomancy: Raynes: oauth1?

17:11 Raynes: oauth2

17:12 technomancy: there was a talk at clojure/west on clj-oauth2

17:12 it sounded pretty happenin'.

17:12 Raynes: What the shit

17:12 Where the bloody hell did this come from?

17:12 I've googled so far and so long.

17:13 technomancy: everyone knows you can't trust google

17:13 trusting google is what leads people to riddell.us tutorials

17:13 lazybot: The riddell.us tutorials are much more highly-ranked on Google than they deserve to be. They're old and way too complicated. If you're trying to install Clojure...don't! Instead, install Leiningen (https://github.com/technomancy/leiningen/tree/stable) and let it manage Clojure for you.tutorials

17:13 Raynes: DerGuteMoritz: Dude. Why didn't you tell me you had an oauth library? You should have known I needed one.

17:16 Looks like Pat Patterson is maintaining it.

17:16 technomancy: yeah, he's the guy who gave the talk

17:17 Raynes: Also the guy who hasn't released anything. :<

17:21 technomancy: I think he's just contributing; he doesn't have push rights to clojars at least.

17:27 Raynes: technomancy: Yeah, he is.

17:27 But complain I shall.

17:28 Wow, it uses lazytest.

17:28 Classic.

17:28 DerGuteMoritz: Raynes: I apologize

17:29 wait I do have push rights at clojars

17:29 technomancy: DerGuteMoritz: I meant patterson didn't

17:29 Raynes: We were talking about Pat.

17:29 DerGuteMoritz: ah yeah

17:29 he sent me some patches so it works with salesforce's ancient oauth2 implementation

17:30 also a ring middleware which I will include soon

17:30 what about lazytest?

17:30 Raynes: I don't think it's maintained anymore.

17:30 Last commit was a year ago.

17:31 TimMc: Raynes: That is because it has reached perfection.

17:31 Raynes: I'm sure.

17:31 DerGuteMoritz: heh

17:31 yeah I've stopped using it for new stuff, too

17:31 technomancy: Raynes: well neither is clojure.test =P

17:32 Raynes: Fair enough, but the former is at least doesn't depend on contrib alpha4.

17:32 DerGuteMoritz: back when I started with clj-oauth2 lazytest was the only one with autotesting

17:32 lazytest has far too many badly composing macros

17:32 * Raynes pretends that sentence didnt't happen.

17:33 technomancy: youch

17:33 Raynes: It looks like your tests could easily be changed to clojure.test or midje.

17:33 DerGuteMoritz: which sentence?

17:33 Raynes: The one I slaughtered.

17:33 DerGuteMoritz: yeah I should rewite them some day

17:33 when I have too much time on my hands!

17:34 Raynes: How do you run lazytest tests?

17:34 DerGuteMoritz: with clojure 2.0

17:34 Raynes: Never had occasion to do it before.

17:34 DerGuteMoritz: I have this autotest thingy

17:35 not sure about the original name, my shell alias is called clj-autolazy

17:35 but lein test should probably work

17:35 Raynes: Doesn't seem to do anything, sadly.

17:36 I think I'll take a shot at moving these tests.

17:36 Doesn't look that bad.

17:36 DerGuteMoritz: nice!

17:36 feel free

17:36 (brb)

17:40 re

17:41 so how was pat's talk? will there be a video?

17:45 daaku: i saw some post a few days ago about disabling locals clearing in 1.4 -- is there a way to backport that to 1.3 or something to make debugging easier?

17:45 aperiodic: DerGuteMoritz: I think there's gonna be a video for every talk (I didn't go to one that wasn't recorded), but I have no idea when they'll be up

17:55 DerGuteMoritz: aperiodic: alright, thanks for the info!

18:16 hagna: in clojure why can I do java.io.FileInputStream without explicitly importing first?

18:16 raek: hagna: 'import' does not cause the class to be loaded, it just gives it a shorter name

18:16 amalloy: because that's how the jvm works. importing classes is just for programmer convenience

18:17 raek: hagna: the JVM automatically loads classes when they are used the first time

18:18 Raynes: amalloy: Man, this font size is not working when using this tv as a monitor. I thought you said "is just for brogrammer convenience". I was already heading to #4clojure to make fun of you.

18:18 amalloy: ugh, brogrammer and progamer. two words i wish would die

18:18 Raynes: You and me both, pal.

18:22 eggsby: write some source codes brah

18:25 jodaro: is there a brogamer too?

18:26 ssideris: all gamers are bros

18:26 aperiodic: not at all true

18:27 rahcola: if i'm using lein ring war to create a servlet, who can i access the init-params in web.xml in my handler-fn?

18:28 do I have access to the Servlet object so I could use .getInitParameter()?

18:29 eggsby: is anyone itc bored enough to do a style review of my simple clojure script? I feel like I'm doing things Wrong(tm)

18:35 hagna: raek, amalloy ok thanks didn't know that

18:36 aperiodic: eggsby: i'd recommend posting a link along with your invitation (promising a style review creates expectations, whereas just posting a link allows people to take a look before deciding to say anything or not)

18:39 eggsby: hahah sorry :)

18:39 http://pastie.org/3637090 I'm just wondering if there is anything glaringly obviously wrong

18:39 aperiodic: no problem, just trying to help you get feedback :)

18:39 eggsby: but I will take any tips anyone has to give, I'm a clojure babby

18:42 Raynes: https://refheap.com/paste/1240 For people who are put off by pastie's atrocious Clojure syntax highlighting.

18:43 Holy crap, that font looks terrible on this monitor.

18:44 Or, I guess it's just how far I'm sitting away from the screen.

18:44 I really hate bothering with fonts. Nothing I choose ever satisfies everyone.

18:47 aperiodic: I'm one of the most typographically picky people I know, and I think it's fine

18:47 Raynes: Yeah, it looks fine on my laptop monitor.

18:51 lynaghk: aperiodic: I hope I'm up there on your typographically picky list

18:52 Raynes: aperiodic: I actually use anonymous pro in my editor. A small poll led me to believe that Deja Vu is more likely to appease the more people than my favorite.

18:53 lynaghk: Anonymous pro is rad, if you can actually get it to line up with physical pixels correctly

18:54 I used it for years at 7 pt on a netbook

18:54 aperiodic: lynaghk: definitely! your presentation at clojure/west was my favorite in terms of typography (though BG's came close)

18:54 i'm using inconsolata-dz these days

18:54 Raynes: Yeah, it isn't pixilated at all for me on this computer. I even used it on refheap briefly, but everybody complained that it was pixilated and proved it with screenshots. I don't know enough about typefaces to understand what the difference between me and them is.

18:55 lynaghk: aperiodic: thanks. Eurostile is the offical Keming Labs font, but there is also some Caecilia in there too.

18:55 Lajla: Raynes, my love

18:55 Let us worship His Shadow together.

18:55 aperiodic: ooh, Anonymous pro looks pretty nice

18:57 lynaghk: definitely a fan of the Caecilia

18:57 lynaghk: aperiodic: if you ever need to give a presentation, http://zachholman.com/posts/slide-design-for-developers/

18:57 nDuff: Where did clojure.contrib.str-utils go? I don't see it in https://github.com/clojure

18:57 Raynes: clojure.string

18:57 But it isn't a copy.

18:58 Not everything made it through.

18:58 And things that did are likely renamed.

18:58 nDuff: ahh; thanks!

18:59 Zoka: Social REPL-ing web based REPL with built in chat http://noirmon.herokuapp.com/ringmon/monview.html

19:01 sritchie: cemerick, I'm seeing this now:

19:01 <<"compilation_error">>,

19:01 <<"Expression does not eval to a function. (

19:01 cemerick: not sure how this worked this morning

19:01 cemerick: sritchie: you can gist if you want; but if it's the same view, then…

19:02 sritchie: I rebuilt the view

19:02 cemerick: I mean, if it's the same view code, then something wonky must be going on.

19:02 sritchie: cemerick: https://gist.github.com/2142226

19:02 had a buddy confirm on another machine, same issue

19:03 this "new String" thing is confusing to me --

19:03 "and this is just some of the error, it prints out the whole view function)

19:03 is it getting wrapped in a new String() call somehow?

19:03 cemerick: looks like the gist is truncated?

19:04 sritchie: okay, I'll gist it all

19:04 one sec

19:04 there

19:04 full error on the gist, sorry about that

19:05 cemerick: I rebuilt the view this aft

19:05 cemerick: yeah, that new String bit is bizarre; nothing like that in the cljs-views ns

19:06 I'm 6 months away from the code, but that doesn't strike me as right.

19:06 sritchie: cemerick: do you have a small example view that works w/ clutch-clojurescript?

19:07 this is couchdb 1.1.1

19:12 cemerick: sritchie: OK, so that new String business is entirely spurious

19:13 sritchie: I can't see it in the design doc

19:13 cemerick: https://gist.github.com/2adf9a5eb778f54b40fe

19:14 cemerick: ok, well, that's something

19:14 what's up with the intermediate cake key?

19:14 yeah, that's your problem

19:14 https://gist.github.com/2142292

19:14 sritchie: that's the name of the view

19:15 my view name was :cake

19:15 cemerick: hrm, right

19:15 sritchie: is that diff than https://gist.github.com/2142226?

19:15 cemerick: ok, well, the just-gisted snippet worksforme

19:16 sritchie: trying it now

19:16 cemerick: it looks isomorphic

19:16 sritchie: cemerick: what couchdb version are you on?

19:17 cemerick: 1.1.3

19:17 yikes, I'd hope that's not it

19:17 1.1.3 / couchbase single

19:18 sritchie: couchbase single isn't made anymore

19:18 they deprecated it

19:18 not just deprecated, it's just not available anymore

19:19 I also get a "can't recur here" error sometimes

19:19 from the cljs compiler

19:19 cemerick: the latter sounds like a cljs error?

19:19 yeah, ok

19:20 huh, didn't realize they stopped distributing the thing

19:20 * cemerick goes to try on cloudant

19:21 lynaghk: Is there any way to read the metadata from a form without evaling it?

19:21 sritchie: cemerick: on cloudant I get: JSON error (end-of-file)

19:21 [Thrown class java.io.EOFException]

19:21 lynaghk: Like I have (def ^:xyz a 1) in a file

19:21 sritchie: dpetrovics might have some more info

19:21 cemerick, gotta run for now, but I'm working with dpetrovics so if you find anything he'll note it

19:22 dpetrovics: hey guys

19:22 gfredericks: lynaghk: just using the reader should get you the metadata

19:22 though in that particular case you'll have to pull out the 'a symbol and check on that

19:23 lynaghk: gfredericks, how do you mean?

19:23 gfredericks: lessee if the bots let me read

19:23 lynaghk: (meta (read-string "(def ^:clj a 1)")) gives nil

19:23 gfredericks: &(-> "(def ^:xyz a 1)" read-string second meta)

19:23 lazybot: ⇒ {:xyz true}

19:23 dpetrovics: cemerick: i missed the begging of the conversation, but the issue seemed to be with getting a view, I can save them just fine

19:23 lynaghk: ah, I see

19:23 gfredericks: lynaghk: because the metadata isn't on the list, it's on the symbol

19:24 lynaghk: gfredericks, that makes sense. Reading the second should work, eh? that covers def and defn

19:24 cemerick: dpetrovics: yeah, it's either a cljs compilation issue or some previously-unknown couchdb rev incompatibility

19:24 gfredericks: yeah I think so

19:24 sritchie: cemerick: btw, this is with [org.clojure/clojurescript "0.0-993"]

19:25 dpetrovics: cemerick: ok, bizarre that it worked for sritchie this morning

19:25 sritchie: that might be it

19:25 gfredericks: &(read-string "(def #^{:fine (def foo 'bar)} baz 12)")

19:25 lazybot: ⇒ (def baz 12)

19:25 gfredericks: &foo

19:25 lazybot: java.lang.RuntimeException: Unable to resolve symbol: foo in this context

19:25 sritchie: dpetrovics: yeah, I don't know what was different about this AM, not worth worrying about until I think of it

19:26 cemerick: sritchie: ok, I've not moved up to that rev yet; that may be the cause of the whole thing?

19:26 sritchie: might be it

19:26 are you on 971?

19:26 cemerick: What I have here works well on cloudant

19:26 I'm still using the old rev I bundled

19:26 sritchie: got it

19:26 that was just one of the git commits?

19:27 cemerick: yeah, that was pre-release

19:27 maybe roll back to that and see how that fares for you

19:27 sritchie: dpetrovics, try removing clojurescript from our deps and adding this:

19:27 [com.cemerick/clutch-clojurescript "0.0.1-SNAPSHOT"]

19:27 then redeps, etc

19:27 gotta run, guy

19:27 s

19:27 cemerick, thanks for the help

19:27 cemerick: sritchie: sure; if you or dpetrovics still have issues tomorrow, you know where to find me :-)

19:28 dpetrovics: cemerick: thanks, appreciate it

19:29 dgrnbrg: does clojure support binary literals?

19:29 gfredericks: no

19:29 * gfredericks waits for someone to declare him wrong

19:31 cemerick: gfredericks is right; the reader is text only

19:31 technomancy: well

19:31 dgrnbrg: So I should implement a reader macro for binary literals, right?

19:31 technomancy: it supports base 2 numbers

19:32 gfredericks: technomancy: I knew there'd be something...

19:32 technomancy: those are binary literals =)

19:32 dgrnbrg: assuming i have a codebase that requires tons of them

19:32 ,(identity 0b0011_1010)

19:32 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 0b0011_1010>

19:32 dgrnbrg: :(

19:32 technomancy: ,2r011

19:32 clojurebot: 3

19:33 dgrnbrg: in 1.3?

19:33 emezeske: Nice, can you set any radix?

19:33 ,7r070301532

19:33 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: For input string: "70301532">

19:33 dgrnbrg: ,2r0000_0110

19:33 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Invalid number: 2r0000_0110>

19:33 emezeske: ,7r123

19:33 gfredericks: emezeske: not if you violate it :P

19:33 clojurebot: 66

19:33 technomancy: I don't think it's particularly new

19:33 gfredericks: ,Ar100

19:33 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: Ar100 in this context, compiling:(NO_SOURCE_PATH:0)>

19:33 gfredericks: ,10r100

19:33 dgrnbrg: Where could I propose making underscore an ignored in numbers?

19:33 clojurebot: 100

19:33 emezeske: gfredericks: I guess I don't have a feel for how many digits of base 7 fit in an int :P

19:34 17rg

19:34 ,17rg

19:34 clojurebot: 16

19:34 gfredericks: emezeske: it wasn't that the number was too large it was that you used a '7' digit

19:34 emezeske: gfredericks: DERP

19:34 ,42rx

19:34 Raynes: DerGuteMoritz: Pull request sent.

19:34 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Radix out of range>

19:35 tmciver: emezeske: your first base 7 example failed because it had a 7 in it.

19:35 nDuff: What ever happened to pods? I'm trying to write an interface to non-a Java library

19:35 er

19:35 non-thread-safe, mutating Java library, and IIRC they would have been useful

19:35 emezeske: tmciver: Yeah... :(

19:35 tmciver: ,7r060301532

19:36 clojurebot: 4992290

19:36 emezeske: ,36rz

19:36 clojurebot: 35

19:36 tmciver: that's cool though, I wasn't aware of that.

19:36 emezeske: ,37r1

19:36 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NumberFormatException: Radix out of range>

19:36 gfredericks: emezeske: bet you'll never make that mistake again though

19:36 emezeske: I guess that makes sense ^_^

19:36 gfredericks: Likely not, but only because I will never use a base 7 literal ^:)

19:36 gfredericks: my grandma always told me to mind my base seven literals...

19:42 muhoo: hmm, i wonder if this ever got integrated into incanter: http://jakemccrary.com/blog/2010/02/21/plotting-time-series-data-with-incanter/

19:42 ah, i see, it does

19:42 choffstein: what is the best way to iterate over a list if you want to call a function that performs side-effects. For example, I want to iterate over a list and delete all the objects from the database with that id. I can do a "map" -- but it feels sort of silly to end up with a resulting list of nils

19:42 muhoo: nm

19:43 lynaghk: choffstein: doseq

19:43 choffstein: perfect. thanks lynaghk.

19:45 aperiodic: technomancy: is there any way to define lein's order of compilation?

19:46 technomancy: aperiodic: more than just :aot [ns.one ns.two] ?

19:47 aperiodic: technomancy: derp. i was using regexes.

19:48 thanks

19:48 technomancy: sure

19:56 aperiodic: technomancy: so, it seems that the ordering in the :aot vector is not preserved if there's regexes in it

19:58 technomancy: aperiodic: ah, tricky

19:59 aperiodic: this may be my chance to earn a leiningen sticker

20:00 technomancy: go for it =)

20:00 wmealing: there are stickers ?

20:03 i'm using lein midje --lazytest , v nice.

20:05 aperiodic: wmealing: http://twitpic.com/2e33r1

20:06 technomancy: aperiodic: ohhoho; the new stickers are way better than that

20:06 aperiodic: oh really?

20:06 pics or they don't exist

20:07 technomancy: https://twitter.com/#!/technomancy/media/slideshow?url=pic.twitter.com%2FxpIrqEBf

20:07 wmealing: brace yourselves, jpegs is coming.

20:07 aperiodic: awesome

20:07 you should update the link in the readme

20:08 technomancy: aha; yes

20:09 ibdknox: I should get cool stickers

20:09 dgrnbrg: I'm trying to write a reader macro but I keep getting "exceptionininitializererror"--what causes that?

20:09 None of my code is in the stacktrace

20:09 just compiler internals

20:10 and I know the dispatch fn is called, b/c it prints to stdout

20:11 technomancy: ibdknox: need a logo first.

20:11 I know a guy... =)

20:11 ibdknox: haha

20:14 dgrnbrg: Oh I see--the reader macro needs to return a syntax fragment

20:24 aperiodic: technomancy: it seems to be fixed in lein2 (ran into the issue on 1.7)

20:26 technomancy: aperiodic: ah, ok. I'd still take a patch for 1.7.1 if you like.

20:32 ibdknox: lol: 499 watchers on Noir.

20:32 oh the torment

20:33 brehaut: 500

20:33 ibdknox: haha

20:33 wooohooo!

20:34 amalloy: quick, someone unwatch so he can get that feeling again

20:34 aperiodic: technomancy: cool; i'll open an issue and get cracking on it after work this evening

20:34 ibdknox: lol

20:37 technomancy: great

20:37 mk: are there any talks online from clojure west?

20:38 qbg: mk: There are slides

20:39 lynaghk: mk: There's a month-old draft of my talk at a SECRET YOUTUBE URL: http://www.youtube.com/watch?v=T83P3PVSy_8

20:40 mk: slides are good, though I prefer audio

20:41 qbg: https://github.com/strangeloop/clojurewest2012-slides

20:41 mk: lynaghk: great, thanks - the title is already interesting

20:42 lynaghk: mk: unfortunately there wasn't much time to talk about composability; I'll be giving a longer talk at the Joint Statiscians Meeting in July

20:43 mk: lynaghk: any major errata/additions to that youtube version?

20:44 * wmealing downloads the sekret.

20:44 lynaghk: The slides at the link qbg gave have some extra example screenshots

20:44 and the code changed a bit (unify no longer provides the mapping function with idx for each datum)

20:44 but otherwise no, it's basically the same as the talk I gave on Saturday.

20:46 ibdknox: lynaghk: had I known the value of this secret, I would've been selling this precious commodity for many monies

20:47 lynaghk: ibdknox: next conference get me a few whiskeys and I'll tell you about the brotherhood of the charts.

20:47 ibdknox: haha

20:49 TimMc: technomancy: The stickers were surprisingly translucent?

20:50 technomancy: yeah, that was unintentional

20:50 looks fine on an aluminium surface, but crappy on a dark background

20:51 but they're much bigger than the old ones

21:04 TimMc: WELP. Guess I'm getting a Mac then!

21:05 technomancy: hah

21:05 it looks fine if you place it on a white label first

21:36 muhoo: before i go trying to reinvent the wheel, has anyone done a real-time graph using incanter, like an oscilloscope-style plot?

21:37 i'm digging into the dynamic-xy-plot macro, trying to figure out how to dynamically update the data without using sliders, and thought "this is probably the hard way"

21:38 tomoj: are you hooking this to overtone?

21:39 mk: lynaghk: that was a good talk, thanks for the link

21:46 muhoo: tomoj: actually, no, but that'd be fun :-)

21:47 overtone already has a scope function anyway though

21:47 no, i just need a rolling plot of data, updated at a regular interval for now, but ultimately to be fed by a lazy seq, from a data collection device

21:48 tomoj: right, just making sure you didn't miss the overtone/sc scope

21:48 unfortunately I couldn't get that to work on linux :(

21:48 muhoo: i did. it was cool, but glitchy when resizing the window

21:49 *sigh*, ok, back to trying to macroexpand dynamic-xy-plot :-/

22:08 aha! add-points :-)

22:08 it's mutable :-P

22:09 eggsby: what does (. comp ..) do?

22:09 specifically the leading .

22:09 or what would I look up to research it?

22:11 Raynes: It is the Java interop form. It calls a Java method.

22:11 &(.contains [1] 1)

22:11 lazybot: ⇒ true

22:12 Raynes: &(. [1] contains 1)

22:12 lazybot: ⇒ true

22:12 Raynes: The former is sugar for the latter and what you should usually use.

22:12 You call a static method with ##(Character/isUpperCase \c)

22:12 lazybot: ⇒ false

22:30 wmealing: what is the closest thing to clojure, not on the jvm ?

22:30 Iceland_jack: Eh, Haskell? Racket? Common Lisp?

22:30 xeqi: clojurescript?

22:30 clojurebot: ClojureScript is https://github.com/clojure/clojurescript

22:30 Iceland_jack: Depends on what you mean by closest

22:31 wmealing: haskell doesn't do infix notation, does it ?

22:31 Iceland_jack: infix notation? it does

22:31 wmealing: i mean syntax, and form behavior

22:31 amalloy: (. comp ..)? i would be astonished if that ever did anything good

22:31 Iceland_jack: so you basically want Lisp syntax

22:32 Liskell ;)

22:32 * wmealing smiles

22:32 wmealing: and, its a real project

22:33 i'm currently evaluating clojure, its not bad, but my main goal is to know that if things close up shop , i have something else to work with.

22:34 Iceland_jack, can liskell do the metadata trickery too ?

22:35 Iceland_jack: metadata is not a Lisp thing, rather a Clojure thing

22:35 wmealing: ah ok

22:36 eggsby: thank you Raynes

22:42 aperiodic: is there a good reason why there isn't an "any?" function in core that i'm missing?

22:42 xeqi: aperiodic: some

22:42 aperiodic: xeqi: that doesn't have quite the same semantics

22:43 xeqi: it returns non-nil or nil, when i'd like a boolean

22:43 eggsby: just ask nil? then :p

22:44 aperiodic: i mean, i can just (def any? (comp not not-any?)) when i want it, i was mainly curious if i was missing something obvious

22:45 eggsby: you could define any? I guess by nil? + some

22:45 then just ask for the complement of any?, right?

22:47 xeqi: its just standard to return a value/nil then booleans

22:47 *rather than

22:47 aperiodic: yeah, or the (comp not not-any?) from my previous comment ("not-any?" *does* exist in core, which is the most confusing part)

22:48 xeqi: why have every? and not-any? return booleans, then?

22:48 xeqi: which value from the seq would you choose for every?

22:49 eggsby: you might be used to nil punning, here we have bool punning!

22:49 :p

22:51 xeqi: I suppose not-any? could return the first one that failed the predicate

22:51 but that just sounds akward to code

22:51 aperiodic: it doesn't, though

22:52 i guess my real question is why there's a "not-any?" but no "any?"

22:52 seems backwards to me, but this conversation is descending into bikeshed territory anyways

22:53 xeqi: https://github.com/clojure/clojure/blob/14428c296de483ea666bd874701046e7088e545c/src/clj/clojure/core.clj#L2398

22:53 prolly just an ease of coding thing

22:55 aperiodic: i guess someone felt silly writing (def any? (comp not not some))

22:55 not me, though!

22:56 eggsby: not not me

22:58 tmciver: Ha!

23:09 jtoy: if i use a gui editor, what should i use as a code reload mechanism for the repl?

23:12 aperiodic: (require :reload ...)

23:14 juhu_chapa: what is the difference between (defn f [& arg]) and (def f [& [arg]])

23:14 what is the difference between (defn f [& arg]) and (defn f [& [arg]])

23:16 xeqi: ,((fn [& args] args) 1 2 3)

23:16 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class clojure.lang.RT>

23:16 xeqi: heh

23:16 &((fn [& args] args) 1 2 3)

23:16 lazybot: ⇒ (1 2 3)

23:17 xeqi: &((fn [& [args]] args) 1 2 3)

23:17 lazybot: ⇒ 1

23:20 juhu_chapa: xeqi: i do not understand it yet.

23:21 xeqi: the second one binds [args] to [1 2 3], which binds args to the first element

23:21 in this case, 1

23:21 &((fn [& [arg1 arg2]] [arg1 arg2]) 1 2 3)

23:21 lazybot: ⇒ [1 2]

23:23 tmciver: I'd like to visit each node of a nested map tree data structure and add a key whose value is an integer that is incremented for each node visited. Is there an idiomatic way to do this?

23:26 aperiodic: juhu_chapa: if you're unfamiliar with destructuring syntax, you should read over "http://clojure.org/special_forms#Special Forms--(let [bindings* ] exprs*)"

23:27 juhu_chapa: thanks a lot: xeqi, aperiodic.

23:27 aperiodic: quite welcome

23:31 rhc: if i already know vim well, it is worthwhile to learn emacs for editing clojure coe

23:31 code?

23:32 tmciver: rhc: I'm not a vim user but there are plenty of Clojurians that are and there seems to be plenty of suuport for it. I'd stick with vim.

23:33 rhc: tmciver: ok, thanks, do you use emacs?

23:33 tmciver: rhc: yup

23:33 rhc: I love it but there's definitely a learning curve if you've never used it.

23:33 Zoka: I use jEdit with Clojure plugin

23:33 rhc: whats the repl integration like?

23:35 tmciver: If you use swank it's very good, imo.

23:36 xeqi: rhc: I hear slimv is a good slime/swank for vim

23:37 rhc: interesting, thank you

23:37 aperiodic: rhc: there's a fork of it specifically for clojure at https://bitbucket.org/sjl/slimv/overview

23:38 apwalk: rhc: I'd also try out vim w/ tslime through tmux

23:38 aperiodic: nah, slimv is better

23:39 unless there's parts to tslime i didn't know about

23:39 rhc: aperiodic: ah cool

23:39 im gonna check out one of these screencasts/tutorials

23:39 i feel like i don't even know whats possible :)

23:40 apwalk: aperiodic: it's simple and effective, without quirks, but not emacs. i use it with paredit borrowed from slimv

23:41 aperiodic: apwalk: tslime is just for sending text from vim to other tmux panes, right?

23:41 apwalk: yeah

23:41 aperiodic: rhc: me neither. i didn't even know about slimv until a few days ago, when someone showed me at clojure/west

23:43 apwalk: slimv gives you much more. e.g., there are commands eval current form/defn, eval the whole buffer, look up docs

23:44 s/commands/commands to/

23:44 rhc: so when i'm working with something like C++, i write -> build -> run -> test -> goto 1, but do people in clojure leave the repl open and re-(use) their code as they build up functionality?

23:44 tmciver_: rhc: goto considered harmful!

23:45 rhc: excuse me, (recur) :P

23:45 tmciver_: better! ;)

23:47 rhc: I believe that it's typical to (use :reload ...) your code in the repl unless you're using something special (like swank-clojure).

23:47 daaku: rhc: if nothing else, the slow boot time for jvm/clojure combined makes it worth it to have the repl running

Logging service provided by n01se.net