#clojure logs

2011-11-11

00:15leo2007how does `lein run' work?
00:18technomancyleo2007: it finds the given -main function and applies it to the arglist you supply
00:18leo2007technomancy: thanks.
00:21technomancysure
00:25cemerickit was only a matter of time, I guess: https://twitter.com/#!/fakerichhickey
00:27leo2007technomancy: what happens when `lein swank'?
00:28bhenryleo2007: lein help swank
00:29leo2007I want to know how it is done?
00:29leo2007because I might need to tweak it.
00:30leo2007for example, I want it to start a http server too.
00:35bhenryleo2007: https://github.com/technomancy/swank-clojure/blob/1.3.x/src/leiningen/swank.clj
00:38leo2007bhenry: thanks
00:57leo2007technomancy: How can I teach lein swank to also starts a http server? I am on a noir project.
00:57tensorpuddingi think that is what lein-noir does
00:57tensorpuddingnot sure
00:58technomancyleo2007: 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
00:58technomancyyou may be able to automate it to run when the swank server launches though; lemme see
00:58leo2007technomancy: thanks.
00:59technomancyif 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
01:00leo2007is :repl-init-script deprecated?
01:00technomancyhm... it may be; I think :repl-init is preferred
01:00leo2007I used :repl-init to load the server namespace.
01:00technomancyyeah, that will load the code but not call the -main function for you
01:02leo2007Then, is it normal to call -main in server.clj?
01:03technomancyit's typically avoided since it's nice to be able to load a file like that without having any side-effects
01:04technomancybut this is a good use case arguing in the opposite direction
01:04technomancyhmmm
01:04leo2007technomancy: or if :repl-inti can accept a form to eval
01:05technomancyyeah, that would work too
01:05duck1123I prefer to have my -main launch both the http and swank servers. That way lein run gives me everything I need
01:05technomancyI could probably come up with a better solution except it's nearly 1am here
01:06technomancyduck1123: yeah, that is especially nice if you're using swank in production
01:06technomancythen you can just use lein run
01:07leo2007ok, for now I will use the second method.
01:07duck1123It's also nice because then all my namespaces are required and ready for C-c M-p
01:08leo2007some people put the dependency as [swank-clojure "1.4.0-SNAPSHOT"] some as [org.clojure/swank-clojure "1.4.0-SNAPSHOT"]
01:08leo2007what are the differences?
01:08duck1123the first is right
01:08cemerickthere's an org.clojure/swank-clojure?!
01:09duck1123cemerick: probably in someone's local repository
01:10leo2007how to find out the group-id?
01:10leo2007duck1123: see sample.project.clj
01:10duck1123swank-clojure is the same as swank-clojure/swank-clojure
01:11leo2007what is group-id?
01:11technomancycemerick: I accidentally squatted on org.clojure when clojars first launched
01:13cemerickthese things happen ;-)
01:13technomancyespecially in a mosh pit
01:14duck1123It would probably make sense to go through and update the example dependencies to the latest stable-ish versions
01:15leo2007technomancy: why isn't swank-clojure defaults to clojure 1.3.0?
01:16technomancyleo2007: clojure 1.3.0 didn't exist when swank was released
01:16duck1123leo2007: if you want 1.3, do lein swank in the context of a project with 1.3 declared
01:17leo2007ok
01:17leo2007just curious.
01:17duck1123outside of a project, lein swank is going to use whatever lein is using
01:18duck1123as a side note, be careful of dev dependencies that want to use 1.3
01:21leo2007duck1123: thanks
01:25leo2007another annoyance is that defproject is available? this makes it difficult to see its doc-string while tweaking.
01:27duck1123I'm not sure I understand what you mean
01:30leo2007for example, I launch the swank server, connect to it and defproject is not available.
01:31duck1123is it when you start swank outside of a project?
01:32duck1123I suppose I modify the project so infrequently, and then in such common ways that that has never bothered me
01:33duck1123the swank server runs with the project's code with the projects clojure, so the class path doesn't include leiningen or it's dependencies
01:34leo2007duck1123: I can live with it.
01:35leo2007Can http://clojuredocs.org/ produce documentation in info format for use in emacs?
01:37duck1123It's not quite the same, but you can C-c C-d C-d on a var to get it's docs
01:43leo2007alright.
02:48leo2007duck1123: do you use fuzzy completion in slime?
02:54leo2007which seems broken for me.
03:40Blktgood morning everyone
04:15clgvhmm 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?
04:18clgvexporting them as pdf via inkscape doesnt work :/
04:21clgvok firefox works when opening it manually
04:29aperiodicquestion: is it possible to find the "cycle" fn using lazybot's findfn?
04:30aperiodichow do i specify i want my output to be infinite and lazy?
04:32jliaperiodic: use lazy-seq. as for infinite, well, that depends on how you write your function.
04:32tomojit's not possible
04:36aperiodicjli: not how to write such a function, how to find one that has those properties using lazybot
04:37tomojhow would you specify the desired infinite seq? and if you could, how could lazybot check for equality?
04:37jliaperiodic: you could look at functions in clojure.core that return infinite sequences: repeat, repeatedly, iterate
04:37jlicycle
04:38jlirange
04:38aperiodictomoj: yeah, you're right. i guess it would take some sort of metadata on the fn
04:38tomojif 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
04:39aperiodicyeah, that's how i test it in the repl
04:39aperiodicit's not a huge deal, i was just curious
04:41aperiodicor if you could comp the fns that are being searched?
04:42aperiodicthat wouldn't be too hard to do, and would probably have other benefits besides
04:44BorkdudeHow are the neat clean slides at clojure_conj being made?\
04:46clgvBorkdude: you may find out when you have a look at the properties view of your pdf reader- Stuart Sierra used Keynote it seems
04:49Borkdudeah right, keynote
04:49BorkdudeI'm messing around now with the beamer package and latex
04:50clgvBorkdude: I often user latex+beamer as well
04:50clgv*use
04:51Borkdudeclgv: what do you use for code highlighting?
04:51clgvBorkdude: I didn't do any code related talks.
04:53BorkdudeI use minted for it, it works quite well (also for Clojure)
04:53clgvgotta look that up
04:55clgvBorkdude: the output looks nice. whats your experience with it?
04:56BorkdudeI have started to use it in normal documents and slides
04:56Borkdudeworks better than the other listings package I think
04:57BorkdudeI mean, it has better highlighting, but it might be less stable, haven't run into any issues though
04:58clgvah, it's working with the -shell-escape option to call pygments
04:58Borkdudeclgv: yes
05:09clgvBorkdude: I'll keep that one in mind.
05:10tsdhtechnomancy: 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.
05:48algalSpeaking 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.
05:48nybbleshello, 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?
05:49nybbleson emacs.. with slime repl and leiningen and all that stuff
05:49nybblesi mean i have slime and leiningen already installed :)
05:49algalnybbles: Our own technomancy had a shout-out for something called clj-stacktrace ( http://technomancy.us/154 ), but that's all I know about it.
05:52nybblesalgal: thanks! hopefully i can find what i need there
05:52algalnp
06:01nybblesso it looks like clj-stacktrace only works from lein repl.. does anyone know how to get it working in the slime repl?
06:01nybblesi.e. if i connect to a server started with lein swank
07:26lnostdalisn't deftype something isa? can work with?
07:26lnostdalor, i mean, i have a deftype that implements several protocols .. "is" not that deftype one of those protocols?
07:26lnostdalany one*
07:44tsdhlnostdal: Yes, isa? should work with deftypes.
07:44lnostdalok, what about protocols? .. is it possible to determine what protocols something implements?`
07:49tsdhlnostdal: Oh wait, I was wrong. (isa? MyTypeExtendingMyProt MyProt) actually returns false
07:49tsdhlnostdal: It works for interfaces, though.
07:56babilenlnostdal: Are you looking for extends?
08:01raekthere is also 'satisfies?'
08:02raek,(class Runnable)
08:02clojurebotjava.lang.Class
08:02raek,(defprotocol Foo)
08:02clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
08:03raekanyway: (class Foo) => clojure.lang.PersistentArrayMap
08:03raekFoo doesn't evaluate to a class
08:04raeklnostdal: anyway, you want to use satisfies? to check whether you can call the protocol methods on an instance
08:08technomancynybbles: getting clj-stacktrace in slime would mean hacking up swank-clojure, which nobody's done yet.
08:09technomancytsdh: good call
08:12BorkdudeI 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.
08:13BorkdudeI'm using lein swank
08:13Borkdudeand emacs with slime-connect
08:14BorkdudeI'm sorry, the test dir is test/twitter-utils/test/...
08:16BorkdudeI'm getting: Could not locate twitter_utils/test/fixtures__init.class or twitter_utils/test/fixtures.clj on classpath:
08:16Borkdude
08:17clgvBorkdude: try prepending "test."
08:18raekBorkdude: where the namespace name has a - in it, the corresponding file path should have a _
08:19raekBorkdude: rename the twitter-urils/ directory to twitter_utils/
08:21Borkduderaek: it is already named thusly
08:21Borkdudealso the test dir is on the classpath and the core.clj can be found properly
08:21Borkdudeonly fixtures.clj which is on the same level cannot be found somehow
08:22BorkdudeI hope it's not smth stupid like a typo
08:22raekwhat does the require form look like?
08:24raek(:require twitter-utils.test.fixtures) ?
08:25raekBorkdude: also, did you create the test directory _after_ you started the clojure instance?
08:25Borkduderaek: https://gist.github.com/1357979
08:26Borkduderaek: no, the directory was already there and I have restarted lein swank just to be sure
08:28raekand the path to the fixture file is "test/twitter_utils/test/fixtures.clj"?
08:29BorkdudeWhat the hell, I'm sorry... it's fixed. Smth stupid like I assumed.
08:41tsdhtechnomancy: thx
09:44TimMcBorkdude: What was the problem?
09:44TimMcI mean, the solution.
09:57BorkdudeTimMc: too embarrasing
09:57TimMcThen how will anyone else learn from your mistake?
09:57BorkdudeIs it possible in Midje to see the actual value instead of just true or false from a fact, when using some provided clausules?\
09:57BorkdudeTimMc: ok, but don't laugh
09:58TimMcI've made so many stupid mistakes with build systems, I can guarantee this isn't worse.
09:58BorkdudeTimMc: I guarantee this one is worse
09:58TimMcok
09:58TimMcwrong machine?
09:58BorkdudeTimMc: I forgot to save the emacs buffer to an actual file on disk...
09:58TimMcOh man, happens to me all the time.
09:59BorkdudeReally? What a relief ;)
10:01TimMcBorkdude: I've been in the wrong directory, or haven't *exported* the shell variables I set, or not pulled down the latest source...
10:02clgvis there any way to tell if a java class is a defrecord?
10:02TimMcReal examples from the past two months.
10:04TimMcclgv: Nothing official I think.
10:06clgvthe kryo serialization gets an hiccup with it, since it implements IMap but does not support put
10:09TimMc#{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:09TimMc(Used ancestors on a defrecord.)
10:11clgvwell, then you could say if it is a Map & IPersistentMap & IObj but non of the clojure maps then it is a defrecord
10:16TimMcMost likely, but not for sure.
10:16clgvhmm, I'll have to handle that differently :/
10:16TimMcYou can tell it is a Clojure object of some sort, of course.
10:16TimMcclgv: What's the serialization problem?
10:17clgvby default it tries to call .put on a defrecord
10:23algal_Hello, Clojurians. Has anyone here had good/bad experiences trying to use Clojure + Google App Engine + Vaadin?
10:23algal_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:27biallymI 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:27Raynes$karma amalloy
10:27biallymAny pointers?
10:27lazybotamalloy has karma 19.
10:28clgv$karma Raynes
10:28lazybotRaynes has karma 7.
10:31tensorpuddingwhat's a native library?
10:32TimMc(inc Raynes)
10:32lazybot⇒ 8
10:33TimMc(dec lazybot)
10:33lazybot⇒ 1
10:33clgvtensorpudding: a binary library e.g. compiled from c/c++ which can be used via JNI
10:33TimMc(catching up)
10:33clgv(inc Raynes)
10:33lazybot⇒ 9
10:33clgv(dec TimMc)
10:33lazybot⇒ 3
10:33clgv;)
10:33TimMchaha
10:33TimMcclgv: Why does it try to call put?
10:33TimMcdeserialization?
10:34tensorpuddingoh
10:34clgvyes. I do investigate what information a custom serializer gets right now
10:34TimMcclgv: How does it handle Java's unmodifiable maps?
10:35clgvTimMc: whats their name?
10:35TimMcclgv: Dunno. http://download.oracle.com/javase/1.4.2/docs/api/java/util/Collections.html#unmodifiableMap%28java.util.Map%29
10:36TimMcclgv: Maybe the answer is to have Clojure defrecords do their own serialization.
10:36clgvreading the javadoc of Map I guess not welol ;)
10:38gfrederickskarma's back up?
10:40TimMc$karma gfrederick s
10:40lazybotgfrederick s has karma 0.
10:40TimMcurgh
10:40biallymI 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:40TimMcI meant to put the zwnbsp in there, not the nbsp.
10:40gfredericks$karma gfredericks
10:40lazybotgfredericks has karma 4.
10:41gfredericksoh nice
10:41gfredericks(inc Raynes)
10:41lazybot⇒ 10
10:41gfredericksTimMc: you're a terrible person.
10:42clgvit's so silent in the conj channel. nothing interesting happening over there?
10:42biallym(I also come from a lisp background not a Java background so I'm learning as I go
10:42bhenryclgv the internet sucks at the conj
10:43lucianbiallym: if you want GL, lwjgl is a one-stop shop
10:43raekbiallym: I think support for native-deps is included in leiningen nowadays
10:43lucianbiallym: if you're interested in a C FFI, the easy one is JNA. JNI is the code-generation-sucky one
10:45biallymlucian: 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:45TimMcgfredericks: This is true.
10:45lucianbiallym: right
10:46biallymraek: oh well that would explain some things >.>
10:46lucianbiallym: i wasn't sure if you wanted to write a binding or just use one
10:46biallymlucian: I want to use a binding that doesn't assume I only want to do basic operations
10:48lucianbiallym: 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:49biallymlucian: I don't want to change them I just want to package them >.>
10:50biallymand my attempts so far have failed miserably
10:50luciani see
10:50lucianthey're hard to package in general, even without clojure
10:53biallymI 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:53lucianyou should be able to, yes
10:57andrewcleggyo. what's the idiomatic way to get just the nth item in a sequence?
10:57TimMcnth
10:57andrewcleggoh :-)
10:58TimMc:-)
10:58andrewcleggthanks
11:08babilentechnomancy: 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:08technomancybabilen: oh, good point
11:09TimMctechnomancy: You said that you're waiting until lein 2.0 to default to 1.3?
11:09TimMc(in project.clj files)
11:09technomancyTimMc: I actually went ahead and bumped it already.
11:09TimMchaha, OK
11:10clgvTimMc: custom serialization with reflection did the trick :)
11:10TimMcDOes that mean that lein repl outside a project will be 1.3?
11:10technomancyTimMc: oh, sorry; I meant for new project.clj files
11:10TimMcOK, but not the vanilla repl?
11:10technomancyright
11:11TimMcgot it
11:11babilentechnomancy: 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:12technomancybabilen: I'll need to check to make sure all my bin/lein changes that are relevant get ported
11:12babilentechnomancy: yeah, we should synchronise that :-/
11:16technomancybabilen: it shouldn't be too bad
11:17TimMctechnomancy: Is the repl/new project version difference on purpose, or is it just that you bumped one and not the other?
11:17technomancyTimMc: I can't upgrade Leiningen's Clojure version without breaking tons of existing plugins.
11:18technomancylots of plugins use monolithic contrib
11:18TimMcAh, the project-less repl is run from lein's own JVM?
11:18technomancyyeah
11:18TimMcmaybe it should run from a special "singleton" porject
11:18technomancyor you could create a singleton project
11:18TimMcor maybe I should drop a project.clj in my ~
11:19technomancyrunning in lein's JVM is significantly faster to start
11:19TimMchmm
11:19TimMcBecause then only one JVM has to start?
11:19technomancyyup
11:33technomancybabilen: pushed changes to bin/lein-pkg
11:42babilentechnomancy: Looks good
11:43technomancybabilen: I'll try to do a few tests on my sid vm before tagging the release
12:24ibdknoxthose have been around for a long time
12:25biallym_Warcraft 3 had a cool editor kinda like that
12:25biallym_made it really easy to make custom games in it
12:25ibdknoxlego mindstorms had a similar interface as well
12:26biallym_We also use that language specifically in our "Cool stuff about CS class"
12:26ibdknoxthough there were many attempts to build real structured editors over the years
12:26ibdknoxfor general purpose programming
12:26technomancydpritchett: see also http://www.istartedsomething.com/wp-content/uploads/2009/07/kodu6.jpg
12:26ibdknoxnone of them were very successful
12:26dpritchetti love the idea of scratch, i was just disheartened by the manual list iteration
12:27dpritchettis that something a 9 year old needs to worry about?
12:27ibdknoxhaha
12:27ibdknoxyeah
12:27biallym_I would say warcraft 3's was successful
12:27ibdknoxbiallym_: sorry, I meant general purpose ones
12:27dpritchettMy 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:28licenseribdknox: have you had experience with the closure GUI elements and cljs?
12:28biallym_Yea I know what you meant, just saying, in certain circumstances they have been
12:28ibdknoxlicenser: no, I've never liked components
12:28ibdknoxbiallym_: I have no doubt, I suspect in the right domains they're really awesome :D
12:29biallym_I think seesaw is an exccellent idiomatic clojure gui library if you were looking for one
12:29licenserso self coding everything?
12:29biallym_yea warcraft 3 also let you put in arbitrary ECMA script
12:29biallym_at any point
12:29ibdknoxlicenser: for designed websites, that's all you can do :)
12:29biallym_if it had the idea of a macro it would have been even cooler
12:30licenseribdknox: heh
12:32mjwhittdpritchett: 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:32gtrak``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:32dpritchettI'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:32duck1123I got my son playing around with irb as a way to play with math and numbers. I figured I could go from there
12:33dpritchettShe does have a little solar calculator that she likes, and we did a "typing in pico" session once just for fun.
12:33technomancyI 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:34mjwhittyeah, actually programming comes later... but you can lay the foundation for it earlier
12:35gfredericksmy son puts everything in his mouth and soils his diapers.
12:35dpritchettShe 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:35ibdknoxthe incredible machine was so awesome
12:35dpritchettI like to think that will help her with cause and effect, physics, and construction. Maybe I should just get some building blocks instead.
12:35mjwhittwhen I was a kid, learning math, my dad showed me bit by bit how binary worked, and I really enjoyed it
12:36mjwhittI liked encoding secret messages in different bases
12:36mjwhittI felt like a top secret spy, haha
12:36mjwhittgfredericks: your son might be a bit young still ;)
12:37gfredericksmjwhitt: I successfully resisted trying to tie my previous comment in to emacs somehow.
12:37mjwhitthehe
12:37duck1123gfredericks: 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:38mjwhittmm, off to bbq lunch
12:38gfredericksduck1123: 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:39tensorpuddinghow do i get bignums?
12:39TimMctensorpudding: +', *', etc.
12:39TimMctensorpudding: Or do you mean literals?
12:40gfredericks&(type 123N)
12:40lazybot⇒ clojure.lang.BigInt
12:40TimMc,(class 42N)
12:40TimMcbah
12:40clojurebotclojure.lang.BigInt
12:40duck1123,(map class [1N 1M])
12:40clojurebot(clojure.lang.BigInt java.math.BigDecimal)
12:40tensorpuddingokay, N was what i want
12:40gfredericksisn't there a syntax for BigInteger as well?
12:40gfredericks,(prn (new BigInteger "239"))
12:40clojurebot239
12:40gfrederickshrm
12:40TimMcgfredericks: c.l.BigInt replaces j.m.BigInteger
12:40tensorpuddingis there docs for literals somewhere
12:41TimMctensorpudding: the reader
12:41TimMcclojure.org/reader I think
12:41gfredericksTimMc: it doesn't do everything though...
12:41tensorpuddingi thought that only documented the other reader macros
12:41tensorpudding' ` ~ @ ~@ etc.
12:41TimMctensorpudding: It is *supposed* to document all the syntax.
12:42TimMcbut it is not complete.
12:42tensorpuddingit just refers to Integer.parseInt()
12:42tensorpuddingit mentions M for making BigDecimals i guess
12:43TimMcUgh, so out of date.
12:44biallym_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:45biallym_(solution for doing that in clojure) I am copying over some java code >.>
12:47biallym_ok so yea I was right... I hate syntax
12:48raekbiallym_: yes. proxy is suitable for this kind of java interop.
12:52biallym_(inc raek)
12:52lazybot⇒ 11
12:52biallym_hehe
13:04duck1123Does this error make sense to anyone? lamina.core.pipeline.ResultChannel cannot be cast to lamina.core.pipeline.ResultChannel
13:14TimMcduck1123: That's usually a dirty JVM/compiled code issue.
13:14Borkdudebiallym_: you are forgetting two ()'s
13:15Borkdudebiallym_: new InterfaceClass() { public blah functionName (blah)
13:15Borkdude {code} }
13:15TimMcduck1123: 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:15Borkdudeany midje proficient people in here?
13:15biallym_I don't program java so >.>. In lisp an extra set () rarely means anything :P
13:16Borkdudebiallym_: in Lisp it means a lot, an extra function to be called most of the time ;)
13:16duck1123TimMc: I'm doing a clean install to see if I still get it
13:17biallym_nil and () are usually considered equal >.>
13:17TimMcduck1123: I'll see if I can dig up the error I was having.
13:17TimMcbiallym_: not quite...
13:18Borkdudebiallym_: not in clojure
13:18Borkdude&(= nil '())
13:18lazybot⇒ false
13:18biallym_I know not in clojure, and I blame java for that, oh never mind I was making a bad joke anyways >.>
13:19TimMcduck1123: https://gist.github.com/899696
13:19tensorpudding&(empty? nil)
13:19lazybot⇒ true
13:19tensorpuddinghuh
13:21tensorpuddingso nil isn't '()
13:21tensorpuddingbut it's a collection?
13:21Borkdude,(doc empty?)
13:21clojurebot"([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:21brehaut tensorpudding ##(coll? ())
13:21lazybot⇒ true
13:21raek() is the empty persistent list
13:22duck1123,(seq nil)
13:22clojurebotnil
13:22Borkdude,(empty? \a)
13:22clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Character>
13:23Borkdude,(type nil)
13:23clojurebotnil
13:23Borkdude:)
13:23tensorpudding&(assoc nil :a 5)
13:23lazybot⇒ {:a 5}
13:23raek,(map class [() nil (conj () 1) (conj nil 1)])
13:23clojurebot(clojure.lang.PersistentList$EmptyList nil clojure.lang.PersistentList clojure.lang.PersistentList)
13:25biallym_so atleast nil is '() [If not the other way around)
13:25Borkdude,(count nil)
13:25clojurebot0
13:26tensorpuddingwhat's the difference between lazybot and clojurebot
13:26Borkdudebiallym_: maybe the answer should be: in some ways yes, in others no
13:26biallym_one likes fancy symbols?
13:27biallym_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:28Borkdudebiallym_: you mean a common lisp standpoint?
13:28biallym_or scheme or arc
13:29tensorpuddingmost of the ways that clojure differs from the other lisps i've used, i rather like
13:30Borkdudebiallym_: I'm sure you have read this? http://clojure.org/lisps
13:30biallym_I like all the steps forwards, I can deal with the cost of some lisp idioms
13:30brehaut,*clojure-version*
13:30clojurebot{:major 1, :minor 3, :incremental 0, :qualifier nil}
13:30biallym_yes
13:30biallym_&*clojure-version*
13:30lazybot⇒ {:major 1, :minor 3, :incremental 0, :qualifier nil}
13:36biallym_,(ns-name *ns*)
13:36clojurebotsandbox
13:36biallym_&(ns-name)
13:36lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: core$ns-name
13:36biallym_&(ns-name *ns*)
13:36lazybot⇒ sandbox16763
13:36biallym_hmmm
13:37brehautthe 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:37biallym_,(all-ns)
13:37clojurebot(#<Namespace user> #<Namespace clojure.core> #<Namespace sandbox> #<Namespace clojure.repl> #<Namespace clojure.java.io> ...)
13:37biallym_&(all-ns)
13:37lazybot⇒ (#<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:37biallym_ok I like lazy better >.>
13:38brehautgiven you can use and require namespaces, im not sure how thats relevant
13:38tensorpuddingi guess lazybot has more modules
13:39biallym_actually I was basing it off of the gist support for long quereys
13:39brehauthttps://github.com/flatland/lazybot/ http://github.com/hiredman/clojurebot tensorpudding you can stop guess
13:40brehauting
13:40biallym_And that reinforced my choice :p
13:42biallym_how do you type hin the return of an fn?
13:46brehaut(fn ^type […] …) or (defn name ^type […] …) i believe
13:48brehautbiallym_: and use *warn-on-reflection* to find the locations where you need to type hint rather than guessing
13:48brehaut(lein has a project wide flag for it too)
13:51biallym_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:51brehautyou can always typehint an expression as needed too
13:52brehaut(.method obj ^type (foo bar))
13:52biallym_is there a way to do function types?
13:53brehautbiallym_: depends what you mean, and where you want to send the function
13:54brehautbiallym_: probably you want clojure.lang.IFn, or perhaps clojure.lang.Fn ?
13:56brehautbiallym_: if you mean like haskell or dotnet parametric function types then no, because they dont really exist in the jvm
13:56biallym_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:56brehauti dont believe so
13:56biallym_I'm more just playing with the limits clojure
13:57biallym_limits of*
13:57brehautthats a limit of the jvm i believe
13:57biallym_How is that translating to clojure though?
13:58biallym_Clojure's compiler is doing the type hinting why can't it type hint one of it's own types?
13:58brehautbiallym_: you can hint a specific function
13:58biallym_but I can't type hint a variable of a function that is expected to be a function
13:59biallym_(Beyond the knowledge that it is a function)
13:59brehautim running out of my knowledge of the hinter
14:00biallym_besides as I understand it, type hinting is only for optimization not for any sort of safety
14:00brehautindeed
14:01biallym_interesting
14:02brehautunfounded assertion: static mutable types are a weaker invariant than dynamic but immutable types
14:03brehautpoor english aside
14:04gfredericks"dynamic" and "immutable" is a weird juxtaposition.
14:05brehautgfredericks: i think i mean variables
14:05gfredericksi.e., programming is fun.
14:05brehaut,(juxt dynamic immutable)
14:05clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: dynamic in this context, compiling:(NO_SOURCE_PATH:0)>
14:07gfredericksI've got half a mind and not enough time to add documentation to unk.
14:25duck1123On 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:25ibdknoxalso this: http://cdsmith.wordpress.com/2011/09/10/haskell-for-kids-week-4/
14:33gfredericksI 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:34gfredericks(i.e., I would be testing a class that only would exists in the test code)
14:35tensorpuddingdon't teach kids lisp, they'll be scarred for life :P
14:36duck1123tensorpudding: Do you really think so? If you raise your kids on lisp and functional programming, they'll never know any different.
14:37tensorpuddingit was a joke
14:38gfredericksduck1123: with much wisdom comes much sorrow
14:39TimMc'strue
14:40TimMcThey'll be depressed.
14:41jodaro`i've tried to get my kids into a little ruby/python
14:41jodarowithout much success heh
14:41mefestokids raised on nothing but lisp and functional programming are spoiled
14:41BorkdudeI'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:42BorkdudeLooks like this: https://gist.github.com/1358984
14:42duck1123"when I was your age, we had to number our lines by 10"
14:42BorkdudeThe test is in a different namespace btw, might it matter
14:42Borkdudeduck1123: haha, indeed... GW Basic is how I started
14:43gfredericksWhat's wrong with (set! *compile-files* true)?
14:43duck1123I still have my Atari XE. I had to leave it turned on because I had no way to save my programs
14:45Borkdudeduck1123: is it still on? ;)
14:46duck1123That would be insane. To have it still running my prime finder from high school
14:47duck1123especially cosidering the number of times I've moved since then
14:53gfredericksduck1123: those primes would be worth a lot of money now
14:55gfrederickshmmm....maybe it's better to use a deterministic algorithm to get the unique symbols for a gen-class
14:57mdeboard$google sha-1 and java
14:57lazybot[JavaBlogging » SHA1 and MD5 checksums in Java] http://www.javablogging.com/sha1-and-md5-checksums-in-java/
14:57mdeboard:o
14:57seancorfieldis there a function that behaves like (fn [v fs] (map (fn [f] (f v)) fs)) ?
14:58TimMcseancorfield: juxt
14:58ibdknoxseancorfield: ((apply juxt fs) v)
14:58TimMcyesssss
14:58seancorfield+1 TimMc
14:59ibdknox,((apply juxt [even? odd? nil?]) 3)
14:59clojurebot[false true false]
14:59seancorfieldthat is certainly nicer than the basic map approach
15:00ibdknoxnon-lazy though
15:00ibdknoxnot sure if that matters
15:00TimMcmm
15:01gfredericksnot hard to define lazy-juxt
15:01seancorfieldand is there a function that behaves like (fn [v f] (f v)) ?
15:01gfredericksaka lust
15:01gfredericksseancorfield: #(%2 %1)
15:01ibdknoxseancorfield: huh?
15:02TimMc,(first ((juxt inc println) 4))
15:02clojurebot4
15:02clojurebot5
15:02adamhwin 7
15:03ibdknoxhm
15:03ibdknoxso it *is* lazy?
15:03ibdknoxno
15:03ibdknox&(first ((juxt inc println) 4))
15:03lazybot⇒ 4 5
15:04seancorfieldjust playing with expressions and wanted something point-free
15:05TimMc (first ((apply juxt (conj (vec (repeat 500 inc)) println)) 4))
15:05TimMc,(first ((apply juxt (conj (vec (repeat 500 inc)) println)) 4))
15:05clojurebot4
15:05clojurebot5
15:05ibdknoxlol
15:05TimMcugh
15:05TimMc(checking for chunked seqs)
15:05ibdknoxyeah
15:09TimMc(letfn [(juxt [& fs] #(map (fn [f] (f %)) fs))] (first ((juxt inc println) 4)))
15:09TimMc,(letfn [(juxt [& fs] #(map (fn [f] (f %)) fs))] (first ((juxt inc println) 4)))
15:09clojurebot5
15:10TimMcSo... why isn't juxt lazy?
15:10TimMc$source juxt
15:10lazybotjuxt is http://is.gd/QuCLxF
15:10ibdknoxit says it returns a vector
15:10TimMcah
15:10ibdknox,(doc juxt)
15:10clojurebot"([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:10TimMcconvenient for (into {})
15:10ibdknoxyep
15:14TimMcOh, it is also optimized for 1–3 fnsor vals
15:14ibdknoxTimMc: I'm confused by the results of your experimentation
15:14ibdknoxthat should have printed all of them out, right?
15:14ibdknoxlooking at the code for juxt
15:14TimMcprintkl'd?
15:14TimMc*println
15:15TimMcI'm having keyanboard troaluble today.
15:15ibdknoxoh, I read your form wrong
15:15TimMcfirst
15:18TimMcBy 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:25bhenryTimMc: it seems that irc and gchat are the only things that work over the shitty wireless for me
15:27TimMcI saw some people struggling to stay connected -- I assume they were using local clients.
15:27bhenryeven when my browser can't connect, i can still chat mostly fine.
15:28mjwhittyeah, we've got 6 people sharing a cell's access point
15:28TimMcyup
15:30TimMcI 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:31brehautTimMc: im sorry to hear that
15:31TimMcI'd like to convert the JSPs into Clojure + Enlive. Is there a way to make .clj coexist with the Java servlets?
15:32brehautTimMc: theres a ring servlet adapter
15:32TimMcbrehaut: This is more of a build issue.
15:32TimMcSpecifically, 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:33TimMcAnd all this is managed by Maven, of course.
15:33duck1123TimMc: You'll probably need to break it up into multiple projects/modules if you want to refer to compiled clojure code from java
15:33TimMc:-(
15:34TimMcWe already have... 44 projects in this tree.
15:34brehautwhats one more :(
15:34duck1123,(inc 44)
15:34clojurebot45
15:34TimMc:-P
15:34brehautthanks duck
15:34duck1123I'm here to help
15:36TimMcI'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:37TimMcor should I be looking at using RT from Java to access teh Clojure stuff?
15:38aperiodicTimMc: i believe there's a way to get lein to compile java for you
15:39aperiodicTimMc: https://github.com/technomancy/leiningen/blob/1.x/sample.project.clj#L161
15:39duck1123lein 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:40aperiodicoh, I see, you want that to happen *while* compiling Clojure
15:40aperiodicsounds messy
15:41TimMcaperiodic: Or at least have two stages of Java compilation.
15:41TimMcI envision the servlet calling the Clojure code directly, passing in a wad of data to put into HML (via Enlive).
15:42TimMcThat wad of data would probably be custom POJOs that Clojure would want to compile against.
15:43TimMcThat'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:43aperiodicso you'd want to compile the POJOs, compile the Clojure against that, and finally compile the servlet against the clojure?
15:44TimMcyeah
15:44TimMcagainst the clojure and the POJOs
15:44TimMcOption 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:44TimMcThen the Java would be compiled first and the Clojure would come along as source.
15:44TimMcI may have just talked myself into option 3. :-)
15:45duck1123TimMc: Why not use gen-class in clojure and give the java code a nice api to work with?
15:45mbacso is there some company out there that desperately wants to hire a hundred clojure programmers
15:45aperiodicyeah, gen-class would work
15:46TimMcduck1123: Because that involves compiling Clojure first, then Java against it.
15:46TimMcwhich is Option 1.
15:46TimMcand that involves two-step Java comp.
15:47aperiodicI think you could do the final java compilation via lein using robert hooke
15:48TimMcCan lein be called from Maven?
15:48TimMcThat's what the top-level build is done in.
15:48TimMcBuild complexity is a top consideration here.
15:50duck1123Could you use some of the dependency injection tools like Guice to inject the clojure classes at runtime?
15:50aperiodicI don't know anything about Maven/Lein cooperation
15:51duck1123I haven't really used Guice much
15:51aperiodicthe three-step compilation would probably get pretty hairy
15:51aperiodiccan you do shell commands in maven?
15:51TimMcduck1123: Good point on dep injection. We already have Spring everywhere. (yuck)
15:52TimMcaperiodic: Yes, but that can be fragile.
15:52duck1123or you could do tricks with Class/forName
15:52TimMcI'm going to try the RT method for now, maybe try Spring later.
15:52TimMcaperiodic: Part of the problem is that I am very ignorant about Maven. :-)
15:53brehautTimMc: thats not a bad thing… ;)
15:53aperiodicTimMc: I'm afraid I'm in the same boat!
16:00jsnikerisI'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:01duck1123`jsnikeris: define a -main function, then specify that ns as the main ns
16:01TimMcWhoa, freaky.
16:01TimMcI just saw your name, jsnikeris.
16:02jsnikerison a web page or something?
16:02jsnikerisduck1123`: I'm looking at the configuration for clojure:run. It looks like I can specify a clojure.mainClass (A java class to run)
16:03jsnikerisduck1123`: is that what you were referring to?
16:03duck1123hold on, trying to mind my old poms
16:03TimMcjsnikeris: On the Enlive Google Group.
16:04jsnikerisduck1123: awesome, thanks. Ah, gotcha. Enlive is great and revolutionary IMO
16:04gfredericksTimMc: do you have special powers over him now or something?
16:04TimMcjsnikeris: While you're here, what did you put in your POM to get the clojure maven plugin?
16:05jsnikerisTimMc: I'm not going to paste it here. You can find it on the github page:
16:05jsnikerishttps://github.com/talios/clojure-maven-plugin
16:05jsnikerisunder "Getting started..."
16:06TimMcjsnikeris: OK, that's what I have.
16:06duck1123jsnikeris: 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:06jsnikerisahhh
16:07jsnikerisduck1123: that makes sense. I'll go with the second option
16:08TimMcjsnikeris: Any extra repos, like clojars?
16:08jsnikerisduck1123: thanks for the help
16:08TimMcThis may be interference from our corporate Maven configuration...
16:08jsnikerisTimMc: if you want to use swank you'll need clojars
16:09TimMcNah, it was complaining about the top thing.
16:09TimMcI bet it's a local config issue. Thanks.
16:10jsnikeristry version 1.3.8
16:10jsnikerisinstead of the SNAPSHOT version
16:10TimMcThere we go!
16:10TimMcThanks!
16:10jsnikerisnp
16:11tsdhDoes anyone generate HTML documentation in a clojure 1.3 project? If so, what tool do you use?
16:11TimMcI infer from your question that Marginalia is 1.2-only?
16:12tsdhTimMc: Isn't marginalia some literate programming thingy?
16:12duck1123marginalia works with 1.3, but every time I've tried it, it fails to extract my doc strings
16:14TimMctsdh: I guess maybe you don't want all your code printed out with your docs... :-)
16:15tsdhMarginalia 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:17TimMcah
16:17TimMcF3 :-)
16:22licenserI'd have another question clojurescript, how do I get a JS array out of a seq?
16:23yodainheelsgreetings dweezils
16:23tsdhHm, 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:23yodainheels@conj
16:25duck1123tsdh: try updating lein maybe?
16:25TimMctsdh: It or the compiler is expecting a name where there's a function's named args list, no doubt.
16:27tsdhduck1123: It's the newest version.
16:28tsdhTimMc: What's a named args list?
16:28TimMcMe stumbling over words.
16:28TimMcIt's the [a b c] in (fn [a b c] ...)
16:28TimMcbindings
16:28TimMcformals?
16:29tsdhTimMc: I know what an arg list is. ;-)
16:31scottjtsdh: autodoc doesn't do what you want?
16:31tsdhTimMc: 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:31tsdhscottj: It errors, presumably because it's not adapted to 1.3 yet.
16:32scottjtsdh: I thought autodoc was used to create api docs on clojure.org, which are for 1.3
16:32tsdhscottj: (although the clojure docs itself are said to be generated by it, but I have no clue how)
16:32duck1123tsdh: I use 1.3, and it runs for me. (although it doesn't extract docstrings appropritely)
16:33tsdhduck1123: Really? How do you use it and what version?
16:33duck1123I just tried using autodoc on my project, and that didn't work though
16:34duck1123tsdh: I'm using 0.6.1 installed via lein plugin install
16:34ibdknoxI drop my project down to 1.2.1 real quick
16:34ibdknoxand then run autodoc
16:34ibdknoxlol
16:34duck1123ibdknox: and that works?
16:34ibdknoxyep
16:35jsnikerisduck1123: 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:35ibdknoxspecifically I use this auto-doc: [org.clojars.rayne/autodoc "0.8.0-SNAPSHOT"]
16:37duck1123jsnikeris: mvn resources:resources might do it for you
16:38tsdhHm, 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:39tsdhAh, no. It just lists the files it's going to parse at the beginning...
16:40duck1123try resource:process-resource ?
16:42tsdhHey, wow! One of the 5 files of my project is marginalia-ready!
16:43TimMcHmph. Maven can't seem to find enlive on any repos...
16:44duck1123TimMc: do you have clojars listed? Leiningen adds it by default, but maven does not
16:45TimMcIt can't find it there either.
16:46duck1123TimMc: it's there http://clojars.org/repo/enlive/enlive/
16:47TimMcyeah...
16:47TimMc"Unable to find resource 'enlive:enlive:jar:1.0.0' in repository clojars (http://clojars.org/repo/)&quot;
16:47TimMcfascinating
16:49duck1123ibdknox: I got a NoClassDefFoundError on every ns when I tried to run autodoc against my project
16:49ibdknox:(
16:49ibdknoxduck1123: it's what I use for noir/korma
16:51licenser,(doc doto)
16:51clojurebot"([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:51duck1123It seems this project truly is incompatible with clojure < 1.3
16:52scottjis rich speaking now? has he mentioned what his topic will be yet?
16:53mjwhitthe's talking about ideas for the future
16:57zms(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:58ihodeszms: you mean, filter the list for a map that matches the given map?
16:59zmsihodes: yes, the map whose key value matches the one provided
17:00ihodesso 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:00ihodesto 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:01zmsihodes: very close. I give 1 and it returns {:A 1}
17:01ihodesah right, you did say value. same idea though; have you looked at 'filter?
17:01TimMczms: by checking what the value associated with :A is?
17:01zmsTimMc: Yes
17:01tensorpudding&(filter (fn [map] (= (:A map) 1)) [{:A 1} {:B 2} {:C 3}])
17:01lazybot⇒ ({:A 1})
17:02TimMc,(first (filter #(= 2 (:A %)) [{:A 1} {:A 2 :B 3} {:A 5}]))
17:02clojurebot{:A 2, :B 3}
17:03tensorpudding&(filter (fn [map] (= (:A map) 3)) [{:A 1} {:B 2} {:C 3}])
17:03lazybot⇒ ()
17:03daniel__what do people here think of racket?
17:03zmstensorpudding, TimMc: Thanks. I'll go try this one. :) (still new to iterating functionally)
17:03tensorpudding&(first (filter (fn [map] (= (:A map) 3)) [{:A 1} {:B 2} {:C 3}]))
17:03lazybot⇒ nil
17:03tensorpuddingah, first returns nil on an empty list, that's good
17:03scottjdaniel__: that it's nice. be more specific if you want a more specific answer :)
17:04TimMcduck1123: Haha... I still haven't solved it, but Maven checks the *corporate* repo but reports that *clojars* doesn't have the artifact!
17:04TimMcOh well. Off to make dinner.
17:04duck1123TimMc: yay! bureaucracy
17:05daniel__scottj: when compared to clojure
17:06zackmarilWhat's the best way to get the image data out of a jpg with clojure?
17:06daniel__do either have anything particularly nice or advantages over the other?
17:07TimMcdaniel__: I'm sure of it.
17:07scottjdaniel__: well clojure has access to all the JVM goodness
17:07tensorpuddingzackmaril, what do you mean by image data? you mean decode it?
17:07TimMcIt's a very general question, though, so you aren't likely to get a satisfying answer.
17:07duck1123zackmaril: There are several good exif libraries for java
17:07tensorpuddingthere's surely a java library that does it
17:07zackmarilI saw this: http://instagram-engineering.tumblr.com/post/12651721845/instagram-engineering-challenge-the-unshredder
17:07tensorpuddingthat you can wrap
17:08zackmarilAnd I thinking "that would be fun to mess around with tomorrow afternoon"
17:08daniel__i might have to give racket a try
17:08zackmaril*I am thinking
17:08daniel__hard to learn compared to clojure do you think?
17:08daniel__or pretty similar
17:09zackmarilProbably just going to wrap ImageJ then.
17:12tensorpuddingi figure racket can't be that hard to learn
17:12tensorpuddingit's got an ide and everything
17:13tensorpuddingit's more traditional than clojure, i reckon
17:13duck1123doesn't haskell have it's own ide?
17:14tensorpuddingleksah
17:14tensorpuddinghaskell is exceptional i guess
17:14daniel__haskell is hard to learn?
17:15ihodesdaniel__: racket is easy enough to learn. what other languages do you know?
17:15daniel__ihodes: mostly OO languages like ruby, python, java
17:16daniel__have been learning clojure, its requires more brain power to work out how to do things
17:16daniel__but i like the end result
17:16tensorpuddingi don't think clojure requires more thought
17:16tensorpuddingexcept in the sense of being unfamiliar
17:17tensorpuddinghaving to look stuff up in the book a lot
17:18daniel__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:18tensorpuddingthere's a looping construct in clojure
17:18daniel__probably because its unfamiliar and im not used to thinking that way
17:19daniel__i think when you read clojure code you have to store more in your head...
17:19daniel__kind of evaluate things like a compiler as you go along
17:20daniel__im sure its mostly unfamiliarity
17:22ihodesdaniel__: yeah, it gets better the more you learn. it's a different way of thinking, and it ends up being easier i think
17:22ihodesdaniel__: 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:23daniel__im not thinking of switching, i plan on using more clojure
17:24daniel__just thought id give it a try
17:24daniel__anyway, tired. nn all
17:25zmsihodes, TimMc: Thanks. That filter based solution worked! (of course, you knew that.) :)
17:26ihodeszms: good :) most of the time filter, map, reduce can do just about whatever you want with lists
17:26ihodesalso, remember remove (removes what you specify, instead of filtering it)
17:27zmsihodes: will do.
17:27zmswhat i'm finding tough is working out how to get things done when i can't modify the data structure..
17:27ihodesthe above functions are your answer :)
17:28zmsi guess. data structures flowing through these functions finally getting into a shape i want. that's how i'm seeing it.
17:29zmsnot sure if that's a right mental model though.
17:29mjwhittnew sport: pod-peeking
17:33pjstadiga pod is a group of dolphins, so a pod group seems redundant
17:34mjwhittyeah but pods are singular in the context
17:36tsdhWhat does one use to traverse directory structures? Plain java.io.File?
17:36duck1123If 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:47taufiqtsdh: 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:48tsdhtaufiq: I've found clojure.core/file-seq which is pretty handy
17:49duck1123c'mon where's the zip filter for file systems?
17:49taufiqthanks, i'll take a look at that
17:56technomancywhat is up with the arg order of <<?
17:56technomancy(<< conj! mypod x) ; <- intentional?
18:02licenseranother 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:05zmsthis works: (update-in (get-item-from-usable "/u1/dbfiles/") [:space :usable] - 1000)
18:06zmsbut when i wrap this in a defn like so: (defn deduct-from-usable [path size]
18:06zms (update-in (get-item-from-usable path) [:space :usable] - size))
18:06zmsthen it doesn't
18:07zmsI call it like so: (deduct-from-usable "/u1/dbfiles" 1000) and it fails with NullPointerException
18:07zmsany hints?
18:08licenserzms: try to run it without the update in first :)
18:09licenserjust to make sure your get items … works correctly
18:09licenserthen add the update in as well
18:09zmslicenser: it works outside of defn
18:09zmsjust wrapping it inside defn seems to make it fail
18:10licenserI read that, but I find it helps to reduce the places where errors can occure
18:10licenserI mean, it clearly shouldn't happen so it's time to find out where something odd happens
18:12zmslicenser: you're right. (get-item-from-usable "/u1/dbfiles/") still works
18:12licenser:)
18:12licenseribdknox: exactly the person I was looking for, my personal cljs expert
18:13zmslicenser: i don't see which parts should i test more.. the next call is to update-in itself
18:15licenserzms: http://pastie.org/2849776
18:15licenserthat is how I would go here
18:15licenseribdknox: had you ever had experience in debugging cljs compilations?
18:16zmslicenser: sorry. i should have done that first thing.
18:16licenserzms: no worries :)
18:24zmslicenser: 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:24zmss/functional/function/
18:24licenserzms: it is a horrible one but it helps when you don't have better tools at hands and the problem is small enough ^^
18:25licenserbut glad I could help
18:26zmslicenser: it's a shame that slime can't jump from stack trace to the the exact source/line of error with clojure.
18:26zmsnot slime's fault though
18:27licenserzms: when you load the file with (use 'bla :reload-all) the stack trace shows the source line
18:27licenserbut the source line isn't much help in a 1 line function ;)(
18:30mindbender1how can I add more than one entry to :dev-resources-path of my project.clj?
18:35zmsmindbender1: i saw this somewhere: :dev-dependencies [[lein-expectations "0.0.1"]
18:35zms [expectations "1.1.0"]])
18:42mindbender1zms: the instruction from ritz says to add src-path-string to :dev-resources-path
18:42mindbender1not :dev-dependencies
18:43mindbender1and I'm trying to add more than one string
18:44mindbender1and I'm getting errors.. so I want information on how to add more than on resource path to :dev-resources-path
18:45zmsmindbender1: may be you've seen leiningen's github page: https://github.com/technomancy/leiningen
19:05licenserI think I found a bug in clojurescript :)
19:35wiseenwhy is acquiring a read lock on ReentrantReadWriteLock so much slower than (locking x), is locking implemented as a spin lock first ?
19:41wiseennvm, turns out calling readLock on the rwlock is actually the slow part, caching that result makes them the same performance :\
19:49wiseenftr. 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:49wiseen*10000
19:54licenserwiseen: that would only be half as funny if you hadn't typed it again ;)
19:55ashafahello
19:56leo2007good morning
19:56ashafaclojurescript question
19:56licenserasenchi: I've them too :) lets combine them ;)
19:57ashafaif i wanted to convert this "var car = new com.honda.Car("black","4wd");"
19:58ashafa...to cljs. How would I write that
19:58ashafa?
19:58licenservar car is a global one?
19:58licenseraside from setting it global it would be:
19:59licenser(def Car (js* "com.honda.Car")); (Car. "black", "4wd")
19:59ashafadoesnt need to be global
19:59licenserthen this should help you :)
19:59bhenrylicenser: wouldn't the second line def into car?
20:00bhenry(def car (Car. "black" "4wd"))
20:00licenserafaik def isn't creating globals
20:00bhenryah
20:01licenserglobals are kind of tricky when I got it right
20:02licenserwhat 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:02ashafahmm is there a way I can do it without defining "Car"
20:02ashafa?
20:02bhenrylicenser: mine would turn into his.namespace.car = ...
20:02ashafaI'm not a big fan of defining globals
20:03licenser*nods*
20:03licenserashafa: no globals
20:03ashafai usually us js/...
20:03bhenryit's just within the namespace
20:03ashafause*
20:03licenseras bhenry points out def is not a global
20:05ashafa:licenser thanks man
20:05ashafabhenry: thanks
20:06ashafaone more question
20:06licensershoot
20:07ashafaare they any advantages to using (js* "window") and js/window?
20:07ashafathan
20:07ashafas/and/than/
20:09licenserI *think* that it ends just as the same
20:10licenser(js* "bla") is just going to translate directly in script
20:14licenserhas anyone worked with macros in clojurescript?
20:25wiseenis there a way to implement keyword access for functions eg. (= (:keyword function) (function :keyword)) ?
20:26licenserwiseen: I think that is a bad idea to do
20:27licensermake the function return a map and use (:keyword (function)) is a good way to go
20:27licenseror just use a mal
20:27licensermap
20:28wiseenlicenser, I'm thinking of using closures as objects - this would allow them to act like it but a good point it's ambiguous
20:31licenserwiseen: what you can do is extend the function class with the interface that implements lookups
20:31licenserbut it will confuse the hell out of everyone reading your code ;)
20:31licenserperhaps look at defrecord?
20:32licenseror was it defprotocol one of the two allowed you to do about that use closures as objects
20:33licensersemi objects at least
20:34wiseenyeah it's a bad design when i think about it for more than a second :)
20:34licenser^^
20:45archaicahh I just upgraded emacs packages and clojure-jack-in broke :| possibly newest slime version is cause?
20:46wiseenis there a good name for functions that take seq and return a seq like "operators" or something similar ?
20:48gfrederickswiseen: don't think so
20:49gfrederickswiseen: 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:50wiseengfredericks, 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:51duck1123naming things is hard
20:55gfredericksseqers! :)
20:56wiseensince the push collection is "observable" that would be observablers :)
20:56gfrederickswhich is a name I wholeheartedly approve of
20:57gfredericksthe 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:57wiseenit sort of breaks my brain :)
20:57wiseenyeah, will probably just stick them in root namespace
20:58duck1123pipeline?
20:59duck1123I 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:00gfrederickswiseen: 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:01duck1123lamina has a bunch of functions that use the same names with the star like that
21:01wiseengfrederick (-̣>> (requestx) (pipeline/filter #(..)) (pipeline/map #(..))) vs (->> (requestx) (filter* #(..)) (map* #(..)))
21:01gfrederickswiseen: there are shorter prefixes ;-)
21:02gfredericksduck1123: yeah, my guess is that both approaches are represented a good bit
21:02gfredericksthat's why I said it without much confidence
21:02pdk(doc when)
21:02clojurebot"([test & body]); Evaluates test. If logical true, evaluates body in an implicit do."
21:03duck1123stuff like that, I can see you wanting to have them without any prefix
21:03gfrederickstwo against one. I repent my wrongful position.
21:03wiseengfredericks, * seems more like microsoft Async posftix convention
21:04duck1123I guess it really all depends on the context in which you want to use them
21:05gfredericksthe most important thing is that you use getters and setters instead of public instance variables
21:06duck1123and make sure all of your variables are prefixed with a letter indicating the datatype
21:07gfrederickswrite unit tests to make sure that your for loops don't have fencepost errors
21:09duck1123so 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:09duck1123anyone doing ns-aware xml processing?
21:26klauerndoes `lein repl` pass along http proxy settings?
21:30klauernBetter yet, how can I get any lein command to pass along the -Dhttp.proxyHost and -Dhttp.proxyPort settings?
21:32klauernI 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:45klauernAh, it seems I can use the :repl-init script in the leiningen project to do what I want
21:46klauernIt's project-by-project, but I can work with that for now
21:50dakroneyou can use :jvm-opts
21:50wiseen,(doc take-nth)
21:50clojurebot"([n coll]); Returns a lazy seq of every nth item in coll."
21:50wiseen,(take-nth 4 (range 10))
21:50clojurebot(0 4 8)
21:51wiseenso 1 item is taken and index starts on 1 ?
21:52wiseen*element at index 0 technically
21:53wiseenthe docs are a bit vague
22:06biallym_&(take-nth 4 (repeat 1))
22:06lazybotExecution Timed Out!
22:06biallym_so much for being lazy
22:07biallym_or maybe the bots are enumerating them
22:07tomoj&(->> [1 2 3] cycle (take-nth 4) (take 10))
22:07lazybot⇒ (1 2 3 1 2 3 1 2 3 1)
22:07tomojnot a very good example :)
22:08biallym_aha that taught me
22:08biallym_(a lot actually)
22:08tomoj&(->> [:foo :bar] cycle (take-nth 2) (take 10))
22:08lazybot⇒ (:foo :foo :foo :foo :foo :foo :foo :foo :foo :foo)
22:09hiredmanhttps://gist.github.com/1359889
22:10wiseentomoj, so it takes (= (mod index n) 0)
22:10dakronehiredman: you need to get some of these in clojure-mode
22:10wiseenand (mod 0 n) = 0
22:11hiredmandakrone: with clj-http in the prepopulated favorite libs list?
22:11hiredman:)
22:11wiseenmaybe that should be in the docs ?
22:11dakronehiredman: yes :), with version 0.2.2 though
22:12dakroneerr, 0.2.3
22:12hiredmanI thought I grabbed that from the github page
22:13dakroneit's at 0.2.3 now
22:13hiredmanoh, no, I grabbed the cheshire version (not added in the gist) from github, the clj-http from an existing project
22:13dakronehahaha
22:13hiredmantalk about a release tread mill
22:14hiredmanthe docstring for favorite-libraries is also wrong
22:16danlarkinraleigh tv sucks
22:17danlarkinwhich is kindof a joke because it's the same tv as everywhere else
22:17hiredmanload my elisp and go add a bunch of dependencies to your projects
22:18wiseenIs there a way to capture the else part of try catch block when no exception has been caught (try ... (catch Exception _ ...) (else ...)) ?
22:19wiseen*no exception has been thrown
22:19tensorpudding&(macroexpand '(->> [:foo :bar] cycle (take-nth 4))))
22:19lazybot⇒ (take-nth 4 (clojure.core/->> [:foo :bar] cycle))
22:20tensorpuddingwhy does it expand ->> only once?
22:20dakronewiseen: do you mean 'finally'?
22:20dakrone,(try (inc 1) (finally (println "foo")))
22:20clojurebotdakrone: Huh?
22:20dakronebleh
22:20wiseendakrone, that is executed even if the exception is thrown
22:21dakronesoo, at the end of your regular function then?
22:21hiredmanor, you know, the whole try block
22:21dakronewhat are you trying to do?
22:22wiseenbut if i put it in the try block the expression it self might throw and I don't want to handle that
22:22hiredmansounds horrible
22:23wiseenhiredman, 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:24wiseensorry, that was for dakrone
22:24wiseenpython has try catch else
22:25duck1123wiseen: have you looked to see if lamina works for you. This all sounds very familiar to what is already there
22:26wiseenduck1123, 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:26wiseenalso it's a learning project
22:27tensorpudding&(macroexpand (macroexpand '(->> [:foo :bar] cycle (take-nth 4)))))
22:27lazybot⇒ (take-nth 4 (clojure.core/->> [:foo :bar] cycle))
22:27tensorpudding&(macroexpand (quote (macroexpand '(->> [:foo :bar] cycle (take-nth 4))))))
22:27lazybot⇒ (macroexpand (quote (->> [:foo :bar] cycle (take-nth 4))))
22:27tensorpuddingwell now i know i don't know anything
22:28tomoj&(clojure.walk/macroexpand-all '(->> [:foo :bar] cycle (take-nth 4)))
22:28lazybot⇒ (take-nth 4 (cycle [:foo :bar]))
22:31tensorpuddingthank you
22:35wiseenfigured out how to do it (when-not (try ... true (catch Exception _ ... false)) else-path)
22:44klauernDoes leiningen have something to the equivalent of "java -cp $LEIN_CLASSPATH $arg1 $arg2 $...." that i could just type `lein run $arg1 $arg2 $.... ?
22:45klauernTHat 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:46gfredericksklauern: I'm having a hard time telling if you already know about the "lein run" command
22:46klauernwhat does lein run do?
22:46gfredericksif not, then that's what you want, combined with setting a :main option in your project.clj
22:46gfredericks_AND_
22:46klauernI am talking about things like being able to pass the classpath and such to a VimClojure 127.0.0.1 runtime,
22:47klauernor the same to nrepl
22:47gfredericksoh I don't know what's going on anymore then
22:47gfrederickslein run just lets you run the main method of one of your namespaces
22:48gfrederickspresumably the same thing you would get if you did "lein jar" and then "java -jar ..."
22:48gfredericksokay I'm off
22:48klauernok, I'll look into that
22:48klauernthanks
23:18daakuone of my dependencies is still pulling in clojure-contrib, is there some easy way to find out which one?
23:19tomojwhat do you plan to do when you find it?
23:20daaku:)
23:21daakui 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:22daakus/relies on this/relies on these/
23:36daakuwhat'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:39duck1123daaku: do lein pom; mvn dependency:tree
23:40duck1123or just exclude contrib on a project-wide level and see what breaks. :)
23:52daakuduck1123: perfect! dependency tree is exactly what i wanted
23:58leo2007folks, 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:58leo2007Ideas?