#clojure log - Nov 11 2011

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

0:15 leo2007: how does `lein run' work?

0:18 technomancy: leo2007: it finds the given -main function and applies it to the arglist you supply

0:18 leo2007: technomancy: thanks.

0:21 technomancy: sure

0:25 cemerick: it was only a matter of time, I guess: https://twitter.com/#!/fakerichhickey

0:27 leo2007: technomancy: what happens when `lein swank'?

0:28 bhenry: leo2007: lein help swank

0:29 leo2007: I want to know how it is done?

0:29 because I might need to tweak it.

0:30 for example, I want it to start a http server too.

0:35 bhenry: leo2007: https://github.com/technomancy/swank-clojure/blob/1.3.x/src/leiningen/swank.clj

0:38 leo2007: bhenry: thanks

0:57 technomancy: How can I teach lein swank to also starts a http server? I am on a noir project.

0:57 tensorpudding: i think that is what lein-noir does

0:57 not sure

0:58 technomancy: leo2007: typically what's done is to just launch the swank server, then go into your server.clj file and run (future (-main)) in the repl

0:58 you may be able to automate it to run when the swank server launches though; lemme see

0:58 leo2007: technomancy: thanks.

0:59 technomancy: if you put :repl-init-script "launch.clj" in project.clj and have launch.clj contain (require 'myapp.server) (myapp.server/-main) that might do it

1:00 leo2007: is :repl-init-script deprecated?

1:00 technomancy: hm... it may be; I think :repl-init is preferred

1:00 leo2007: I used :repl-init to load the server namespace.

1:00 technomancy: yeah, that will load the code but not call the -main function for you

1:02 leo2007: Then, is it normal to call -main in server.clj?

1:03 technomancy: it's typically avoided since it's nice to be able to load a file like that without having any side-effects

1:04 but this is a good use case arguing in the opposite direction

1:04 hmmm

1:04 leo2007: technomancy: or if :repl-inti can accept a form to eval

1:05 technomancy: yeah, that would work too

1:05 duck1123: I prefer to have my -main launch both the http and swank servers. That way lein run gives me everything I need

1:05 technomancy: I could probably come up with a better solution except it's nearly 1am here

1:06 duck1123: yeah, that is especially nice if you're using swank in production

1:06 then you can just use lein run

1:07 leo2007: ok, for now I will use the second method.

1:07 duck1123: It's also nice because then all my namespaces are required and ready for C-c M-p

1:08 leo2007: some people put the dependency as [swank-clojure "1.4.0-SNAPSHOT"] some as [org.clojure/swank-clojure "1.4.0-SNAPSHOT"]

1:08 what are the differences?

1:08 duck1123: the first is right

1:08 cemerick: there's an org.clojure/swank-clojure?!

1:09 duck1123: cemerick: probably in someone's local repository

1:10 leo2007: how to find out the group-id?

1:10 duck1123: see sample.project.clj

1:10 duck1123: swank-clojure is the same as swank-clojure/swank-clojure

1:11 leo2007: what is group-id?

1:11 technomancy: cemerick: I accidentally squatted on org.clojure when clojars first launched

1:13 cemerick: these things happen ;-)

1:13 technomancy: especially in a mosh pit

1:14 duck1123: It would probably make sense to go through and update the example dependencies to the latest stable-ish versions

1:15 leo2007: technomancy: why isn't swank-clojure defaults to clojure 1.3.0?

1:16 technomancy: leo2007: clojure 1.3.0 didn't exist when swank was released

1:16 duck1123: leo2007: if you want 1.3, do lein swank in the context of a project with 1.3 declared

1:17 leo2007: ok

1:17 just curious.

1:17 duck1123: outside of a project, lein swank is going to use whatever lein is using

1:18 as a side note, be careful of dev dependencies that want to use 1.3

1:21 leo2007: duck1123: thanks

1:25 another annoyance is that defproject is available? this makes it difficult to see its doc-string while tweaking.

1:27 duck1123: I'm not sure I understand what you mean

1:30 leo2007: for example, I launch the swank server, connect to it and defproject is not available.

1:31 duck1123: is it when you start swank outside of a project?

1:32 I suppose I modify the project so infrequently, and then in such common ways that that has never bothered me

1:33 the swank server runs with the project's code with the projects clojure, so the class path doesn't include leiningen or it's dependencies

1:34 leo2007: duck1123: I can live with it.

1:35 Can http://clojuredocs.org/ produce documentation in info format for use in emacs?

1:37 duck1123: It's not quite the same, but you can C-c C-d C-d on a var to get it's docs

1:43 leo2007: alright.

2:48 duck1123: do you use fuzzy completion in slime?

2:54 which seems broken for me.

3:40 Blkt: good morning everyone

4:15 clgv: hmm I cant view Chris Houser's slides (svg) with a normal image viewer. thats weird. what program are they supposed to be viewed with? can't we have them as pdf?

4:18 exporting them as pdf via inkscape doesnt work :/

4:21 ok firefox works when opening it manually

4:29 aperiodic: question: is it possible to find the "cycle" fn using lazybot's findfn?

4:30 how do i specify i want my output to be infinite and lazy?

4:32 jli: aperiodic: use lazy-seq. as for infinite, well, that depends on how you write your function.

4:32 tomoj: it's not possible

4:36 aperiodic: jli: not how to write such a function, how to find one that has those properties using lazybot

4:37 tomoj: how would you specify the desired infinite seq? and if you could, how could lazybot check for equality?

4:37 jli: aperiodic: you could look at functions in clojure.core that return infinite sequences: repeat, repeatedly, iterate

4:37 cycle

4:38 range

4:38 aperiodic: tomoj: yeah, you're right. i guess it would take some sort of metadata on the fn

4:38 tomoj: if it were more sophisticated maybe you could ask it to find a function such that (take 10) of the result is equal to some literal coll

4:39 aperiodic: yeah, that's how i test it in the repl

4:39 it's not a huge deal, i was just curious

4:41 or if you could comp the fns that are being searched?

4:42 that wouldn't be too hard to do, and would probably have other benefits besides

4:44 Borkdude: How are the neat clean slides at clojure_conj being made?\

4:46 clgv: Borkdude: you may find out when you have a look at the properties view of your pdf reader- Stuart Sierra used Keynote it seems

4:49 Borkdude: ah right, keynote

4:49 I'm messing around now with the beamer package and latex

4:50 clgv: Borkdude: I often user latex+beamer as well

4:50 *use

4:51 Borkdude: clgv: what do you use for code highlighting?

4:51 clgv: Borkdude: I didn't do any code related talks.

4:53 Borkdude: I use minted for it, it works quite well (also for Clojure)

4:53 clgv: gotta look that up

4:55 Borkdude: the output looks nice. whats your experience with it?

4:56 Borkdude: I have started to use it in normal documents and slides

4:56 works better than the other listings package I think

4:57 I mean, it has better highlighting, but it might be less stable, haven't run into any issues though

4:58 clgv: ah, it's working with the -shell-escape option to call pygments

4:58 Borkdude: clgv: yes

5:09 clgv: Borkdude: I'll keep that one in mind.

5:10 tsdh: technomancy: Would you mind adding slime-complete-symbol to completion-at-point-functions in clojure-mode if that's bound? Then TAB completes if indentation is already correct if tab-always-indent is set to 'complete, exactly like in emacs-lisp-mode.

5:48 algal: Speaking of clojure-mode keybindings, it's currently violating the emacs guidelines by binding (kbd "C-c t") to clojure-jump-test. Since C-c [key] is expressly reserved for the user. But such is life… SLIME is also an offender there.

5:48 nybbles: hello, does anyone know where i can find an up-to-date video or resource for setting up my clojure dev env so i get useful stack traces?

5:49 on emacs.. with slime repl and leiningen and all that stuff

5:49 i mean i have slime and leiningen already installed :)

5:49 algal: nybbles: Our own technomancy had a shout-out for something called clj-stacktrace ( http://technomancy.us/154 ), but that's all I know about it.

5:52 nybbles: algal: thanks! hopefully i can find what i need there

5:52 algal: np

6:01 nybbles: so it looks like clj-stacktrace only works from lein repl.. does anyone know how to get it working in the slime repl?

6:01 i.e. if i connect to a server started with lein swank

7:26 lnostdal: isn't deftype something isa? can work with?

7:26 or, i mean, i have a deftype that implements several protocols .. "is" not that deftype one of those protocols?

7:26 any one*

7:44 tsdh: lnostdal: Yes, isa? should work with deftypes.

7:44 lnostdal: ok, what about protocols? .. is it possible to determine what protocols something implements?`

7:49 tsdh: lnostdal: Oh wait, I was wrong. (isa? MyTypeExtendingMyProt MyProt) actually returns false

7:49 lnostdal: It works for interfaces, though.

7:56 babilen: lnostdal: Are you looking for extends?

8:01 raek: there is also 'satisfies?'

8:02 ,(class Runnable)

8:02 clojurebot: java.lang.Class

8:02 raek: ,(defprotocol Foo)

8:02 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

8:03 raek: anyway: (class Foo) => clojure.lang.PersistentArrayMap

8:03 Foo doesn't evaluate to a class

8:04 lnostdal: anyway, you want to use satisfies? to check whether you can call the protocol methods on an instance

8:08 technomancy: nybbles: getting clj-stacktrace in slime would mean hacking up swank-clojure, which nobody's done yet.

8:09 tsdh: good call

8:12 Borkdude: I have a project structure like this: src/twitter-utils/core.clj and test/twitter-utils/{core.clj,fixtures.clj}.I am interactively running through the tests from core.clj, which is requiring fixtures.clj, but it complains it cannot find it.

8:13 I'm using lein swank

8:13 and emacs with slime-connect

8:14 I'm sorry, the test dir is test/twitter-utils/test/...

8:16 I'm getting: Could not locate twitter_utils/test/fixtures__init.class or twitter_utils/test/fixtures.clj on classpath:

8:16

8:17 clgv: Borkdude: try prepending "test."

8:18 raek: Borkdude: where the namespace name has a - in it, the corresponding file path should have a _

8:19 Borkdude: rename the twitter-urils/ directory to twitter_utils/

8:21 Borkdude: raek: it is already named thusly

8:21 also the test dir is on the classpath and the core.clj can be found properly

8:21 only fixtures.clj which is on the same level cannot be found somehow

8:22 I hope it's not smth stupid like a typo

8:22 raek: what does the require form look like?

8:24 (:require twitter-utils.test.fixtures) ?

8:25 Borkdude: also, did you create the test directory _after_ you started the clojure instance?

8:25 Borkdude: raek: https://gist.github.com/1357979

8:26 raek: no, the directory was already there and I have restarted lein swank just to be sure

8:28 raek: and the path to the fixture file is "test/twitter_utils/test/fixtures.clj"?

8:29 Borkdude: What the hell, I'm sorry... it's fixed. Smth stupid like I assumed.

8:41 tsdh: technomancy: thx

9:44 TimMc: Borkdude: What was the problem?

9:44 I mean, the solution.

9:57 Borkdude: TimMc: too embarrasing

9:57 TimMc: Then how will anyone else learn from your mistake?

9:57 Borkdude: Is it possible in Midje to see the actual value instead of just true or false from a fact, when using some provided clausules?\

9:57 TimMc: ok, but don't laugh

9:58 TimMc: I've made so many stupid mistakes with build systems, I can guarantee this isn't worse.

9:58 Borkdude: TimMc: I guarantee this one is worse

9:58 TimMc: ok

9:58 wrong machine?

9:58 Borkdude: TimMc: I forgot to save the emacs buffer to an actual file on disk...

9:58 TimMc: Oh man, happens to me all the time.

9:59 Borkdude: Really? What a relief ;)

10:01 TimMc: Borkdude: I've been in the wrong directory, or haven't *exported* the shell variables I set, or not pulled down the latest source...

10:02 clgv: is there any way to tell if a java class is a defrecord?

10:02 TimMc: Real examples from the past two months.

10:04 clgv: Nothing official I think.

10:06 clgv: the kryo serialization gets an hiccup with it, since it implements IMap but does not support put

10:09 TimMc: #{clojure.lang.ILookup java.lang.Object java.io.Serializable clojure.lang.IPersistentCollection clojure.lang.IPersistentMap clojure.lang.IMeta clojure.lang.Counted java.util.Map java.lang.Iterable clojure.lang.Seqable clojure.lang.IObj clojure.lang.IKeywordLookup clojure.lang.Associative}

10:09 (Used ancestors on a defrecord.)

10:11 clgv: well, then you could say if it is a Map & IPersistentMap & IObj but non of the clojure maps then it is a defrecord

10:16 TimMc: Most likely, but not for sure.

10:16 clgv: hmm, I'll have to handle that differently :/

10:16 TimMc: You can tell it is a Clojure object of some sort, of course.

10:16 clgv: What's the serialization problem?

10:17 clgv: by default it tries to call .put on a defrecord

10:23 algal_: Hello, Clojurians. Has anyone here had good/bad experiences trying to use Clojure + Google App Engine + Vaadin?

10:23 I can see there's an old github project for this ( https://github.com/tlipski/appengine-magic-vaadin ) but it seems little-followed and a bit out of date.

10:27 biallym: I can't seem to find any information on using native libraries, let alone packaging them (specifically JOGL, the rencent ones, not the ones on java.net)

10:27 Raynes: $karma amalloy

10:27 biallym: Any pointers?

10:27 lazybot: amalloy has karma 19.

10:28 clgv: $karma Raynes

10:28 lazybot: Raynes has karma 7.

10:31 tensorpudding: what's a native library?

10:32 TimMc: (inc Raynes)

10:32 lazybot: ⇒ 8

10:33 TimMc: (dec lazybot)

10:33 lazybot: ⇒ 1

10:33 clgv: tensorpudding: a binary library e.g. compiled from c/c++ which can be used via JNI

10:33 TimMc: (catching up)

10:33 clgv: (inc Raynes)

10:33 lazybot: ⇒ 9

10:33 clgv: (dec TimMc)

10:33 lazybot: ⇒ 3

10:33 clgv: ;)

10:33 TimMc: haha

10:33 clgv: Why does it try to call put?

10:33 deserialization?

10:34 tensorpudding: oh

10:34 clgv: yes. I do investigate what information a custom serializer gets right now

10:34 TimMc: clgv: How does it handle Java's unmodifiable maps?

10:35 clgv: TimMc: whats their name?

10:35 TimMc: clgv: Dunno. http://download.oracle.com/javase/1.4.2/docs/api/java/util/Collections.html#unmodifiableMap%28java.util.Map%29

10:36 clgv: Maybe the answer is to have Clojure defrecords do their own serialization.

10:36 clgv: reading the javadoc of Map I guess not welol ;)

10:38 gfredericks: karma's back up?

10:39 * gfredericks just arrived

10:40 TimMc: $karma gfrederick s

10:40 lazybot: gfrederick s has karma 0.

10:40 TimMc: urgh

10:40 biallym: I have the native libraries in the structure described by some of the blog posts about the native-deps plugin (which I can't seem to get working). I just don't know who to package it >.>

10:40 TimMc: I meant to put the zwnbsp in there, not the nbsp.

10:40 gfredericks: $karma gfredericks

10:40 lazybot: gfredericks has karma 4.

10:41 gfredericks: oh nice

10:41 (inc Raynes)

10:41 lazybot: ⇒ 10

10:41 gfredericks: TimMc: you're a terrible person.

10:42 clgv: it's so silent in the conj channel. nothing interesting happening over there?

10:42 biallym: (I also come from a lisp background not a Java background so I'm learning as I go

10:42 bhenry: clgv the internet sucks at the conj

10:43 lucian: biallym: if you want GL, lwjgl is a one-stop shop

10:43 raek: biallym: I think support for native-deps is included in leiningen nowadays

10:43 lucian: biallym: if you're interested in a C FFI, the easy one is JNA. JNI is the code-generation-sucky one

10:45 biallym: lucian: lwjgl doesn't provide all the functions I want to use. jogl has a much more up to date set of bindings, closer to what I want

10:45 TimMc: gfredericks: This is true.

10:45 lucian: biallym: right

10:46 biallym: raek: oh well that would explain some things >.>

10:46 lucian: biallym: i wasn't sure if you wanted to write a binding or just use one

10:46 biallym: lucian: I want to use a binding that doesn't assume I only want to do basic operations

10:48 lucian: biallym: if you want to change JOGL or lwjgl, you'll have to much about with Java and w/e they generate for the other JNI side

10:49 biallym: lucian: I don't want to change them I just want to package them >.>

10:50 and my attempts so far have failed miserably

10:50 lucian: i see

10:50 they're hard to package in general, even without clojure

10:50 * lucian has more experience with java than clojure

10:53 biallym: I was under the impression I could just use the java ones and arange them into a package that is easier to use as a dependency

10:53 lucian: you should be able to, yes

10:54 * technomancy is about to do a leiningen release; if you know of any open issues that should be fixed before it goes out please speak up

10:57 andrewclegg: yo. what's the idiomatic way to get just the nth item in a sequence?

10:57 TimMc: nth

10:57 andrewclegg: oh :-)

10:58 TimMc: :-)

10:58 andrewclegg: thanks

11:08 babilen: technomancy: Include the up-to-date version of lein-pkg ... In particular the one that fixes #647632 (with clojure-contrib in SHARE_JARS (for plugins)

11:08 technomancy: babilen: oh, good point

11:09 TimMc: technomancy: You said that you're waiting until lein 2.0 to default to 1.3?

11:09 (in project.clj files)

11:09 technomancy: TimMc: I actually went ahead and bumped it already.

11:09 TimMc: haha, OK

11:10 clgv: TimMc: custom serialization with reflection did the trick :)

11:10 TimMc: DOes that mean that lein repl outside a project will be 1.3?

11:10 technomancy: TimMc: oh, sorry; I meant for new project.clj files

11:10 TimMc: OK, but not the vanilla repl?

11:10 technomancy: right

11:11 TimMc: got it

11:11 babilen: technomancy: http://paste.debian.net/144832/ is what will be shipped in the next upload (once Daigo gets around to upload it) -- Are there other differences to your lein-pkg than clojure-contrib?

11:12 technomancy: babilen: I'll need to check to make sure all my bin/lein changes that are relevant get ported

11:12 babilen: technomancy: yeah, we should synchronise that :-/

11:16 technomancy: babilen: it shouldn't be too bad

11:17 TimMc: technomancy: Is the repl/new project version difference on purpose, or is it just that you bumped one and not the other?

11:17 technomancy: TimMc: I can't upgrade Leiningen's Clojure version without breaking tons of existing plugins.

11:18 lots of plugins use monolithic contrib

11:18 TimMc: Ah, the project-less repl is run from lein's own JVM?

11:18 technomancy: yeah

11:18 TimMc: maybe it should run from a special "singleton" porject

11:18 technomancy: or you could create a singleton project

11:18 TimMc: or maybe I should drop a project.clj in my ~

11:19 technomancy: running in lein's JVM is significantly faster to start

11:19 TimMc: hmm

11:19 Because then only one JVM has to start?

11:19 technomancy: yup

11:33 babilen: pushed changes to bin/lein-pkg

11:42 babilen: technomancy: Looks good

11:43 technomancy: babilen: I'll try to do a few tests on my sid vm before tagging the release

12:22 * dpritchett is flabbergasted http://wiki.scratch.mit.edu/images/Range_1.png

12:24 ibdknox: those have been around for a long time

12:25 biallym_: Warcraft 3 had a cool editor kinda like that

12:25 made it really easy to make custom games in it

12:25 ibdknox: lego mindstorms had a similar interface as well

12:26 biallym_: We also use that language specifically in our "Cool stuff about CS class"

12:26 ibdknox: though there were many attempts to build real structured editors over the years

12:26 for general purpose programming

12:26 technomancy: dpritchett: see also http://www.istartedsomething.com/wp-content/uploads/2009/07/kodu6.jpg

12:26 ibdknox: none of them were very successful

12:26 dpritchett: i love the idea of scratch, i was just disheartened by the manual list iteration

12:27 is that something a 9 year old needs to worry about?

12:27 ibdknox: haha

12:27 yeah

12:27 biallym_: I would say warcraft 3's was successful

12:27 ibdknox: biallym_: sorry, I meant general purpose ones

12:27 dpritchett: My daughter is 4.5 and I've been wondering how/if to teach her these things. I don't necesarily want her to grow up to be a dev like me but I think she could at least stand to learn logic.

12:28 licenser: ibdknox: have you had experience with the closure GUI elements and cljs?

12:28 biallym_: Yea I know what you meant, just saying, in certain circumstances they have been

12:28 ibdknox: licenser: no, I've never liked components

12:28 biallym_: I have no doubt, I suspect in the right domains they're really awesome :D

12:29 biallym_: I think seesaw is an exccellent idiomatic clojure gui library if you were looking for one

12:29 licenser: so self coding everything?

12:29 biallym_: yea warcraft 3 also let you put in arbitrary ECMA script

12:29 at any point

12:29 ibdknox: licenser: for designed websites, that's all you can do :)

12:29 biallym_: if it had the idea of a macro it would have been even cooler

12:30 licenser: ibdknox: heh

12:32 mjwhitt: dpritchett: I think there are multiple aspects to getting kids interested in programming, logic is good, being comfortable using computers, and the understanding that a computer is a tool that you can control... then you need inspiration - ideas of what you want to make it do for you

12:32 gtrak``: when I was 8, I drew a bunch of concentric circles in qbasic and was fascinated by the moire effect, started by looking at the gorilla.bas and nibbles.bas code

12:32 dpritchett: I'm also not sure what the right age to expose her to these things might be. She can't quite read yet and she is doing single-digit addition, I don't exactly want to toss programming at her just yet.

12:32 duck1123: I got my son playing around with irb as a way to play with math and numbers. I figured I could go from there

12:33 dpritchett: She does have a little solar calculator that she likes, and we did a "typing in pico" session once just for fun.

12:33 technomancy: I let my son type in full-screen Emacs because there's nothing for him to click on to accidentally close it or mess it up.

12:34 mjwhitt: yeah, actually programming comes later... but you can lay the foundation for it earlier

12:35 gfredericks: my son puts everything in his mouth and soils his diapers.

12:35 dpritchett: She has a neat Rube Goldberg style game on the iPad, it's sort of like The Incredible Machine. This one's called "casey's contraptions" or something.

12:35 ibdknox: the incredible machine was so awesome

12:35 dpritchett: I like to think that will help her with cause and effect, physics, and construction. Maybe I should just get some building blocks instead.

12:35 mjwhitt: when I was a kid, learning math, my dad showed me bit by bit how binary worked, and I really enjoyed it

12:36 I liked encoding secret messages in different bases

12:36 I felt like a top secret spy, haha

12:36 gfredericks: your son might be a bit young still ;)

12:37 gfredericks: mjwhitt: I successfully resisted trying to tie my previous comment in to emacs somehow.

12:37 mjwhitt: hehe

12:37 duck1123: gfredericks: if you are on linux, check out GCompris. There are a couple really easy games for the really little ones. (hit the keys, move the mouse, etc.)

12:38 mjwhitt: mm, off to bbq lunch

12:38 gfredericks: duck1123: he still doesn't have enough precision to keep hold of an object for very long, but I suppose that will be relevant sooner than later

12:39 tensorpudding: how do i get bignums?

12:39 TimMc: tensorpudding: +', *', etc.

12:39 tensorpudding: Or do you mean literals?

12:40 gfredericks: &(type 123N)

12:40 lazybot: ⇒ clojure.lang.BigInt

12:40 TimMc: ,(class 42N)

12:40 bah

12:40 clojurebot: clojure.lang.BigInt

12:40 duck1123: ,(map class [1N 1M])

12:40 clojurebot: (clojure.lang.BigInt java.math.BigDecimal)

12:40 tensorpudding: okay, N was what i want

12:40 gfredericks: isn't there a syntax for BigInteger as well?

12:40 ,(prn (new BigInteger "239"))

12:40 clojurebot: 239

12:40 gfredericks: hrm

12:40 TimMc: gfredericks: c.l.BigInt replaces j.m.BigInteger

12:40 tensorpudding: is there docs for literals somewhere

12:41 TimMc: tensorpudding: the reader

12:41 clojure.org/reader I think

12:41 gfredericks: TimMc: it doesn't do everything though...

12:41 tensorpudding: i thought that only documented the other reader macros

12:41 ' ` ~ @ ~@ etc.

12:41 TimMc: tensorpudding: It is *supposed* to document all the syntax.

12:42 but it is not complete.

12:42 tensorpudding: it just refers to Integer.parseInt()

12:42 it mentions M for making BigDecimals i guess

12:43 TimMc: Ugh, so out of date.

12:44 biallym_: So I come from lisp land and have never used java (just C++) quick syntax check "new InterfaceClass { public blah functionName (blah) {code} }" is an anonymous implementation correct? and the proxy macro is the solution for that

12:45 (solution for doing that in clojure) I am copying over some java code >.>

12:47 ok so yea I was right... I hate syntax

12:48 raek: biallym_: yes. proxy is suitable for this kind of java interop.

12:52 biallym_: (inc raek)

12:52 lazybot: ⇒ 11

12:52 biallym_: hehe

13:04 duck1123: Does this error make sense to anyone? lamina.core.pipeline.ResultChannel cannot be cast to lamina.core.pipeline.ResultChannel

13:14 TimMc: duck1123: That's usually a dirty JVM/compiled code issue.

13:14 Borkdude: biallym_: you are forgetting two ()'s

13:15 biallym_: new InterfaceClass() { public blah functionName (blah)

13:15 {code} }

13:15 TimMc: duck1123: Oh, and I've also encountered something similar when a bit of load-time code used a defrecord that hadn't been created yet.

13:15 Borkdude: any midje proficient people in here?

13:15 biallym_: I don't program java so >.>. In lisp an extra set () rarely means anything :P

13:16 Borkdude: biallym_: in Lisp it means a lot, an extra function to be called most of the time ;)

13:16 duck1123: TimMc: I'm doing a clean install to see if I still get it

13:17 biallym_: nil and () are usually considered equal >.>

13:17 TimMc: duck1123: I'll see if I can dig up the error I was having.

13:17 biallym_: not quite...

13:18 Borkdude: biallym_: not in clojure

13:18 &(= nil '())

13:18 lazybot: ⇒ false

13:18 biallym_: I know not in clojure, and I blame java for that, oh never mind I was making a bad joke anyways >.>

13:19 TimMc: duck1123: https://gist.github.com/899696

13:19 tensorpudding: &(empty? nil)

13:19 lazybot: ⇒ true

13:19 tensorpudding: huh

13:21 so nil isn't '()

13:21 but it's a collection?

13:21 Borkdude: ,(doc empty?)

13:21 clojurebot: "([coll]); Returns true if coll has no items - same as (not (seq coll)). Please use the idiom (seq x) rather than (not (empty? x))"

13:21 brehaut: tensorpudding ##(coll? ())

13:21 lazybot: ⇒ true

13:21 raek: () is the empty persistent list

13:22 duck1123: ,(seq nil)

13:22 clojurebot: nil

13:22 Borkdude: ,(empty? \a)

13:22 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character>

13:23 Borkdude: ,(type nil)

13:23 clojurebot: nil

13:23 Borkdude: :)

13:23 tensorpudding: &(assoc nil :a 5)

13:23 lazybot: ⇒ {:a 5}

13:23 raek: ,(map class [() nil (conj () 1) (conj nil 1)])

13:23 clojurebot: (clojure.lang.PersistentList$EmptyList nil clojure.lang.PersistentList clojure.lang.PersistentList)

13:25 biallym_: so atleast nil is '() [If not the other way around)

13:25 Borkdude: ,(count nil)

13:25 clojurebot: 0

13:26 tensorpudding: what's the difference between lazybot and clojurebot

13:26 Borkdude: biallym_: maybe the answer should be: in some ways yes, in others no

13:26 biallym_: one likes fancy symbols?

13:27 Borkdude: yea I was talking from a more lisp standpoint, not clojure, I knew clojure had some funny stuff from other lisps going on there

13:28 Borkdude: biallym_: you mean a common lisp standpoint?

13:28 biallym_: or scheme or arc

13:29 tensorpudding: most of the ways that clojure differs from the other lisps i've used, i rather like

13:30 Borkdude: biallym_: I'm sure you have read this? http://clojure.org/lisps

13:30 biallym_: I like all the steps forwards, I can deal with the cost of some lisp idioms

13:30 brehaut: ,*clojure-version*

13:30 clojurebot: {:major 1, :minor 3, :incremental 0, :qualifier nil}

13:30 biallym_: yes

13:30 &*clojure-version*

13:30 lazybot: ⇒ {:major 1, :minor 3, :incremental 0, :qualifier nil}

13:36 biallym_: ,(ns-name *ns*)

13:36 clojurebot: sandbox

13:36 biallym_: &(ns-name)

13:36 lazybot: clojure.lang.ArityException: Wrong number of args (0) passed to: core$ns-name

13:36 biallym_: &(ns-name *ns*)

13:36 lazybot: ⇒ sandbox16763

13:36 biallym_: hmmm

13:37 brehaut: the main difference between clojurebot and lazybot is not the clojure support (though there is differences in the sandbox libraries used); its all the miscellanous extra bits

13:37 biallym_: ,(all-ns)

13:37 clojurebot: (#<Namespace user> #<Namespace clojure.core> #<Namespace sandbox> #<Namespace clojure.repl> #<Namespace clojure.java.io> ...)

13:37 biallym_: &(all-ns)

13:37 lazybot: ⇒ (#<Namespace cheshire.parse> #<Namespace lazybot.plugins.lmgtfy> #<Namespace lazybot.plugins.timer> #<Namespace clojure.set> #<Namespace lazybot.plugins.ping> #<Namespace cheshire.generate> #<Namespace clojure.tools.logging> #<Namespace clj-http.util> #<Namespace l... https://gist.github.com/1358799

13:37 biallym_: ok I like lazy better >.>

13:38 brehaut: given you can use and require namespaces, im not sure how thats relevant

13:38 tensorpudding: i guess lazybot has more modules

13:39 biallym_: actually I was basing it off of the gist support for long quereys

13:39 brehaut: https://github.com/flatland/lazybot/ http://github.com/hiredman/clojurebot tensorpudding you can stop guess

13:40 ing

13:40 biallym_: And that reinforced my choice :p

13:42 how do you type hin the return of an fn?

13:46 brehaut: (fn ^type […] …) or (defn name ^type […] …) i believe

13:48 biallym_: and use *warn-on-reflection* to find the locations where you need to type hint rather than guessing

13:48 (lein has a project wide flag for it too)

13:51 biallym_: yea it was an interface issue it was more to get the function to fit in the right hole (it expected a void return)

13:51 brehaut: you can always typehint an expression as needed too

13:52 (.method obj ^type (foo bar))

13:52 biallym_: is there a way to do function types?

13:53 brehaut: biallym_: depends what you mean, and where you want to send the function

13:54 biallym_: probably you want clojure.lang.IFn, or perhaps clojure.lang.Fn ?

13:56 biallym_: if you mean like haskell or dotnet parametric function types then no, because they dont really exist in the jvm

13:56 biallym_: hmm but is there a way to type that function? to say, I expect this value to be an fn that returns, say float or void

13:56 brehaut: i dont believe so

13:56 biallym_: I'm more just playing with the limits clojure

13:57 limits of*

13:57 brehaut: thats a limit of the jvm i believe

13:57 biallym_: How is that translating to clojure though?

13:58 Clojure's compiler is doing the type hinting why can't it type hint one of it's own types?

13:58 brehaut: biallym_: you can hint a specific function

13:58 biallym_: but I can't type hint a variable of a function that is expected to be a function

13:59 (Beyond the knowledge that it is a function)

13:59 brehaut: im running out of my knowledge of the hinter

14:00 biallym_: besides as I understand it, type hinting is only for optimization not for any sort of safety

14:00 brehaut: indeed

14:01 biallym_: interesting

14:02 brehaut: unfounded assertion: static mutable types are a weaker invariant than dynamic but immutable types

14:03 poor english aside

14:04 gfredericks: "dynamic" and "immutable" is a weird juxtaposition.

14:05 brehaut: gfredericks: i think i mean variables

14:05 gfredericks: i.e., programming is fun.

14:05 brehaut: ,(juxt dynamic immutable)

14:05 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: dynamic in this context, compiling:(NO_SOURCE_PATH:0)>

14:07 gfredericks: I've got half a mind and not enough time to add documentation to unk.

14:25 duck1123: On the earlier subject of coding for kids: https://www.nytimes.com/2011/11/10/technology/personaltech/computer-programming-for-children-minus-cryptic-syntax.html?_r=1

14:25 ibdknox: also this: http://cdsmith.wordpress.com/2011/09/10/haskell-for-kids-week-4/

14:33 gfredericks: I want to test a macro that emits gen-class code. Do I need to do special stuff to make sure the generated class exists so I can test it?

14:34 (i.e., I would be testing a class that only would exists in the test code)

14:35 tensorpudding: don't teach kids lisp, they'll be scarred for life :P

14:36 duck1123: tensorpudding: Do you really think so? If you raise your kids on lisp and functional programming, they'll never know any different.

14:37 tensorpudding: it was a joke

14:38 gfredericks: duck1123: with much wisdom comes much sorrow

14:39 TimMc: 'strue

14:40 They'll be depressed.

14:41 jodaro`: i've tried to get my kids into a little ruby/python

14:41 jodaro: without much success heh

14:41 mefesto: kids raised on nothing but lisp and functional programming are spoiled

14:41 Borkdude: I've got this problem with Midje. I'm trying to test a function, with some prerequisites. But it actually executes the functions mentioned in 'provided'

14:42 Looks like this: https://gist.github.com/1358984

14:42 duck1123: "when I was your age, we had to number our lines by 10"

14:42 Borkdude: The test is in a different namespace btw, might it matter

14:42 duck1123: haha, indeed... GW Basic is how I started

14:43 gfredericks: What's wrong with (set! *compile-files* true)?

14:43 duck1123: I still have my Atari XE. I had to leave it turned on because I had no way to save my programs

14:45 Borkdude: duck1123: is it still on? ;)

14:46 duck1123: That would be insane. To have it still running my prime finder from high school

14:47 especially cosidering the number of times I've moved since then

14:53 gfredericks: duck1123: those primes would be worth a lot of money now

14:55 hmmm....maybe it's better to use a deterministic algorithm to get the unique symbols for a gen-class

14:56 * gfredericks googles sha-1 and java

14:57 mdeboard: $google sha-1 and java

14:57 lazybot: [JavaBlogging » SHA1 and MD5 checksums in Java] http://www.javablogging.com/sha1-and-md5-checksums-in-java/

14:57 mdeboard: :o

14:57 seancorfield: is there a function that behaves like (fn [v fs] (map (fn [f] (f v)) fs)) ?

14:58 TimMc: seancorfield: juxt

14:58 ibdknox: seancorfield: ((apply juxt fs) v)

14:58 TimMc: yesssss

14:58 seancorfield: +1 TimMc

14:59 ibdknox: ,((apply juxt [even? odd? nil?]) 3)

14:59 clojurebot: [false true false]

14:59 seancorfield: that is certainly nicer than the basic map approach

15:00 ibdknox: non-lazy though

15:00 not sure if that matters

15:00 TimMc: mm

15:01 gfredericks: not hard to define lazy-juxt

15:01 seancorfield: and is there a function that behaves like (fn [v f] (f v)) ?

15:01 gfredericks: aka lust

15:01 seancorfield: #(%2 %1)

15:01 ibdknox: seancorfield: huh?

15:02 TimMc: ,(first ((juxt inc println) 4))

15:02 clojurebot: 4

15:02 5

15:02 adamh: win 7

15:03 ibdknox: hm

15:03 so it *is* lazy?

15:03 no

15:03 &(first ((juxt inc println) 4))

15:03 lazybot: ⇒ 4 5

15:04 seancorfield: just playing with expressions and wanted something point-free

15:05 * seancorfield realizes that stream of consciousness doesn't play nice with irc ;)

15:05 TimMc: (first ((apply juxt (conj (vec (repeat 500 inc)) println)) 4))

15:05 ,(first ((apply juxt (conj (vec (repeat 500 inc)) println)) 4))

15:05 clojurebot: 4

15:05 5

15:05 ibdknox: lol

15:05 TimMc: ugh

15:05 (checking for chunked seqs)

15:05 ibdknox: yeah

15:09 TimMc: (letfn [(juxt [& fs] #(map (fn [f] (f %)) fs))] (first ((juxt inc println) 4)))

15:09 ,(letfn [(juxt [& fs] #(map (fn [f] (f %)) fs))] (first ((juxt inc println) 4)))

15:09 clojurebot: 5

15:10 TimMc: So... why isn't juxt lazy?

15:10 $source juxt

15:10 lazybot: juxt is http://is.gd/QuCLxF

15:10 ibdknox: it says it returns a vector

15:10 TimMc: ah

15:10 ibdknox: ,(doc juxt)

15:10 clojurebot: "([f] [f g] [f g h] [f g h & fs]); Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"

15:10 TimMc: convenient for (into {})

15:10 ibdknox: yep

15:14 TimMc: Oh, it is also optimized for 1–3 fnsor vals

15:14 ibdknox: TimMc: I'm confused by the results of your experimentation

15:14 that should have printed all of them out, right?

15:14 looking at the code for juxt

15:14 TimMc: printkl'd?

15:14 *println

15:15 I'm having keyanboard troaluble today.

15:15 ibdknox: oh, I read your form wrong

15:15 TimMc: first

15:18 By the way, if anyone needs a screen session on a server so they can use IRC over shitty wireless at the Conj, let me know.

15:25 bhenry: TimMc: it seems that irc and gchat are the only things that work over the shitty wireless for me

15:27 TimMc: I saw some people struggling to stay connected -- I assume they were using local clients.

15:27 bhenry: even when my browser can't connect, i can still chat mostly fine.

15:28 mjwhitt: yeah, we've got 6 people sharing a cell's access point

15:28 TimMc: yup

15:30 I have this project at work that involves some JSPs and servlets and such. The whole thing gets packaged up as a WAR file and deployed elsewhere.

15:31 brehaut: TimMc: im sorry to hear that

15:31 TimMc: I'd like to convert the JSPs into Clojure + Enlive. Is there a way to make .clj coexist with the Java servlets?

15:32 brehaut: TimMc: theres a ring servlet adapter

15:32 TimMc: brehaut: This is more of a build issue.

15:32 Specifically, I would *probably* need to have Clojure code that is both referenced by the Java servlets and also references some common Java classes in the same project.

15:33 And all this is managed by Maven, of course.

15:33 duck1123: TimMc: You'll probably need to break it up into multiple projects/modules if you want to refer to compiled clojure code from java

15:33 TimMc: :-(

15:34 We already have... 44 projects in this tree.

15:34 brehaut: whats one more :(

15:34 duck1123: ,(inc 44)

15:34 clojurebot: 45

15:34 TimMc: :-P

15:34 brehaut: thanks duck

15:34 duck1123: I'm here to help

15:36 TimMc: I've not worked with a mixed Java/Clj source tree. Is there a way for the Clojure AOT compiler to invoke the Java compiler as necessary?

15:37 or should I be looking at using RT from Java to access teh Clojure stuff?

15:38 aperiodic: TimMc: i believe there's a way to get lein to compile java for you

15:39 TimMc: https://github.com/technomancy/leiningen/blob/1.x/sample.project.clj#L161

15:39 duck1123: lein and maven compile the java stuff first. You could probably put togeter a convoluted lifecycle to get it to work, but its probably easier to make the clojure code a separate project

15:40 aperiodic: oh, I see, you want that to happen *while* compiling Clojure

15:40 sounds messy

15:41 TimMc: aperiodic: Or at least have two stages of Java compilation.

15:41 I envision the servlet calling the Clojure code directly, passing in a wad of data to put into HML (via Enlive).

15:42 That wad of data would probably be custom POJOs that Clojure would want to compile against.

15:43 That's option 1. Option 2 is to pass in bean-like and use (bean) on them, which involves a level of dynamic-ness that my coworkers might not be comfortable with.

15:43 aperiodic: so you'd want to compile the POJOs, compile the Clojure against that, and finally compile the servlet against the clojure?

15:44 TimMc: yeah

15:44 against the clojure and the POJOs

15:44 Option 3 is to do have each servlet have a public subinterface called Builder and use RT.resolve to get the appropriate Builder, actually proxy'd Clojure.

15:44 Then the Java would be compiled first and the Clojure would come along as source.

15:44 I may have just talked myself into option 3. :-)

15:45 duck1123: TimMc: Why not use gen-class in clojure and give the java code a nice api to work with?

15:45 mbac: so is there some company out there that desperately wants to hire a hundred clojure programmers

15:45 aperiodic: yeah, gen-class would work

15:46 TimMc: duck1123: Because that involves compiling Clojure first, then Java against it.

15:46 which is Option 1.

15:46 and that involves two-step Java comp.

15:47 aperiodic: I think you could do the final java compilation via lein using robert hooke

15:48 TimMc: Can lein be called from Maven?

15:48 That's what the top-level build is done in.

15:48 Build complexity is a top consideration here.

15:50 duck1123: Could you use some of the dependency injection tools like Guice to inject the clojure classes at runtime?

15:50 aperiodic: I don't know anything about Maven/Lein cooperation

15:51 duck1123: I haven't really used Guice much

15:51 aperiodic: the three-step compilation would probably get pretty hairy

15:51 can you do shell commands in maven?

15:51 TimMc: duck1123: Good point on dep injection. We already have Spring everywhere. (yuck)

15:52 aperiodic: Yes, but that can be fragile.

15:52 duck1123: or you could do tricks with Class/forName

15:52 TimMc: I'm going to try the RT method for now, maybe try Spring later.

15:52 aperiodic: Part of the problem is that I am very ignorant about Maven. :-)

15:53 brehaut: TimMc: thats not a bad thing… ;)

15:53 aperiodic: TimMc: I'm afraid I'm in the same boat!

16:00 jsnikeris: I'm using clojure-maven-plugin to run a single .clj file (mvn clojure:run -Dclojure.script=src/main/clojure/blah.clj). So in blah.clj I have a bunch of defns and at the end I call the top-level defn: (report). Unfortunately, this has the side-effect of also calling (report) when I run the 'mvn clojure:swank'. It seems like these two goals are mutually exclusive. Is there another way to do this?

16:01 duck1123`: jsnikeris: define a -main function, then specify that ns as the main ns

16:01 TimMc: Whoa, freaky.

16:01 I just saw your name, jsnikeris.

16:02 jsnikeris: on a web page or something?

16:02 duck1123`: I'm looking at the configuration for clojure:run. It looks like I can specify a clojure.mainClass (A java class to run)

16:03 duck1123`: is that what you were referring to?

16:03 duck1123: hold on, trying to mind my old poms

16:03 TimMc: jsnikeris: On the Enlive Google Group.

16:04 jsnikeris: duck1123: awesome, thanks. Ah, gotcha. Enlive is great and revolutionary IMO

16:04 gfredericks: TimMc: do you have special powers over him now or something?

16:04 TimMc: jsnikeris: While you're here, what did you put in your POM to get the clojure maven plugin?

16:05 jsnikeris: TimMc: I'm not going to paste it here. You can find it on the github page:

16:05 https://github.com/talios/clojure-maven-plugin

16:05 under "Getting started..."

16:06 TimMc: jsnikeris: OK, that's what I have.

16:06 duck1123: jsnikeris: Ok, you can use the clojure.mainClass, but I think that requires you AOT that ns. the other option is to make a run script outside of your src path, and specify that as the run script. have that script just call your start fn

16:06 jsnikeris: ahhh

16:07 duck1123: that makes sense. I'll go with the second option

16:08 TimMc: jsnikeris: Any extra repos, like clojars?

16:08 jsnikeris: duck1123: thanks for the help

16:08 TimMc: This may be interference from our corporate Maven configuration...

16:08 jsnikeris: TimMc: if you want to use swank you'll need clojars

16:09 TimMc: Nah, it was complaining about the top thing.

16:09 I bet it's a local config issue. Thanks.

16:10 jsnikeris: try version 1.3.8

16:10 instead of the SNAPSHOT version

16:10 TimMc: There we go!

16:10 Thanks!

16:10 jsnikeris: np

16:11 tsdh: Does anyone generate HTML documentation in a clojure 1.3 project? If so, what tool do you use?

16:11 TimMc: I infer from your question that Marginalia is 1.2-only?

16:12 tsdh: TimMc: Isn't marginalia some literate programming thingy?

16:12 duck1123: marginalia works with 1.3, but every time I've tried it, it fails to extract my doc strings

16:14 TimMc: tsdh: I guess maybe you don't want all your code printed out with your docs... :-)

16:15 tsdh: Marginalia looks cool and I don't have anything against printing all the code, too. But at least there has to be some alphabetical index of all vars, which I cannot see at http://fogus.me/fun/marginalia

16:17 TimMc: ah

16:17 F3 :-)

16:22 licenser: I'd have another question clojurescript, how do I get a JS array out of a seq?

16:23 yodainheels: greetings dweezils

16:23 tsdh: Hm, I've installed lein-marginalia-0.6.1 (which fetches clojure 1.2.1 and the old contribs) but then "lein marg" fails directly with clojure.lang.PersistentVector cannot be cast to clojure.lang.Named.

16:23 yodainheels: @conj

16:25 duck1123: tsdh: try updating lein maybe?

16:25 TimMc: tsdh: It or the compiler is expecting a name where there's a function's named args list, no doubt.

16:27 tsdh: duck1123: It's the newest version.

16:28 TimMc: What's a named args list?

16:28 TimMc: Me stumbling over words.

16:28 It's the [a b c] in (fn [a b c] ...)

16:28 bindings

16:28 formals?

16:29 tsdh: TimMc: I know what an arg list is. ;-)

16:31 scottj: tsdh: autodoc doesn't do what you want?

16:31 tsdh: TimMc: Hm, does marginalia parse the code, or does it load it and then get the metadata dynamically? In the latter case, it's pretty obvious that it won't work with 1.2...

16:31 scottj: It errors, presumably because it's not adapted to 1.3 yet.

16:32 scottj: tsdh: I thought autodoc was used to create api docs on clojure.org, which are for 1.3

16:32 tsdh: scottj: (although the clojure docs itself are said to be generated by it, but I have no clue how)

16:32 duck1123: tsdh: I use 1.3, and it runs for me. (although it doesn't extract docstrings appropritely)

16:33 tsdh: duck1123: Really? How do you use it and what version?

16:33 duck1123: I just tried using autodoc on my project, and that didn't work though

16:34 tsdh: I'm using 0.6.1 installed via lein plugin install

16:34 ibdknox: I drop my project down to 1.2.1 real quick

16:34 and then run autodoc

16:34 lol

16:34 duck1123: ibdknox: and that works?

16:34 ibdknox: yep

16:35 jsnikeris: duck1123: When I run the swank goal, files in src/main/resources are copied to target/classes so they're available on the classpath. However, neither the compile or run goal is copying resources. Any ideas how to get those included?

16:35 ibdknox: specifically I use this auto-doc: [org.clojars.rayne/autodoc "0.8.0-SNAPSHOT"]

16:37 duck1123: jsnikeris: mvn resources:resources might do it for you

16:38 tsdh: Hm, I've checked out marginalia's git repo and built an überjar. With that, I can generate docs for marginalia and when running it on my project, it says that it parsed several files successfully. Is there a way to figure out where it's breaking?

16:39 Ah, no. It just lists the files it's going to parse at the beginning...

16:40 duck1123: try resource:process-resource ?

16:42 tsdh: Hey, wow! One of the 5 files of my project is marginalia-ready!

16:43 TimMc: Hmph. Maven can't seem to find enlive on any repos...

16:44 duck1123: TimMc: do you have clojars listed? Leiningen adds it by default, but maven does not

16:45 TimMc: It can't find it there either.

16:46 duck1123: TimMc: it's there http://clojars.org/repo/enlive/enlive/

16:47 TimMc: yeah...

16:47 "Unable to find resource 'enlive:enlive:jar:1.0.0' in repository clojars (http://clojars.org/repo/)"

16:47 fascinating

16:49 duck1123: ibdknox: I got a NoClassDefFoundError on every ns when I tried to run autodoc against my project

16:49 ibdknox: :(

16:49 duck1123: it's what I use for noir/korma

16:51 licenser: ,(doc doto)

16:51 clojurebot: "([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the front of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))"

16:51 duck1123: It seems this project truly is incompatible with clojure < 1.3

16:52 scottj: is rich speaking now? has he mentioned what his topic will be yet?

16:53 mjwhitt: he's talking about ideas for the future

16:53 * scottj feels like everytime rich talks it's like how it used to be when steve jobs would give a preso

16:57 zms: (noob alert) I've a list of maps and I want to return the map that has a matching value. I've spent many hours trying to get this working.. :-( any pointers?

16:58 ihodes: zms: you mean, filter the list for a map that matches the given map?

16:59 zms: ihodes: yes, the map whose key value matches the one provided

17:00 ihodes: so you have somethine like: ({:A 1} {:B 2} {:C 2}) and want have a function that you give :A and that list to, and it returns {:A 1}?

17:00 to put it in list-processing terms... it sounds like you want to 'filter the list with a function that examples the maps in the list

17:01 zms: ihodes: very close. I give 1 and it returns {:A 1}

17:01 ihodes: ah right, you did say value. same idea though; have you looked at 'filter?

17:01 TimMc: zms: by checking what the value associated with :A is?

17:01 zms: TimMc: Yes

17:01 tensorpudding: &(filter (fn [map] (= (:A map) 1)) [{:A 1} {:B 2} {:C 3}])

17:01 lazybot: ⇒ ({:A 1})

17:02 TimMc: ,(first (filter #(= 2 (:A %)) [{:A 1} {:A 2 :B 3} {:A 5}]))

17:02 clojurebot: {:A 2, :B 3}

17:03 tensorpudding: &(filter (fn [map] (= (:A map) 3)) [{:A 1} {:B 2} {:C 3}])

17:03 lazybot: ⇒ ()

17:03 daniel__: what do people here think of racket?

17:03 zms: tensorpudding, TimMc: Thanks. I'll go try this one. :) (still new to iterating functionally)

17:03 tensorpudding: &(first (filter (fn [map] (= (:A map) 3)) [{:A 1} {:B 2} {:C 3}]))

17:03 lazybot: ⇒ nil

17:03 tensorpudding: ah, first returns nil on an empty list, that's good

17:03 scottj: daniel__: that it's nice. be more specific if you want a more specific answer :)

17:04 TimMc: duck1123: Haha... I still haven't solved it, but Maven checks the *corporate* repo but reports that *clojars* doesn't have the artifact!

17:04 Oh well. Off to make dinner.

17:04 duck1123: TimMc: yay! bureaucracy

17:05 daniel__: scottj: when compared to clojure

17:06 zackmaril: What's the best way to get the image data out of a jpg with clojure?

17:06 daniel__: do either have anything particularly nice or advantages over the other?

17:07 TimMc: daniel__: I'm sure of it.

17:07 scottj: daniel__: well clojure has access to all the JVM goodness

17:07 tensorpudding: zackmaril, what do you mean by image data? you mean decode it?

17:07 TimMc: It's a very general question, though, so you aren't likely to get a satisfying answer.

17:07 duck1123: zackmaril: There are several good exif libraries for java

17:07 tensorpudding: there's surely a java library that does it

17:07 zackmaril: I saw this: http://instagram-engineering.tumblr.com/post/12651721845/instagram-engineering-challenge-the-unshredder

17:07 tensorpudding: that you can wrap

17:08 zackmaril: And I thinking "that would be fun to mess around with tomorrow afternoon"

17:08 daniel__: i might have to give racket a try

17:08 zackmaril: *I am thinking

17:08 daniel__: hard to learn compared to clojure do you think?

17:08 or pretty similar

17:09 zackmaril: Probably just going to wrap ImageJ then.

17:12 tensorpudding: i figure racket can't be that hard to learn

17:12 it's got an ide and everything

17:13 it's more traditional than clojure, i reckon

17:13 duck1123: doesn't haskell have it's own ide?

17:14 tensorpudding: leksah

17:14 haskell is exceptional i guess

17:14 daniel__: haskell is hard to learn?

17:15 ihodes: daniel__: racket is easy enough to learn. what other languages do you know?

17:15 daniel__: ihodes: mostly OO languages like ruby, python, java

17:16 have been learning clojure, its requires more brain power to work out how to do things

17:16 but i like the end result

17:16 tensorpudding: i don't think clojure requires more thought

17:16 except in the sense of being unfamiliar

17:17 having to look stuff up in the book a lot

17:18 daniel__: well for me its more natural to think in terms of step by step procedures, i find recursive/iterative functions can be pretty hard to get my heda around sometimes

17:18 tensorpudding: there's a looping construct in clojure

17:18 daniel__: probably because its unfamiliar and im not used to thinking that way

17:19 i think when you read clojure code you have to store more in your head...

17:19 kind of evaluate things like a compiler as you go along

17:20 im sure its mostly unfamiliarity

17:22 ihodes: daniel__: yeah, it gets better the more you learn. it's a different way of thinking, and it ends up being easier i think

17:22 daniel__: racket is much the same way, i'd say. but i'd stick with clojure for now, since you've already begun, there's no advantage to switching (and I think clojure is more practical)

17:23 daniel__: im not thinking of switching, i plan on using more clojure

17:24 just thought id give it a try

17:24 anyway, tired. nn all

17:25 zms: ihodes, TimMc: Thanks. That filter based solution worked! (of course, you knew that.) :)

17:26 ihodes: zms: good :) most of the time filter, map, reduce can do just about whatever you want with lists

17:26 also, remember remove (removes what you specify, instead of filtering it)

17:27 zms: ihodes: will do.

17:27 what i'm finding tough is working out how to get things done when i can't modify the data structure..

17:27 ihodes: the above functions are your answer :)

17:28 zms: i guess. data structures flowing through these functions finally getting into a shape i want. that's how i'm seeing it.

17:29 not sure if that's a right mental model though.

17:29 mjwhitt: new sport: pod-peeking

17:33 pjstadig: a pod is a group of dolphins, so a pod group seems redundant

17:34 mjwhitt: yeah but pods are singular in the context

17:36 tsdh: What does one use to traverse directory structures? Plain java.io.File?

17:36 duck1123: If you have a whole bunch of pods of dolphins, and you want to group those pods into different groups, you would have pod groups. (and a whole lot of dolphins)

17:47 taufiq: tsdh: that's what i've been using, though it would be nice to know whether or not that's generally the way it's done

17:48 tsdh: taufiq: I've found clojure.core/file-seq which is pretty handy

17:49 duck1123: c'mon where's the zip filter for file systems?

17:49 taufiq: thanks, i'll take a look at that

17:56 technomancy: what is up with the arg order of <<?

17:56 (<< conj! mypod x) ; <- intentional?

18:02 licenser: another one for clojurescript: http://pastie.org/2849703 a 3 line macro but it crashes the compiler, is there a way to debug what exactly happens?

18:05 zms: this works: (update-in (get-item-from-usable "/u1/dbfiles/") [:space :usable] - 1000)

18:06 but when i wrap this in a defn like so: (defn deduct-from-usable [path size]

18:06 (update-in (get-item-from-usable path) [:space :usable] - size))

18:06 then it doesn't

18:07 I call it like so: (deduct-from-usable "/u1/dbfiles" 1000) and it fails with NullPointerException

18:07 any hints?

18:08 licenser: zms: try to run it without the update in first :)

18:09 just to make sure your get items … works correctly

18:09 then add the update in as well

18:09 zms: licenser: it works outside of defn

18:09 just wrapping it inside defn seems to make it fail

18:10 licenser: I read that, but I find it helps to reduce the places where errors can occure

18:10 I mean, it clearly shouldn't happen so it's time to find out where something odd happens

18:12 zms: licenser: you're right. (get-item-from-usable "/u1/dbfiles/") still works

18:12 licenser: :)

18:12 ibdknox: exactly the person I was looking for, my personal cljs expert

18:13 zms: licenser: i don't see which parts should i test more.. the next call is to update-in itself

18:15 licenser: zms: http://pastie.org/2849776

18:15 that is how I would go here

18:15 ibdknox: had you ever had experience in debugging cljs compilations?

18:16 zms: licenser: sorry. i should have done that first thing.

18:16 licenser: zms: no worries :)

18:16 * licenser loves problems, especially those he can solve ;()

18:24 zms: licenser: thank you. it was a typo in my functional call. the argument that i was passing did not exist in the map. thanks for teaching a nice debugging technique. :)

18:24 s/functional/function/

18:24 licenser: zms: it is a horrible one but it helps when you don't have better tools at hands and the problem is small enough ^^

18:25 but glad I could help

18:26 zms: licenser: it's a shame that slime can't jump from stack trace to the the exact source/line of error with clojure.

18:26 not slime's fault though

18:27 licenser: zms: when you load the file with (use 'bla :reload-all) the stack trace shows the source line

18:27 but the source line isn't much help in a 1 line function ;)(

18:30 mindbender1: how can I add more than one entry to :dev-resources-path of my project.clj?

18:35 zms: mindbender1: i saw this somewhere: :dev-dependencies [[lein-expectations "0.0.1"]

18:35 [expectations "1.1.0"]])

18:42 mindbender1: zms: the instruction from ritz says to add src-path-string to :dev-resources-path

18:42 not :dev-dependencies

18:43 and I'm trying to add more than one string

18:44 and I'm getting errors.. so I want information on how to add more than on resource path to :dev-resources-path

18:45 zms: mindbender1: may be you've seen leiningen's github page: https://github.com/technomancy/leiningen

18:52 * zms needs to sleep now.. almost morning

18:53 * zms says good night

19:05 licenser: I think I found a bug in clojurescript :)

19:35 wiseen: why is acquiring a read lock on ReentrantReadWriteLock so much slower than (locking x), is locking implemented as a spin lock first ?

19:41 nvm, turns out calling readLock on the rwlock is actually the slow part, caching that result makes them the same performance :\

19:49 ftr. I'm a moron I typed 1000 vs 1000 for two test cases, turns out it's the same performance and locks are actually really fast !

19:49 *10000

19:54 licenser: wiseen: that would only be half as funny if you hadn't typed it again ;)

19:55 ashafa: hello

19:56 leo2007: good morning

19:56 ashafa: clojurescript question

19:56 licenser: asenchi: I've them too :) lets combine them ;)

19:57 ashafa: if i wanted to convert this "var car = new com.honda.Car("black","4wd");"

19:58 ...to cljs. How would I write that

19:58 ?

19:58 licenser: var car is a global one?

19:58 aside from setting it global it would be:

19:59 (def Car (js* "com.honda.Car")); (Car. "black", "4wd")

19:59 ashafa: doesnt need to be global

19:59 licenser: then this should help you :)

19:59 bhenry: licenser: wouldn't the second line def into car?

20:00 (def car (Car. "black" "4wd"))

20:00 licenser: afaik def isn't creating globals

20:00 bhenry: ah

20:01 licenser: globals are kind of tricky when I got it right

20:02 what you can do is creating globals in a script that is loaded before your bootstrap script and then include them via (def (js* "myglobal"))

20:02 ashafa: hmm is there a way I can do it without defining "Car"

20:02 ?

20:02 bhenry: licenser: mine would turn into his.namespace.car = ...

20:02 ashafa: I'm not a big fan of defining globals

20:03 licenser: *nods*

20:03 ashafa: no globals

20:03 ashafa: i usually us js/...

20:03 bhenry: it's just within the namespace

20:03 ashafa: use*

20:03 licenser: as bhenry points out def is not a global

20:05 ashafa: :licenser thanks man

20:05 bhenry: thanks

20:06 one more question

20:06 licenser: shoot

20:07 ashafa: are they any advantages to using (js* "window") and js/window?

20:07 than

20:07 s/and/than/

20:08 * licenser has no clue

20:09 licenser: I *think* that it ends just as the same

20:10 (js* "bla") is just going to translate directly in script

20:14 has anyone worked with macros in clojurescript?

20:25 wiseen: is there a way to implement keyword access for functions eg. (= (:keyword function) (function :keyword)) ?

20:26 licenser: wiseen: I think that is a bad idea to do

20:27 make the function return a map and use (:keyword (function)) is a good way to go

20:27 or just use a mal

20:27 map

20:28 wiseen: licenser, I'm thinking of using closures as objects - this would allow them to act like it but a good point it's ambiguous

20:31 licenser: wiseen: what you can do is extend the function class with the interface that implements lookups

20:31 but it will confuse the hell out of everyone reading your code ;)

20:31 perhaps look at defrecord?

20:32 or was it defprotocol one of the two allowed you to do about that use closures as objects

20:33 semi objects at least

20:34 wiseen: yeah it's a bad design when i think about it for more than a second :)

20:34 licenser: ^^

20:45 archaic: ahh I just upgraded emacs packages and clojure-jack-in broke :| possibly newest slime version is cause?

20:46 wiseen: is there a good name for functions that take seq and return a seq like "operators" or something similar ?

20:48 gfredericks: wiseen: don't think so

20:49 wiseen: more often folk create functions that operate on the elements of a seq, and then use the built in seq functions to do the work

20:50 wiseen: gfredericks, how ambiguous is calling them "operators" ? I'm writing a library that works on push collections and one namespace has seq equivalents (map*, take*, etc.) I don't know how to call that namespace :)

20:51 duck1123: naming things is hard

20:55 gfredericks: seqers! :)

20:56 wiseen: since the push collection is "observable" that would be observablers :)

20:56 gfredericks: which is a name I wholeheartedly approve of

20:57 the clojure cheatsheet's heading for the category you speak of is "Seq in, Seq out", which I think confirms my story that there's no good existing word

20:57 wiseen: it sort of breaks my brain :)

20:57 yeah, will probably just stick them in root namespace

20:58 duck1123: pipeline?

20:59 I have a library that I've been meaning to write the docs for one of the features, but I haven't done it yet because I don't have good names for the thifferent parts

21:00 gfredericks: wiseen: I don't say this with much confidence, but if I were making a bunch of functions that act similarly to the core seq functions, I would probably name them without decorating with asterisks, and encourage users to require instead of use

21:01 duck1123: lamina has a bunch of functions that use the same names with the star like that

21:01 wiseen: gfrederick (-̣>> (requestx) (pipeline/filter #(..)) (pipeline/map #(..))) vs (->> (requestx) (filter* #(..)) (map* #(..)))

21:01 gfredericks: wiseen: there are shorter prefixes ;-)

21:02 duck1123: yeah, my guess is that both approaches are represented a good bit

21:02 that's why I said it without much confidence

21:02 pdk: (doc when)

21:02 clojurebot: "([test & body]); Evaluates test. If logical true, evaluates body in an implicit do."

21:03 duck1123: stuff like that, I can see you wanting to have them without any prefix

21:03 gfredericks: two against one. I repent my wrongful position.

21:03 wiseen: gfredericks, * seems more like microsoft Async posftix convention

21:04 duck1123: I guess it really all depends on the context in which you want to use them

21:05 gfredericks: the most important thing is that you use getters and setters instead of public instance variables

21:06 duck1123: and make sure all of your variables are prefixed with a letter indicating the datatype

21:07 gfredericks: write unit tests to make sure that your for loops don't have fencepost errors

21:09 duck1123: so is it at all possible to use xml zip filters with namespaced xml? I tried using them, but had issues and am now using Saxon for my ns-aware needs, but I don't like it

21:09 anyone doing ns-aware xml processing?

21:26 klauern: does `lein repl` pass along http proxy settings?

21:30 Better yet, how can I get any lein command to pass along the -Dhttp.proxyHost and -Dhttp.proxyPort settings?

21:32 I see there's settings for the .m2/settings.xml, but unless I set System.setProperty("http.proxyHost", "") and proxyPort, no HTTP calls work in the REPL

21:45 Ah, it seems I can use the :repl-init script in the leiningen project to do what I want

21:46 It's project-by-project, but I can work with that for now

21:50 dakrone: you can use :jvm-opts

21:50 wiseen: ,(doc take-nth)

21:50 clojurebot: "([n coll]); Returns a lazy seq of every nth item in coll."

21:50 wiseen: ,(take-nth 4 (range 10))

21:50 clojurebot: (0 4 8)

21:51 wiseen: so 1 item is taken and index starts on 1 ?

21:52 *element at index 0 technically

21:53 the docs are a bit vague

22:06 biallym_: &(take-nth 4 (repeat 1))

22:06 lazybot: Execution Timed Out!

22:06 biallym_: so much for being lazy

22:07 or maybe the bots are enumerating them

22:07 tomoj: &(->> [1 2 3] cycle (take-nth 4) (take 10))

22:07 lazybot: ⇒ (1 2 3 1 2 3 1 2 3 1)

22:07 tomoj: not a very good example :)

22:08 biallym_: aha that taught me

22:08 (a lot actually)

22:08 tomoj: &(->> [:foo :bar] cycle (take-nth 2) (take 10))

22:08 lazybot: ⇒ (:foo :foo :foo :foo :foo :foo :foo :foo :foo :foo)

22:09 hiredman: https://gist.github.com/1359889

22:10 wiseen: tomoj, so it takes (= (mod index n) 0)

22:10 dakrone: hiredman: you need to get some of these in clojure-mode

22:10 wiseen: and (mod 0 n) = 0

22:11 hiredman: dakrone: with clj-http in the prepopulated favorite libs list?

22:11 :)

22:11 wiseen: maybe that should be in the docs ?

22:11 dakrone: hiredman: yes :), with version 0.2.2 though

22:12 err, 0.2.3

22:12 hiredman: I thought I grabbed that from the github page

22:13 dakrone: it's at 0.2.3 now

22:13 hiredman: oh, no, I grabbed the cheshire version (not added in the gist) from github, the clj-http from an existing project

22:13 dakrone: hahaha

22:13 hiredman: talk about a release tread mill

22:14 the docstring for favorite-libraries is also wrong

22:16 danlarkin: raleigh tv sucks

22:17 which is kindof a joke because it's the same tv as everywhere else

22:17 hiredman: load my elisp and go add a bunch of dependencies to your projects

22:18 wiseen: Is there a way to capture the else part of try catch block when no exception has been caught (try ... (catch Exception _ ...) (else ...)) ?

22:19 *no exception has been thrown

22:19 tensorpudding: &(macroexpand '(->> [:foo :bar] cycle (take-nth 4))))

22:19 lazybot: ⇒ (take-nth 4 (clojure.core/->> [:foo :bar] cycle))

22:20 tensorpudding: why does it expand ->> only once?

22:20 dakrone: wiseen: do you mean 'finally'?

22:20 ,(try (inc 1) (finally (println "foo")))

22:20 clojurebot: dakrone: Huh?

22:20 dakrone: bleh

22:20 wiseen: dakrone, that is executed even if the exception is thrown

22:21 dakrone: soo, at the end of your regular function then?

22:21 hiredman: or, you know, the whole try block

22:21 dakrone: what are you trying to do?

22:22 wiseen: but if i put it in the try block the expression it self might throw and I don't want to handle that

22:22 hiredman: sounds horrible

22:23 wiseen: hiredman, I want to call a function and if that function throws an exception I route it trough a special path, but if it doesn't it goes trough the regular message path. now the message send function might throw as well but I need to let that exception bubble up

22:24 sorry, that was for dakrone

22:24 python has try catch else

22:25 duck1123: wiseen: have you looked to see if lamina works for you. This all sounds very familiar to what is already there

22:26 wiseen: duck1123, lamina is a bit to highlevel - it assumes a message queue afaik - where I just want to orchestrate callbacks (which can be used to build a queue then)

22:26 also it's a learning project

22:27 tensorpudding: &(macroexpand (macroexpand '(->> [:foo :bar] cycle (take-nth 4)))))

22:27 lazybot: ⇒ (take-nth 4 (clojure.core/->> [:foo :bar] cycle))

22:27 tensorpudding: &(macroexpand (quote (macroexpand '(->> [:foo :bar] cycle (take-nth 4))))))

22:27 lazybot: ⇒ (macroexpand (quote (->> [:foo :bar] cycle (take-nth 4))))

22:27 tensorpudding: well now i know i don't know anything

22:28 tomoj: &(clojure.walk/macroexpand-all '(->> [:foo :bar] cycle (take-nth 4)))

22:28 lazybot: ⇒ (take-nth 4 (cycle [:foo :bar]))

22:31 tensorpudding: thank you

22:35 wiseen: figured out how to do it (when-not (try ... true (catch Exception _ ... false)) else-path)

22:44 klauern: Does leiningen have something to the equivalent of "java -cp $LEIN_CLASSPATH $arg1 $arg2 $...." that i could just type `lein run $arg1 $arg2 $.... ?

22:45 THat way I could have a project with various dev-dependencies and dependencies that I could pass a class to it and run some arguments for it?

22:46 gfredericks: klauern: I'm having a hard time telling if you already know about the "lein run" command

22:46 klauern: what does lein run do?

22:46 gfredericks: if not, then that's what you want, combined with setting a :main option in your project.clj

22:46 * gfredericks second guesses himself thinking there must be an easier way to do this

22:46 gfredericks: _AND_

22:46 klauern: I am talking about things like being able to pass the classpath and such to a VimClojure 127.0.0.1 runtime,

22:47 or the same to nrepl

22:47 gfredericks: oh I don't know what's going on anymore then

22:47 lein run just lets you run the main method of one of your namespaces

22:48 presumably the same thing you would get if you did "lein jar" and then "java -jar ..."

22:48 okay I'm off

22:48 klauern: ok, I'll look into that

22:48 thanks

23:18 daaku: one of my dependencies is still pulling in clojure-contrib, is there some easy way to find out which one?

23:19 tomoj: what do you plan to do when you find it?

23:20 daaku: :)

23:21 i was using clojure.contrib.string in some of my own packages, and was looking at the app that relies on this to figure out which ones needed some cleanup since i got the impression the monolithic contrib was dying

23:22 s/relies on this/relies on these/

23:36 what's the easiest way to use my forked copy of someone's github repo as the source of a package instead of the one from clojars?

23:39 duck1123: daaku: do lein pom; mvn dependency:tree

23:40 or just exclude contrib on a project-wide level and see what breaks. :)

23:52 daaku: duck1123: perfect! dependency tree is exactly what i wanted

23:58 leo2007: folks, I want to use fuzzy completions in slime. for a fully-qualified symbol I can only complete to the namespace such as swank.core/ but swank.core/break.

23:58 Ideas?

Logging service provided by n01se.net