#clojure logs

2010-11-07

00:00woobysame here :/
00:00amalloynimred: http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html should work, but it will be more involved than necessary since it has you building everything from source
00:00nimredshouldn't http://clojure.pastebin.com/mvqjB3BB settings be OK ?
00:02hiredmanyou should follow the instructions in the swank clojure readme
00:02amalloynimred: i suspect you may have to put slime before swank-clojure
00:02hiredmanI have yet to see any blog post on the subject that is not hilariously out of date
00:03nimredhiredman i did but (require 'swank-clojure-autoload) didn't work :/
00:04hiredmannimred: that isn't in the readme anywhere
00:04hiredmanhttps://github.com/technomancy/swank-clojure
00:07nimredamalloy ok loading slime before swank-clojure as you suggested made emacs starting without any error
00:33tonylping?
00:33clojurebotPONG!
00:34amalloytonyl: pinging anyone in particular, or just clojurebot?
00:34tonyljust clojurebot, i do that everytime I join the channel
00:34hiredman~#1
00:34clojurebot1. One man's constant is another man's variable.
00:36Adamant~#42
00:36clojurebot42. You can measure a programmer's perspective by noting his attitude on the continuing vitality of FORTRAN.
00:36Adamant~#34
00:36clojurebot34. The string is a stark data structure and everywhere it is passed there is much duplication of process. It is a perfect vehicle for hiding information.
00:36Adamant\
01:40amalloythere doesn't seem to be a convenient way to conj something to both the front and back of a sequence. i assume that's because at least one of those operations will be expensive?
01:19tobiassp1any idea how to fix " No implementation of method: :make-reader of protocol: irc://irc.freenode.net/#'clojure.java.io/IOFactory found for class: nil " when running lein uberjar ? <— total clj n00b
01:21amalloyum. this is going to be pretty hard with no idea what's in your source files, tobiassp1
01:22amalloycould you provide a link? particularly to any source file that includes "freenode"
01:23tobiassp1amally: just a main with println hello world
01:23tobiassp1literally just newed the project and added the defn to the projectname.clj
01:24amalloyhm. maybe something is wrong with my irc client
01:25amalloyis the error, in fact, "protocol: hash, quote, clojure.java.io/IOFactory?" i think my irc client turned that into a link to an irc channel
01:26tobiassp1amalloy: http://pastebin.com/KazycWXM
01:27amalloyhrm. are you sure about that? core.clj and project.clj seem to be switched
01:27amalloyif that's really the contents of your files they need to be reversed
01:27amalloybut i assume just a mispaste
01:28tobiassp1doh of course … misspaste
01:28tobiassp1thanks for checking it out btw
01:28amalloyk. i'll try to reproduce it locally
01:28amalloywhat directory is core.clj in? src/project/core.clj?
01:29tobiassp1yeah
01:29amalloyokay. your namespace needs to mirror your directory layout
01:29amalloyso subcity.core needs to be in src/subcity/core.clj
01:29amalloyand :main needs to refer to the actual namespace
01:30tobiassp1heh … i replaced instances of subcity with project … apparently i didnt catch all instances
01:30tobiassp1sorry
01:30amalloy*chuckle*
01:30tobiassp1let me paste it up verbatim :)
01:31tobiassp1if you refresh … i fixed it
01:31tobiassp1sorry bout that
01:32amalloysure? even with ctl-f5 it looks the same to me. i think amendments get a new url
01:32tobiassp1http://pastebin.com/PStaP5C8
01:32tobiassp1shows that i was running a fever earlier
01:33amalloyokay. and core.clj is actually in src/subcity?
01:33tobiassp1yeah
01:33tobiassp1osx btw with clojure and lein from macports
01:34amalloyhm. well your files look fine
01:34tobiassp1i figured i didnt get far enough to make any mistakes ;)
01:35amalloy*laugh*
01:35amalloyyeah, when i lein uberjar it up it works fine
01:36tobiassp1i guess i will remove the macports versions and bootstrap everything with the lein shell script … is that the recommended approach ?
01:36amalloytobiassp1: i'm afraid i can't help there. haven't touched a mac in years
01:37amalloybut that's what i'd do. or if you don't mind a little ruby, you could use cake instead of lein
01:38tobiassp1thanks a ton for your help
01:38amalloyyou might also need to add :gen-class to your (ns) declaration?
01:38tobiassp1i tried that with the same result
01:38amalloyk
01:38amalloywell yes, it's not going to fix *this* problem
01:39tobiassp1i'll redo my env :) thanks again
01:40amalloytobiassp1: just tried it locally: it needs :gen-class
01:40amalloy(in addition to whatever else)
01:40tobiassp1k will add that again
01:43tobiassp1omfg that worked … lame
01:44amalloyjust junking macports?
01:44tobiassp1macports lein version is borked
01:44tobiassp1yep
01:44amalloyyeah, lein is supported on linux and windows, to the best of my knowledge
01:46tobiassp1well now i get to do productive stuff :) thanks for helping me out
01:46amalloyany time
01:46amalloy#clojure is pretty friendly. pop in as needed
01:49tobiassp1thanks!
01:59amalloyanyone have a link explaining how to do unit testing in clojure? i know clojure.test and lazytest are supposed to be great, but i don't know how to get started with them
03:44LauJensenMorning all
04:00RaynesTop of the mornin' to ya.
04:24kumarshantanuhi all
04:26kumarshantanuI wonder if stack trace printing should be pluggable *stacktrace-printer-fn* in Clojure 1.3 -- anybody shares the idea?
04:30dmaohi, does anyone know if the lein repl puts you into an env with the lein dependencies in the classpath? I tried to "use" something in my classpath but it's saying it can't be found.
04:31kumarshantanudmao: it does
04:31kumarshantanudmao: you need to say it like this -- (use 'app.xyz)
04:31dmaoah ok, that's why. thanks
04:57danishkirel&(loop [] (or (when-let [a nil] (recur)) 1))
04:57sexpbotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
05:02danishkirel&(loop [] (or (when-let [a nil] (recur)) "test"))
05:02sexpbotjava.lang.UnsupportedOperationException: Can only recur from tail position
05:04danishkirelSo I thought the above form was elegant but it does not work. But it should not be a problem because or is short circuited. ;/
05:05LauJensenYou can only use recur from the tail position
05:06danishkirelYea - the error tells me. But it is some kind of tail position because or is short circuited, isn't it?
05:08jarpiain,(macroexpand '(or (recur) "test"))
05:08clojurebot(let* [or__3470__auto__ (recur)] (if or__3470__auto__ or__3470__auto__ (clojure.core/or "test")))
05:09danishkirelI see.
05:36Raynessexpbot: Night, my friend.
05:37bmhenjoy your timezone
05:37sexpbotRaynes: Night, master. <3
05:37Raynesbmh: It's nearly 5AM here.
05:37bmhRaynes: It's nearly 11AM here
05:37RaynesI just have a weird/non-existent sleeping schedule.
05:38bmhYou'll do well in college.
06:17esj1
08:27agravierHi everyone
08:29agravier(noob warning) I've been trying to unit test some relatively simple code using atticus. https://github.com/hugoduncan/atticus
08:30agravierIs anyone using it too? Or are there better alternatives?
08:31hugodagravier: it's not the most popular option - are you familiar with clojure.test?
08:32agravierhugod: Yes, well, i read the doc, but I did't see how to easily mock functions
08:33agravierhugod: (I use the assertions and other basic forms in clojure.test, of course.)
08:34hugodagravier: you can replace the implementation of a function (at least in 1.2) by binding it to a new function
08:39lpetithello, are the maven-clojure-plugin gurus in the room ?
08:40agravierhugod: So you are telling me that I can use (let [mockedfn #(...)] calling-fn) within mytests to mock a called function?
08:41lpetitagravier: replace let with binding
08:43agravierlpetit: Thank you, I'll do that and read the binding doc.
08:44agravierAdditionally (It's reated to my issues with unit testing), I don't understand why (let [a (map #(println "processing " %) [1 2 3 4])] 'something) does not produce any output
08:44lpetitagravier: just note that the direction taken by clojure 1.3 is that by default, vars created via "def" will not be "dynamically rebindable" (via binding) anymore. Only those with the appropriate meta-data ( #^:dynamic ) will be. Of course, it will still be possible to "fix" a global var from the REPL by calling (def) again on it (this is not "binding", this is changing the root value of the var)
08:45lpetitagravier: which output do you expect ?
08:46lpetitagravier: map is lazy, and you do not start to consume its result (stored in the 'a' local) anywhere
08:46agravierlpetit: processing 1\nprocessing 2... (and the expected value 'smth)
08:46agravierlpetit: Hoooooo lazyness
08:47agravierlpetit: Thank you, I have to get used to think about lazy evaluation. I understand.
08:48lpetitagravier: np. You can still (for test purposes, I imagine) make the map fully realize itself by encapsulating it in a call to doall
08:48lpetit,(doc doall)
08:48clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is co...
08:48lpetit>(doc doall)
08:49lpetitargh
08:49agravierlpetit: Yes, thanks for reminding me that.
08:50agravierlpetit: I get back to understanding my own code now, have a nice day.
10:30kzarIs there an opposite of map that takes a list of functions and runs each one on some value?
10:31kzaroh I could use a for loop, sory
10:31kzarsorry*
10:32jonasen,(map #(% 2) [dec identity inc])
10:32clojurebot(1 2 3)
10:33kzarjonasen: Oh cool, that's even better
10:33Vinzent((reduce comp [f1 f2]) value)
10:35kzarjonasen: Thanks, I should have remembered when I did that accidently the other day
10:37MayDanielkzar: ((juxt dec identity inc) 2)
10:41dnolen,((apply juxt [dec identity inc]) 2)
10:41clojurebot[1 2 3]
10:43kzarWow juxt is a pretty cool idea
10:44kzarI was doing some Python the other day and the more I learned about the language the more annoyed I got but with Clojure it's the other way around :)
11:08dnolen,((juxt :foo :bar :baz) {:foo 'a :bar 'b :baz 'c :woz 'd})
11:08clojurebot[a b c]
11:09LOPPhow do you do sorting in clojure
11:10LOPPusing java sort functions?
11:10morphling,(doc sort)
11:10clojurebot"([coll] [comp coll]); Returns a sorted sequence of the items in coll. If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."
11:17LOPPah crap
11:17LOPPso I can't just pick a clojure fn
11:17LOPPto sort with?
11:17LOPPalso does sort function use transients or something
11:18LOPPsomehow I think swaping vector elements on immutable vector would incur a huge overhead
11:18dnolen,(sort > [1 2 3 4 5 6])
11:18clojurebot(6 5 4 3 2 1)
11:19LOPPwait what
11:19LOPPhow is > a java.util.comparator?
11:19LOPPconfused
11:19dnolenLOPP: fns already implement that interface
11:20dnolenconvenient, eh?
11:20LOPPreally?
11:20LOPPjesus chirst how many interfaces do they implement
11:21dnolena bazillion
11:21LOPP,(sort (fn [] "ff") [1 2 3 4])
11:21clojurebotjava.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong number of args (2) passed to: sandbox$eval698$fn
11:21LOPPhm
11:22Chousukeclojure classes are rather interface-heavy :P
11:23LOPPI don't understand the error I got here
11:23dnolenthat fn needs to take two arguments
11:23dnolenLOPP: ^
11:23LOPPaha
11:23kzarI have a namespace called notes which just def's a var called notes. (A big list of all the different notes. I'm trying to import it with (:import wobble.notes notes) in my namespace declaration but that gives me "ClassNotFoundException: wobble.notes.notes". (:import wobble.notes) works but then I still have to do wobble.notes/notes to get at the notes. How can I import it so I can just use notes?
11:24dnolenkzar: import is for java classes
11:24dnolenclojurebot: use
11:24clojurebotuse vs require is (:use [lib :only [a b c]) or (:require [lib :as alias]) -- (:use lib) is only for playing around
11:24LOPPso fns that don't take 2 arguments and don't return a number implement Comparator so all its methods throw an exception?
11:25LOPP,(sort (fn [a b] "ff") [1 2 3 4])
11:25clojurebotjava.lang.RuntimeException: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number
11:25LOPPok
11:25LOPPthat was expected
11:25LOPPwhat about my second question
11:26dnolenLOPP: which is what?
11:26LOPPsorts do element swaps inside a vector
11:26LOPPin clojure vectors this would cause a huge overhead
11:26LOPPas a bunch of new vectors would get generated
11:26LOPPis this worked around somehow?
11:26kzar(:use (wobble.notes notes)) gives me an error and (:use (wobble.notes/notes)) and (:use (wobble.notes)) don't seem to help me accesing notes without the wobble.notes/ prefix?
11:27LOPPin other words, would I be better served by converting into a java array and sorting that?
11:30dnolenLOPP: sort converts the collection to an array first then sorts, then returns a seq of the sorted collection
11:30dnolensorted array I mean
11:32mfexfliebel: ping
11:32fliebelmfex: pong
11:33dnolenkzar: (ns your-ns (:use [wobble.notes :only [notes]])), should work
11:33fliebelsexpbot should give a ping time for this stuff...
11:33mfexI think I found the problem with freqs function for minecraft
11:33fliebelmfex: … I'm listening
11:34mfexI also posted a reply on the clojure group but I can't see it yet
11:34LaPingvinofliebel: tafeltennis
11:34kzardnolen: Sweet it works :) thnaks
11:35fliebelLaPingvino: huh?
11:35LOPPdnolen: since a boatload of clojure core fns return sequences, what do you do when you want your data to have properties of a vector, for instance I want to retain the ability to get items by index in O(1)
11:35mfexthe numbers for the python algorithm are for running the program to plot the graph for the six types, as the one in your blogpost?
11:35LOPPmost of the time I do one transformation on my vector and bam...vector benefits are gone
11:35dnolenLOPP: you will need to coerce the seq back into a vector (into [] some-seq)
11:36fliebelmfex: You're thinking hex vs dec?
11:36LaPingvinofliebel: hoe noemen we tafeltennis ook wel ;)
11:36mfexfliebel: the python approach only calculates the freqs for six types, while the clojure approach counts all frequencies and then shows only those for the 6 types
11:36fliebelLaPingvino: pingpong...
11:37LOPPdnolen:isn't that expensive?
11:37mfexfliebel: https://gist.github.com/666228
11:37LaPingvinofliebel: precies :)
11:37fliebelmfex: good point I think… I'll let it sink in.
11:38mfexfliebel: could you run the python code for all the types? I couldn't get the python code to work
11:38dnolenLOPP: if you need to the perf guarantees of Java arrays just use them instead. Clojure has plenty of methods for working with them. but you lose the simpler concurrency semantics. tradeoffs.
11:38fliebelmfex: You reordered a lot of the code. I'll try to run the Python code… on moment.
11:42LOPPmy brother keep nagging me with CL. Says it cooler because it has mutables by default and it's also much faster than Clojure. :P nag nag nag
11:43fliebelmfex: It;s taking long… uncomfortably long…
11:43mfexfliebel: the python one I hope?
11:43fliebelmfex: yea
11:44mfexfliebel: the clojure code from the gist for all types take 40secs for me, because it only traverses the blocks array once
11:45dnolenLOPP: heh, write some moderately complex concurrent code and tell your brother to reimplement in CL. we'll see what he thinks then ;)
11:45fliebelmfex: I just piped all block types into the default blocks, and the resulting time is uncomfortably close to the clojure time.
11:46mfexfliebel: could you try the code from the gist? you only need to adjust the path to your level dir
11:51LOPPdnolen: true :) but not everyone works with concurrency, in fact I've never once needed to use it
11:52fliebelmfex: 12 seconds :D
11:53mfexfliebel: 12 secs for just freqs or total?
11:53fliebelfreqs
11:53dnolenLOPP: in my experience even trivial tasks could benefit from good concurrency semantics, but most langs make it too hard to exploit that.
11:55LOPPa lot of the time I work with stuff that runs on servers like JSF pages, where multithreading is done by the container
11:55mfexfliebel: hmm I was hoping for less, the main point still stands tho
11:56fliebelmfex: Yea, so it's not a matter of how to do things fast, but what not to do.
11:57fliebelmfex: I remember some gnu guy pointing out to a bsd group that some gnu tool was much faster by simply doing half the work.
11:58dnolenLOPP: sure, but eventually there's the scenario you might want to share temp data across threads. people just hack around that by writing to the db and reading out, adding incidental complexity. simpler to create an atom or ref and move on w/ your life.
11:59mfexfliebel: it is the right algorithm for the job, now it's a matter finding ways to chunk the work to utilize more of the cpu
11:59fliebelmfex: Thanks for figuring this out. I hope you had fun doin git :)
11:59LOPPhere's one question: when do I use agents and when do I use futures
11:59LOPPthey seem very much the same in a lot of regards
12:01mfexfliebel: fun it was
13:05pppaulcan someone tell me the benifits of using swank or slime?
13:05pppaulright now i'm using just clojure-mode
13:11BahmanHi all!
13:19pppaulbatman?
13:33nimredi am trying to compile http://sprunge.us/IQYN but am getting http://sprunge.us/KUOA
13:33nimredwhat's wrong ?
13:35dnolennimred: hmm looks like you don' t have your Clojure SLIME environment setup properly.
13:38nimreddnolen here are my settings --> http://sprunge.us/LSSb
13:40dnolennimred: I never setup SLIME manually anymore, I just install from ELPA. I got tired of figuring out what was wrong w/ my setup.
13:41nimreddnolen elpa :/
13:42dnolennimred: yup, sadly the headache of elpa is less than the headache of managing SLIME configuration.
14:02tonylping?
14:02clojurebotPONG!
14:04pppaulpong?
14:04clojurebotPONG YANG!
14:04pppaulyang?
14:04pppaulping pong?
14:04pppaulping pong yang?
14:05pppaul(doc love)
14:05clojurebotExcuse me?
14:07kzarying
14:09jdsandersRaynes: you around? started looking into giving you a hand with making the tryclojure tutorial interactive, want to talk about what you're looking for?
14:15kzarI've seen some Java that writes AudioFileFormat.Type.WAVE , I've already imported AudioFileFormat and tab completion confirms it's around but AudioFileFormat/Type and AudioFileFormat.Type give me nothing?
14:16jarpiainkzar: AudioFileFormat$Type
14:17kumarshantanuhi, did anybody get La Clojure working with Clojure 1.2 ?
14:17pppaulwhat's special about la clojure?
14:17kzarjarpiain: Hmm that's not giving me anything either
14:17pppaulis it french?
14:18jarpiainkzar: you need to import it also
14:18kumarshantanupppaul: "La Clojure" is the Clojure plugin for IntelliJ IDEA
14:18pppauloooooooh
14:18kzarjarpiain: Ah sweet that works, thanks
14:18kzarjarpiain: What does the $ mean?
14:19pppaul(doc $)
14:19clojurebotNo entiendo
14:19jarpiainit's the encoding javac uses for inner class names
14:19tonylit is a class inside a class
14:19jarpiaininner classes don't really exist on the JVM level
14:19kzarheh 'Yo dawg...'
14:34kumarshantanurepeat-question -- did anybody here get La Clojure working with Clojure 1.2?
14:39nimredany good tutorial to install cloj-ure/swank/slime emacs modes without using elpa ?
14:40kumarshantanunimred: is it useful? http://charsequence.blogspot.com/2010/07/setup-emacs-for-development-with.html
14:42nimredah kumarshantanu also without starter-kit
14:43kumarshantanunimred: do you want to use leiningen at all?
14:43kumarshantanuif not, perhaps you can just install Emacs and Slime and get going
14:44kumarshantanuSwank is to connect to lein-environment using slime-connect
14:44Raynesapgwoz: Yo.
14:46nimredisn't leiningen need to just compile clojure ?
14:47kumarshantanunimred: lein is useful for several things
14:47nimredto build clojure code i mean
14:47kumarshantanulein is advisable when working on a project rather than just a file or the REPL
14:48kumarshantanuEmacs doesn't know about Lein in particular, but it can connect to Lein using Swank/Slime-connect
14:48kumarshantanunimred: if you can tell me your requirement maybe I can suggest something more specific
15:27samxwhen building a set with #{:a :b}, will the implementation be a hash-set, or some array based thing (like with literal maps) ?
15:28chouser,(class #{:a :b})
15:28clojurebotclojure.lang.PersistentHashSet
15:28samxcheers
15:36bartjwhat is the difference between PersistentHashMap and PersistentArrayMap?
15:36bartj, (type {:a 1})
15:36clojurebotclojure.lang.PersistentArrayMap
15:37RaynesOne has a longer name than the other. ;)
15:37bartjcan someone give an example of PersistentHashMap ?
15:42bartjweirdly, I get the following error while using clojure.contrib.json:
15:42bartjCaused by: java.lang.IllegalArgumentException: No implementation of method: :read-json-from of protocol: #'clojure.contrib.json/Read-JSON-From found for class: clojure.lang.PersistentHashMap
15:45mfex bartj : perhaps the input is not a string {} instead of "{}"
15:47lpetithello. maven experts ? clojure-maven-contributors ? in the room ?
15:47stuartsierraeh?
15:48lpetitHello Stuart
15:48stuartsierrahi
15:49lpetitI need all the experience of a maven guru because I just entered the "clojure maven club" :-)
15:49stuartsierrawelcome
15:49lpetitSo
15:50lpetitI want to compile ccw.core with maven. It contains both clojure and java code. There are dependencies inside the artifact between the 2 worlds. But not dependencies in the "usual way". It's my java code which depends on my clojure gen-classes.
15:50bmhhas anyone used zef's jopenid wrapper?
15:51lpetitSo I have attached the clojure:compile goal to the "generate-sources" phase, so that it comes first.
15:51lpetitBut (yes, there's a but)
15:51kumarshantanulpetit: would suggest split into multiple small projects (in dependency order)
15:52lpetitI'm using a packaging specific to Eclipse/PDE (plugins) compilation: "eclipse-plugin". Provided by "Tycho" ( a set of maven plugins under development by Sonatype )
15:52stuartsierraYou probably need to split into separate projects or separate modules within a project.
15:52lpetitWait ... :)
15:53lpetitI already have separate modules in the project which make sense. I do not have circular dependencies inside my artifact.
15:54stuartsierraPretty much any time you need to control the order of compilation, you need separate modules
15:54lpetitThe problem is that Tycho is doing magical stuff : it is "enhancing" the project classpath with classpath entries it finds in the plugin's META-INF/MANIFEST.MF
15:55lpetitBut this *seems* to be done by tycho's maven-osgi-compiler-plugin, in the "compile" phase. So it's too late for me (I try to compile in the "generate-sources" phase).
15:55kumarshantanuis there a function that wraps a value into a function that always return the constant? e.g. (wrap true) -- returns (fn [& x] true)
15:55lpetitstuartsierra: I understand. But I will resist separating artifacts just for the sake of technical concerns (contrary to design concerns) as far as possible
15:56lpetitconstantly ?
15:56stuartsierraResistance is futile
15:56lpetit,(doc constantly)
15:56clojurebot"([x]); Returns a function that takes any number of arguments and returns x."
15:56lpetitstuartsierra: which rule number of the "maven club" ? ;-p
15:56kumarshantanulpetit: ah yes, thanks!
15:57stuartsierraThe first rule of Maven Club is Everybody Hates Maven
15:57lpetitstuartsierra, kumarshantanu: the whole story is here: https://github.com/sonatype/sonatype-tycho/blob/master/tycho-maven-plugin/src/main/resources/META-INF/plexus/components.xml#L23
15:58Ploujwow, you people are actually using clojure for real projects?
15:58lpetitIf you could just tell me if there's a flaw in my analysis (beyond the "split into modules" advice, which I take in mind, given the "resistance is futile" abstract rule)
15:58lpetitPlouj: are you asking this seriously ?
15:58Ploujlpetit: yes
15:59kumarshantanuPlouj: http://www.google.co.in/search?sourceid=chrome&amp;ie=UTF-8&amp;q=clojure+production+use
15:59stuartsierralpetit: sorry, I have no idea what the Tycho plugin might be doing
15:59lpetitPlouj: AFAIC, depends whether you consider ccw a real project or not :)
15:59kumarshantanulpetit: what's the use-case? Maven support in CCW?
16:01lpetitstuartsierra: it provides an alternate java compiler, which enhances the regular compiler by being able to look into the project's MANIFEST.MF, find OSGi dependencies (e.g. org.eclipse.equinox), resolve them from a p2 repository (OSGi repository full of OSGi bundles) and use the result to "enhance" the classpath of the project.
16:02stuartsierraDoes it alter the classpath in a way that clojure-maven-plugin can use?
16:02lpetitkumarshantanu: no, the usecase is "being able to build ccw with maven". ccw being an eclipse project with lots of plugins, I'm using Tycho which seems to be the right tool (it has been created for this intent).
16:02lpetitanswer I got from the Tycho mailing list: "Tycho injects all resolved OSGi dependencies back into Maven project
16:02lpetitmodel, so, in theory, regular maven mojos should see complete classpath
16:02lpetitwith all dependencies."
16:03lpetitSo in theory, yes. I'm just wary that this "injects all resolved ..." thing happens too late for me when I want to compile "before" tycho.
16:04lpetitI would have expected that Tycho had injected these OSGi related classpath entries early on.
16:04kumarshantanulpetit: because tycho is not Clojure-aware?
16:04lpetitkumarshantanu: yes, not aware at all.
16:05lpetitclojure-maven-plugin uses this: ${project.compileClasspathElements}
16:05lpetit(via dependency injection, if I understand well)
16:05lpetitAnd Tycho compiler does this:
16:05kumarshantanulpetit: looks like -- split into (1) clojure specific stuff using Clojure-maven plugin, (2) rest of tycho-related parts that depends in #1
16:06lpetithttps://github.com/sonatype/sonatype-tycho/blob/master/maven-osgi-compiler-plugin/src/main/java/org/codehaus/tycho/osgicompiler/AbstractOsgiCompilerMojo.java#L220
16:06kumarshantanuso, #1 and #2 are separate artifacts (perhaps independent projects)
16:06lpetitkumarshantanu: yes, but what if this does not make any architectural sense ?
16:07lpetit(interestingly enough, if somebody else would have asked, I may well be in Shantanu's position :) )
16:07lpetitIs it bad to expect that the tool adapts to me ? :)
16:07stuartsierrawith Maven, yes
16:08stuartsierra"You don't configure Maven, Maven configures you."
16:08kumarshantanulpetit: if it finally "just builds" gives a JAR that "just works" that makes all the sense in the world ;-)
16:08lpetitin the end, yes, I wholeheartedly agree :-)
16:09lpetitstuartsierra: what is the maven incantation to avoid to prevent one's hairs become blue ? :-p
16:09lpetit:)
16:09stuartsierramvn -DturnHairBlue=false
16:09lpetitsorry this joke was a little bit "hairy"
16:09stuartsierraIt made me feel "blue"
16:10lpetitmaven blues ?
16:10lpetit :)
16:11technomancyso... I don't suppose anyone has figured out how to get RT.load to work when Clojure is on the boot classpath?
16:17technomancyit's one of those great situations where you're searching and you find something that looks like it's exactly what you're looking for, only to realize it's a mailing list post that you sent. =\
16:17technomancythere should be a term for that phenomenon
16:18stuartsierratechnomancy: Programming
16:18technomancyquite
16:19kumarshantanutechnomancy: RT/load seems to be working for non-classpath'ed .clj files -- what am I missing?
16:20technomancykumarshantanu: it works when clojure is on the bootclasspath?
16:21kumarshantanutechnomancy: oops...let me try
16:21lpetittechnomancy: will it be a problem related to classloader hierarchies visibility, or something more subtle related to the boot classloader ?
16:22technomancylpetit: probably the first; I think the root cause is that RT.baseLoader assumes Compiler.class.getClassLoader will return a sensible value
16:22technomancybut it just returns nil when the bootclassloader comes into play
16:23lpetittechnomancy: oops, yes. But why did it work *before* ?
16:24technomancylpetit: I don't think it ever worked, but there were workarounds before that are no longer effective
16:25technomancybasically: it used to be if you wanted to use a lib that used another lib (say clojure.test requires clojure.stacktrace) you could load clojure.stacktrace, then clojure.test
16:25technomancybut now clojure.main requires clojure.repl, so you can't even get started.
16:25technomancyclojure.main used to depend on nothing
16:25lpetittechnomancy: ok.
16:25technomancyI'd be happy if I could get that workaround fixed, but of course it would be better if RT.load just worked. =)
16:26lpetitgood luck then (I don't use the bootclasspath trick myself, and would not recommend it anyway)
16:26technomancylpetit: are you aware it cuts clojure's boot time in half?
16:26technomancy0.59s here
16:26lpetiteven if it cut it by 4, it would remain a trick, sorry for that.
16:27technomancyis there another way to skip running the bytecode verifier on a jar?
16:28technomancydon't say "dalvik" =)
16:29lpetittechnomancy: :)
16:29vibrantevenin
16:29technomancyI'm interested to hear of the pitfalls. other than the RT.load problem it's been working fine so far.
16:30technomancyJRuby also uses it effectively
16:30vibranttechnomancy; you use clj-processing?
16:31technomancyvibrant: once upon a time, but it's been about a year since I did
16:31vibrantoh, ok. i did a fork too and actually even committed some changes.
16:32vibrantprobably more will come, as i write this game of mine :)
16:32technomancycool. I found it to be fun.
16:32vibrantyeah it's the only package that is usable and documented.
16:32vibrantfor graphics.
16:34technomancyit looks like the clj-processing guy is still somewhat active
16:36vibrantthe original guy a bit, but then there is some other guy's port which builds on that and i forget that one since it had better mouse support.
16:36vibrants/port/fork/
16:36sexpbot<vibrant> the original guy a bit, but then there is some other guy's fork which builds on that and i forget that one since it had better mouse supfork.
16:44jnymoyerp
16:44jnymothis thing work? Am I on?
16:44kumarshantanutechnomancy: I can't even get the REPL by putting clojure-1.2.0.jar in the boot classpath
16:45kumarshantanumaybe missing more subtle things
16:45raekjnymo: we can hear you
16:46jnymohmm. used to have to sign in.. hmm
16:47jnymoanyway. So, I frequent the clojure community from time to time.
16:47kumarshantanupossible reason -- RT/load seems to depend on Class.forName infrastructure (which means the regular classpath)
16:47jnymoI know someone who needs a website built and they asked me who they should go with to create their website for a fair price. It's for a book they are publishing soon. Honestly,
16:48jnymoHonestly, I don't know. But I figured someone here would know.
16:48jnymoDoesn't have to be a big shop. But not a chop shop either.
16:49jnymoanyone have any favorites?
16:50jnymoI know it's off topic, but I enjoy and appreciate the clojure community, so I figured I'd give you guys some business, whoever is in the webdev community.
16:51sl33kwhich one is a good resource/tutorial on clojure
16:51jnymoIt could even be done in compojure, if that's your fancy :)
16:52jnymosl33k, honestly, clojure.org has a list of links with great tutorials.
16:52kumarshantanuClass.forName seems to be beyond Boot classloader
16:52jnymothere's wikibooks, but there are also tons of other good places to learn clojure.. clojure.org is a great place to start though.
16:52sl33kwich are the prerequisites
16:53sl33kwhat prior knowledge
16:53jnymosl33k. None really, but knowing either java or lisp helps.
16:54technomancykumarshantanu: the repl doesn't work here either, but clojure.main -e does
16:55technomancyand that's all I need. =)
16:56technomancy~peepcode
16:56clojurebotpeepcode is a commercial screencast series; see the Clojure one at http://peepcode.com/products/functional-programming-with-clojure by technomancy
16:56jrphello, Im having some difficulty getting emacs + misc set up. Ive set up emacs, slime, and clojure, and I think emacs a bit more with elpa but Im getting errors when I M-x slime, namely that it cant find swank
16:59jrpIf anyone could explain a bit of whats going on, Im rather confused. Normally Im perfectly happy using vim + friends and there is a ton of new stuff here to learn at once
17:00Raynesjrp: Not to turn you away from Emacs, but there is some Clojure Vim support. Check out VimClojure if you haven't already.
17:00jrpRaynes: I have, but last time I checked the only way to get a repl inside vim was to do some hackish stuff involving sending stuff to screen. Has that changed?
17:01RaynesYup.
17:01jrpAlright, Ill give it a try. thanks
17:01RaynesI'm pretty sure it has nothing to do with screen now.
17:01jnymoaint no website devs in here that want a job? Aight den.. but pm me if you want.
17:02Raynes$dict soliciting
17:02sexpbotRaynes: verb: present participle of soliciting.
17:02kumarshantanujrp: does this help? http://charsequence.blogspot.com/2010/07/setup-emacs-for-development-with.html
17:02Raynesjrp: If you do go with Emacs, try using cake or leiningen to start a swank server in a project, and then connect to it with M-x slime-connect
17:03Raynesjrp: That's the most popular workflow these days.
17:03jrpWould you guys recommend emacs + vipermode or vim + vimclojure?
17:04jrpIve notced most people using emacs + slime + friends, and Ive found that the wisdom of some crowds to be decent
17:04RaynesIf you're already familiar with Vim, and you aren't familiar with Clojure, it might be easier on you to just use Vim for now so that you don't have to learn all of this at once. Warding off frustration. However, in the long run, I'd recommend you go with Emacs because SLIME is fantastic.
17:05jrpHm, used vim for 10 years, so yeah, I guess Ill give that a try.
17:05RaynesMost people do use Emacs, mostly because of SLIME. There are lots of Vim users in the Clojure community, they just tend to be less vocal I guess.
17:06hiredmantechnomancy: have you seen http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Class.html#getClassLoader()
17:07jdsandersjrp: last time I got interactive eval through vim working was using nailgun, which felt hacky to me, but didn't involve the use of screen
17:09jdsandersI personally decided it was less valuable to have SLIME-like support than to use the vim environment I'm already good at
17:09jrpjdsanders: Yeah, that looks like what Im doing now and pretty much what Im thinking
17:09jrpalthought to be fair, I dont use too many features of vim
17:09jdsanderswell, that's an interesting point
17:10jdsandersit's a balance, at some point the better evaluation support is more valuable than the current vim knowledge
17:10jdsandersfor me, it's mostly navigation, i'm too full of vim kool aid at this point to use the arrow keys or control sequences to move around text
17:11jdsandersvipermode is pretty good, and I'd like to spend more time with it
17:11jrpdoes vipermode not help out with that?
17:11jrpoh
17:11jdsandersyeah definitely it does
17:12jdsandersthere were just small things for me that i got frustrated with about vipermode, but I don't think I gave it enough of a chance
17:12chouserwhoops. *agent* isn't defined in agent handlers in 1.3a3
17:13chouserwait, in 1.2?
17:14chouserstrike that
17:14jrpwell vimclojure mode blows up, so i guess ill try emacs
17:14chouserright, ok. 1.2 is correct. 1.3a3 is not
17:14chouser& (send (agent nil) #(prn :agent *agent* %))
17:14chouser, (send (agent nil) #(prn :agent *agent* %))
17:14clojurebot#<Agent@14f223f: nil>
17:14chousermeh
17:15jrpcan someone give me a rough outline of what the rough architecture of swank is? I get that clj is the repl, and that slime is bindings for emacs that provides helpful info
17:17chouser,(let [a (agent 1)] (send a #(array-map :state % :agent *agent*)) (await a) @a)
17:17clojurebot{:state 1, :agent #<Agent@269101: {:state 1, :agent #<Agent@269101: {:state 1, :agent #}>}>}
17:17chouser& (let [a (agent 1)] (send a #(array-map :state % :agent *agent*)) (await a) @a)
17:18chouserthat's right. 1.3a3 says :agent nil
17:18raekjrp: http://i.imgur.com/9ZUMG.png I'm sorry that I don't have any time to explain it, but this picture is from a tutorial I'm working on
17:19raekthe lightning bolt is a network connection
17:19hiredmanI bet the bindings are being "rehydrated" after *agent* is bound, and the rehydrated bindings have *agent* as nil
17:19jrpraek: ok, thanks.
17:21hiredmanso maybe is send-off and send bound *agent* before sudmiting the Action? I haven't looked at the binding+threadpool stuff at all
17:21hiredmanif
17:21LauJensenClojureQL now supports joining on tables with aggregates. This is first cut but working, see commit msg for example https://github.com/LauJensen/clojureql/commit/0eef6b41936cc8422a4909f1e8b3c89fa559594c
17:22technomancyhiredman: yeah, .getClassLoader is well-documented to return nil for classes that came from the bootclassloader
17:23technomancyalthough... it does say that the getSystemResource static method will work where the boot classloader is involved. that would at least cover the part of the problem that I've been able to diagnose so far
17:24technomancyI'm going to stick with 1.2 for now though
17:26hiredmanoh I am such a liar, I must have looked at the binding conveyance stuff at some point, because when I open core.clj that is where emacs drops me
17:27technomancyclojurebot: is hiredman lazy?
17:27clojurebothiredman is an evil genius.
17:27technomancyI see.
17:30jrpjdsanders: Im kinda confused with vimclojure, it says I need to compile a jar, but I dont see any java files in the zip
17:31jdsandershmm, crap it's been awhile since I set mine up and I don't remember too well, where are you following directions from?
17:32chouserhiredman: that's my guess -- still looking
17:33hiredmanwhich rhickey anounced the binding conveyance I was expecting something a little more magical then wrapping functions in a function that does the binding dance
17:33hiredmanwhen
17:34jrpjdsanders: the main site here: http://kotka.de/projects/clojure/vimclojure.html and the readme
17:35jrpjdsanders: they seem to conflict
17:38chouserhiredman: yep, that's it. *agent* is bound then the fn created by binding-conveyor-fn is called, which resets the bindingframe, and then the sent fn is called.
17:38kumarshantanubye all
17:39jdsandersjrp: ah, it looks like you need to compile a jar for nailgun support...i don't use that anymore...i recall thinking it was a bit hacky (possibly because of compiling a mysterious jar??)
17:40jrpalso why are there two versions of swank-clojure on github?
17:42jdsandersdunno if you've found this screencast yet, looks helpful, not sure how old it is
17:42jdsandershttp://blip.tv/file/1884989
17:43jrpyeah, i think thats older. ah well, thanks anyways
17:43jdsandersfor what it's worth, all I have is a clojure.vim in ftdetect, ftplugin, indent, and syntax
17:58qbg,(distinct? '[1 x x 2])
17:58clojurebottrue
17:58qbgThat doesn't seem right!
17:59mrBliss,(apply distinct? '[1 x x 2])
17:59clojurebotfalse
17:59qbgReading fail :(
17:59technomancyjrp: the author of swank-clojure abandoned it; I've taken it over
18:00jrpoh. thanks.
18:01belundon't you have enough tehcno ? :P
18:02technomancybelun: well... I took it over 18 months or so ago... back when I was a slacker
18:04thothcan you guys check this post (http://stackoverflow.com/questions/4111715/what-does-it-mean-for-something-to-compose-well) and perhaps gave some insight why my post has a downvote ? did i do a big mistake there ?
18:05Lopp,(doc array-map)
18:05clojurebot"([] [& keyvals]); Constructs an array-map."
18:05Loppwhat's an array-map
18:05pppaul(doc flatmap)
18:05clojurebotExcuse me?
18:06pppaul(doc flatten)
18:06clojurebot"([x]); Takes any nested combination of sequential things (lists, vectors, etc.) and returns their contents as a single, flat sequence. (flatten nil) returns nil."
18:06pppaulwhat is swank clojure supposed to provide me with?
18:06technomancypppaul: it's an enhanced repl-like server that Emacs can interact with.
18:07pppaulwhen i put inferior-lisp into clojure-mode it breaks
18:07pppaulwill swank keep it un-broken?
18:07thothdamn mirc is still ugly...
18:08pppauluse something other than mirc
18:08thothlike ?
18:08pppauli use Xchat.... though mirc may be better than xchat as i can't even configure it to automate some stuff, or exclude quits/joins
18:09pppaulthere are a lot of irc clients, though
18:09clojurebotexcusez-moi
18:09pppaulone is probably good
18:09thothi know there are wikipedia has a huge list
18:09thothi'm lost in there
18:09RaynesI use XChat as well.
18:09pppaulyou can use irc in emacs. one of my friends really likes that
18:09thothemacs is like the console from matrix
18:09thothi like pretty stuff
18:09pppaul^_^
18:10thothi juz want to change the foooont
18:10pppauli don't know if xchat lets me change that
18:10thothgot client :P
18:10pppaulyou should make a fork of xchat
18:10thothgood*
18:11RaynesYou can change the font in XChat.
18:11samxwhy does (dorun 2 (map println (range 1 10))) print all numers from 1 to 10 ? i thought that due to the lazy evaluation, it should only be printing 1 2 3?
18:11pppaul&( dorun 2 (map println (range 1 4)))
18:12pppaul&( take 2 (map println (range 1 4)))
18:12pppaul&( take 2 (map prn (range 1 4)))
18:12pppauloh
18:12pppauli forgot about sexbot being offline
18:12thothya u gotta use take. whats got the rest have to do with 1 to 3 ?
18:12jrpHm ok. So Ive gathered I need to run a nailgun server with vim clojure, and Ive found a lein-vimclojure project that does that, but when I run it I get NoClassDefFoundError: clojure/main
18:12thothclojure jars
18:12pppaulclasspath may be wrong
18:13pppaul(doc dorun)
18:13clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. dorun can be used to force any effects. Walks through the successive nexts of the seq, does not retain the head and returns nil."
18:14pppaul(doc doall)
18:14clojurebot"([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through the successive nexts of the seq, retains the head and returns it, thus causing the entire seq to reside in memory at one time."
18:14samxwell, the dorun example of printing only 1 2 3 is from 'Practical Clojure', and in the printed text it's showing it to only print the first three
18:14pppauluse clojure-docs website to look at examples
18:15pppauli don't have experience using dorun
18:15Raynespppaul: When sexpbot is down, you can use clojurebot to evaluate code. Just use , instead of &.
18:15pppaul,( take 2 (map prn (range 1 4)))
18:15clojurebot(nil nil)
18:15samxi'm not looking for examples, but looking to understand why it's doing something that i'm considering unexpected
18:15pppaul,( take 2 (map cons (range 1 4)))
18:15clojurebotjava.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$cons
18:15pppaulmaybe the book is wrong
18:15pppaulso examples may help
18:16thoth:)
18:16pppauli don't think books have editors anymore
18:17pppaul,( take 2 (map #(cons %) (range 1 4)))
18:17clojurebotjava.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$cons
18:17thothcons join some elements to a seq
18:17thothu just have the seq tehre
18:17pppaul,( take 2 (map #(cons join %) (range 1 4)))
18:17clojurebotjava.lang.Exception: Unable to resolve symbol: join in this context
18:17pppauli guess i need to use let/
18:18pppaul,( take 2 (map #(cons (join %)) (range 1 4)))
18:18clojurebotjava.lang.Exception: Unable to resolve symbol: join in this context
18:18pppaul(doc join)
18:18clojurebotIt's greek to me.
18:18nimredkumarshantanu yes i need leiningen. Shouldn't http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html work ?
18:18pppauli hope it does, cus i'll probably follow it soon
18:19thoth:-)
18:19Raynesapgwoz: I'll check out your new stuff in a little while. Busy reaming dmehosting at the moment.
18:20technomancynimred: that's kind of a painstakingly complex way to get things working
18:20pppaulnimred: i think i used another tutorial off the site for clojure, it was good
18:20technomancyyou don't need to go through all those steps unless you're a gentoo user. =)
18:21nimredpppaul URI ?
18:21danlarkinwatch out! gentoo burn coming through
18:22pppaulnimred http://riddell.us/ClojureOnUbuntu.html
18:22pppaulif you have any problems ask me, i made a text of any issues i had (there was one with the scrip)
18:23pppaulwish these things were wikis so i could correct them
18:23thothwhat functions have sideeffect ?
18:23pppaul(rand)
18:23thoththose that do concurency ?
18:23samxhmm.. ok.. (dorun 2 (map println (range 1 1000))) only prints 1..32.. so, i guess its forcing the evaluation in blocks of 32
18:23technomancypppaul: that's also a lot more complicated than you need to do too
18:24pppaulyeah i know, but i wanted to use git and learn a bit anyway
18:24pppaulalso, the ubuntu repo doesn't work 100%
18:24nimredpppaul almost the same. When was that written ?
18:24technomancyyeah, I mean it works, but people might get the wrong idea that Clojure is really hard to use with Emacs
18:24pppaulnimred, i dono, a year ago
18:25pppauli had a lot of trouble getting it to run with emacs, even with the tutorials from the main clojure sites
18:25pppaulthey aren't made for people who have no idea what emacs is, or little experience using emacs
18:25pppaultook me a long time to figure out what some of the steps meant
18:26nimredpppaul did you post your notes somewhere ?
18:26pppaulno
18:26nimredok
18:26pppaulthey are on my dropbox, maybe i can make it public
18:26nimredtechnomancy what more simple way do you purpose to install ?
18:27belunpropose* :D
18:27technomancynimred: leiningen is already only 2 lines to install, then do "lein install swank-clojure 1.3.0-SNAPSHOT". now you can launch a swank server with ~/.lein/bin/swank-clojure
18:28pppaulnimred give me your email address and i'll share my folder
18:29technomancythen hit M-x package-install slime-repl. then you can connect to a running swakn server with M-x slime-connect
18:29technomancy(package-install won't work unless you're on the latest Emacs or the starter kit, but on older ones it's easy to install.)
18:29pppaulthanks technomancy
18:30nimredtechnomancy sorry but i prefer a "by-hand" install
18:30technomancymost of that is already in the swank-clojure readme, except for the stuff that relies on newer lein features
18:31technomancynimred: ok, then the riddel.us tutorials are great for you. but that's very uncommon.
18:33beluncan anyone explain currying ? meet the term again and don't know what really means
18:34pppaulthere is a wikipedia article on it
18:34pppaulit's related to functional programming
18:35pppaulf(x y) = (f y (g x)) or something
18:35pppaulor was it f(x) + (g y)
18:35beluninvented by haskel curry... look 2 things in 1 name :P
18:35pppaulthis is making me hungry
18:36pppaulhaskel is the man!
18:37belunthe book the joy of clojure says currying is different than using partial... they sound the same to me
18:38technomancycurrying is only possible in languages without varargs
18:39technomancybasically if f takes 2 args and you call it with 1 in a language with currying, you'll get the equivalent of (partial f x) back instead of calling f
18:39belunso it misses the call
18:39beluncalling*
18:40technomancyit's just a more convenient way to do partial application at the expense of varargs
18:41belunvarargs is darkmatter science to me :)
18:41technomancyvariable arity
18:41technomancyfunctions that may be called with more than one argument count
18:42belunwhat are functions with 1 arg called ?
18:43technomancyone arg list, not one arg.
18:43technomancyyou may call reduce with two arguments or three arguments
18:44technomancyso it supports multiple arities
18:44belunoh arity = number of args
18:47technomancyaye
18:47belunty
18:49belunso wait, why is it move convenient to do partial ?
18:50belunmore*
18:50chewbrancais there no longer a boot.clj? I'm watching the talk on sequences where rich hickey mentions to look at boot.clj
18:51technomancybelun: partial is less convenient than currying, but as I understand it you can't support currying and variable arity; they are mutually exclusive
18:51chewbrancabtw this is in clojure 1.2 from github
18:52nimredany .clj file to test my fresh install ?
18:52technomancychewbranca: it's now called clojure/core.clj
18:53chewbrancatechnomancy: cool thanks. btw, I'm Russell the big guy who showed up at seajure this week
18:53beluntherefore since clojure has multimethods, then it's bye bye currying ?
18:53technomancychewbranca: oh cool; nice to match faces and nicks
18:53technomancybelun: multimethods are a separate thing from variable arity
18:53belundamn...
18:53technomancybelun: but right.
18:54technomancyhaving to use partial is a pretty slight inconvenience compared to the flexibility you get from variable arity though.
18:55chewbrancatechnomancy: for sure. I'm making progress through the videos right now, two things are very different from what I'm used to that I really like, 1) live repl where you can interact with the running program, I went through the ant simulation talk on friday, amazingly cool to be able to update the running simulation/gui live from the repl inside my editor, and 2) I'm really liking lazy lists, very cool stuff
18:56belunwut videos ?
18:56chewbrancabelun: http://clojure.blip.tv/
18:58technomancythat's what got me started 2 years minus three weeks ago.
18:59nimredpppaul !
18:59belunthis has nothing to do with clojure, but have you heard some guy used genetic algorithms with starcraft2 and come up with a build order to kick butts ? :D
18:59nimredno URI ?
19:01Raynesapgwoz: Ping.
19:02nimredpppaul isn't it http://clojure.googlegroups.com/web/ants.clj ?
19:03pppaulnimred, could be
19:04pppaulbelun, he used java
19:04pppaulbelun: also, it only came up with one build order... at least that i know of
19:04belunya the rest were inveted by chinesse ppl :P
19:05pppaulkoreans
19:05belunma bad
19:05pppaulchinese people aren't allowed to play because there is blood in the game
19:05belunot even green blood ?
19:05belunnot*
19:05pppaulso the blood is being censored with overlays of kittens
19:06belunpoor guys
19:06technomancyyou mean like http://www.penny-arcade.com/comic/2008/8/11/
19:06pppaulonly with more kittens
19:07belunthat thins is ugglier then the real stuff
19:07belunit's like growing on him
19:09pppaul,#([%]
19:09pppaul (cond (= % nil) nil
19:09pppaul :else (cons (last %)
19:09pppaul (my-reverse (butlast %))))) [1 2 3 4 5 6]
19:09clojurebotEOF while reading
19:09belunsry to waste ur time, but omg smarts : http://thereifixedit.failblog.org/2010/11/05/white-trash-repairs-beeramid-is-locked-in-and-ready-to-go
19:10pppaul,#(my-reverse [%] (cond (= % nil) nil :else (cons (last %) (my-reverse (butlast %))))) [1 2 3 4 5 6]
19:10clojurebotjava.lang.Exception: Unable to resolve symbol: my-reverse in this context
19:10pppaul(doc fn)
19:10clojurebot"([& sigs]); (fn name? [params* ] exprs*) (fn name? ([params* ] exprs*)+) params => positional-params* , or positional-params* & next-param positional-param => binding-form next-param => binding-form name => symbol Defines a function"
19:12pppaul,#(my-reverse (cond (= % nil) nil :else (cons (last %) (my-reverse (butlast %))))) [1 2 3 4 5 6]
19:12clojurebotjava.lang.Exception: Unable to resolve symbol: my-reverse in this context
19:19pppaul,( (fn my-reverse [%]
19:19pppaul (cond (= % nil) nil
19:19pppaul :else (cons (last %) (my-reverse (butlast %)))))
19:19pppaul [1 2 3 4 5 6])
19:19clojurebotEOF while reading
19:20nimredwell cannot execute nor compile ants.clj
19:20pppaulyou don't compile stuff
19:21pppaulto load ants go into clojure-mode, C-x C-l ants.clj
19:21pppaulthen look at the last line, and run those in the inferior-lisp REPL
19:22pppaul,((fn my-reverse [%] (cond (= % nil) nil :else (cons (last %) (my-reverse (butlast %))))) [1 2 3 4 5 6])
19:22clojurebot(6 5 4 3 2 1)
19:22pppaulanyone like my sexy reverse function?
19:22pppaul,((fn my-reverse [%] (cond (= % nil) nil :else (cons (last %) (my-reverse (butlast %))))) (range 1e4))
19:23clojurebotExecution Timed Out
19:23pppauli think it's O(n^3)
19:25pppaul,1e4
19:25clojurebot10000.0
19:25pppaul(time 1e4)
19:25pppaul,(time 1e4)
19:25clojurebot"Elapsed time: 0.066 msecs"
19:25clojurebot10000.0
19:25pppaul,(time 1e4000)
19:25clojurebot"Elapsed time: 0.148 msecs"
19:25clojurebotInfinity
19:25nimredpppaul that's what i do but here is what i get --> http://sprunge.us/DiIh
19:27pppaulnimred sure that you can run any clojure in the REPL?
19:27pppaul,(System/getProperty "java.class.path")
19:27clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)
19:28pppaulnimred, i haven't used swank/slime with clojure yet
19:29nimred[~]->> clj
19:29nimredClojure 1.2.0-master-SNAPSHOT
19:29nimreduser=> (System/getProperty "java.class.path")
19:29nimred"/home/nimred/.clojure/clojure.jar:/home/nimred/.clojure/clojure-contrib.jar:/home/nimred/.clojure/jline-0_9_5.jar:/home/nimred/.clojure/clj-env-dir:/opt/java/lib"
19:29nimreduser=>
19:29nimredpppaul isn't it OK ?
19:29pppaulit looks ok
19:30nimredwithin emacs it doesn't work
19:30nimreda *sldb clisp/0* buffer is opened
19:31pppaulwithout swank: M-x clojure-mode, M-x inferior-lisp, and run it in that
19:31nimredthat contains : http://sprunge.us/jDfP
19:32pppaulmaybe you need to put slime into clojure-mode
19:32pppaultry without swank/slime first
19:32Raynes,(-> Thread pr-str symbol resolve pr-str symbol)
19:32clojurebotjava.lang.Thread
19:32pppaulyour classpath is alright, though
19:32RaynesIs there a better way to do that that I'm brainfarting on right now?
19:33pppaullol
19:33nimredpppaul http://lisp.pastebin.com/XDmepuJj
19:33pppaul,(pr-str Thread)
19:33clojurebot"java.lang.Thread"
19:33RaynesIt feels like there has to be a better way to get a symbol from a resolved class.
19:33Raynes:\
19:34pppauljust use what you have and make a function out of it so you don't have to look at it ever again :P
19:34Raynes:p
19:34pppaul(doc resolve)
19:34clojurebot"([sym]); same as (ns-resolve *ns* symbol)"
19:35nimredpppaul any idea ?
19:36pppaulthat didn't really tell me anything
19:37pppaulyou could load the file, and go into clojure-mode, then C-M-x expression
19:37pppaulsee if you get errors doing that
19:37pppaul*(each expression)
19:38RaynesEveryone digging try-clojure.org's new design? http://try-clojure.org/
19:39pppaul(str (reve­rse "!dlr­ow ,olle­H"))
19:39RaynesAlso got somebody working on a tryhaskellish interactive Javascript tutorial.
19:39pppaul,(str (reve­rse "!dlr­ow ,olle­H"))
19:39clojurebotjava.lang.Exception: Unable to resolve symbol: reve�rse in this context
19:39pppaulwoaaaaaaaah
19:40pppaulthe tutorial is nice, needs more sexiness and a link to clojuredocs
19:40pppaul(doc reverse)
19:40clojurebot"([coll]); Returns a seq of the items in coll in reverse order. Not lazy."
19:40pppaul,(str (reve­rse "!dlr­ow ,olle­H"))
19:40clojurebotjava.lang.Exception: Unable to resolve symbol: reve�rse in this context
19:40pppaul,(str (reverse "!dlr­ow ,olle­H"))
19:40clojurebot"(\\H \\� \\e \\l \\l \\o \\, \\space \\w \\o \\� \\r \\l \\d \\!)"
19:40RaynesThe tutorial is mostly just a stub for now. It needs a rewrite and more content.
19:40pppaullook at that sexy hello world!
19:41pppaul,(apply (str (reverse "!dlr­ow ,olle­H")) vector)
19:41clojurebotjava.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
19:41nimredClojure> (System/ge tProperty "java .class.pat h")
19:41bhenry,(apply str (reverse "!dlrow ,olleH"))
19:41nimredjava.lang.SecurityException: Tried to call: getProperty on class java.lang.System which is not allowed.
19:41clojurebot"Hello, world!"
19:41nimredon http://try-clojure.org/
19:42pppaulcus it's in a sandbox
19:42hiredmanpppaul: feel free to play with your own repl
19:42belunprobably is an appled
19:42belunapplet
19:42Raynesbelun: It isn't an applet.
19:42pppaulhtml5?
19:42pppaul6?
19:42Raynesnimred: It's sandboxed. You can't do dangerous stuff.
19:42belunwhat's a sandbox ?
19:42Raynespppaul: Javascript.
19:42pppaulhtml5 is javascript
19:43belunwut ?
19:43Raynesbelun: It's something that prevents execution of dangerous code.
19:43nimredok
19:43pppaulwikipedia (sandbox)
19:43pppaulall of my code is dangerous
19:43belunirc (sandbox) :P
19:45pppauli'm learning apply!
19:45pppaul:D
19:46nimredwich way to run C-M-x expression ?
19:46pppaulcursor over the expression (def....) and C-M-x
19:46pppaulthe inferior-lisp needs to be running
19:47nimredCtrl+Alt+x ?
19:48nimred*** - EVAL: undefined function DEF
19:48bhenrynimred: mostly. sometimes Meta is ESC
19:48bhenryoh
19:49hiredmanyour slime is running common lisp
19:49nimredhiredman isn't it OK ?
19:49hiredmanOK ?
19:49hiredmanthis is #clojure
19:50hiredmanclojure is not common lisp
19:50hiredmanif you want help with common lisp you should find a common lisp irc channel
19:50pppaulhe wants to run clojure
19:51pppaulM-x clojure-mode
19:51pppaulmake sure your inferior-lisp is pointing to clojure
19:51RaynesAnd he wants to set it all up manually, for whatever reason. Gentoo user in the making.
19:51pppaulM-x describe-variable -> inferior-lisp (click on the customize button)
19:52Wilducknimred: are you following http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html? Because use that tutorial to get slime/swank/clojure working on debian. What OS are you using?
19:53Wilduck*I used
19:53nimredWilduck ArchLinux
19:53WilduckI see. Where in the tutorial are you getting stuck?
19:54WilduckIf slime is running common lisp, instead of clojure, I'm guessing that you don't have a swank server running that you're connecting to
19:55Wilduck~$ lein swank
19:55clojurebotleiningen is a build tool designed not to set your hair on fire (http://github.com/technomancy/leiningen)
19:55Wilduckat the command line should start the swank server
19:55pppauli like it when a pretty girl sets my hair on fire
19:55Wilduckand then in emacs M-x slime-connnect will connect to it
19:56nimredwhat should inferior-lisp-program be set to ?
19:56nimred/PATH/TO/clojure.jar ?
19:56pppaulclojure
19:56pppaulwhat you use on the command line to run clojure
19:57pppaulmine is set to clj, which is a script in /usr/bin
19:57WilduckI never set inferior-lisp-program when using swank
19:57pppauli've never used swank
19:58pppaulmaybe i should start ^_^
19:58WilduckAlthough I (sort of) remember that step from when I set up SBCL
19:59Wilducknimred: can you pastebin your .emacs?
19:59Wilduckor at least the relevant sections?
20:01pppaulanyone used cake?
20:01nimredWilduck http://clojure.pastebin.com/KDt9Fmq0
20:03nimredrunning C-M-x gives me : "Process lisp does not exist"
20:03pppaulM-x inferior-lisp
20:05Wilduckintersting...
20:05nimredWilduck ?
20:06nimreduser=> (def animator (agent nil))
20:06nimred(def animator (agent nil))
20:06nimred#'user/animator
20:06nimredrunning M-x inferior-lisp
20:07Wilducksorry, it's just that I didn't set the inferior-lisp-program, and am instead starting a swank server any time I want to use slime. So I'm not sure what's going wrong for you
20:07Wilduckbut I'm curious
20:08nimredWilduck looks like working
20:08nimredno ?
20:09Wilducksorry?
20:09Raynesinferior-lisp != slime
20:09WilduckRaynes: right
20:10WilduckI may be trying to solve a different problem than nimred is having
20:10WilduckI just saw that he was using the same tutorial that I used
20:10nimredhttp://clojure.pastebin.com/eZVNJEKV
20:11Wilduckbut setting inferior lisp is not a part of said tutorial...
20:11WilduckI think I might be in over my head, I'm pretty new at this...
20:13nimredWilduck did http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html completly worked for you ?
20:13nimredif so on which distribution ?
20:13nimredand when did you run this tuto ?
20:13Wilduckit worked, and I'm using debian stable
20:14Wilduckas of a few weeks ago
20:14Wilduckarch is *definitely* more bleeding edge, so I don't see why it wouldn't work if it worked on debian stable
20:15nimredok let's redo. I perhaps missed something
20:15WilduckIt took me 5+ tries, but it ended up working
20:20RaynesYay! My VPS is back up. Here comes teh sexpbot!
20:20eeeyo long time since i've been here. giving clojure another look
20:20eeecan't get my multimethod to work
20:20eeeand no example looks like my sitruation
20:21eeewhat if you have two arguments. the first arg is always the same or you don't care. but you want to switch on the second argument
20:21eeeno one ever has a two-argument example for multimethods
20:21chouser(defmulti myfoo (fn [_ x] x))
20:22eeei have to write a custom function?
20:22chouseryou always have to provide a function
20:22hiredmanperish the thought
20:22eeenah, sometimes you just say the type
20:22hiredmantype is a function
20:22eeehere's my case: (defmethod heap-add java.util.Map [a-heap data-pri-map]
20:23eeethe data-pri-map is the thing to switch on
20:23eeea-heap is always the same
20:23chouser(defmulti myfoo (fn [_ x] (type x)))
20:23RaynesHrm.
20:24RaynesI think I broke my database.
20:24eeethanks chouser. i'll try to understand that
20:25tomojtechnomancy: are you aware of github ssl problems with lein?
20:25tomojmaybe it's just me
20:25chouser(defmulti heap-add (fn [a-heap data-pri-map] (type data-pri-map)))
20:25Raynes$seen amalloy
20:26sexpbotamalloy was last seen quitting 17 hours, 55 minutes ago.
20:26RaynesThere we go.
20:27eeethanks. I think I would have assumed it would be different, like in java where the types are with the variables, pairwise, in the signature
20:29rata_hi
20:30eeeit didn't work
20:30eeesays the syntax has now changed
20:31eeeis there somewhere I can cut-n-paste some code?
20:33nimredWilduck :
20:33nimred[~/opt/clojure-contrib]->> cp target/clojure-contrib*.jar ~/.clojure/clojure-contrib.jar
20:33nimredzsh: no matches found: target/clojure-contrib*.jar
20:33nimred:/
20:35nimredafter having run `git clone git://github.com/clojure/clojure-contrib.git`
20:35hiredmanyou really should just follow the swank-clojure readme
20:36nimredand `cd clojure-contrib && mvn package`
20:37eeehttp://pastebin.ca/1984944
20:37eeestill confused
20:38eeehere's the error: Unable to resolve symbol: a-heap in this context
20:42nimredok using `git clone git://github.com/richhickey/clojure-contrib.git ` it works
20:42eeeanyone know a good resource on multimethods? I guess I could always write my own dispatcher
20:42eeea map of types to functions
20:47eeehi. sorry to bug people, but anyone just entering see what's wrong with this code? http://pastebin.ca/1984944
20:53eeei tried this, too: http://pastebin.ca/1984952
20:53eeeno luck :(
20:53Wilducknimred: I guess I remember having to play around with which repositories I was downloading from
20:54puredangereee: what error do you see? are you not seeing the dispatch go the right place? if so, it sometimes helps to break your dispatch function out as a top-level defn and test it separately
20:54RaynesDME heard my cries, and claims to have moved me to a better server with less clients, and promises to ensure stability.
20:55eeei don't know the most basic thing about dispatch when I have two args. the second arg is the one to switch on, but i still need the first arg
20:55Wilducknimred: I actually started out by following http://riddell.us/ClojureWithEmacsSlimeSwankOnUbuntu.html
20:55puredangereee: at a glance it also appears you are trying to call .insert on a java.util.Map, which does not exist
20:55eeei get "unable to resolve heap-add
20:55eeethe insert is on my heap
20:55Wilduckand dug around for all sorts of different repositiories
20:55eeei have a heap
20:55Wilducksomehow I found a combination that worked
20:55eeeand I want to be able to insert based on input as a map
20:56eeeor on a pair
20:56puredangereee: for a dispatch function that switches on second arg, you want: (defmulti heap-add [x y] (class y)) usually
20:56hiredmanno you don't
20:56hiredmanyou want to go read the multimethod docs on clojure.org
20:56eeei had that already
20:56eeeit did not work
20:57eeei have been on clojure.org for an hour
20:57eeetoo dumb
20:58eeeThe syntax for defmulti has changed. Example: (defmulti name dispatch-fn :default dispatch-value) (jc_pheap.clj:34)
20:59eeeit's very very difficult in clojure to discern literal things from variables
20:59eeei never know what i am supposed to replace
21:00puredangereee: sorry, meant: (defmulti heap-add (fn [x y] (class y))
21:02puredangerthen you would (defmethod heap-add java.util.Map [x y] ( ... whatever where y is a Map ... ) )
21:03nimredok
21:03nimredhttp://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html? doesn't work
21:03nimredhttp://riddell.us/ClojureOnUbuntu.html doesn't
21:03eeegetting closer
21:04eeenow i got yelled at because my dispatch is for java.util.Vector but [] is a persistentVector
21:05Wilducknimred: The first one is the tutorial I ended up using, although I'm pretty sure the location of some of the repositories is slightly out of date, a fact I failed to remember earlier
21:05Wilduckthe second one definitely didn't work, but it was the tutorial I tried first
21:06nimredeh guys i won't spend a week to get clojure/sllime/swank working using emacs
21:08puredangereee: you could switch on something like Indexed (in clojure.lang) if you want to call nth on it
21:09nimredso wich repository is up to date ?
21:09nimredwhich one to use ?
21:09Wilduckwhich one isn't working?
21:09nimredwhy isn't a GOOD OFFICIAL tutorial to get it installed ?
21:09nimredthe one on tutorial
21:10nimredgit://github.com/clojure/clojure-contrib.git doesn't work
21:11Wilduckdidn't you say git clone git://github.com/richhickey/clojure-contrib.git worked for you?
21:11nimredsure it worked
21:11nimredbut git://github.com/clojure/clojure-contrib.git didn't
21:12puredangereee: or maybe this is just generally the wrong path...not sure I understand what you're doing really
21:12hiredmanrichhickey/clojure and clojure-contrib are not the right repos any more
21:13nimredand git://github.com/clojure/clojure-contrib.git is the one mentioned in tuto
21:13nimredhiredman so which one ?
21:13nimredshit is human food
21:14nimredwrite an official tuto and track it up to date...
21:14nimredtime to go to bed
21:14nimredshit is human food
21:27pppaulnimred should use something other than emacs
21:29pppaulthe tutorials should be wikis, so they can be maintained
21:31jrpalright back at it. Ive installed leiningen from macports, and am trying to use it to start lein-vimclojure. When i start it up, I get a no class def found error for clojure/main, which means I think my classpath is screwed up. My classpath however, contains the clojure jars
21:34tonylhello
21:37hiredmandon't install anyting from a package manager, follow the installation instructions for lein from the readme
21:37hiredmangrab the clojure jar from the website
21:37jrpok
21:37hiredmananything in package managers is out of date
21:38rdeshpandejrp: i installed clojure and leiningen from homebrew
21:38rdeshpandejrp: then i installed vimclojure from the mercurial repo
21:38pppaul(vars)
21:38pppaul&(vars)
21:38sexpbotjava.lang.Exception: Unable to resolve symbol: vars in this context
21:39rdeshpandecemerick: cool talk on continuous deployment
21:41cemerickrdeshpande: the talk or screencast? In either case, thanks :-)
21:41pppaullinks?
21:43cemerickpppaul: http://cemerick.com/2010/11/02/continuous-deployment-of-clojure-web-applications/
21:43pppaul(clojure.contrib.math/abs 4) (fix please) :D
21:45cemerickpppaul: what's the problem?
21:46cemerick&(clojure.contrib.math/abs 4)
21:46sexpbotjava.lang.ClassNotFoundException: clojure.contrib.math
21:46cemerick,(clojure.contrib.math/abs 4)
21:46clojurebotjava.lang.ClassNotFoundException: clojure.contrib.math
21:46cemerickoh well
21:46pppaulneed to use 'use'
21:46cemerickwon't work in the sandboxes, I presume
21:46cemerick&(require 'clojure.contrib.math)
21:46sexpbotjava.io.FileNotFoundException: Could not locate clojure/contrib/math__init.class or clojure/contrib/math.clj on classpath:
21:46cemerick,(require 'clojure.contrib.math)
21:46clojurebotjava.io.FileNotFoundException: Could not locate clojure/contrib/math__init.class or clojure/contrib/math.clj on classpath:
21:46pppaul(use 'clojure.contrib.math (abs 5))
21:46cemerickno contrib in either bot?
21:47pppaul,(use 'clojure.contrib.math (abs 5))
21:47clojurebotjava.lang.Exception: Unable to resolve symbol: abs in this context
21:47cemerickpppaul: what's the problem you're seeing?
21:47pppauli'm trying to use namespaces without using 'use'
21:47pppaulis that silly?
21:47cemerickYou need to require them.
21:48cemerick(require 'some.ns) (some.ns/some-fn …)
21:48cemerickpppaul: see: http://clojure.org/libs
21:48pppaul(use 'clojure.contrib.ns_utils)
21:48pppauljava.lang.Exception: namespace 'clojure.contrib.ns_utils' not found after loading '/clojure/contrib/ns_utils' (NO_SOURCE_FILE:0
21:49cemerickpppaul: it's ns-utils, not ns_utils
21:49Raynes&"still working?"
21:49sexpbot⟹ "still working?"
21:49pppauloh
21:50Raynes,(require 'clojure.contrib.math)
21:50clojurebotjava.io.FileNotFoundException: Could not locate clojure/contrib/math__init.class or clojure/contrib/math.clj on classpath:
21:50RaynesI can't figure that out.
21:50RaynesWhy wouldn't that work in a sandbox?
21:50RaynesIt doesn't work on my sandbox either, which is totally different.
21:51cemerickRaynes: that's just no contrib jar on the classpath, not a security exception
21:51pppauli'm trying to use (vars)
21:51RaynesIt works in my new sandboxing library (sexpbot doesn't use that).
21:51Raynescemerick: Right, but there is.
21:51Raynes&(clojure.contrib.json/pprint-json "")
21:51sexpbot⟹ ""nil
21:51cemerickoh, that's interesting
21:51cemerick&(System/getProperty "java.class.path")
21:51sexpbotjava.lang.IllegalArgumentException: No matching method found: getProperty for class java.lang.Class
21:52cemerickwha?
21:52RaynesAw man.
21:52RaynesI introduced a new bug in clj-sandbox.
21:52RaynesI'm actually working on my own sandboxing library. Not ready for sexpbot though.
21:52RaynesYou can require clojure.contrib.math in it. :>
21:53cemerickI'll leave you to figuring it out then ;-)
21:54RaynesI'll fix clj-sandbox after The Walking Dead. Then, I'll spend the rest of the night making clojail awesome.
21:56pppaul,(ns-map 'user)
21:56clojurebot{sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, val #'clojure.core/val, ProcessBuilder java.lang.Pro...
21:57pppaulsexy
22:07pppaul,(unquote 'quote)
22:07clojurebotjava.lang.IllegalStateException: Var clojure.core/unquote is unbound.
22:07pppaul(doc unquote)
22:07clojurebot"; "
22:07pppaulhot stuff
22:15pppaul,(unchecked-add Integer/MAX_VALUE Integer/MAX_VALUE)
22:15clojurebot-2
22:16tonyllol
22:16tonyl,Integer/MAX_VALUE
22:16clojurebot2147483647
22:16pppaul,(Math/abs Integer/MIN_VALUE)
22:16clojurebot-2147483648
22:17tonylwhy the minus sign in both
22:17tonylthat is weird
22:17pppaulabs doesn't always return a positive value
22:17tonylthe defies it's definition
22:17clojurebotHuh?
22:17pppaulit's like pandoras box
22:18tonyli can see that
22:18tonylwonder if it is because of those big values
22:18pppaulit does bit manipulation, so when given min_value it screws up
22:19tonyl,(Math/abs (+ 1 Integer/MIN_VALUE))
22:19clojurebot2147483647
22:20tonyl,(Math/abs (- 1 Integer/MIN_VALUE))
22:20clojurebot2147483649
22:20tonylok
22:21tonyl,(Math/abs (+ Integer/MIN_VALUE))
22:21clojurebot-2147483648
22:21pppaul,(unchecked-add 5 55555555555)
22:21clojurebotjava.lang.ExceptionInInitializerError
22:21pppaul,(unchecked-add 5555555555555 55555555555)
22:21clojurebotjava.lang.ExceptionInInitializerError
22:21pppaulawww
22:21bhenryis there a shortcut for (remove nil? (map …))
22:21pppaulremove nil?
22:21pppaulyou aren't supposed to remove the nils
22:22tonyli see it pretty concise
22:22bhenryi didn't know if there was a single function that did it
22:22pppaulmake your own, then change if you find out later
22:23pppauli didn't see many functions for seq operations
22:23DeranderI don't know how much clearer it can be
22:23pppaulmost are very general
22:23Derander(remove-nils (map ..))
22:23Derander?
22:23Deranderruby has Array#compact
22:23pppaul(doc remove-nils)
22:23clojurebotCool story bro.
22:23Deranderpppaul: was speculating
22:23pppaulclojure likes it's seqs fat
22:25tonyl&(remove nil? {:a 1 nil 2 :c 3 })
22:25sexpbot⟹ ([:c 3] [nil 2] [:a 1])
22:25tonyl&(remove nil? {:a 1 :b nil :c 3 })
22:25sexpbot⟹ ([:c 3] [:b nil] [:a 1])
22:26tonylthat doesn't seem to remove either by val or key, it takes a vector of the key and value pair
22:26pppaul(filter nil?)
22:26tonylbut as far as i know that wouldn't fly whey a map is constructed
22:26tonyl&(filter nil? {:a 1 :b nil :c 3 })
22:26sexpbot⟹ ()
22:26bhenrytonyl (map …) returns a seq. i wasn't removing nils from a map literal
22:26tonyl&(filter nil? {:a 1 nil 2 :c 3 })
22:26sexpbot⟹ ()
22:27tonyloh ok
22:27tonyl:P
22:35tomoj&(remove (comp nil? val) {:a 1 :b nil :c 3}) ; ?
22:35sexpbot⟹ ([:c 3] [:a 1])
22:35bhenrytomoj i like that
22:36bhenryif i comp zero? val i won't need to worry about removing nils after.
22:38bhenryoh wait.
22:38bhenryi didn't read all of it i guess
22:38tonylsomething like this
22:39tonyl,(remove (comp #(or (nil? %) (zero? %)) val) {:a 1 :b nil :c 3})
22:39clojurebot([:a 1] [:c 3])
22:42tobiasspis there anything other than using weka directly to implement hierarchical clustering with a custom distance function (geospatial stuff) ?
22:48rata_is there anything like (take n (iterate f ...)) that calls f exactly n times?
22:49amalloyrata_: i don't think there's a built-in for it
22:49somniumrata_: dotimes or repeatedly?
22:50amalloysomnium: those don't do the same thing as iterate
22:51somniumyes, but his example would call f exactly n times, so I was guessing at the meaning of like
22:51amalloyi see
22:51tonyli would say loop and recur would do your trick
22:56rata_ok, let's do it with loop and recur
22:59amalloyrata_: wait, i don't get it. is there something wrong with (take n (iterate f ...))? loop/recur will get you the same result with more work
23:00tonylrata_: would f take any input?
23:00rata_amalloy: the wrong thing is chunking in this case, because f takes a lot of time to return
23:00amalloyrata_: iterate and take don't chunk
23:01rata_really? aren't they lazy? doesn't every lazy seq do chunking?
23:01amalloyyes; yes; no
23:02rata_oh ok... thanks :)
23:02amalloycompare (source map) with (source iterate)
23:09Raynescemerick: http://try-clojure.org/
23:09RaynesIn case you haven't seen it yet.
23:09RaynesCourtesy of apgwoz
23:09cemerickmmm, getting swankier :-)
23:10cemerickso to speak, of course ;-)
23:11RaynesI have a guy on the interactive tutorial as well.
23:11RaynesLauJensen will be pleased.
23:12rata_Raynes: I've just spotted a type, in the second line of the second paragraph of the tutorial... it should say "independently"
23:12RaynesHe was the first one to be very vocal about tryclojure's ugliness. He actually helped me with the original design.
23:12rata_hahahaha a typo
23:12Raynesrata_: Probably plenty of them. That tutorial is mostly just a stub.
23:12rata_ok
23:12RaynesFogus made some changes to it a while back. Probably his typo.
23:12Raynes>:)
23:13amalloyRaynes: is this the "official" tutorial, or is someone working on a complete replacement?
23:13amalloyif it's going to be the real thing i'll do some copy-editing
23:13Raynesamalloy: Once the interactive tutorial is ready, the tutorial will be rewritten, fixed, changed, mutilated, or any number of things to make it better.
23:14RaynesIt needs more content too.
23:14amalloyk. so i shouldn't spend any significant time on it till then? let me know when it's ready for proofing
23:14RaynesThe guy is just working on an interactive tutorial. The actual content for that tutorial isn't his responsibility.
23:14Raynesamalloy: Will do! :D
23:18tomojanyone using nutch?
23:36Intertricity_How long before ClojureCLR gets to see the light of day? In a clojure box >.>
23:36Intertricity_Just like lispbox
23:41rata_is it right to do (time (let [x (f ...)] nil)) to compute how long f takes to run?
23:41tonylor just (time (f ...)
23:41tonyls/)/))/
23:42rata_because I did it and it seemed to take like 3 secs but time said 0.07 millisecs
23:42rata_tonyl: I don't want the REPL to print the output
23:43tonyltime will always print the output
23:43tonylunlees you bind
23:43tonylbind *in*
23:43amalloyrata_: if anything is lazy, (time) will print how long it takes to get the head of the sequence, and then the repl will force the sequence so you can see it
23:44rata_amalloy: ok, then doall is what I need there
23:44rata_tonyl: no, it won't if you return nil insted of the output
23:44amalloyrata_: i'd use dorun, if you don't actually want the result
23:45tonyl,(time (let [x (var rest)] nil))
23:45clojurebot"Elapsed time: 0.062 msecs"
23:45amalloy&(->> (range) (take 10000000) dorun time)
23:45sexpbotjava.lang.IllegalArgumentException: No matching method found: nanoTime for class java.lang.Class
23:45amalloy,(->> (range) (take 10000000) dorun time)
23:45rata_tonyl: by output I mean the output of calling f
23:45clojurebotExecution Timed Out
23:45tonylooh ok
23:46amalloyrata_: dorun won't print the output, and it won't hold onto the head, but it won't return until it's consumed the whole seq
23:46amalloyso it sounds like exactly what you want
23:46rata_yes, you're right :) it's exactly what I want
23:47tonylis the # suffix in vars inside macros a convention or does the reader do something different with them?
23:47amalloythe reader
23:47amalloydoes super-magic
23:47tonylwhat does it do with them?
23:48RaynesI'm fixing that bug.
23:48rata_mmmm... my code performs just a little slower than the prototype I wrote one year ago in python
23:49rata_what do you use to profile? I used visualvm, but it caused my code to run super-slow
23:49rata_I had to kill the app
23:55tonyl'x#
23:55tonyl,'x#
23:55clojurebotx#
23:55tonyl&`x#
23:55sexpbot⟹ x__5883__auto__
23:56tonylwhat is the gain from a non-fully-qualified symbol and a qualified one?
23:57tonyl&(gensym :wer)
23:57sexpbot⟹ :wer5888
23:57tonyl&`(gensym :wer)
23:57sexpbot⟹ (clojure.core/gensym :wer)
23:57amalloy,(let [myns/x 1] myns/x)
23:57clojurebotjava.lang.Exception: Can't let qualified name: myns/x
23:57amalloytonyl: ^^
23:57tonyloh mm