2010-11-07
| 00:00 | wooby | same here :/ |
| 00:00 | amalloy | nimred: http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html should work, but it will be more involved than necessary since it has you building everything from source |
| 00:00 | nimred | shouldn't http://clojure.pastebin.com/mvqjB3BB settings be OK ? |
| 00:02 | hiredman | you should follow the instructions in the swank clojure readme |
| 00:02 | amalloy | nimred: i suspect you may have to put slime before swank-clojure |
| 00:02 | hiredman | I have yet to see any blog post on the subject that is not hilariously out of date |
| 00:03 | nimred | hiredman i did but (require 'swank-clojure-autoload) didn't work :/ |
| 00:04 | hiredman | nimred: that isn't in the readme anywhere |
| 00:04 | hiredman | https://github.com/technomancy/swank-clojure |
| 00:07 | nimred | amalloy ok loading slime before swank-clojure as you suggested made emacs starting without any error |
| 00:33 | tonyl | ping? |
| 00:33 | clojurebot | PONG! |
| 00:34 | amalloy | tonyl: pinging anyone in particular, or just clojurebot? |
| 00:34 | tonyl | just clojurebot, i do that everytime I join the channel |
| 00:34 | hiredman | ~#1 |
| 00:34 | clojurebot | 1. One man's constant is another man's variable. |
| 00:36 | Adamant | ~#42 |
| 00:36 | clojurebot | 42. You can measure a programmer's perspective by noting his attitude on the continuing vitality of FORTRAN. |
| 00:36 | Adamant | ~#34 |
| 00:36 | clojurebot | 34. 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:36 | Adamant | \ |
| 01:40 | amalloy | there 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:19 | tobiassp1 | any 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:21 | amalloy | um. this is going to be pretty hard with no idea what's in your source files, tobiassp1 |
| 01:22 | amalloy | could you provide a link? particularly to any source file that includes "freenode" |
| 01:23 | tobiassp1 | amally: just a main with println hello world |
| 01:23 | tobiassp1 | literally just newed the project and added the defn to the projectname.clj |
| 01:24 | amalloy | hm. maybe something is wrong with my irc client |
| 01:25 | amalloy | is 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:26 | tobiassp1 | amalloy: http://pastebin.com/KazycWXM |
| 01:27 | amalloy | hrm. are you sure about that? core.clj and project.clj seem to be switched |
| 01:27 | amalloy | if that's really the contents of your files they need to be reversed |
| 01:27 | amalloy | but i assume just a mispaste |
| 01:28 | tobiassp1 | doh of course … misspaste |
| 01:28 | tobiassp1 | thanks for checking it out btw |
| 01:28 | amalloy | k. i'll try to reproduce it locally |
| 01:28 | amalloy | what directory is core.clj in? src/project/core.clj? |
| 01:29 | tobiassp1 | yeah |
| 01:29 | amalloy | okay. your namespace needs to mirror your directory layout |
| 01:29 | amalloy | so subcity.core needs to be in src/subcity/core.clj |
| 01:29 | amalloy | and :main needs to refer to the actual namespace |
| 01:30 | tobiassp1 | heh … i replaced instances of subcity with project … apparently i didnt catch all instances |
| 01:30 | tobiassp1 | sorry |
| 01:30 | amalloy | *chuckle* |
| 01:30 | tobiassp1 | let me paste it up verbatim :) |
| 01:31 | tobiassp1 | if you refresh … i fixed it |
| 01:31 | tobiassp1 | sorry bout that |
| 01:32 | amalloy | sure? even with ctl-f5 it looks the same to me. i think amendments get a new url |
| 01:32 | tobiassp1 | http://pastebin.com/PStaP5C8 |
| 01:32 | tobiassp1 | shows that i was running a fever earlier |
| 01:33 | amalloy | okay. and core.clj is actually in src/subcity? |
| 01:33 | tobiassp1 | yeah |
| 01:33 | tobiassp1 | osx btw with clojure and lein from macports |
| 01:34 | amalloy | hm. well your files look fine |
| 01:34 | tobiassp1 | i figured i didnt get far enough to make any mistakes ;) |
| 01:35 | amalloy | *laugh* |
| 01:35 | amalloy | yeah, when i lein uberjar it up it works fine |
| 01:36 | tobiassp1 | i guess i will remove the macports versions and bootstrap everything with the lein shell script … is that the recommended approach ? |
| 01:36 | amalloy | tobiassp1: i'm afraid i can't help there. haven't touched a mac in years |
| 01:37 | amalloy | but that's what i'd do. or if you don't mind a little ruby, you could use cake instead of lein |
| 01:38 | tobiassp1 | thanks a ton for your help |
| 01:38 | amalloy | you might also need to add :gen-class to your (ns) declaration? |
| 01:38 | tobiassp1 | i tried that with the same result |
| 01:38 | amalloy | k |
| 01:38 | amalloy | well yes, it's not going to fix *this* problem |
| 01:39 | tobiassp1 | i'll redo my env :) thanks again |
| 01:40 | amalloy | tobiassp1: just tried it locally: it needs :gen-class |
| 01:40 | amalloy | (in addition to whatever else) |
| 01:40 | tobiassp1 | k will add that again |
| 01:43 | tobiassp1 | omfg that worked … lame |
| 01:44 | amalloy | just junking macports? |
| 01:44 | tobiassp1 | macports lein version is borked |
| 01:44 | tobiassp1 | yep |
| 01:44 | amalloy | yeah, lein is supported on linux and windows, to the best of my knowledge |
| 01:46 | tobiassp1 | well now i get to do productive stuff :) thanks for helping me out |
| 01:46 | amalloy | any time |
| 01:46 | amalloy | #clojure is pretty friendly. pop in as needed |
| 01:49 | tobiassp1 | thanks! |
| 01:59 | amalloy | anyone 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:44 | LauJensen | Morning all |
| 04:00 | Raynes | Top of the mornin' to ya. |
| 04:24 | kumarshantanu | hi all |
| 04:26 | kumarshantanu | I wonder if stack trace printing should be pluggable *stacktrace-printer-fn* in Clojure 1.3 -- anybody shares the idea? |
| 04:30 | dmao | hi, 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:31 | kumarshantanu | dmao: it does |
| 04:31 | kumarshantanu | dmao: you need to say it like this -- (use 'app.xyz) |
| 04:31 | dmao | ah ok, that's why. thanks |
| 04:57 | danishkirel | &(loop [] (or (when-let [a nil] (recur)) 1)) |
| 04:57 | sexpbot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer |
| 05:02 | danishkirel | &(loop [] (or (when-let [a nil] (recur)) "test")) |
| 05:02 | sexpbot | java.lang.UnsupportedOperationException: Can only recur from tail position |
| 05:04 | danishkirel | So 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:05 | LauJensen | You can only use recur from the tail position |
| 05:06 | danishkirel | Yea - the error tells me. But it is some kind of tail position because or is short circuited, isn't it? |
| 05:08 | jarpiain | ,(macroexpand '(or (recur) "test")) |
| 05:08 | clojurebot | (let* [or__3470__auto__ (recur)] (if or__3470__auto__ or__3470__auto__ (clojure.core/or "test"))) |
| 05:09 | danishkirel | I see. |
| 05:36 | Raynes | sexpbot: Night, my friend. |
| 05:37 | bmh | enjoy your timezone |
| 05:37 | sexpbot | Raynes: Night, master. <3 |
| 05:37 | Raynes | bmh: It's nearly 5AM here. |
| 05:37 | bmh | Raynes: It's nearly 11AM here |
| 05:37 | Raynes | I just have a weird/non-existent sleeping schedule. |
| 05:38 | bmh | You'll do well in college. |
| 06:17 | esj | 1 |
| 08:27 | agravier | Hi everyone |
| 08:29 | agravier | (noob warning) I've been trying to unit test some relatively simple code using atticus. https://github.com/hugoduncan/atticus |
| 08:30 | agravier | Is anyone using it too? Or are there better alternatives? |
| 08:31 | hugod | agravier: it's not the most popular option - are you familiar with clojure.test? |
| 08:32 | agravier | hugod: Yes, well, i read the doc, but I did't see how to easily mock functions |
| 08:33 | agravier | hugod: (I use the assertions and other basic forms in clojure.test, of course.) |
| 08:34 | hugod | agravier: you can replace the implementation of a function (at least in 1.2) by binding it to a new function |
| 08:39 | lpetit | hello, are the maven-clojure-plugin gurus in the room ? |
| 08:40 | agravier | hugod: So you are telling me that I can use (let [mockedfn #(...)] calling-fn) within mytests to mock a called function? |
| 08:41 | lpetit | agravier: replace let with binding |
| 08:43 | agravier | lpetit: Thank you, I'll do that and read the binding doc. |
| 08:44 | agravier | Additionally (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:44 | lpetit | agravier: 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:45 | lpetit | agravier: which output do you expect ? |
| 08:46 | lpetit | agravier: map is lazy, and you do not start to consume its result (stored in the 'a' local) anywhere |
| 08:46 | agravier | lpetit: processing 1\nprocessing 2... (and the expected value 'smth) |
| 08:46 | agravier | lpetit: Hoooooo lazyness |
| 08:47 | agravier | lpetit: Thank you, I have to get used to think about lazy evaluation. I understand. |
| 08:48 | lpetit | agravier: np. You can still (for test purposes, I imagine) make the map fully realize itself by encapsulating it in a call to doall |
| 08:48 | lpetit | ,(doc doall) |
| 08:48 | clojurebot | "([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:48 | lpetit | >(doc doall) |
| 08:49 | lpetit | argh |
| 08:49 | agravier | lpetit: Yes, thanks for reminding me that. |
| 08:50 | agravier | lpetit: I get back to understanding my own code now, have a nice day. |
| 10:30 | kzar | Is there an opposite of map that takes a list of functions and runs each one on some value? |
| 10:31 | kzar | oh I could use a for loop, sory |
| 10:31 | kzar | sorry* |
| 10:32 | jonasen | ,(map #(% 2) [dec identity inc]) |
| 10:32 | clojurebot | (1 2 3) |
| 10:33 | kzar | jonasen: Oh cool, that's even better |
| 10:33 | Vinzent | ((reduce comp [f1 f2]) value) |
| 10:35 | kzar | jonasen: Thanks, I should have remembered when I did that accidently the other day |
| 10:37 | MayDaniel | kzar: ((juxt dec identity inc) 2) |
| 10:41 | dnolen | ,((apply juxt [dec identity inc]) 2) |
| 10:41 | clojurebot | [1 2 3] |
| 10:43 | kzar | Wow juxt is a pretty cool idea |
| 10:44 | kzar | I 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:08 | dnolen | ,((juxt :foo :bar :baz) {:foo 'a :bar 'b :baz 'c :woz 'd}) |
| 11:08 | clojurebot | [a b c] |
| 11:09 | LOPP | how do you do sorting in clojure |
| 11:10 | LOPP | using java sort functions? |
| 11:10 | morphling | ,(doc sort) |
| 11:10 | clojurebot | "([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:17 | LOPP | ah crap |
| 11:17 | LOPP | so I can't just pick a clojure fn |
| 11:17 | LOPP | to sort with? |
| 11:17 | LOPP | also does sort function use transients or something |
| 11:18 | LOPP | somehow I think swaping vector elements on immutable vector would incur a huge overhead |
| 11:18 | dnolen | ,(sort > [1 2 3 4 5 6]) |
| 11:18 | clojurebot | (6 5 4 3 2 1) |
| 11:19 | LOPP | wait what |
| 11:19 | LOPP | how is > a java.util.comparator? |
| 11:19 | LOPP | confused |
| 11:19 | dnolen | LOPP: fns already implement that interface |
| 11:20 | dnolen | convenient, eh? |
| 11:20 | LOPP | really? |
| 11:20 | LOPP | jesus chirst how many interfaces do they implement |
| 11:21 | dnolen | a bazillion |
| 11:21 | LOPP | ,(sort (fn [] "ff") [1 2 3 4]) |
| 11:21 | clojurebot | java.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong number of args (2) passed to: sandbox$eval698$fn |
| 11:21 | LOPP | hm |
| 11:22 | Chousuke | clojure classes are rather interface-heavy :P |
| 11:23 | LOPP | I don't understand the error I got here |
| 11:23 | dnolen | that fn needs to take two arguments |
| 11:23 | dnolen | LOPP: ^ |
| 11:23 | LOPP | aha |
| 11:23 | kzar | I 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:24 | dnolen | kzar: import is for java classes |
| 11:24 | dnolen | clojurebot: use |
| 11:24 | clojurebot | use vs require is (:use [lib :only [a b c]) or (:require [lib :as alias]) -- (:use lib) is only for playing around |
| 11:24 | LOPP | so fns that don't take 2 arguments and don't return a number implement Comparator so all its methods throw an exception? |
| 11:25 | LOPP | ,(sort (fn [a b] "ff") [1 2 3 4]) |
| 11:25 | clojurebot | java.lang.RuntimeException: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number |
| 11:25 | LOPP | ok |
| 11:25 | LOPP | that was expected |
| 11:25 | LOPP | what about my second question |
| 11:26 | dnolen | LOPP: which is what? |
| 11:26 | LOPP | sorts do element swaps inside a vector |
| 11:26 | LOPP | in clojure vectors this would cause a huge overhead |
| 11:26 | LOPP | as a bunch of new vectors would get generated |
| 11:26 | LOPP | is this worked around somehow? |
| 11:26 | kzar | (: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:27 | LOPP | in other words, would I be better served by converting into a java array and sorting that? |
| 11:30 | dnolen | LOPP: sort converts the collection to an array first then sorts, then returns a seq of the sorted collection |
| 11:30 | dnolen | sorted array I mean |
| 11:32 | mfex | fliebel: ping |
| 11:32 | fliebel | mfex: pong |
| 11:33 | dnolen | kzar: (ns your-ns (:use [wobble.notes :only [notes]])), should work |
| 11:33 | fliebel | sexpbot should give a ping time for this stuff... |
| 11:33 | mfex | I think I found the problem with freqs function for minecraft |
| 11:33 | fliebel | mfex: … I'm listening |
| 11:34 | mfex | I also posted a reply on the clojure group but I can't see it yet |
| 11:34 | LaPingvino | fliebel: tafeltennis |
| 11:34 | kzar | dnolen: Sweet it works :) thnaks |
| 11:35 | fliebel | LaPingvino: huh? |
| 11:35 | LOPP | dnolen: 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:35 | mfex | the 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:35 | LOPP | most of the time I do one transformation on my vector and bam...vector benefits are gone |
| 11:35 | dnolen | LOPP: you will need to coerce the seq back into a vector (into [] some-seq) |
| 11:36 | fliebel | mfex: You're thinking hex vs dec? |
| 11:36 | LaPingvino | fliebel: hoe noemen we tafeltennis ook wel ;) |
| 11:36 | mfex | fliebel: 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:36 | fliebel | LaPingvino: pingpong... |
| 11:37 | LOPP | dnolen:isn't that expensive? |
| 11:37 | mfex | fliebel: https://gist.github.com/666228 |
| 11:37 | LaPingvino | fliebel: precies :) |
| 11:37 | fliebel | mfex: good point I think… I'll let it sink in. |
| 11:38 | mfex | fliebel: could you run the python code for all the types? I couldn't get the python code to work |
| 11:38 | dnolen | LOPP: 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:38 | fliebel | mfex: You reordered a lot of the code. I'll try to run the Python code… on moment. |
| 11:42 | LOPP | my 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:43 | fliebel | mfex: It;s taking long… uncomfortably long… |
| 11:43 | mfex | fliebel: the python one I hope? |
| 11:43 | fliebel | mfex: yea |
| 11:44 | mfex | fliebel: the clojure code from the gist for all types take 40secs for me, because it only traverses the blocks array once |
| 11:45 | dnolen | LOPP: heh, write some moderately complex concurrent code and tell your brother to reimplement in CL. we'll see what he thinks then ;) |
| 11:45 | fliebel | mfex: I just piped all block types into the default blocks, and the resulting time is uncomfortably close to the clojure time. |
| 11:46 | mfex | fliebel: could you try the code from the gist? you only need to adjust the path to your level dir |
| 11:51 | LOPP | dnolen: true :) but not everyone works with concurrency, in fact I've never once needed to use it |
| 11:52 | fliebel | mfex: 12 seconds :D |
| 11:53 | mfex | fliebel: 12 secs for just freqs or total? |
| 11:53 | fliebel | freqs |
| 11:53 | dnolen | LOPP: in my experience even trivial tasks could benefit from good concurrency semantics, but most langs make it too hard to exploit that. |
| 11:55 | LOPP | a lot of the time I work with stuff that runs on servers like JSF pages, where multithreading is done by the container |
| 11:55 | mfex | fliebel: hmm I was hoping for less, the main point still stands tho |
| 11:56 | fliebel | mfex: Yea, so it's not a matter of how to do things fast, but what not to do. |
| 11:57 | fliebel | mfex: 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:58 | dnolen | LOPP: 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:59 | mfex | fliebel: 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:59 | fliebel | mfex: Thanks for figuring this out. I hope you had fun doin git :) |
| 11:59 | LOPP | here's one question: when do I use agents and when do I use futures |
| 11:59 | LOPP | they seem very much the same in a lot of regards |
| 12:01 | mfex | fliebel: fun it was |
| 13:05 | pppaul | can someone tell me the benifits of using swank or slime? |
| 13:05 | pppaul | right now i'm using just clojure-mode |
| 13:11 | Bahman | Hi all! |
| 13:19 | pppaul | batman? |
| 13:33 | nimred | i am trying to compile http://sprunge.us/IQYN but am getting http://sprunge.us/KUOA |
| 13:33 | nimred | what's wrong ? |
| 13:35 | dnolen | nimred: hmm looks like you don' t have your Clojure SLIME environment setup properly. |
| 13:38 | nimred | dnolen here are my settings --> http://sprunge.us/LSSb |
| 13:40 | dnolen | nimred: I never setup SLIME manually anymore, I just install from ELPA. I got tired of figuring out what was wrong w/ my setup. |
| 13:41 | nimred | dnolen elpa :/ |
| 13:42 | dnolen | nimred: yup, sadly the headache of elpa is less than the headache of managing SLIME configuration. |
| 14:02 | tonyl | ping? |
| 14:02 | clojurebot | PONG! |
| 14:04 | pppaul | pong? |
| 14:04 | clojurebot | PONG YANG! |
| 14:04 | pppaul | yang? |
| 14:04 | pppaul | ping pong? |
| 14:04 | pppaul | ping pong yang? |
| 14:05 | pppaul | (doc love) |
| 14:05 | clojurebot | Excuse me? |
| 14:07 | kzar | ying |
| 14:09 | jdsanders | Raynes: 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:15 | kzar | I'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:16 | jarpiain | kzar: AudioFileFormat$Type |
| 14:17 | kumarshantanu | hi, did anybody get La Clojure working with Clojure 1.2 ? |
| 14:17 | pppaul | what's special about la clojure? |
| 14:17 | kzar | jarpiain: Hmm that's not giving me anything either |
| 14:17 | pppaul | is it french? |
| 14:18 | jarpiain | kzar: you need to import it also |
| 14:18 | kumarshantanu | pppaul: "La Clojure" is the Clojure plugin for IntelliJ IDEA |
| 14:18 | pppaul | oooooooh |
| 14:18 | kzar | jarpiain: Ah sweet that works, thanks |
| 14:18 | kzar | jarpiain: What does the $ mean? |
| 14:19 | pppaul | (doc $) |
| 14:19 | clojurebot | No entiendo |
| 14:19 | jarpiain | it's the encoding javac uses for inner class names |
| 14:19 | tonyl | it is a class inside a class |
| 14:19 | jarpiain | inner classes don't really exist on the JVM level |
| 14:19 | kzar | heh 'Yo dawg...' |
| 14:34 | kumarshantanu | repeat-question -- did anybody here get La Clojure working with Clojure 1.2? |
| 14:39 | nimred | any good tutorial to install cloj-ure/swank/slime emacs modes without using elpa ? |
| 14:40 | kumarshantanu | nimred: is it useful? http://charsequence.blogspot.com/2010/07/setup-emacs-for-development-with.html |
| 14:42 | nimred | ah kumarshantanu also without starter-kit |
| 14:43 | kumarshantanu | nimred: do you want to use leiningen at all? |
| 14:43 | kumarshantanu | if not, perhaps you can just install Emacs and Slime and get going |
| 14:44 | kumarshantanu | Swank is to connect to lein-environment using slime-connect |
| 14:44 | Raynes | apgwoz: Yo. |
| 14:46 | nimred | isn't leiningen need to just compile clojure ? |
| 14:47 | kumarshantanu | nimred: lein is useful for several things |
| 14:47 | nimred | to build clojure code i mean |
| 14:47 | kumarshantanu | lein is advisable when working on a project rather than just a file or the REPL |
| 14:48 | kumarshantanu | Emacs doesn't know about Lein in particular, but it can connect to Lein using Swank/Slime-connect |
| 14:48 | kumarshantanu | nimred: if you can tell me your requirement maybe I can suggest something more specific |
| 15:27 | samx | when building a set with #{:a :b}, will the implementation be a hash-set, or some array based thing (like with literal maps) ? |
| 15:28 | chouser | ,(class #{:a :b}) |
| 15:28 | clojurebot | clojure.lang.PersistentHashSet |
| 15:28 | samx | cheers |
| 15:36 | bartj | what is the difference between PersistentHashMap and PersistentArrayMap? |
| 15:36 | bartj | , (type {:a 1}) |
| 15:36 | clojurebot | clojure.lang.PersistentArrayMap |
| 15:37 | Raynes | One has a longer name than the other. ;) |
| 15:37 | bartj | can someone give an example of PersistentHashMap ? |
| 15:42 | bartj | weirdly, I get the following error while using clojure.contrib.json: |
| 15:42 | bartj | Caused 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:45 | mfex | bartj : perhaps the input is not a string {} instead of "{}" |
| 15:47 | lpetit | hello. maven experts ? clojure-maven-contributors ? in the room ? |
| 15:47 | stuartsierra | eh? |
| 15:48 | lpetit | Hello Stuart |
| 15:48 | stuartsierra | hi |
| 15:49 | lpetit | I need all the experience of a maven guru because I just entered the "clojure maven club" :-) |
| 15:49 | stuartsierra | welcome |
| 15:49 | lpetit | So |
| 15:50 | lpetit | I 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:50 | bmh | has anyone used zef's jopenid wrapper? |
| 15:51 | lpetit | So I have attached the clojure:compile goal to the "generate-sources" phase, so that it comes first. |
| 15:51 | lpetit | But (yes, there's a but) |
| 15:51 | kumarshantanu | lpetit: would suggest split into multiple small projects (in dependency order) |
| 15:52 | lpetit | I'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:52 | stuartsierra | You probably need to split into separate projects or separate modules within a project. |
| 15:52 | lpetit | Wait ... :) |
| 15:53 | lpetit | I already have separate modules in the project which make sense. I do not have circular dependencies inside my artifact. |
| 15:54 | stuartsierra | Pretty much any time you need to control the order of compilation, you need separate modules |
| 15:54 | lpetit | The 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:55 | lpetit | But 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:55 | kumarshantanu | is there a function that wraps a value into a function that always return the constant? e.g. (wrap true) -- returns (fn [& x] true) |
| 15:55 | lpetit | stuartsierra: I understand. But I will resist separating artifacts just for the sake of technical concerns (contrary to design concerns) as far as possible |
| 15:56 | lpetit | constantly ? |
| 15:56 | stuartsierra | Resistance is futile |
| 15:56 | lpetit | ,(doc constantly) |
| 15:56 | clojurebot | "([x]); Returns a function that takes any number of arguments and returns x." |
| 15:56 | lpetit | stuartsierra: which rule number of the "maven club" ? ;-p |
| 15:56 | kumarshantanu | lpetit: ah yes, thanks! |
| 15:57 | stuartsierra | The first rule of Maven Club is Everybody Hates Maven |
| 15:57 | lpetit | stuartsierra, 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:58 | Plouj | wow, you people are actually using clojure for real projects? |
| 15:58 | lpetit | If 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:58 | lpetit | Plouj: are you asking this seriously ? |
| 15:58 | Plouj | lpetit: yes |
| 15:59 | kumarshantanu | Plouj: http://www.google.co.in/search?sourceid=chrome&ie=UTF-8&q=clojure+production+use |
| 15:59 | stuartsierra | lpetit: sorry, I have no idea what the Tycho plugin might be doing |
| 15:59 | lpetit | Plouj: AFAIC, depends whether you consider ccw a real project or not :) |
| 15:59 | kumarshantanu | lpetit: what's the use-case? Maven support in CCW? |
| 16:01 | lpetit | stuartsierra: 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:02 | stuartsierra | Does it alter the classpath in a way that clojure-maven-plugin can use? |
| 16:02 | lpetit | kumarshantanu: 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:02 | lpetit | answer I got from the Tycho mailing list: "Tycho injects all resolved OSGi dependencies back into Maven project |
| 16:02 | lpetit | model, so, in theory, regular maven mojos should see complete classpath |
| 16:02 | lpetit | with all dependencies." |
| 16:03 | lpetit | So 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:04 | lpetit | I would have expected that Tycho had injected these OSGi related classpath entries early on. |
| 16:04 | kumarshantanu | lpetit: because tycho is not Clojure-aware? |
| 16:04 | lpetit | kumarshantanu: yes, not aware at all. |
| 16:05 | lpetit | clojure-maven-plugin uses this: ${project.compileClasspathElements} |
| 16:05 | lpetit | (via dependency injection, if I understand well) |
| 16:05 | lpetit | And Tycho compiler does this: |
| 16:05 | kumarshantanu | lpetit: looks like -- split into (1) clojure specific stuff using Clojure-maven plugin, (2) rest of tycho-related parts that depends in #1 |
| 16:06 | lpetit | https://github.com/sonatype/sonatype-tycho/blob/master/maven-osgi-compiler-plugin/src/main/java/org/codehaus/tycho/osgicompiler/AbstractOsgiCompilerMojo.java#L220 |
| 16:06 | kumarshantanu | so, #1 and #2 are separate artifacts (perhaps independent projects) |
| 16:06 | lpetit | kumarshantanu: yes, but what if this does not make any architectural sense ? |
| 16:07 | lpetit | (interestingly enough, if somebody else would have asked, I may well be in Shantanu's position :) ) |
| 16:07 | lpetit | Is it bad to expect that the tool adapts to me ? :) |
| 16:07 | stuartsierra | with Maven, yes |
| 16:08 | stuartsierra | "You don't configure Maven, Maven configures you." |
| 16:08 | kumarshantanu | lpetit: if it finally "just builds" gives a JAR that "just works" that makes all the sense in the world ;-) |
| 16:08 | lpetit | in the end, yes, I wholeheartedly agree :-) |
| 16:09 | lpetit | stuartsierra: what is the maven incantation to avoid to prevent one's hairs become blue ? :-p |
| 16:09 | lpetit | :) |
| 16:09 | stuartsierra | mvn -DturnHairBlue=false |
| 16:09 | lpetit | sorry this joke was a little bit "hairy" |
| 16:09 | stuartsierra | It made me feel "blue" |
| 16:10 | lpetit | maven blues ? |
| 16:10 | lpetit | :) |
| 16:11 | technomancy | so... I don't suppose anyone has figured out how to get RT.load to work when Clojure is on the boot classpath? |
| 16:17 | technomancy | it'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:17 | technomancy | there should be a term for that phenomenon |
| 16:18 | stuartsierra | technomancy: Programming |
| 16:18 | technomancy | quite |
| 16:19 | kumarshantanu | technomancy: RT/load seems to be working for non-classpath'ed .clj files -- what am I missing? |
| 16:20 | technomancy | kumarshantanu: it works when clojure is on the bootclasspath? |
| 16:21 | kumarshantanu | technomancy: oops...let me try |
| 16:21 | lpetit | technomancy: will it be a problem related to classloader hierarchies visibility, or something more subtle related to the boot classloader ? |
| 16:22 | technomancy | lpetit: probably the first; I think the root cause is that RT.baseLoader assumes Compiler.class.getClassLoader will return a sensible value |
| 16:22 | technomancy | but it just returns nil when the bootclassloader comes into play |
| 16:23 | lpetit | technomancy: oops, yes. But why did it work *before* ? |
| 16:24 | technomancy | lpetit: I don't think it ever worked, but there were workarounds before that are no longer effective |
| 16:25 | technomancy | basically: 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:25 | technomancy | but now clojure.main requires clojure.repl, so you can't even get started. |
| 16:25 | technomancy | clojure.main used to depend on nothing |
| 16:25 | lpetit | technomancy: ok. |
| 16:25 | technomancy | I'd be happy if I could get that workaround fixed, but of course it would be better if RT.load just worked. =) |
| 16:26 | lpetit | good luck then (I don't use the bootclasspath trick myself, and would not recommend it anyway) |
| 16:26 | technomancy | lpetit: are you aware it cuts clojure's boot time in half? |
| 16:26 | technomancy | 0.59s here |
| 16:26 | lpetit | even if it cut it by 4, it would remain a trick, sorry for that. |
| 16:27 | technomancy | is there another way to skip running the bytecode verifier on a jar? |
| 16:28 | technomancy | don't say "dalvik" =) |
| 16:29 | lpetit | technomancy: :) |
| 16:29 | vibrant | evenin |
| 16:29 | technomancy | I'm interested to hear of the pitfalls. other than the RT.load problem it's been working fine so far. |
| 16:30 | technomancy | JRuby also uses it effectively |
| 16:30 | vibrant | technomancy; you use clj-processing? |
| 16:31 | technomancy | vibrant: once upon a time, but it's been about a year since I did |
| 16:31 | vibrant | oh, ok. i did a fork too and actually even committed some changes. |
| 16:32 | vibrant | probably more will come, as i write this game of mine :) |
| 16:32 | technomancy | cool. I found it to be fun. |
| 16:32 | vibrant | yeah it's the only package that is usable and documented. |
| 16:32 | vibrant | for graphics. |
| 16:34 | technomancy | it looks like the clj-processing guy is still somewhat active |
| 16:36 | vibrant | the 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:36 | vibrant | s/port/fork/ |
| 16:36 | sexpbot | <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:44 | jnymo | yerp |
| 16:44 | jnymo | this thing work? Am I on? |
| 16:44 | kumarshantanu | technomancy: I can't even get the REPL by putting clojure-1.2.0.jar in the boot classpath |
| 16:45 | kumarshantanu | maybe missing more subtle things |
| 16:45 | raek | jnymo: we can hear you |
| 16:46 | jnymo | hmm. used to have to sign in.. hmm |
| 16:47 | jnymo | anyway. So, I frequent the clojure community from time to time. |
| 16:47 | kumarshantanu | possible reason -- RT/load seems to depend on Class.forName infrastructure (which means the regular classpath) |
| 16:47 | jnymo | I 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:48 | jnymo | Honestly, I don't know. But I figured someone here would know. |
| 16:48 | jnymo | Doesn't have to be a big shop. But not a chop shop either. |
| 16:49 | jnymo | anyone have any favorites? |
| 16:50 | jnymo | I 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:51 | sl33k | which one is a good resource/tutorial on clojure |
| 16:51 | jnymo | It could even be done in compojure, if that's your fancy :) |
| 16:52 | jnymo | sl33k, honestly, clojure.org has a list of links with great tutorials. |
| 16:52 | kumarshantanu | Class.forName seems to be beyond Boot classloader |
| 16:52 | jnymo | there's wikibooks, but there are also tons of other good places to learn clojure.. clojure.org is a great place to start though. |
| 16:52 | sl33k | wich are the prerequisites |
| 16:53 | sl33k | what prior knowledge |
| 16:53 | jnymo | sl33k. None really, but knowing either java or lisp helps. |
| 16:54 | technomancy | kumarshantanu: the repl doesn't work here either, but clojure.main -e does |
| 16:55 | technomancy | and that's all I need. =) |
| 16:56 | technomancy | ~peepcode |
| 16:56 | clojurebot | peepcode is a commercial screencast series; see the Clojure one at http://peepcode.com/products/functional-programming-with-clojure by technomancy |
| 16:56 | jrp | hello, 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:59 | jrp | If 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:00 | Raynes | jrp: Not to turn you away from Emacs, but there is some Clojure Vim support. Check out VimClojure if you haven't already. |
| 17:00 | jrp | Raynes: 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:01 | Raynes | Yup. |
| 17:01 | jrp | Alright, Ill give it a try. thanks |
| 17:01 | Raynes | I'm pretty sure it has nothing to do with screen now. |
| 17:01 | jnymo | aint no website devs in here that want a job? Aight den.. but pm me if you want. |
| 17:02 | Raynes | $dict soliciting |
| 17:02 | sexpbot | Raynes: verb: present participle of soliciting. |
| 17:02 | kumarshantanu | jrp: does this help? http://charsequence.blogspot.com/2010/07/setup-emacs-for-development-with.html |
| 17:02 | Raynes | jrp: 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:03 | Raynes | jrp: That's the most popular workflow these days. |
| 17:03 | jrp | Would you guys recommend emacs + vipermode or vim + vimclojure? |
| 17:04 | jrp | Ive notced most people using emacs + slime + friends, and Ive found that the wisdom of some crowds to be decent |
| 17:04 | Raynes | If 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:05 | jrp | Hm, used vim for 10 years, so yeah, I guess Ill give that a try. |
| 17:05 | Raynes | Most 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:06 | hiredman | technomancy: have you seen http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Class.html#getClassLoader() |
| 17:07 | jdsanders | jrp: 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:09 | jdsanders | I personally decided it was less valuable to have SLIME-like support than to use the vim environment I'm already good at |
| 17:09 | jrp | jdsanders: Yeah, that looks like what Im doing now and pretty much what Im thinking |
| 17:09 | jrp | althought to be fair, I dont use too many features of vim |
| 17:09 | jdsanders | well, that's an interesting point |
| 17:10 | jdsanders | it's a balance, at some point the better evaluation support is more valuable than the current vim knowledge |
| 17:10 | jdsanders | for 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:11 | jdsanders | vipermode is pretty good, and I'd like to spend more time with it |
| 17:11 | jrp | does vipermode not help out with that? |
| 17:11 | jrp | oh |
| 17:11 | jdsanders | yeah definitely it does |
| 17:12 | jdsanders | there 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:12 | chouser | whoops. *agent* isn't defined in agent handlers in 1.3a3 |
| 17:13 | chouser | wait, in 1.2? |
| 17:14 | chouser | strike that |
| 17:14 | jrp | well vimclojure mode blows up, so i guess ill try emacs |
| 17:14 | chouser | right, ok. 1.2 is correct. 1.3a3 is not |
| 17:14 | chouser | & (send (agent nil) #(prn :agent *agent* %)) |
| 17:14 | chouser | , (send (agent nil) #(prn :agent *agent* %)) |
| 17:14 | clojurebot | #<Agent@14f223f: nil> |
| 17:14 | chouser | meh |
| 17:15 | jrp | can 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:17 | chouser | ,(let [a (agent 1)] (send a #(array-map :state % :agent *agent*)) (await a) @a) |
| 17:17 | clojurebot | {:state 1, :agent #<Agent@269101: {:state 1, :agent #<Agent@269101: {:state 1, :agent #}>}>} |
| 17:17 | chouser | & (let [a (agent 1)] (send a #(array-map :state % :agent *agent*)) (await a) @a) |
| 17:18 | chouser | that's right. 1.3a3 says :agent nil |
| 17:18 | raek | jrp: 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:19 | raek | the lightning bolt is a network connection |
| 17:19 | hiredman | I bet the bindings are being "rehydrated" after *agent* is bound, and the rehydrated bindings have *agent* as nil |
| 17:19 | jrp | raek: ok, thanks. |
| 17:21 | hiredman | so maybe is send-off and send bound *agent* before sudmiting the Action? I haven't looked at the binding+threadpool stuff at all |
| 17:21 | hiredman | if |
| 17:21 | LauJensen | ClojureQL 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:22 | technomancy | hiredman: yeah, .getClassLoader is well-documented to return nil for classes that came from the bootclassloader |
| 17:23 | technomancy | although... 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:24 | technomancy | I'm going to stick with 1.2 for now though |
| 17:26 | hiredman | oh 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:27 | technomancy | clojurebot: is hiredman lazy? |
| 17:27 | clojurebot | hiredman is an evil genius. |
| 17:27 | technomancy | I see. |
| 17:30 | jrp | jdsanders: Im kinda confused with vimclojure, it says I need to compile a jar, but I dont see any java files in the zip |
| 17:31 | jdsanders | hmm, crap it's been awhile since I set mine up and I don't remember too well, where are you following directions from? |
| 17:32 | chouser | hiredman: that's my guess -- still looking |
| 17:33 | hiredman | which 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:33 | hiredman | when |
| 17:34 | jrp | jdsanders: the main site here: http://kotka.de/projects/clojure/vimclojure.html and the readme |
| 17:35 | jrp | jdsanders: they seem to conflict |
| 17:38 | chouser | hiredman: 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:38 | kumarshantanu | bye all |
| 17:39 | jdsanders | jrp: 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:40 | jrp | also why are there two versions of swank-clojure on github? |
| 17:42 | jdsanders | dunno if you've found this screencast yet, looks helpful, not sure how old it is |
| 17:42 | jdsanders | http://blip.tv/file/1884989 |
| 17:43 | jrp | yeah, i think thats older. ah well, thanks anyways |
| 17:43 | jdsanders | for what it's worth, all I have is a clojure.vim in ftdetect, ftplugin, indent, and syntax |
| 17:58 | qbg | ,(distinct? '[1 x x 2]) |
| 17:58 | clojurebot | true |
| 17:58 | qbg | That doesn't seem right! |
| 17:59 | mrBliss | ,(apply distinct? '[1 x x 2]) |
| 17:59 | clojurebot | false |
| 17:59 | qbg | Reading fail :( |
| 17:59 | technomancy | jrp: the author of swank-clojure abandoned it; I've taken it over |
| 18:00 | jrp | oh. thanks. |
| 18:01 | belun | don't you have enough tehcno ? :P |
| 18:02 | technomancy | belun: well... I took it over 18 months or so ago... back when I was a slacker |
| 18:04 | thoth | can 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:05 | Lopp | ,(doc array-map) |
| 18:05 | clojurebot | "([] [& keyvals]); Constructs an array-map." |
| 18:05 | Lopp | what's an array-map |
| 18:05 | pppaul | (doc flatmap) |
| 18:05 | clojurebot | Excuse me? |
| 18:06 | pppaul | (doc flatten) |
| 18:06 | clojurebot | "([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:06 | pppaul | what is swank clojure supposed to provide me with? |
| 18:06 | technomancy | pppaul: it's an enhanced repl-like server that Emacs can interact with. |
| 18:07 | pppaul | when i put inferior-lisp into clojure-mode it breaks |
| 18:07 | pppaul | will swank keep it un-broken? |
| 18:07 | thoth | damn mirc is still ugly... |
| 18:08 | pppaul | use something other than mirc |
| 18:08 | thoth | like ? |
| 18:08 | pppaul | i 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:09 | pppaul | there are a lot of irc clients, though |
| 18:09 | clojurebot | excusez-moi |
| 18:09 | pppaul | one is probably good |
| 18:09 | thoth | i know there are wikipedia has a huge list |
| 18:09 | thoth | i'm lost in there |
| 18:09 | Raynes | I use XChat as well. |
| 18:09 | pppaul | you can use irc in emacs. one of my friends really likes that |
| 18:09 | thoth | emacs is like the console from matrix |
| 18:09 | thoth | i like pretty stuff |
| 18:09 | pppaul | ^_^ |
| 18:10 | thoth | i juz want to change the foooont |
| 18:10 | pppaul | i don't know if xchat lets me change that |
| 18:10 | thoth | got client :P |
| 18:10 | pppaul | you should make a fork of xchat |
| 18:10 | thoth | good* |
| 18:11 | Raynes | You can change the font in XChat. |
| 18:11 | samx | why 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:11 | pppaul | &( dorun 2 (map println (range 1 4))) |
| 18:12 | pppaul | &( take 2 (map println (range 1 4))) |
| 18:12 | pppaul | &( take 2 (map prn (range 1 4))) |
| 18:12 | pppaul | oh |
| 18:12 | pppaul | i forgot about sexbot being offline |
| 18:12 | thoth | ya u gotta use take. whats got the rest have to do with 1 to 3 ? |
| 18:12 | jrp | Hm 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:12 | thoth | clojure jars |
| 18:12 | pppaul | classpath may be wrong |
| 18:13 | pppaul | (doc dorun) |
| 18:13 | clojurebot | "([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:14 | pppaul | (doc doall) |
| 18:14 | clojurebot | "([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:14 | samx | well, 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:14 | pppaul | use clojure-docs website to look at examples |
| 18:15 | pppaul | i don't have experience using dorun |
| 18:15 | Raynes | pppaul: When sexpbot is down, you can use clojurebot to evaluate code. Just use , instead of &. |
| 18:15 | pppaul | ,( take 2 (map prn (range 1 4))) |
| 18:15 | clojurebot | (nil nil) |
| 18:15 | samx | i'm not looking for examples, but looking to understand why it's doing something that i'm considering unexpected |
| 18:15 | pppaul | ,( take 2 (map cons (range 1 4))) |
| 18:15 | clojurebot | java.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$cons |
| 18:15 | pppaul | maybe the book is wrong |
| 18:15 | pppaul | so examples may help |
| 18:16 | thoth | :) |
| 18:16 | pppaul | i don't think books have editors anymore |
| 18:17 | pppaul | ,( take 2 (map #(cons %) (range 1 4))) |
| 18:17 | clojurebot | java.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong number of args (1) passed to: core$cons |
| 18:17 | thoth | cons join some elements to a seq |
| 18:17 | thoth | u just have the seq tehre |
| 18:17 | pppaul | ,( take 2 (map #(cons join %) (range 1 4))) |
| 18:17 | clojurebot | java.lang.Exception: Unable to resolve symbol: join in this context |
| 18:17 | pppaul | i guess i need to use let/ |
| 18:18 | pppaul | ,( take 2 (map #(cons (join %)) (range 1 4))) |
| 18:18 | clojurebot | java.lang.Exception: Unable to resolve symbol: join in this context |
| 18:18 | pppaul | (doc join) |
| 18:18 | clojurebot | It's greek to me. |
| 18:18 | nimred | kumarshantanu yes i need leiningen. Shouldn't http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html work ? |
| 18:18 | pppaul | i hope it does, cus i'll probably follow it soon |
| 18:19 | thoth | :-) |
| 18:19 | Raynes | apgwoz: I'll check out your new stuff in a little while. Busy reaming dmehosting at the moment. |
| 18:20 | technomancy | nimred: that's kind of a painstakingly complex way to get things working |
| 18:20 | pppaul | nimred: i think i used another tutorial off the site for clojure, it was good |
| 18:20 | technomancy | you don't need to go through all those steps unless you're a gentoo user. =) |
| 18:21 | nimred | pppaul URI ? |
| 18:21 | danlarkin | watch out! gentoo burn coming through |
| 18:22 | pppaul | nimred http://riddell.us/ClojureOnUbuntu.html |
| 18:22 | pppaul | if you have any problems ask me, i made a text of any issues i had (there was one with the scrip) |
| 18:23 | pppaul | wish these things were wikis so i could correct them |
| 18:23 | thoth | what functions have sideeffect ? |
| 18:23 | pppaul | (rand) |
| 18:23 | thoth | those that do concurency ? |
| 18:23 | samx | hmm.. ok.. (dorun 2 (map println (range 1 1000))) only prints 1..32.. so, i guess its forcing the evaluation in blocks of 32 |
| 18:23 | technomancy | pppaul: that's also a lot more complicated than you need to do too |
| 18:24 | pppaul | yeah i know, but i wanted to use git and learn a bit anyway |
| 18:24 | pppaul | also, the ubuntu repo doesn't work 100% |
| 18:24 | nimred | pppaul almost the same. When was that written ? |
| 18:24 | technomancy | yeah, I mean it works, but people might get the wrong idea that Clojure is really hard to use with Emacs |
| 18:24 | pppaul | nimred, i dono, a year ago |
| 18:25 | pppaul | i had a lot of trouble getting it to run with emacs, even with the tutorials from the main clojure sites |
| 18:25 | pppaul | they aren't made for people who have no idea what emacs is, or little experience using emacs |
| 18:25 | pppaul | took me a long time to figure out what some of the steps meant |
| 18:26 | nimred | pppaul did you post your notes somewhere ? |
| 18:26 | pppaul | no |
| 18:26 | nimred | ok |
| 18:26 | pppaul | they are on my dropbox, maybe i can make it public |
| 18:26 | nimred | technomancy what more simple way do you purpose to install ? |
| 18:27 | belun | propose* :D |
| 18:27 | technomancy | nimred: 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:28 | pppaul | nimred give me your email address and i'll share my folder |
| 18:29 | technomancy | then hit M-x package-install slime-repl. then you can connect to a running swakn server with M-x slime-connect |
| 18:29 | technomancy | (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:29 | pppaul | thanks technomancy |
| 18:30 | nimred | technomancy sorry but i prefer a "by-hand" install |
| 18:30 | technomancy | most of that is already in the swank-clojure readme, except for the stuff that relies on newer lein features |
| 18:31 | technomancy | nimred: ok, then the riddel.us tutorials are great for you. but that's very uncommon. |
| 18:33 | belun | can anyone explain currying ? meet the term again and don't know what really means |
| 18:34 | pppaul | there is a wikipedia article on it |
| 18:34 | pppaul | it's related to functional programming |
| 18:35 | pppaul | f(x y) = (f y (g x)) or something |
| 18:35 | pppaul | or was it f(x) + (g y) |
| 18:35 | belun | invented by haskel curry... look 2 things in 1 name :P |
| 18:35 | pppaul | this is making me hungry |
| 18:36 | pppaul | haskel is the man! |
| 18:37 | belun | the book the joy of clojure says currying is different than using partial... they sound the same to me |
| 18:38 | technomancy | currying is only possible in languages without varargs |
| 18:39 | technomancy | basically 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:39 | belun | so it misses the call |
| 18:39 | belun | calling* |
| 18:40 | technomancy | it's just a more convenient way to do partial application at the expense of varargs |
| 18:41 | belun | varargs is darkmatter science to me :) |
| 18:41 | technomancy | variable arity |
| 18:41 | technomancy | functions that may be called with more than one argument count |
| 18:42 | belun | what are functions with 1 arg called ? |
| 18:43 | technomancy | one arg list, not one arg. |
| 18:43 | technomancy | you may call reduce with two arguments or three arguments |
| 18:44 | technomancy | so it supports multiple arities |
| 18:44 | belun | oh arity = number of args |
| 18:47 | technomancy | aye |
| 18:47 | belun | ty |
| 18:49 | belun | so wait, why is it move convenient to do partial ? |
| 18:50 | belun | more* |
| 18:50 | chewbranca | is there no longer a boot.clj? I'm watching the talk on sequences where rich hickey mentions to look at boot.clj |
| 18:51 | technomancy | belun: partial is less convenient than currying, but as I understand it you can't support currying and variable arity; they are mutually exclusive |
| 18:51 | chewbranca | btw this is in clojure 1.2 from github |
| 18:52 | nimred | any .clj file to test my fresh install ? |
| 18:52 | technomancy | chewbranca: it's now called clojure/core.clj |
| 18:53 | chewbranca | technomancy: cool thanks. btw, I'm Russell the big guy who showed up at seajure this week |
| 18:53 | belun | therefore since clojure has multimethods, then it's bye bye currying ? |
| 18:53 | technomancy | chewbranca: oh cool; nice to match faces and nicks |
| 18:53 | technomancy | belun: multimethods are a separate thing from variable arity |
| 18:53 | belun | damn... |
| 18:53 | technomancy | belun: but right. |
| 18:54 | technomancy | having to use partial is a pretty slight inconvenience compared to the flexibility you get from variable arity though. |
| 18:55 | chewbranca | technomancy: 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:56 | belun | wut videos ? |
| 18:56 | chewbranca | belun: http://clojure.blip.tv/ |
| 18:58 | technomancy | that's what got me started 2 years minus three weeks ago. |
| 18:59 | nimred | pppaul ! |
| 18:59 | belun | this 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:59 | nimred | no URI ? |
| 19:01 | Raynes | apgwoz: Ping. |
| 19:02 | nimred | pppaul isn't it http://clojure.googlegroups.com/web/ants.clj ? |
| 19:03 | pppaul | nimred, could be |
| 19:04 | pppaul | belun, he used java |
| 19:04 | pppaul | belun: also, it only came up with one build order... at least that i know of |
| 19:04 | belun | ya the rest were inveted by chinesse ppl :P |
| 19:05 | pppaul | koreans |
| 19:05 | belun | ma bad |
| 19:05 | pppaul | chinese people aren't allowed to play because there is blood in the game |
| 19:05 | belun | ot even green blood ? |
| 19:05 | belun | not* |
| 19:05 | pppaul | so the blood is being censored with overlays of kittens |
| 19:06 | belun | poor guys |
| 19:06 | technomancy | you mean like http://www.penny-arcade.com/comic/2008/8/11/ |
| 19:06 | pppaul | only with more kittens |
| 19:07 | belun | that thins is ugglier then the real stuff |
| 19:07 | belun | it's like growing on him |
| 19:09 | pppaul | ,#([%] |
| 19:09 | pppaul | (cond (= % nil) nil |
| 19:09 | pppaul | :else (cons (last %) |
| 19:09 | pppaul | (my-reverse (butlast %))))) [1 2 3 4 5 6] |
| 19:09 | clojurebot | EOF while reading |
| 19:09 | belun | sry 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:10 | pppaul | ,#(my-reverse [%] (cond (= % nil) nil :else (cons (last %) (my-reverse (butlast %))))) [1 2 3 4 5 6] |
| 19:10 | clojurebot | java.lang.Exception: Unable to resolve symbol: my-reverse in this context |
| 19:10 | pppaul | (doc fn) |
| 19:10 | clojurebot | "([& 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:12 | pppaul | ,#(my-reverse (cond (= % nil) nil :else (cons (last %) (my-reverse (butlast %))))) [1 2 3 4 5 6] |
| 19:12 | clojurebot | java.lang.Exception: Unable to resolve symbol: my-reverse in this context |
| 19:19 | pppaul | ,( (fn my-reverse [%] |
| 19:19 | pppaul | (cond (= % nil) nil |
| 19:19 | pppaul | :else (cons (last %) (my-reverse (butlast %))))) |
| 19:19 | pppaul | [1 2 3 4 5 6]) |
| 19:19 | clojurebot | EOF while reading |
| 19:20 | nimred | well cannot execute nor compile ants.clj |
| 19:20 | pppaul | you don't compile stuff |
| 19:21 | pppaul | to load ants go into clojure-mode, C-x C-l ants.clj |
| 19:21 | pppaul | then look at the last line, and run those in the inferior-lisp REPL |
| 19:22 | pppaul | ,((fn my-reverse [%] (cond (= % nil) nil :else (cons (last %) (my-reverse (butlast %))))) [1 2 3 4 5 6]) |
| 19:22 | clojurebot | (6 5 4 3 2 1) |
| 19:22 | pppaul | anyone like my sexy reverse function? |
| 19:22 | pppaul | ,((fn my-reverse [%] (cond (= % nil) nil :else (cons (last %) (my-reverse (butlast %))))) (range 1e4)) |
| 19:23 | clojurebot | Execution Timed Out |
| 19:23 | pppaul | i think it's O(n^3) |
| 19:25 | pppaul | ,1e4 |
| 19:25 | clojurebot | 10000.0 |
| 19:25 | pppaul | (time 1e4) |
| 19:25 | pppaul | ,(time 1e4) |
| 19:25 | clojurebot | "Elapsed time: 0.066 msecs" |
| 19:25 | clojurebot | 10000.0 |
| 19:25 | pppaul | ,(time 1e4000) |
| 19:25 | clojurebot | "Elapsed time: 0.148 msecs" |
| 19:25 | clojurebot | Infinity |
| 19:25 | nimred | pppaul that's what i do but here is what i get --> http://sprunge.us/DiIh |
| 19:27 | pppaul | nimred sure that you can run any clojure in the REPL? |
| 19:27 | pppaul | ,(System/getProperty "java.class.path") |
| 19:27 | clojurebot | java.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read) |
| 19:28 | pppaul | nimred, i haven't used swank/slime with clojure yet |
| 19:29 | nimred | [~]->> clj |
| 19:29 | nimred | Clojure 1.2.0-master-SNAPSHOT |
| 19:29 | nimred | user=> (System/getProperty "java.class.path") |
| 19:29 | nimred | "/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:29 | nimred | user=> |
| 19:29 | nimred | pppaul isn't it OK ? |
| 19:29 | pppaul | it looks ok |
| 19:30 | nimred | within emacs it doesn't work |
| 19:30 | nimred | a *sldb clisp/0* buffer is opened |
| 19:31 | pppaul | without swank: M-x clojure-mode, M-x inferior-lisp, and run it in that |
| 19:31 | nimred | that contains : http://sprunge.us/jDfP |
| 19:32 | pppaul | maybe you need to put slime into clojure-mode |
| 19:32 | pppaul | try without swank/slime first |
| 19:32 | Raynes | ,(-> Thread pr-str symbol resolve pr-str symbol) |
| 19:32 | clojurebot | java.lang.Thread |
| 19:32 | pppaul | your classpath is alright, though |
| 19:32 | Raynes | Is there a better way to do that that I'm brainfarting on right now? |
| 19:33 | pppaul | lol |
| 19:33 | nimred | pppaul http://lisp.pastebin.com/XDmepuJj |
| 19:33 | pppaul | ,(pr-str Thread) |
| 19:33 | clojurebot | "java.lang.Thread" |
| 19:33 | Raynes | It feels like there has to be a better way to get a symbol from a resolved class. |
| 19:33 | Raynes | :\ |
| 19:34 | pppaul | just use what you have and make a function out of it so you don't have to look at it ever again :P |
| 19:34 | Raynes | :p |
| 19:34 | pppaul | (doc resolve) |
| 19:34 | clojurebot | "([sym]); same as (ns-resolve *ns* symbol)" |
| 19:35 | nimred | pppaul any idea ? |
| 19:36 | pppaul | that didn't really tell me anything |
| 19:37 | pppaul | you could load the file, and go into clojure-mode, then C-M-x expression |
| 19:37 | pppaul | see if you get errors doing that |
| 19:37 | pppaul | *(each expression) |
| 19:38 | Raynes | Everyone digging try-clojure.org's new design? http://try-clojure.org/ |
| 19:39 | pppaul | (str (reverse "!dlrow ,olleH")) |
| 19:39 | Raynes | Also got somebody working on a tryhaskellish interactive Javascript tutorial. |
| 19:39 | pppaul | ,(str (reverse "!dlrow ,olleH")) |
| 19:39 | clojurebot | java.lang.Exception: Unable to resolve symbol: reve�rse in this context |
| 19:39 | pppaul | woaaaaaaaah |
| 19:40 | pppaul | the tutorial is nice, needs more sexiness and a link to clojuredocs |
| 19:40 | pppaul | (doc reverse) |
| 19:40 | clojurebot | "([coll]); Returns a seq of the items in coll in reverse order. Not lazy." |
| 19:40 | pppaul | ,(str (reverse "!dlrow ,olleH")) |
| 19:40 | clojurebot | java.lang.Exception: Unable to resolve symbol: reve�rse in this context |
| 19:40 | pppaul | ,(str (reverse "!dlrow ,olleH")) |
| 19:40 | clojurebot | "(\\H \\� \\e \\l \\l \\o \\, \\space \\w \\o \\� \\r \\l \\d \\!)" |
| 19:40 | Raynes | The tutorial is mostly just a stub for now. It needs a rewrite and more content. |
| 19:40 | pppaul | look at that sexy hello world! |
| 19:41 | pppaul | ,(apply (str (reverse "!dlrow ,olleH")) vector) |
| 19:41 | clojurebot | java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn |
| 19:41 | nimred | Clojure> (System/ge tProperty "java .class.pat h") |
| 19:41 | bhenry | ,(apply str (reverse "!dlrow ,olleH")) |
| 19:41 | nimred | java.lang.SecurityException: Tried to call: getProperty on class java.lang.System which is not allowed. |
| 19:41 | clojurebot | "Hello, world!" |
| 19:41 | nimred | on http://try-clojure.org/ |
| 19:42 | pppaul | cus it's in a sandbox |
| 19:42 | hiredman | pppaul: feel free to play with your own repl |
| 19:42 | belun | probably is an appled |
| 19:42 | belun | applet |
| 19:42 | Raynes | belun: It isn't an applet. |
| 19:42 | pppaul | html5? |
| 19:42 | pppaul | 6? |
| 19:42 | Raynes | nimred: It's sandboxed. You can't do dangerous stuff. |
| 19:42 | belun | what's a sandbox ? |
| 19:42 | Raynes | pppaul: Javascript. |
| 19:42 | pppaul | html5 is javascript |
| 19:43 | belun | wut ? |
| 19:43 | Raynes | belun: It's something that prevents execution of dangerous code. |
| 19:43 | nimred | ok |
| 19:43 | pppaul | wikipedia (sandbox) |
| 19:43 | pppaul | all of my code is dangerous |
| 19:43 | belun | irc (sandbox) :P |
| 19:45 | pppaul | i'm learning apply! |
| 19:45 | pppaul | :D |
| 19:46 | nimred | wich way to run C-M-x expression ? |
| 19:46 | pppaul | cursor over the expression (def....) and C-M-x |
| 19:46 | pppaul | the inferior-lisp needs to be running |
| 19:47 | nimred | Ctrl+Alt+x ? |
| 19:48 | nimred | *** - EVAL: undefined function DEF |
| 19:48 | bhenry | nimred: mostly. sometimes Meta is ESC |
| 19:48 | bhenry | oh |
| 19:49 | hiredman | your slime is running common lisp |
| 19:49 | nimred | hiredman isn't it OK ? |
| 19:49 | hiredman | OK ? |
| 19:49 | hiredman | this is #clojure |
| 19:50 | hiredman | clojure is not common lisp |
| 19:50 | hiredman | if you want help with common lisp you should find a common lisp irc channel |
| 19:50 | pppaul | he wants to run clojure |
| 19:51 | pppaul | M-x clojure-mode |
| 19:51 | pppaul | make sure your inferior-lisp is pointing to clojure |
| 19:51 | Raynes | And he wants to set it all up manually, for whatever reason. Gentoo user in the making. |
| 19:51 | pppaul | M-x describe-variable -> inferior-lisp (click on the customize button) |
| 19:52 | Wilduck | nimred: 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:53 | Wilduck | *I used |
| 19:53 | nimred | Wilduck ArchLinux |
| 19:53 | Wilduck | I see. Where in the tutorial are you getting stuck? |
| 19:54 | Wilduck | If 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:55 | Wilduck | ~$ lein swank |
| 19:55 | clojurebot | leiningen is a build tool designed not to set your hair on fire (http://github.com/technomancy/leiningen) |
| 19:55 | Wilduck | at the command line should start the swank server |
| 19:55 | pppaul | i like it when a pretty girl sets my hair on fire |
| 19:55 | Wilduck | and then in emacs M-x slime-connnect will connect to it |
| 19:56 | nimred | what should inferior-lisp-program be set to ? |
| 19:56 | nimred | /PATH/TO/clojure.jar ? |
| 19:56 | pppaul | clojure |
| 19:56 | pppaul | what you use on the command line to run clojure |
| 19:57 | pppaul | mine is set to clj, which is a script in /usr/bin |
| 19:57 | Wilduck | I never set inferior-lisp-program when using swank |
| 19:57 | pppaul | i've never used swank |
| 19:58 | pppaul | maybe i should start ^_^ |
| 19:58 | Wilduck | Although I (sort of) remember that step from when I set up SBCL |
| 19:59 | Wilduck | nimred: can you pastebin your .emacs? |
| 19:59 | Wilduck | or at least the relevant sections? |
| 20:01 | pppaul | anyone used cake? |
| 20:01 | nimred | Wilduck http://clojure.pastebin.com/KDt9Fmq0 |
| 20:03 | nimred | running C-M-x gives me : "Process lisp does not exist" |
| 20:03 | pppaul | M-x inferior-lisp |
| 20:05 | Wilduck | intersting... |
| 20:05 | nimred | Wilduck ? |
| 20:06 | nimred | user=> (def animator (agent nil)) |
| 20:06 | nimred | (def animator (agent nil)) |
| 20:06 | nimred | #'user/animator |
| 20:06 | nimred | running M-x inferior-lisp |
| 20:07 | Wilduck | sorry, 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:07 | Wilduck | but I'm curious |
| 20:08 | nimred | Wilduck looks like working |
| 20:08 | nimred | no ? |
| 20:09 | Wilduck | sorry? |
| 20:09 | Raynes | inferior-lisp != slime |
| 20:09 | Wilduck | Raynes: right |
| 20:10 | Wilduck | I may be trying to solve a different problem than nimred is having |
| 20:10 | Wilduck | I just saw that he was using the same tutorial that I used |
| 20:10 | nimred | http://clojure.pastebin.com/eZVNJEKV |
| 20:11 | Wilduck | but setting inferior lisp is not a part of said tutorial... |
| 20:11 | Wilduck | I think I might be in over my head, I'm pretty new at this... |
| 20:13 | nimred | Wilduck did http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html completly worked for you ? |
| 20:13 | nimred | if so on which distribution ? |
| 20:13 | nimred | and when did you run this tuto ? |
| 20:13 | Wilduck | it worked, and I'm using debian stable |
| 20:14 | Wilduck | as of a few weeks ago |
| 20:14 | Wilduck | arch is *definitely* more bleeding edge, so I don't see why it wouldn't work if it worked on debian stable |
| 20:15 | nimred | ok let's redo. I perhaps missed something |
| 20:15 | Wilduck | It took me 5+ tries, but it ended up working |
| 20:20 | Raynes | Yay! My VPS is back up. Here comes teh sexpbot! |
| 20:20 | eee | yo long time since i've been here. giving clojure another look |
| 20:20 | eee | can't get my multimethod to work |
| 20:20 | eee | and no example looks like my sitruation |
| 20:21 | eee | what 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:21 | eee | no one ever has a two-argument example for multimethods |
| 20:21 | chouser | (defmulti myfoo (fn [_ x] x)) |
| 20:22 | eee | i have to write a custom function? |
| 20:22 | chouser | you always have to provide a function |
| 20:22 | hiredman | perish the thought |
| 20:22 | eee | nah, sometimes you just say the type |
| 20:22 | hiredman | type is a function |
| 20:22 | eee | here's my case: (defmethod heap-add java.util.Map [a-heap data-pri-map] |
| 20:23 | eee | the data-pri-map is the thing to switch on |
| 20:23 | eee | a-heap is always the same |
| 20:23 | chouser | (defmulti myfoo (fn [_ x] (type x))) |
| 20:23 | Raynes | Hrm. |
| 20:24 | Raynes | I think I broke my database. |
| 20:24 | eee | thanks chouser. i'll try to understand that |
| 20:25 | tomoj | technomancy: are you aware of github ssl problems with lein? |
| 20:25 | tomoj | maybe it's just me |
| 20:25 | chouser | (defmulti heap-add (fn [a-heap data-pri-map] (type data-pri-map))) |
| 20:25 | Raynes | $seen amalloy |
| 20:26 | sexpbot | amalloy was last seen quitting 17 hours, 55 minutes ago. |
| 20:26 | Raynes | There we go. |
| 20:27 | eee | thanks. 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:29 | rata_ | hi |
| 20:30 | eee | it didn't work |
| 20:30 | eee | says the syntax has now changed |
| 20:31 | eee | is there somewhere I can cut-n-paste some code? |
| 20:33 | nimred | Wilduck : |
| 20:33 | nimred | [~/opt/clojure-contrib]->> cp target/clojure-contrib*.jar ~/.clojure/clojure-contrib.jar |
| 20:33 | nimred | zsh: no matches found: target/clojure-contrib*.jar |
| 20:33 | nimred | :/ |
| 20:35 | nimred | after having run `git clone git://github.com/clojure/clojure-contrib.git` |
| 20:35 | hiredman | you really should just follow the swank-clojure readme |
| 20:36 | nimred | and `cd clojure-contrib && mvn package` |
| 20:37 | eee | http://pastebin.ca/1984944 |
| 20:37 | eee | still confused |
| 20:38 | eee | here's the error: Unable to resolve symbol: a-heap in this context |
| 20:42 | nimred | ok using `git clone git://github.com/richhickey/clojure-contrib.git ` it works |
| 20:42 | eee | anyone know a good resource on multimethods? I guess I could always write my own dispatcher |
| 20:42 | eee | a map of types to functions |
| 20:47 | eee | hi. sorry to bug people, but anyone just entering see what's wrong with this code? http://pastebin.ca/1984944 |
| 20:53 | eee | i tried this, too: http://pastebin.ca/1984952 |
| 20:53 | eee | no luck :( |
| 20:53 | Wilduck | nimred: I guess I remember having to play around with which repositories I was downloading from |
| 20:54 | puredanger | eee: 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:54 | Raynes | DME heard my cries, and claims to have moved me to a better server with less clients, and promises to ensure stability. |
| 20:55 | eee | i 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:55 | Wilduck | nimred: I actually started out by following http://riddell.us/ClojureWithEmacsSlimeSwankOnUbuntu.html |
| 20:55 | puredanger | eee: at a glance it also appears you are trying to call .insert on a java.util.Map, which does not exist |
| 20:55 | eee | i get "unable to resolve heap-add |
| 20:55 | eee | the insert is on my heap |
| 20:55 | Wilduck | and dug around for all sorts of different repositiories |
| 20:55 | eee | i have a heap |
| 20:55 | Wilduck | somehow I found a combination that worked |
| 20:55 | eee | and I want to be able to insert based on input as a map |
| 20:56 | eee | or on a pair |
| 20:56 | puredanger | eee: for a dispatch function that switches on second arg, you want: (defmulti heap-add [x y] (class y)) usually |
| 20:56 | hiredman | no you don't |
| 20:56 | hiredman | you want to go read the multimethod docs on clojure.org |
| 20:56 | eee | i had that already |
| 20:56 | eee | it did not work |
| 20:57 | eee | i have been on clojure.org for an hour |
| 20:57 | eee | too dumb |
| 20:58 | eee | The syntax for defmulti has changed. Example: (defmulti name dispatch-fn :default dispatch-value) (jc_pheap.clj:34) |
| 20:59 | eee | it's very very difficult in clojure to discern literal things from variables |
| 20:59 | eee | i never know what i am supposed to replace |
| 21:00 | puredanger | eee: sorry, meant: (defmulti heap-add (fn [x y] (class y)) |
| 21:02 | puredanger | then you would (defmethod heap-add java.util.Map [x y] ( ... whatever where y is a Map ... ) ) |
| 21:03 | nimred | ok |
| 21:03 | nimred | http://riddell.us/ClojureSwankLeiningenWithEmacsOnLinux.html? doesn't work |
| 21:03 | nimred | http://riddell.us/ClojureOnUbuntu.html doesn't |
| 21:03 | eee | getting closer |
| 21:04 | eee | now i got yelled at because my dispatch is for java.util.Vector but [] is a persistentVector |
| 21:05 | Wilduck | nimred: 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:05 | Wilduck | the second one definitely didn't work, but it was the tutorial I tried first |
| 21:06 | nimred | eh guys i won't spend a week to get clojure/sllime/swank working using emacs |
| 21:08 | puredanger | eee: you could switch on something like Indexed (in clojure.lang) if you want to call nth on it |
| 21:09 | nimred | so wich repository is up to date ? |
| 21:09 | nimred | which one to use ? |
| 21:09 | Wilduck | which one isn't working? |
| 21:09 | nimred | why isn't a GOOD OFFICIAL tutorial to get it installed ? |
| 21:09 | nimred | the one on tutorial |
| 21:10 | nimred | git://github.com/clojure/clojure-contrib.git doesn't work |
| 21:11 | Wilduck | didn't you say git clone git://github.com/richhickey/clojure-contrib.git worked for you? |
| 21:11 | nimred | sure it worked |
| 21:11 | nimred | but git://github.com/clojure/clojure-contrib.git didn't |
| 21:12 | puredanger | eee: or maybe this is just generally the wrong path...not sure I understand what you're doing really |
| 21:12 | hiredman | richhickey/clojure and clojure-contrib are not the right repos any more |
| 21:13 | nimred | and git://github.com/clojure/clojure-contrib.git is the one mentioned in tuto |
| 21:13 | nimred | hiredman so which one ? |
| 21:13 | nimred | shit is human food |
| 21:14 | nimred | write an official tuto and track it up to date... |
| 21:14 | nimred | time to go to bed |
| 21:14 | nimred | shit is human food |
| 21:27 | pppaul | nimred should use something other than emacs |
| 21:29 | pppaul | the tutorials should be wikis, so they can be maintained |
| 21:31 | jrp | alright 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:34 | tonyl | hello |
| 21:37 | hiredman | don't install anyting from a package manager, follow the installation instructions for lein from the readme |
| 21:37 | hiredman | grab the clojure jar from the website |
| 21:37 | jrp | ok |
| 21:37 | hiredman | anything in package managers is out of date |
| 21:38 | rdeshpande | jrp: i installed clojure and leiningen from homebrew |
| 21:38 | rdeshpande | jrp: then i installed vimclojure from the mercurial repo |
| 21:38 | pppaul | (vars) |
| 21:38 | pppaul | &(vars) |
| 21:38 | sexpbot | java.lang.Exception: Unable to resolve symbol: vars in this context |
| 21:39 | rdeshpande | cemerick: cool talk on continuous deployment |
| 21:41 | cemerick | rdeshpande: the talk or screencast? In either case, thanks :-) |
| 21:41 | pppaul | links? |
| 21:43 | cemerick | pppaul: http://cemerick.com/2010/11/02/continuous-deployment-of-clojure-web-applications/ |
| 21:43 | pppaul | (clojure.contrib.math/abs 4) (fix please) :D |
| 21:45 | cemerick | pppaul: what's the problem? |
| 21:46 | cemerick | &(clojure.contrib.math/abs 4) |
| 21:46 | sexpbot | java.lang.ClassNotFoundException: clojure.contrib.math |
| 21:46 | cemerick | ,(clojure.contrib.math/abs 4) |
| 21:46 | clojurebot | java.lang.ClassNotFoundException: clojure.contrib.math |
| 21:46 | cemerick | oh well |
| 21:46 | pppaul | need to use 'use' |
| 21:46 | cemerick | won't work in the sandboxes, I presume |
| 21:46 | cemerick | &(require 'clojure.contrib.math) |
| 21:46 | sexpbot | java.io.FileNotFoundException: Could not locate clojure/contrib/math__init.class or clojure/contrib/math.clj on classpath: |
| 21:46 | cemerick | ,(require 'clojure.contrib.math) |
| 21:46 | clojurebot | java.io.FileNotFoundException: Could not locate clojure/contrib/math__init.class or clojure/contrib/math.clj on classpath: |
| 21:46 | pppaul | (use 'clojure.contrib.math (abs 5)) |
| 21:46 | cemerick | no contrib in either bot? |
| 21:47 | pppaul | ,(use 'clojure.contrib.math (abs 5)) |
| 21:47 | clojurebot | java.lang.Exception: Unable to resolve symbol: abs in this context |
| 21:47 | cemerick | pppaul: what's the problem you're seeing? |
| 21:47 | pppaul | i'm trying to use namespaces without using 'use' |
| 21:47 | pppaul | is that silly? |
| 21:47 | cemerick | You need to require them. |
| 21:48 | cemerick | (require 'some.ns) (some.ns/some-fn …) |
| 21:48 | cemerick | pppaul: see: http://clojure.org/libs |
| 21:48 | pppaul | (use 'clojure.contrib.ns_utils) |
| 21:48 | pppaul | java.lang.Exception: namespace 'clojure.contrib.ns_utils' not found after loading '/clojure/contrib/ns_utils' (NO_SOURCE_FILE:0 |
| 21:49 | cemerick | pppaul: it's ns-utils, not ns_utils |
| 21:49 | Raynes | &"still working?" |
| 21:49 | sexpbot | ⟹ "still working?" |
| 21:49 | pppaul | oh |
| 21:50 | Raynes | ,(require 'clojure.contrib.math) |
| 21:50 | clojurebot | java.io.FileNotFoundException: Could not locate clojure/contrib/math__init.class or clojure/contrib/math.clj on classpath: |
| 21:50 | Raynes | I can't figure that out. |
| 21:50 | Raynes | Why wouldn't that work in a sandbox? |
| 21:50 | Raynes | It doesn't work on my sandbox either, which is totally different. |
| 21:51 | cemerick | Raynes: that's just no contrib jar on the classpath, not a security exception |
| 21:51 | pppaul | i'm trying to use (vars) |
| 21:51 | Raynes | It works in my new sandboxing library (sexpbot doesn't use that). |
| 21:51 | Raynes | cemerick: Right, but there is. |
| 21:51 | Raynes | &(clojure.contrib.json/pprint-json "") |
| 21:51 | sexpbot | ⟹ ""nil |
| 21:51 | cemerick | oh, that's interesting |
| 21:51 | cemerick | &(System/getProperty "java.class.path") |
| 21:51 | sexpbot | java.lang.IllegalArgumentException: No matching method found: getProperty for class java.lang.Class |
| 21:52 | cemerick | wha? |
| 21:52 | Raynes | Aw man. |
| 21:52 | Raynes | I introduced a new bug in clj-sandbox. |
| 21:52 | Raynes | I'm actually working on my own sandboxing library. Not ready for sexpbot though. |
| 21:52 | Raynes | You can require clojure.contrib.math in it. :> |
| 21:53 | cemerick | I'll leave you to figuring it out then ;-) |
| 21:54 | Raynes | I'll fix clj-sandbox after The Walking Dead. Then, I'll spend the rest of the night making clojail awesome. |
| 21:56 | pppaul | ,(ns-map 'user) |
| 21:56 | clojurebot | {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:57 | pppaul | sexy |
| 22:07 | pppaul | ,(unquote 'quote) |
| 22:07 | clojurebot | java.lang.IllegalStateException: Var clojure.core/unquote is unbound. |
| 22:07 | pppaul | (doc unquote) |
| 22:07 | clojurebot | "; " |
| 22:07 | pppaul | hot stuff |
| 22:15 | pppaul | ,(unchecked-add Integer/MAX_VALUE Integer/MAX_VALUE) |
| 22:15 | clojurebot | -2 |
| 22:16 | tonyl | lol |
| 22:16 | tonyl | ,Integer/MAX_VALUE |
| 22:16 | clojurebot | 2147483647 |
| 22:16 | pppaul | ,(Math/abs Integer/MIN_VALUE) |
| 22:16 | clojurebot | -2147483648 |
| 22:17 | tonyl | why the minus sign in both |
| 22:17 | tonyl | that is weird |
| 22:17 | pppaul | abs doesn't always return a positive value |
| 22:17 | tonyl | the defies it's definition |
| 22:17 | clojurebot | Huh? |
| 22:17 | pppaul | it's like pandoras box |
| 22:18 | tonyl | i can see that |
| 22:18 | tonyl | wonder if it is because of those big values |
| 22:18 | pppaul | it does bit manipulation, so when given min_value it screws up |
| 22:19 | tonyl | ,(Math/abs (+ 1 Integer/MIN_VALUE)) |
| 22:19 | clojurebot | 2147483647 |
| 22:20 | tonyl | ,(Math/abs (- 1 Integer/MIN_VALUE)) |
| 22:20 | clojurebot | 2147483649 |
| 22:20 | tonyl | ok |
| 22:21 | tonyl | ,(Math/abs (+ Integer/MIN_VALUE)) |
| 22:21 | clojurebot | -2147483648 |
| 22:21 | pppaul | ,(unchecked-add 5 55555555555) |
| 22:21 | clojurebot | java.lang.ExceptionInInitializerError |
| 22:21 | pppaul | ,(unchecked-add 5555555555555 55555555555) |
| 22:21 | clojurebot | java.lang.ExceptionInInitializerError |
| 22:21 | pppaul | awww |
| 22:21 | bhenry | is there a shortcut for (remove nil? (map …)) |
| 22:21 | pppaul | remove nil? |
| 22:21 | pppaul | you aren't supposed to remove the nils |
| 22:22 | tonyl | i see it pretty concise |
| 22:22 | bhenry | i didn't know if there was a single function that did it |
| 22:22 | pppaul | make your own, then change if you find out later |
| 22:23 | pppaul | i didn't see many functions for seq operations |
| 22:23 | Derander | I don't know how much clearer it can be |
| 22:23 | pppaul | most are very general |
| 22:23 | Derander | (remove-nils (map ..)) |
| 22:23 | Derander | ? |
| 22:23 | Derander | ruby has Array#compact |
| 22:23 | pppaul | (doc remove-nils) |
| 22:23 | clojurebot | Cool story bro. |
| 22:23 | Derander | pppaul: was speculating |
| 22:23 | pppaul | clojure likes it's seqs fat |
| 22:25 | tonyl | &(remove nil? {:a 1 nil 2 :c 3 }) |
| 22:25 | sexpbot | ⟹ ([:c 3] [nil 2] [:a 1]) |
| 22:25 | tonyl | &(remove nil? {:a 1 :b nil :c 3 }) |
| 22:25 | sexpbot | ⟹ ([:c 3] [:b nil] [:a 1]) |
| 22:26 | tonyl | that doesn't seem to remove either by val or key, it takes a vector of the key and value pair |
| 22:26 | pppaul | (filter nil?) |
| 22:26 | tonyl | but as far as i know that wouldn't fly whey a map is constructed |
| 22:26 | tonyl | &(filter nil? {:a 1 :b nil :c 3 }) |
| 22:26 | sexpbot | ⟹ () |
| 22:26 | bhenry | tonyl (map …) returns a seq. i wasn't removing nils from a map literal |
| 22:26 | tonyl | &(filter nil? {:a 1 nil 2 :c 3 }) |
| 22:26 | sexpbot | ⟹ () |
| 22:27 | tonyl | oh ok |
| 22:27 | tonyl | :P |
| 22:35 | tomoj | &(remove (comp nil? val) {:a 1 :b nil :c 3}) ; ? |
| 22:35 | sexpbot | ⟹ ([:c 3] [:a 1]) |
| 22:35 | bhenry | tomoj i like that |
| 22:36 | bhenry | if i comp zero? val i won't need to worry about removing nils after. |
| 22:38 | bhenry | oh wait. |
| 22:38 | bhenry | i didn't read all of it i guess |
| 22:38 | tonyl | something like this |
| 22:39 | tonyl | ,(remove (comp #(or (nil? %) (zero? %)) val) {:a 1 :b nil :c 3}) |
| 22:39 | clojurebot | ([:a 1] [:c 3]) |
| 22:42 | tobiassp | is there anything other than using weka directly to implement hierarchical clustering with a custom distance function (geospatial stuff) ? |
| 22:48 | rata_ | is there anything like (take n (iterate f ...)) that calls f exactly n times? |
| 22:49 | amalloy | rata_: i don't think there's a built-in for it |
| 22:49 | somnium | rata_: dotimes or repeatedly? |
| 22:50 | amalloy | somnium: those don't do the same thing as iterate |
| 22:51 | somnium | yes, but his example would call f exactly n times, so I was guessing at the meaning of like |
| 22:51 | amalloy | i see |
| 22:51 | tonyl | i would say loop and recur would do your trick |
| 22:56 | rata_ | ok, let's do it with loop and recur |
| 22:59 | amalloy | rata_: 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:00 | tonyl | rata_: would f take any input? |
| 23:00 | rata_ | amalloy: the wrong thing is chunking in this case, because f takes a lot of time to return |
| 23:00 | amalloy | rata_: iterate and take don't chunk |
| 23:01 | rata_ | really? aren't they lazy? doesn't every lazy seq do chunking? |
| 23:01 | amalloy | yes; yes; no |
| 23:02 | rata_ | oh ok... thanks :) |
| 23:02 | amalloy | compare (source map) with (source iterate) |
| 23:09 | Raynes | cemerick: http://try-clojure.org/ |
| 23:09 | Raynes | In case you haven't seen it yet. |
| 23:09 | Raynes | Courtesy of apgwoz |
| 23:09 | cemerick | mmm, getting swankier :-) |
| 23:10 | cemerick | so to speak, of course ;-) |
| 23:11 | Raynes | I have a guy on the interactive tutorial as well. |
| 23:11 | Raynes | LauJensen will be pleased. |
| 23:12 | rata_ | Raynes: I've just spotted a type, in the second line of the second paragraph of the tutorial... it should say "independently" |
| 23:12 | Raynes | He was the first one to be very vocal about tryclojure's ugliness. He actually helped me with the original design. |
| 23:12 | rata_ | hahahaha a typo |
| 23:12 | Raynes | rata_: Probably plenty of them. That tutorial is mostly just a stub. |
| 23:12 | rata_ | ok |
| 23:12 | Raynes | Fogus made some changes to it a while back. Probably his typo. |
| 23:12 | Raynes | >:) |
| 23:13 | amalloy | Raynes: is this the "official" tutorial, or is someone working on a complete replacement? |
| 23:13 | amalloy | if it's going to be the real thing i'll do some copy-editing |
| 23:13 | Raynes | amalloy: Once the interactive tutorial is ready, the tutorial will be rewritten, fixed, changed, mutilated, or any number of things to make it better. |
| 23:14 | Raynes | It needs more content too. |
| 23:14 | amalloy | k. so i shouldn't spend any significant time on it till then? let me know when it's ready for proofing |
| 23:14 | Raynes | The guy is just working on an interactive tutorial. The actual content for that tutorial isn't his responsibility. |
| 23:14 | Raynes | amalloy: Will do! :D |
| 23:18 | tomoj | anyone using nutch? |
| 23:36 | Intertricity_ | How long before ClojureCLR gets to see the light of day? In a clojure box >.> |
| 23:36 | Intertricity_ | Just like lispbox |
| 23:41 | rata_ | is it right to do (time (let [x (f ...)] nil)) to compute how long f takes to run? |
| 23:41 | tonyl | or just (time (f ...) |
| 23:41 | tonyl | s/)/))/ |
| 23:42 | rata_ | because I did it and it seemed to take like 3 secs but time said 0.07 millisecs |
| 23:42 | rata_ | tonyl: I don't want the REPL to print the output |
| 23:43 | tonyl | time will always print the output |
| 23:43 | tonyl | unlees you bind |
| 23:43 | tonyl | bind *in* |
| 23:43 | amalloy | rata_: 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:44 | rata_ | amalloy: ok, then doall is what I need there |
| 23:44 | rata_ | tonyl: no, it won't if you return nil insted of the output |
| 23:44 | amalloy | rata_: i'd use dorun, if you don't actually want the result |
| 23:45 | tonyl | ,(time (let [x (var rest)] nil)) |
| 23:45 | clojurebot | "Elapsed time: 0.062 msecs" |
| 23:45 | amalloy | &(->> (range) (take 10000000) dorun time) |
| 23:45 | sexpbot | java.lang.IllegalArgumentException: No matching method found: nanoTime for class java.lang.Class |
| 23:45 | amalloy | ,(->> (range) (take 10000000) dorun time) |
| 23:45 | rata_ | tonyl: by output I mean the output of calling f |
| 23:45 | clojurebot | Execution Timed Out |
| 23:45 | tonyl | ooh ok |
| 23:46 | amalloy | rata_: 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:46 | amalloy | so it sounds like exactly what you want |
| 23:46 | rata_ | yes, you're right :) it's exactly what I want |
| 23:47 | tonyl | is the # suffix in vars inside macros a convention or does the reader do something different with them? |
| 23:47 | amalloy | the reader |
| 23:47 | amalloy | does super-magic |
| 23:47 | tonyl | what does it do with them? |
| 23:48 | Raynes | I'm fixing that bug. |
| 23:48 | rata_ | mmmm... my code performs just a little slower than the prototype I wrote one year ago in python |
| 23:49 | rata_ | what do you use to profile? I used visualvm, but it caused my code to run super-slow |
| 23:49 | rata_ | I had to kill the app |
| 23:55 | tonyl | 'x# |
| 23:55 | tonyl | ,'x# |
| 23:55 | clojurebot | x# |
| 23:55 | tonyl | &`x# |
| 23:55 | sexpbot | ⟹ x__5883__auto__ |
| 23:56 | tonyl | what is the gain from a non-fully-qualified symbol and a qualified one? |
| 23:57 | tonyl | &(gensym :wer) |
| 23:57 | sexpbot | ⟹ :wer5888 |
| 23:57 | tonyl | &`(gensym :wer) |
| 23:57 | sexpbot | ⟹ (clojure.core/gensym :wer) |
| 23:57 | amalloy | ,(let [myns/x 1] myns/x) |
| 23:57 | clojurebot | java.lang.Exception: Can't let qualified name: myns/x |
| 23:57 | amalloy | tonyl: ^^ |
| 23:57 | tonyl | oh mm |