#clojure log - Feb 09 2014

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

0:32 ivan: I fixed the pygments clojure lexer but now everything looks worse when the specials list only includes specials

0:32 now I have to come up with elaborate rationale for a list of builtin macros to highlight as a pygments Keyword instead of a Name.Builtin

0:34 bindings_and_control_flow = [...]

0:41 dsrx: any way I can use destructuring to bind to the last several elements of a sequence?

0:41 something like [[& _ x y] [1 2 3 4]]

0:41 where i'd like x and y to be bound to 3 and 4

1:01 xuser: dsrx: you can use map destructuring in that case

1:02 dsrx: [{x 2 y 3}

1:02 quizdr: xuser i suppose you mean where 2 and 3 are the index keys, right?

1:02 xuser: [{x 2 y 3} [1 2 3 4]]

1:02 quizdr: yes

1:02 quizdr: but what if you don't know how long the args list is? I suspect that's what dsrx is asking

1:03 in which case i'd think you just get the entire collection as a single binding, and call collection functions to get the last couple elements [& everything]

1:06 xuser: quizdr: yeah, I guess you can pull the values from the collection in the bingding vector

1:16 quizdr: xuser what i mean i don't know if you can actually do what dsrx in the destructuring, you'd have to call functions on your entire passed collection list within the function definition

1:17 although i know destructing can be a deep minilanguage on its own so i might be overlooking an obvious solution

5:26 piranha_: damn, somehow core.async fails me in advanced compilation mode :(

5:51 is the author of sablono here? :)

8:17 voldyman: any recommendations for caching data in a web server?

8:18 mercwithamouth: ok '(blah) vs (list blah) (list ...) evaluates they say. can someone sort of help me out here? i'm not even sure what to ask

8:19 llasram: mercwithamouth: Well, what are you trying to understand?

8:19 d11wtq: mercwithamouth: What's the question? '(blah) is equivalent to (list 'blah), but (list blah) is the list of variable "blah".

8:20 llasram: ,(read-string "'(blah)")

8:20 clojurebot: (quote (blah))

8:20 scottj: ,(let [blah 1] ['(blah) (list blah)])

8:20 clojurebot: [(blah) (1)]

8:21 llasram: haha, too many teachers in the classroom

8:21 d11wtq: ,(= '(blah) (list 'blah))

8:21 clojurebot: true

8:21 mercwithamouth: lol

8:21 overload

8:21 (list ...) allows you toevaluate...but evaluate what?

8:22 ,(count '(1 2 3))

8:22 clojurebot: 3

8:22 mercwithamouth: ,(count (list 1 2 3))

8:22 clojurebot: 3

8:22 d11wtq: mercwithamouth: (list ...) allows you to interpolate variables into lists, effectively.

8:22 llasram: Er

8:22 d11wtq: mercwithamouth: While '(... ) quotes the entire list.

8:22 llasram: I think starting a little earlier might help

8:22 mercwithamouth: ah! ok

8:23 llasram: Code is data. We store the data as strings. The reader translates strings into data.

8:23 mercwithamouth: well i gotcha. i'm reading programming clojure and clojure in action. i'm just going through http://java.ociweb.com/mark/clojure/article.html so i decided to stop and see what they meant

8:23 llasram: ,(read-string "'(blah)")

8:23 clojurebot: (quote (blah))

8:23 llasram: ,(read-string "(list blah)")

8:23 clojurebot: (list blah)

8:23 llasram: The compiler is what turns data into code

8:24 voldyman: mercwithamouth: braveclojure.com explains these things pretty nicely.

8:24 mercwithamouth: voldyman: ahh yeah, i have that site in my bookmarks as well

8:25 voldyman: its what helped me go from 0 - a simple website in a week

8:25 and #clojure is always helpful

8:25 mercwithamouth: i'll go ahead and work my way through it today. i suppose it would help if i didn't jump around

9:32 AeroNotix: Did anyone get JSVC working with Clojure apps? https://github.com/clojure-cookbook/my-daemon/issues/1

9:32 The cookbook claims to have this working, but I can't get it to on my system.

9:33 I can't even get the example project to run? Same error with my personal projects.

9:41 if I `jar -tf $MY_UBERJAR` then it has the class in it!

9:41 huh

9:42 I've tried lein-daemon but for some reason it hangs on my CI server and never starts

9:44 any ideas guys/gals?

9:45 how do you guys daemonize your Clojure applications?

9:48 hyPiRion: AeroNotix: http://www.rkn.io/2014/02/06/clojure-cookbook-daemons/ has a tutorial on that.

9:48 AeroNotix: hyPiRion: please look at the link I posted, I already said I'm following _that_exact_thing_

9:49 I get the same error with the code associated with that blog post and my own projects

9:49 benzap: Is there an article out there outlining the several different clojure web frameworks / methods of deployment?

9:49 I'm having a really hard time finding something I like

9:53 AeroNotix: hyPiRion: could you try running this locally? It takes like 2 minutes to try\

9:57 llasram: AeroNotix: I daemonize Clojure applications by building uberjars then running them under an init system (runit), essentially as with any other language

9:57 hyPiRion: AeroNotix: wish I could, but I'm away from work computer now

9:57 AeroNotix: hyPiRion: ok

10:08 piranha_: dnolen: here by any chance?

10:26 hyPiRion: AeroNotix: perhaps try what llasram suggested instead?

10:26 AeroNotix: What did he say?

10:27 hyPiRion: ^

10:27 hyPiRion: "I daemonize Clojure applications by building uberjars then running them under an init system (runit), essentially as with any other language

10:27 llasram: AeroNotix: Haha, I un-/ignored you, but you have me /ignored ?

10:27 hyPiRion: "

10:28 AeroNotix: llasram: I don't, nor have ever /ignored you

10:28 llasram: Fair enough then

10:28 AeroNotix: llasram: the problem with that is, how to programmatically do it in a sane way with CI?

10:28 I want to run acceptance test suites, essentially just running the jar, then my external test suite, then killing the server.

10:29 At the moment, I hacked together a Python script to spawn the server, then the test suite and then recursively kill the process tree

10:29 due to the jar forking plenty of proceses

10:29 processes

10:29 lein-daemonize worked locally, but failed to start on my jenkins server, and it's annoying to debug. So I looked into other methods

10:29 llasram: I see... Maybe just build the uberjar and spawn that as the service then? Should match what you'd end up doing in production

10:31 technomancy: (inc uberjars+runit)

10:31 lazybot: ⇒ 1

10:31 AeroNotix: llasram: I'd like to get the daemon working since this would also help our ops team with making services

10:31 llasram: heh

10:31 AeroNotix: since it seems to allow arbitrary code execution when stopping/killing services

10:32 llasram: AeroNotix: What init system are you using? I guess I'm not following what differentiates a script launching the JVM w/ an uberjar from a service

10:32 technomancy: self-daemonizing processes usually involve a lot of wheel-reinventing

10:32 AeroNotix: llasram: the fact that it blocks, and needs killing, for a start.

10:32 technomancy: exactly why I want to use apache daemon

10:32 technomancy: AeroNotix: eh; apache just NIH'd it too

10:33 this stuff is a ton simpler if you do it outside your process

10:33 AeroNotix: llasram: in production? Not sure, tbh. The ops team uses Ubuntu, so whatever Ubuntu uses I guess?

10:33 technomancy: that'd be upstart

10:33 clojars uses upstart

10:33 AeroNotix: I'll take your word for it, I don't touch ubuntu

10:33 technomancy: it's not great, but it is simple

10:33 AeroNotix: Why isn't this a solved problem though?

10:33 technomancy: you work for Heroku, what do they use?

10:33 technomancy: hm; I don't see that it isn't

10:34 AeroNotix: an out-of-process daemonization system =)

10:34 https://github.com/ato/clojars-web/blob/master/SYSADMIN.md

10:34 hm; I guess that doesn't give the exact upstart config

10:34 llasram: AeroNotix: upstart works with processes which do not daemonize themselves. In my experience, that model is simpler for everyone

10:34 AeroNotix: the other thing is, I want a solution which can work in isolation, cross platform and on-demand. It's a lot to ask for, I know. Our developers use a mix of MacOSX and Linux, so a pure Java solution would be perfect.

10:35 llasram: development OS != production OS -> madness

10:35 AeroNotix: llasram: don't the majority of developers use MacOSX these days?

10:35 llasram: Especially with all the options (vagrant etc) to make them match

10:35 technomancy: (inc *1)

10:35 lazybot: ⇒ 2

10:35 technomancy: oops race condition

10:36 llasram: haha

10:36 technomancy: AeroNotix: lots of macosecksists just use it as a platform on which to run linux for development

10:36 AeroNotix: technomancy: *this* sounds like madness, as far as I am concerned. But that's for another day.

10:37 Regardless, did anyone try the my-daemon demo app?

10:37 technomancy: you'll never get things to work the same

10:37 llasram: AeroNotix: You can run whatever you want on your development system as the bare-metal OS, but the code you're developing should run in development under the close-as-possible env to what you run in production

10:37 AeroNotix: llasram: I get that. It's a nice idea to strive for.

10:37 vagrant isn't a panacea

10:37 nor is docker

10:38 Running things locally is fine for a whole slew of languages/platforms

10:38 llasram: No, but they're both better than "it works under OS X" :-)

10:38 AeroNotix: llasram: I don't run things on OSX

10:38 My development machine is Linux.

10:38 technomancy: the effort it takes to try to get the exact same version numbers across OSes is an ongoing time suck; getting a production-like env on your laptop is a one-time up-front cost that pays back over time

10:38 llasram: (inc technomancy)

10:39 lazybot: ⇒ 97

10:39 AeroNotix: I'm not arguing with that

10:39 but there are other factors at play here

10:39 namely, political issues regarding getting mac users to put down their shinies

10:39 technomancy: =\

10:40 AeroNotix: I'm introducing clojure at my workspace with a periphery project. I want to make it as seamless as possible

10:40 Lein has gone a long way, especially in contrast with Rebar

10:40 But Erlang comes with releases, which allow the developer to not even realise that application daemonizing is a thing

10:41 so I want to have something which I can literally have "app {start,stop}"

10:41 which Erlang has, and I'm sure is possible in Clojure/JVM land

10:42 hyPiRion: Q: Do people tend to define all records in the same namespace in an application?

10:43 llasram: hyPiRion: Elaborate?

10:43 AeroNotix: technomancy: so how do you guys do CI/testing?

10:43 with Clojure applications

10:43 hyPiRion: llasram: I want to define a couple of records. Should I put them all in the same for namespace? They're essentially just used as structs.

10:43 llasram: AeroNotix: In Turing, all things are possible. I consider what you've described undesirable, and thus have no experience with to suggest options :-)

10:44 AeroNotix: llasram: which aspect is undesireable?

10:44 llasram: AeroNotix: Processes daemonizing themselves

10:44 AeroNotix: llasram: Erlang gives you the option

10:45 technomancy: AeroNotix: when I was using clojure we just used jenkins

10:45 llasram: Sure. And maybe it makes sense for Erlang in historical context. I don't think it's a good way to think about services on current Unix-y distros

10:45 AeroNotix: technomancy: great, we're using Jenkins. Can you give me any more information?

10:46 technomancy: AeroNotix: there wasn't really anything clojure-specific about our setup

10:46 AeroNotix: technomancy: so what did you do for testing e.g. REST endpoints or some other http listener?

10:46 I want to do end-to-end testing

10:46 technomancy: we just had a bin/setup script in the repo that would pull in apt-get dependencies and a bin/ci script that would kick off the CI run

10:46 the system I worked on was an AMQP worker

10:47 llasram: hyPiRion: Ah. I don't use defrecord much... Interesting question

10:47 technomancy: AeroNotix: FWIW the platform independence thing is different on erlang; they have a strong motivation not to rely on anything outside the BEAM VM for reliability reasons which simply arent' present on the JVM

10:47 but I understand that decisions like that can't always be made for technical reasons

10:48 AeroNotix: technomancy: it's part of it, but there's a whole deployment / upgrade philosphy around Erlang where it makes sense. It just doubles as a succinct way to test things.

10:49 technomancy: AeroNotix: but as far as organizing our code, we had a primary entry point as a -main invoked via an uberjar, and then some admin helper namespaces also done as -main defns

10:49 AeroNotix: technomancy: so, did you spawn these processes off and then run tests/

10:49 ?

10:50 technomancy: AeroNotix: oh, no the tests were just `lein test` affairs. we didn't do any fully end-to-end tests

10:50 AeroNotix: technomancy: ok, cool

10:50 https://gist.github.com/AeroNotix/db274b8e6863a412de0a

10:50 I'm using this at the moment

10:51 benzap: Hey guys, i'm trying to include other directories for the ring-server to monitor, and i'm not really certain on the relative path

10:51 does this look correct? http://cljbin.com/paste/52f7a2cbe4b014e0a4429c5e

10:51 I have a folder resources with a template folder, with templates

10:51 and then i'm still referencing my src directory

10:52 i've found that it still works with my handler in the src directory, but modifying my templates don't have any effect

10:58 technomancy: AeroNotix: seems reasonable

11:02 ornicar: hello there!

11:03 I've been trying and googling for long enough now, time to try asking #clojure :P

11:04 I have 2 async channels, I want to wait and do something when both chans have outputed a message.

11:04 I've been trying merge, but it gives me only the first message sent by the channel that completes the faster

11:04 (<! (merge chan-a chan-b)) ; I get the message of whatever chan outputs first

11:05 what I want is:

11:05 (let [[a b] (<! (??? [chan-a chan-b]))

11:06 where ??? is the function I'm looking for.

11:06 does it make sense?

11:15 llasram: ornicar: Don't you just want (let [a (<! chan-a), b (<! chan-b)] ...)

11:16 ornicar: I don't know which one will return first.

11:16 does it matter?

11:17 AeroNotix: TIL you can merge channels

11:17 llasram: Oh, I guess it could, because of fixed-size queues

11:17 I haven't actually used core.async yet, so can comment no further :-)

11:18 AeroNotix: ornicar: alts?

11:19 ornicar: no, alts! behaves like merge in this case

11:20 AeroNotix: do you need to know which channel the message came from?

11:20 llasram: But doesn't alts! let you know the channel? Then you just wait on the other one

11:20 ornicar: afaik, (<! (merge [a b])) is similar to (alts! [a b])

11:20 except, yes, you know the chan

11:21 well I can hack my way around, but I wanted to know if there was a standard solution to this, imo, common problem: parallelism.

11:21 clojurebot: Pardon?

11:48 tpope: bbloom: is it just (comment ...) stuff tripping you up?

11:48 bbloom: tpope: yeah, getting used to it a bit, but as you know, it's hard to retrain your fingers :-)

11:49 tpope: also my workflow has changed a bit over time

11:50 tpope: i used to re-eval individual defs a bunch, but now i just cpr the whole file

11:50 tpope: my workflow used to involve re-evaling top-levels a lot back when i used tmux hackery to emulate real repl integration, but when you released foreplay, i no longer had to do that

11:51 tpope: since then, i've basically stopped evaluating top levels, since cpr is so easy to do

11:53 the only time i really have to eval a top level form is if i'm changing a definition in namespace with deftypes or defprotocols other than the namespace i'm currently working on

12:13 ambrosebs: for those core.typed + vim users out there https://github.com/typedclojure/vim-typedclojure

13:33 bacon1989: Hello, i've been trying to get a simple development server running clojure for a while now, and i'm having a hard time getting some more advanced functionality working

13:33 I tried following this example http://stackoverflow.com/questions/1665760/compojure-development-without-web-server-restarts

13:33 and made a few changes into this http://cljbin.com/paste/52f7c8b4e4b0f2c6653e9f1d

13:34 i'm able to get the web-server running just fine, but the wrap-reload line doesn't seem to be working

13:34 i've even been running the server within the repl, which means the evaluating certain things, like the main-routes, should have changed the web-server's main-routes variable, no?

13:36 technomancy: ambrosebs: have you seen https://github.com/technomancy/nrepl-discover ?

13:37 I would like to see more tooling like that happen in an editor-agnostic way

13:39 bacon1989: Has no one here ever set up a clojure web server?

13:40 technomancy: bacon1989: if it's not picking up reloads then probably you need to pass a var to run-jetty instead of a function

13:40 (just a guess; that's the common mistake)

13:42 bacon1989: so I should change my defn app to an def app, etc?

13:43 technomancy: bacon1989: yeah, and do (run-jetty #'app ...)

13:44 bacon1989: technomancy: oh nice, that did the trick

13:44 technomancy: vars are great

13:44 bartxx: Maybe this time I'll have more luck (sory for asking same question 3rd time): is there any way to extract and save (to file for example) state of core async's "go" state machine?

13:44 bacon1989: that's interesting, I wonder if I should respond to that stack overflow article, and update it

13:58 clojuredood: hey guys.. just wondering what a concise way is to check if string starts with any one of a collection of substrings ?

14:08 I suppose I'm basically hoping I can supply a set to a 'startsWith' alike function

14:08 any ideas ?

14:09 fowlslegs: clojuredood: are the substrings of variable length?

14:09 clojuredood: yes

14:10 is regex the best way to go instead ?

14:10 systemfault: some + startsWith (I'm a noob so don't trust me)

14:10 clojuredood: systemfault: I don't understand that sorry

14:11 systemfault: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/some + String.startsWith ?

14:12 fowlslegs: Maybe something like this

14:12 Actually hold on

14:12 clojuredood: systemfault: I begin to see thanks

14:13 sdegutis: Do you have to manually convert a clojure.lang.PersistentVector into a System.Collections.Generic.IEnumerable?

14:14 I thought since the first is concrete and the second is an interface, it wouldn't need a conversion.

14:14 But then I see: Unable to cast object of type 'clojure.lang.PersistentVector' to type 'System.Collections.Generic.IEnumerable`1[System.String]'.

14:22 fowlslegs: )

14:23 (for [x (range 1 longest prefix)] (if #(some (apply str (take x "string")) prefixlist) (apply str (take x "string"))))

14:23 ^clojuredood

14:23 clojuredood: fowlslegs: thanks! I will take a look now

14:26 pyrtsa: fowlslegs: What was that supposed to do? o_O

14:29 fowlslegs: (def stringlist '("p" "f" "li" "far"))

14:30 logic_prog: I thought I was going to get some work done today. Then, I stumble across http://www.youtube.com/watch?v=Y8gttn9xmtA

14:30 fowlslegs: (def stringlist '("p" "f" "li" "far"))

14:30 (for [x (range 1 4)] (let [prefix (apply str (take x "fargo"))] (if (some #(= prefix %) stringlist) prefix)))

14:30 clojuredood pyrtsa ^^

14:30 pyrtsa: To find which prefix matched?

14:31 fowlslegs: Yeah

14:31 clojuredood asked for a simple way. I am pretty new to Cloj, but that's what seemed most simple to me.

14:31 pyrtsa: ,(first (filter #(.startsWith "fargo" %) '("p" "f" "li" "far")))

14:31 clojurebot: "f"

14:32 clojuredood: folwslegs: you've given me a boost... gave me some ideas... I've got as far as : (some #(if (.startsWith some-string %) true false) prefixes)

14:32 seems to be working so far

14:32 thanks!

14:33 fowlslegs: I wonder if that java function is performing the same comparisons as my fn.

14:33 pyrtsa: clojuredood: The (if ... true false) is redundant though. Just do #(.startsWith ...) there.

14:33 clojuredood: pyrtsa: awesome, another refinement

14:34 pyrtsa: ,(some #(.startsWith "fargo" %) '("p" "f" "li" "far"))

14:34 clojurebot: true

14:36 clojuredood: lol, clojure is just awesome

14:36 fowlslegs: My fn ran in .33ms vs .11ms for pyrtsa

14:36 pyrtsa: If the list of substrings is a compile-time constant, you can just use e.g. ##(re-find #"^(?:p|f|li|far)" "fargo")

14:36 lazybot: ⇒ "f"

14:36 clojuredood: thanks guys

14:46 fowlslegs: pyrtsa: I'm new to regex. Would you enlighten me as to how to alter the above function s.t. "f" and "far" are returned.

14:49 pyrtsa: fowlslegs: Doesn't sound like a problem that you'd tackle with (one) regex anymore.

14:49 fowlslegs: Yeah I thought that too and was trying to figure out the re-find/re-matcher relationship.

14:50 pyrtsa: fowlslegs: ##(keep #(re-find % "fargo") [#"^p" #"^f" #"^li" #"^far"])

14:50 lazybot: ⇒ ("f" "far")

14:53 fowlslegs: So in the original ^ means "starts with" and x|y means "find x or y", but why the ?:

14:53 pyrtsa: The regex part of clojure.core is a bit limited, by the way. It doesn't expose a way of finding *where* the pattern matched in the string, only *whether* and *what* it matched.

14:54 fowlslegs: The (?: ... ) is a non-capturing block.

14:54 If you omit the ?:, it turns into a capturing one, and -- somewhat surprisingly -- re-find starts to return vectors instead of strings.

14:55 fowlslegs: Yeah I noticed.

14:55 pyrtsa: Vectors containing both the whole match as well as the captured blocks (one or many).

14:55 I don't think it's the prettiest API design, but it's pretty common practice in many dynamic languages.

14:56 fowlslegs: I don't see anything about non-capturing blocks on the oracle regex doc http://docs.oracle.com/javase/tutorial/essential/regex/index.html

14:56 maybe I just skipped over it.

14:56 pyrtsa: fowlslegs: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

14:56 "(?:X) -- X, as a non-capturing group"

14:57 fowlslegs: pyrtsa gratsi

15:54 steckerhalter: if I fetch some content from url and store that in a variable (I will update it from time to time), what should I use? atom/ref/..

15:55 llasram: steckerhalter: Depends on the update model, but it sounds like an agent could be appropriate

16:09 steckerhalter: llasram: ok, I'll try that, thanks

16:09 akyte`: Can clojure/android handle intents without issue?

16:50 Krajsnick: Is it possible getting code completion for Clojure and imported deps within Vim?

17:49 seangrove: I have a bunch of :style attributes I need to modify in an emacs buffer. I wrote a clojure function that does what I want for each individual one. I then recorded an emacs macro that finds the next :style attribute, cuts it, switches to the clojure repl, transforms it into the desired for, then copies the new form back into the original location

17:50 The problem is, it always fails on copying the result from the repl. I think ti could be a race condition, where the macro step to copy the resultant form runs before the repl can return, so it copies the wrong thing. Any tips on how to do this in a cleaner way?

17:53 llasram: seangrove: The communication between emacs and the nrepl server is async, so that's almost certainly what's happening. I don't have any good ideas on how to fix w/o just writing some elisp to call into the nrepl server yourself though

17:54 seangrove: llasram: Yeah, I'm not clear on how to do that either. Probably a good idea long term to figure it out though. Any idea if it's clean/simple enough?

17:54 Maybe I should just write the function in elisp

17:55 llasram: The functions looked straightforward when I've poked around, but I haven't actually tried to do anything like what you're describing myself

18:18 seangrove: llasram: The hack for today is just M-: (sleep-for 0.25)

18:32 greghendershott: Is HEAD wonky? I pushed a commit that only fails HEAD (not 4 other vers inc 5.92): https://travis-ci.org/greghendershott/rackjure/builds/18548966

18:33 and fails it with SIGSEGV MAPERR https://travis-ci.org/greghendershott/rackjure/jobs/18548971 O_o

18:34 ... and I'm on the wrong channel ... sorry!

18:34 gfredericks: clojurebot: HEAD is wonky

18:34 clojurebot: Ok.

19:11 scape_: how could i merge a smaller byte array into a larger? or should I do this sequentially with aset-byte?

19:16 hyPiRion: scape_: System/arraycopy perhaps?

19:16 benkay: a test fixtures question: i'd like to spin up a tcp server in the setup phase of my fixture, and tear it down in the teardown phase. to stop this tcp server (aleph) I need to call the function returned when I start the tcp server. would it be idiomatic to (def stop-server (tcp-server {blablabla})) in the setup phase and then (stop-server) in the teardown phase?

19:22 scape_: ill take a look thx hyPiRion

19:25 benkay: it's somewhat familiar in other frameworks to do that-- I personally don't like it, it'd make more sense to receive some server object/map that you'd pass to a stop-server function. which is how I modeled my tcp server (not using aleph)

23:10 tolstoy: dnolen: Do we need to do something extra to get onMouseOver and so on to work in OM?

23:12 dnolen: Hm. Maybe somehow get the react-with-addons....

23:15 Oh, alas: https://github.com/swannodette/om/issues/59 (22 days ago)

23:32 ambrosebs: technomancy: not aware of nrepl-discover

23:32 technomancy: love the idea. I'm going to have to reimplement this functionality many times I bet.

23:33 amalloy: benkay: why would you def it rather than just letting it? setup and teardown happen in the same lexical scope for test fixtures

23:35 benkay: so (let [thinger (stuffs)] ... (thinger))

23:35 ?

23:36 amalloy: indeed

23:36 benkay: (defn my-fxt [fn] (let [close-server (open-server)] (fn) (close-server)))

23:38 yeah that makes a great deal of sense. i think i was assuming that the let'd be the setup phase, and that I'd have to close the let in the setup phase and lose access to the bindings declared therein.

23:38 thanks amalloy!

23:47 frozenlo`: Is there a `distinct' fn that's like `filter'? (distinct my-fn [coll])

23:48 amalloy: nothing built in, Frozenlock, but of course you can implement distinct-by pretty easily

23:51 Frozenlock: amalloy: ok, thanks

23:54 srruby: Which jdk do you recommend? My server runds debian wheezy. Thanks, John

Logging service provided by n01se.net