#clojure logs

2010-04-22

00:16rfgWhat's the easiest way to get an infinite sequence of [0 1 2 3 0 1 2 3 ...]?
00:18hiredman,(doc cycle)
00:18clojurebot"([coll]); Returns a lazy (infinite!) sequence of repetitions of the items in coll."
00:18rfgDanke
01:24johnmn3hi
01:24herdrickyou know what'd be nice? to make memoized functions implement IPersistentMap
01:24herdrickthat'd be super handy
01:24herdrickand would make symmetric the 'maps are functions' property
01:26ChousukeI think it might actually be confusing
01:26herdrickhow?
01:26clojurebotwith style and grace
01:26herdrickwords of wisdom, clojurebot
01:27Chousuke"maps are functions" makes sense and is useful, but "functions are maps (only if memoized)" just isn't :/
01:28hoeckherdrick: regardless wether its useful or not, with deftype, its only a few lines away :)
01:29Chousukethough I suppose it would facilitate a "lazy map" kind of thing
01:29herdrickit makes plenty of sense, and it's something i want right now
01:29herdrickhoeck: really?
01:30herdrickhmmm - i'll check out deftype
01:30herdrickthanks
01:30herdrick!
01:30hoeckherdrick: yes, wait a little, I'm pasting sth in a few minutes
01:30Chousukenote that deftype is 1.2
01:33herdrickChousuke - thanks
01:33herdrickouch
01:33herdricki don't have 1.2 and my last clojure upgrade hurt
01:34Chousukeyou can have two versions installed
01:36johnmn3was reading the irc logs, seeing rhickey's comments about creating some kind of mechanism in clojure that can mimic some of OOP's modeling... could someone give an example of how that would look in code, using 'bank accounts' for example?
01:37johnmn3like... would the clojure example require dereferencing of the fields or would that be taken care of by the object?
01:42johnmn3if dereferencing was taken care of internally, would the clojure example look essentially like the java example (hiding the "where to put the value problem")? And what would be the limitations of the clojure version compared to the java one?
01:48hoeckherdrick: http://gist.github.com/374865
02:00herdrickhoeck: thanks!
02:01herdrickcan't try it until i get the newest clojure
02:01herdrick:(
02:01herdrickhave been avoiding that
02:03hoeckherdrick: you can download clojure.jar from build.clojure.org, and just try it on the repl, without upgrading you other clojure environment
02:03slyphonso, is it possible to hand a function a var's name (like *foo*) and then have that function deref the var? kind of like what a macro would do in terms of delaying evaluation?
02:03herdrickhoeck: ok.
02:03herdrickor make a new swank-clojure-project using that jar, eh?
02:03herdrickthat'd be a snap
02:04herdrickhuh
02:04hoeck if it works for you, of course :)
02:05herdrickyeah
02:27woobyhoeck, that's sweet
02:33hoeckwooby: deftype is really nice, you can combine all the clojure interfaces to create new datastructures
02:34woobyhoeck, i've read a little on it but didn't realize the implications
02:35hoeckfor example, if you implement seq and cons on your new datatype, you can map over and conj onto it as if it were a "native" clojure datatype
02:37hoeckyou could do this all the time, maps and seqs were defined by interfaces all the time, but deftype makes it really succinct and efficient to implement them, in contrast to genclass or proxy
02:39woobyis defprotocol related to this capability somehow?
02:45woobyhm, i think ill try and write it myself :)
03:15TheBusbyis there a simple way to check to see if something can be treated like a seq? I know (seq? [1 2]) is false...
03:15Licenser_morning
03:16Licenser_TheBusby: try coll?
03:16Licenser_,(coll? [1 2])
03:16clojurebottrue
03:16Licenser_,(coll? '(1 2))
03:16clojurebottrue
03:16TheBusbyLicenser_: perfect, thank you!
03:17_ato,(coll? "wheeeeeee")
03:17clojurebotfalse
03:17_ato,(seq "wheeeeee")
03:17clojurebot(\w \h \e \e \e \e \e \e)
03:17_ato,(seqable? "wheeee")
03:17clojurebottrue
03:17Licenser_and again _ato is smarter then me :P
03:18_atothough coll? maybe more appropriate if you
03:18_atore really only interested in clojure collections
03:18TheBusbyyep, '() [] and {} for the moment
03:18Licenser_(coll? {1 2})
03:18Licenser_,(coll? {1 2})
03:18clojurebottrue
03:18TheBusbystrings are have their own special level of hell reserved for them
03:19Licenser_^^
03:20tomojjust need a language where the words are integers
03:20Licenser_1
03:21_atohellish java string fact of the day: if you take a small subsequence of a large string and then release all references the large string so it can be garbage collected, prepare to be surprised by an OutOfMemoryError
03:21Licenser_*g*
03:22TheBusbyjava strings have their fun, but everything after pure ASCII strings in C seems to have their own pain
03:22_atoI think it'd be interesting to try implementing strings using persistent vectors, it'd allow structure sharing but still avoid that problem
03:22_atoand would probably make manipulating them faster
03:23TheBusbyI blame human language though, that's the difficult part
03:23ChousukeICU is one of the few string libraries that is probably doing it right :P
03:23_atoor maybe they'd just be slower, dunno. Interesting to try
03:23TheBusbyusually speed is the big problem
03:23greghany problem in compute science can be solved with an other level of indirection
03:23greghcomputer
03:24Chousukegregh: including the problem of overabstraction?
03:24TheBusbyhaha
03:24greghexcept that one, it creates other problems. :)
03:31greghanyway, one could create a string class that broke up the backend representation when a substring was taken, so that freeing the large string would allow the majority to be garbage collected
03:31greghyou'd have to have a pretty good reason to go to all that work, though.
03:32_atotrue that
03:33_atoI occasionally run into the problem when parsing lots of big data and tallying things up in hash tables, based on some smaller part of the larger text
03:33_atojust need to remember to explicitly copy the string before sticking it in your hash map
03:58Licenser_meep meep
04:02TheBusbyer, what's the trick where you can call a function before you define it? It's not bind...
04:02_atodeclare
04:02TheBusby_ato: thank you!
04:04esjI do declare Mr. Beauregard... !
04:05esjmercy, i need more coffee.... I'm turning into a ircbot
04:21Licenser__ato: do you still remember the bug in clj-sandbox that let you remap a function wiht var and such?
04:22Licenser_you called .alterRootVar on some var and then got a eval with another name when I remember correctly
04:22_atohmm
04:24Licenser_i think clj-sandbox fixed the issue now but I'd like to make a test to be sure :P
04:25_atoLicenser_: see #clojure-casual
04:53MadWombatHello all
04:55MadWombatIf I have a defstruct with 3 keys and 3 lists of items, how can I make a bunch of structs picking values from each collections?
04:57AWizzArdHi MadWombat. Could you please describe what you want in other words? I am not sure that I understand what you want.
04:57bsteuberMadWombat: you pick values with (:your-key your-struct) - not sure if this is what you need either :)
04:58Chousuke(map (partial struct yourstruct) list1 list2 list3)
05:29AWizzArdWhat do you use to parse .csv files? Does Contrib have something for that?
05:31zmilacertainly, exists some java implementation of csv-parsers
05:32esjAWizzArd: I think there is such a thing in Incantre
05:43stilkovAWizzArd: check out http://github.com/davidsantiago/clojure-csv
05:46AWizzArdoki
05:49stilkovhow does one submit bug reports for the clojure documentation?
05:50Chousukenormally through the ticket system I think
05:50Chousukethere's a support tab in assembla for non-members
05:52stilkovthanks
06:26npoektopwhat does mean :memory here (defmethod read-session :memory [repository id] ...)?
06:27bsteubernpoektop: depends on the definition of read-session
06:28bsteuberhttp://clojure.org/multimethods
06:28npoektopbsteuber, thank you
07:03_extermIs the ASM used by the clojure compiler just a repackaged org.objectweb.asm? if so, which version is it based on?
07:20eglyphhello, I'm following the tutorial on enlive. scrape3 isn't working. it uses html/selector which is not in enlive-html. am I missing something?
07:34_extermHey people, I'm trying to do some modifications to the Compilre to target a different Bytecode format. Is the ASM used by the clojure compiler just a repackaged org.objectweb.asm? if so, which version is it based on?
07:37hoeck_exterm: yes, its org.objectweb.asm, but I don't know which version
07:38hoeckeglyph: which tutorial?
07:39eglyphhoeck: the one from here: http://github.com/swannodette/enlive-tutorial/
07:40eglypheverything is fine until the moment i have to load scrape3.clj. i've browsed the source and couldn't find 'selector' function
07:42hoeckeglyph: and what about net.cgrand.enlive-html/selector ?
07:43eglyphis there such a function in enlive-html?
07:44eglyphenlive-html is :required as html, so the full name is html/selector. this is the exact thing the slime barks at.
07:44hoeckI don't know, I have never used enlive :P
07:44eglyphas i've already said there is no such function in enlive-html
07:44hoeckah, okay, I first thought that there was a typo somewhere in scrape3 or so
07:45eglyphit seems the idea is to use partial application if i'm not mistaken
07:59kzarSo I'm probably just being stupid here but I'm a bit confused by the clojure.http.client package. If I call the request function with the GET method and add some parameters the parameters seem to be given as post ones. (Even though the :method of the response is GET) . If I add the parameters manually to the URL they are sent as GET parameters though
08:01AntonyBlakeyeglyph: in enlive_html.clj line 343 I see (defmacro selector ...) so it's definitely defined. This is enlive 1.0.0-SNAPSHOT
08:04eglyphAntonyBlakey: I'm looking into git version and there is no such string. the tutorial is installed with lein. so probably enlive evolved and the tutorial is not updated.
08:04AntonyBlakeyCheck your project.clj to see what version lein specifies.
08:05AntonyBlakeyI did the tutorial with no problems.
08:05eglyphenlive "1.0.0-SNAPSHOT"
08:06eglyphi've just looked into enlive jar for the source. it's not there. wtf?
08:06_atokzar: I think when you pass a map to it it always puts it in the request body, not the query string. If you want to put something on the query string add it to the URL (you can probably use url-encode on the map to format it)
08:07AntonyBlakeyeglyph: It is in mine (along with many compiled files)
08:08eglyphAntonyBlakey: my jar consists two .clj files. this is weird.
08:11AntonyBlakeyYou have a later version than I do.
08:13AntonyBlakeyDid you perchance checkout out the git head and build it?
08:14Licenser_hmm has anyone worked with clojure to write gui applications?
08:14AntonyBlakeyberlin brown has a blog post on it.
08:15AntonyBlakeyhttp://berlinbrowndev.blogspot.com/2009/04/practical-clojure-with-swt-junit-and.html
08:15sexpbot"Berlin Brown and Software Development: Practical Clojure with SWT, JUnit and Spring"
08:15eglyphAntonyBlakey: no, I just cloned the tutorial repo and followed all the steps listed. lein deps && lein repl
08:15AntonyBlakeyand this for swing: http://stuartsierra.com/2010/01/03/doto-swing-with-clojure
08:15sexpbot"doto Swing with Clojure - Digital Digressions by Stuart Sierra"
08:15hoeckeglyph: it looks like the selector macro was there for "compiling" selectors
08:16hoeckand now selectors are just plain functions, and you don't have to compile them
08:16eglyphhoeck: so the tutorial won't work until fixed, right?
08:16hoeckeglyph: can you try to just remove the html/selector calls from the scrape3 source?
08:17AntonyBlakeyeglyph: try deleting the enlive jar from your lib directory and your ~/.m2/ repository
08:17hoeckeglyph: yes, but it looks like its a very small fix
08:17AntonyBlakeyBut I don't think that 1.0.0-SNAPSHOT matches git head.
08:17hoeckeglyph: but beware, I'm only doing a wild guess while looking at the commits
08:18vu3rdd_exterm: The clojure package in debian is built without the in-built asm library, as asm is already present as a deb package
08:18vu3rddand it uses version 3.2 of libasm3
08:20Licenser_thanks fort the links
08:20kzar_ato: OK fair enough
08:22eglyphhoeck: right, selector has to be removed from the code
08:22hoeckeglyph: that was the commit I'm referring to: http://github.com/cgrand/enlive/commit/6d0919ef2be0f3ea1ca69335d8098ec9e3442f8f#L0R369
08:26eglyphi wonder why it is not working
08:55jfieldsare there any conventions around naming in clojure? obviously dashes are preferred to camel case or underscores. Anything else? For example, Stu Halloway once mentioned to me that foo->bar was idiomatic for converting a foo to a bar. Are there other things like that?
08:55kzar_ato: Hey you're right the url-encode function works really well, I love how you can just give it a map. It was actually really easy to make a little web-request function that behaved like I expected. Thanks
08:56Chousukejfields: ? for predicates
08:57hoeckjfields: also: http://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards
08:57sexpbot"Clojure Library Coding Standards | Clojure | Assembla"
08:57Chousukejfields: also parameter names: coll for collection, x, y, n, f, g for functions etc.
08:57Chousukehm, that's unclear. obviously not x, y, n for functions :P
08:58Chousukealso shadowing core names is okay if the scope of shadowing is short-lived
08:59jfieldsChousuke, hoeck: cool, thanks
08:59Chousukeeg. (defn reverse-map [map] (into {} (for [[k v] map] [v k]))) is okay
09:01jfieldsI've been using using name:age for maps (e.g. (def name:age {:jay 30 :bob 24}), but I was considering switching to name=>age and saving : for another option
09:05hoeckjfields: colons in symbols are not a good idea
09:06jfieldshoeck: why's that?
09:07hoeckit looks bad, as they are usually reserved for keywords
09:09hoeckan idiomatic name would be name-age
09:10jfieldshoeck: which looks good in that case, but when it's first-name-last-name you loose a bit of information. first-name=>last-name is more expressive, to me.
09:10jfieldss/loose/lose/
09:10ChousukeI think it's better to name the map to indicate its use
09:11Chousukethough if such a naming scheme is not applicable, name=>age is pretty good
09:11Chousukeor name->age
09:11hoeckright
09:13jfieldschousuke: name->age, really? doesn't that collide with the idea that -> is usually used for converting from one data structure to another?
09:13Chousukenah.
09:13AWizzArdCould be a map :)
09:14jfieldscool. I'm just learning this stuff, so thanks for the ideas.
09:14Chousukethe type->another is mostly borrowed from scheme
09:15Chousukebut in clojure most things for now are simply maps and vectors and strings and other mundane data types. there isn't much need for conversion
09:15jfieldschousuke: sadly, most of my clojure work is tied very closely to an existing java codebase. which has me doing ->'s all the time.
09:16Chousukeheh.
09:16AWizzArd“(->” does not look similar to “(something->”
09:17ChousukeAWizzArd: I don't think anyone said that.
09:32dnolenhmm, so is it possible to augment final Java classes now with extend ?
09:36chouseryes
09:38kzarIs there a way to use clojure.xml/parse with a string or a seq of strings instead of giving it a filename to open?
09:40zmilakzar - xml/parse can parse InputStream
09:42chouser,(clojure.xml/parse (java.io.ByteArrayInputStream. (.getBytes "<foo>bar</foo>")))
09:42clojurebot{:tag :foo, :attrs nil, :content ["bar"]}
09:42chouserdnolen: yeah, that's appropriate
09:45kzarzmila: chouser: sweet thanks
09:45kzarWhich html parser would you recommend that can handle badly formed html?
09:46chousertagsoup
09:46chouserworks quite nicely with clojure.xml/parse
09:46dnolenok, interesting so you can't extend a protocol right ? (that is, without having to specify a list of types)
09:48chouser"extend" is always about filling in an implementation at an intersection between a protocol and something else.
09:48chouserthe something else can be a record, datatype, class (even a final one), or an interface.
09:48dnolenchouser: so that's a no. A protocol is a bit less of dynamic thing. I can't change the protocol for everyone (a bad idea I suppose anyway), but I can extend it for a type.
09:49chouseroh... you mean add a new method spec to an existing protocol?
09:49dnolenchouser: yes
09:49chouserI think you can redefine the entire protocol if you want.
09:50dnolenchouser: sure, I meant for users of a library which defines a protocol. They want to add some methods, they have to extend all types that use that protocol, they can't jsut add a method spec.
09:54kzarchouser: Dumb question but how do I know what to add to my use list to get clj-tagsoup working? Usually I just add the name but with hyphens changed to periods so [clj.tagsoup] but it's not working
09:56_atokzar: if it's not documented then just look at the directory structure of the library source, or read the (ns ...) line: http://github.com/nathell/clj-tagsoup/blob/master/src/pl/danieljanus/tagsoup.clj
09:57_atoso in this case you'd use pl.danieljanus.tagsoup
09:57dnolenkzar: hyphens don't become periods.
09:58chouserit looks like http://github.com/nathell/clj-tagsoup produces different output than clojure.xml
09:58chouserif you want clojure.xml output, you don't need a clojure lib, just the tagsoup java .jar
10:03dnolenchouser: now that I think about it, I suppose it doesn't matter really, since protocols are composable :)
10:04Licenseraloa
10:05kzarHmm so I did try pl.danieljanus.tagsoup earlier, but no luck. At least I was onto something. It's good to know how that stuff should work even if it's not all functioning atm. I tried unziping the tagsoup jar somewhere and the structure looks like org/ccil/cowan/tagsoup so I should add [org.ccil.cowan.tagsoup] to my use list right? Well that's not working either so I'm stumped now
10:06vu3rddI see something very strange with (comment .. )
10:07vu3rddif I put some clojure code there, it is fine. But if I use a strange looking identifier (for example cut and paste code from dotrace), it does not compile
10:07vu3rdd,(comment (defn x[] "true"))
10:07clojurebotnil
10:08vu3rdd,(comment (defn x[] xyz:))
10:08clojurebotInvalid token: xyz:
10:08kzar(I have copied all of the jars from tagsoup into my classpath and restarted Clojure)
10:09Licenserkzar: there is already a clojure lib for tagsoup that works
10:10kzarLicenser: Yea I think you joined us mid convo, I was having trouble getting that loaded and it was suggested I tried the tagsoup directly
10:10lpetithello all
10:11vu3rddIs this behaviour with (comment) a bug?
10:13Licenserah okay, kzar I used it with the lib and it worked w/o any trouble - strange
10:14kzarLicenser: Heh it's very probably me doing something wrong to be fair on the library
10:15Licenserhttp://github.com/Licenser/lein-search/commit/7fc3030f8d5edb0099f93ea87717673d3f6fe56f#diff-7
10:16Licenseractually http://github.com/Licenser/lein-search/blob/7fc3030f8d5edb0099f93ea87717673d3f6fe56f/src/leiningen/update.clj
10:17kzarOK I got it working, turns out killing Clojure wasn't enough to add the new jar files to the classpath. I needed to restart emacs
10:17kzarOn the plus side I understand how things are laid out a lot better now
10:22Licenser:)
10:28kzarOh sweet it's working really well with the inspect-tree gizmo, go to love that
10:29kzarDoes anyone know of a good guide that explains the difference between map apply and reduce? I know it's dumb but the difference always eluded me
10:38liebkekzar: a one line summary of the difference is: (apply foo [1 2 3]) => (foo 1 2 3), where as (reduce foo [1 2 3]) => (foo (foo 1 2) 3).
10:39bsteuberand (map foo [1 2 3]) => [(foo 1) (foo 2) (foo 3)]
11:07caljuniorso I was creating this ubercool gui. Sensibly designed it in Netbeans. :import into clojure. everything beautiful. now I want to (.add some-panel (JScrollPane. some-table)) but the ScrollPane is not showing up in the gui. Just an empty JPanel.
11:09caljuniorall my (.addActionListnener ) code I added in clojure is working just fine in the same gui.
11:09Chousukedid you try forcing a repaint of the whole thing?
11:10caljuniorno
11:10Chousukeor check if the scroll pane has any visibility flags
11:10caljuniorok
11:10ChousukeThere's no reason code like that shouldn't work as far as I know so I'm guessing it's for some reason deciding it doesn't need to get drawn at all
11:15caljunior(.repaint some-panel) no effect.
11:16caljunior*checking visibility flags on scroll pane*
11:23jfieldsdoes anyone know if (append-spit) is thread safe?
11:24Chousuke~def append-spit
11:24clojurebotIt's greek to me.
11:24jfieldsit's in contrib
11:25stuartsierradefine thread safe
11:25Chousukeyou can always ensure it's thread safe by using an agent :P
11:25jfieldsI have two threads that want to write to the same file
11:26stuartsierraSince it's just calling java.io methods, I would guess it is not safe to use from 2 threads at once.
11:26jfieldsokay, thanks
11:27LicenserI really want to write a program with agents, then I'd call them all smith
11:27stuartsierraha
11:27Chousuke(def agent smith)
11:27Licenser(def smith agent)
11:27Chousukeexcept hm, yeah
11:28Licenserthen you could use smith instead of agent
11:34cYmenI wrote down how I set up vimclojure in case anybody wants to try it: https://simon.a-oben.org/pages/clojurestart.html
11:36LicenserI really start to dislike my typo blog :( is there any nice clojure one out there? (yes I know I could write my own)
11:36Licenserpropably would be best but I hate to do the graphics part -.-
11:38tomoj`"typo" blog?
11:38Licenserfor god's sake :(
11:38Licenseryes it's a blog in rails
11:38tomoj`oh, yeah
11:38Licenserand I start to hate it more and more
11:38tomoj`naturally
11:39Licenserit refuses to update properly and their new editor is hell - I am scared to share the link of my latest post since it is embarrasing ...
11:40rfgLink please.
11:40rfg:)
11:41rfgI've been writing a blog in CL.
11:42rfgI would've liked to write it in clojure, but it's cgi based and so the jvm start-up speed is problematic.
11:42Licenserrfg: it is broken
11:42LicenserI really want to cry now
11:43Licenser*sighs*
11:47Chousukerfg: have you considered using a wholly jvm-based approach like compojure with Jetty serving the pages?
11:48zaphar_psrfg: I went the static site generator route and wrote it in clojure
11:49rfgChousuke: It's mainly because my host was only (until recently) allowing cgi. They've started a beta for using arbitrary technologies which should allow me to do it in clojure, but I need to look into how one goes about doing that.
11:51ivenkysafternoon gents - i am learning clojure (and loving it) , any suggestions for code to look at for getting the idioms right
11:51rfgzaphar_ps: Yeah, I've seen your site.
11:52zaphar_psreally?
11:52zaphar_psheh
11:52zaphar_psnot used to people having been there :-)
11:52zaphar_psit's pretty low traffic
11:52ivenkysa small library or so would be perfect -
11:52rfgActually could people have a look at my site and tell me if it is rendering nicely. www.radiofreeganymede.com
11:52sexpbot"Radio Free Ganymede"
11:53zaphar_psooohhhh pretty picture :-)
11:53zaphar_pslooks ok to me chrome on ubuntu linux
11:54slaxorlooks fine on firefox, windows 7
11:54rfgI hope to have my first clojure related post up soon.
11:55Licenserrfg: looks good on safari http://grab.by/3VYX
11:56dnoleninvenkys: you could look at cgrand's repo on GitHub tho his work tends to be ultra-dense. The clojure-contrib 1.2.0 libraries might also be educational.
11:56dnolenivenkys: ^
11:56ivenkysdnolen: tkx
11:57ivenkysrfg : looks good in Firefox on Arch
11:57lrenncan you pass wild cards clojure.lang.Compile? In other words, is there a way to write an ant task that doesn't list an argument for each namespace?
11:58stuartsierrawith a lot of ant XML foolery, yes
11:58chouserif you compile a namespace the 'require' or 'use's other namespaces, all those will be compiled too
11:58Licenserfor gods sake :( this is so sad
11:59lrenngrr, thanks folks.
12:00cemericklrenn: if you're locked into ant, but not opposed to using the maven-ant-tasks lib there, the clojure-maven-plugin supports wildcards for choosing which namespaces to compile.
12:03lrenncemerick: thanks but I'm just fooling around with reimplementing lein in ant + ivy :) It's backwards compatible other than having to specify all your namespace :(
12:03cemerickheh, ok
12:29ad4mI've got a Clojure app that calls for clojure-1.2.0-master-SNAPSHOT.jar, but I can't seem to find that specific version in any repositories. I have found repos with 1.2.0 snapshot jars with dates in the name, do I just grab one of those and rename it to remove the date?
12:30Chousukead4m: that name is what you get if you build from git, but renaming a maven snapshot will work as well
12:32ad4mAh, so is the idea that I should have that already in my local repo by way of building it from source?
12:33Chousukeprobably
12:33Chousukethough the clojure build process doesn't actually put it in a *maven* repo. it just produces a jar
12:34ad4mOk, well I don't know much about Maven either, but I'd assume there's a way to publish things to your local repo or cache or whatever it is called
12:34ad4mThanks
12:44raekhow is clojure's = done for java arrays? identity? element-wise-=?
12:45dakroneraek: the doc is pretty clear about it
12:45dakrone,(doc =)
12:45clojurebot"([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison."
12:47dakroneraek: does that make sense? so they are equal if the elements are equal
12:49stuartsierra,(= (list 1 2 3) (seq [1 2 3]))
12:49clojurebottrue
12:50dakrone,(= '(1 2 3) [1 2 3])
12:50clojurebottrue
12:50dakroneeven though one's a list and one's a vector
12:50Chousukearrays have identity comparison.
12:50stuartsierra,(= (list [:a 1] [:b 2]) {:a 1 :b 2})
12:50clojurebotfalse
12:51Chousuke,(seq {:a 1 :b 2})
12:51clojurebot([:a 1] [:b 2])
12:51Chousuke,(= (into-array [1 2 3]) (into-array [1 2 3]))
12:51clojurebotfalse
12:52Chousuke(this is not a bug :))
12:55slyphonwhat's the deal with the "trailing attr-map" style?
12:56Chousukewhat do you mean?
12:57tchalvakHey, it worked!
12:57slyphonwhat does it look like?
12:57slyphonyou can do (defn blah "docstr" {:private true} [] )
12:58slyphonor even (defn #^{:private true} blah "docstr" [] (println "yay!"))
12:58slyphonthere's a form where the metadata comes at the end, though
12:59slyphonno?
12:59Chousukehm
12:59tchalvakSo I'm trying to get started with clojure, and I'm running into problems including jars, can I do this, to test that I have the right paths, from within the repl? And if so, what's the actual syntax?
12:59Chousukemaybe with multiple arities?
12:59Chousuke(doc defn)
12:59clojurebot"([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata"
12:59slyphonmaybe
12:59stuartsierra(defn foo ([x] ...) {:meta ...})
13:00slyphonahhh
13:00slyphonok, i couldn't figure out where the meta went in that form
13:00slyphonstuartsierra: thanks
13:00stuartsierratest that; I think it's right
13:01Chousuketchalvak: do what?
13:01slyphonstuartsierra: yep, that's it, thanks!
13:02stuartsierrayou're welcome
13:02tchalvakGet a jar library loaded, e.g. if I'm running the repl from a folder, and I have a blog/blog.jar file, can I include or require it from within the repl?
13:02stuartsierranope
13:05tchalvakAh.
13:05raekis there a simple way to make a hex string from a java byte array?
13:06bsteubertchalvak: but you can check your existing classpath with (System/getProperty "java.class.path")
13:08tchalvakbsteuber: *nods* Ok, I guess that'll work for seeing whether the stuff that I'm trying to load is actually present, guess I'll have to load & reload the repl and test different configs. Thanks.
13:08bsteubertchalvak: yes, I think so - or you can use something like leiningen or maven that sets up the right classpath for you
13:09dakroneraek: something like this perhaps: (map #(Integer/toHexString (int %)) [\a \b \c\ \d])
13:09dakrone,(map #(Integer/toHexString (int %)) [\a \b \c\ \d])
13:09clojurebot("61" "62" "63" "20" "64")
13:09dakroneyou'll need to convert your byte array to a seq first
13:10dakrone,(map #(Integer/toHexString (int %)) (.getBytes "asdf"))
13:10clojurebot("61" "73" "64" "66")
13:10dakroneor not
13:11bsteubertchalvak: but actually google gives some results for "java modify classpath runtime" - maybe you can experiment with this..
13:12bsteuberwould be nice to do a clojure wrapper around this
13:12stuartsierraClojure has add-classpath, deprecated because it doesn't work in many environments
13:12tchalvakbsteuber: Not to dump lots of text, but: user=> (System/getProperty "java.class.path")
13:12tchalvak"/home/tchalvak/sites/threadhack/www/crow-blog:/home/tchalvak/sites/threadhack/ClojureX/lib/clojure.jar:/home/tchalvak/sites/threadhack/ClojureX/lib/clojure-contrib.jar:compojure/compojure.jar:rhino1_7R2/js.jar:blog/admin.clj:blog/config.clj:blog/db.clj:blog/layout.clj:blog/markdown.clj:blog/pages.clj:blog/rss.clj:blog/server.clj:blog/test.clj:blog/tokyocabinet.clj:blog/util.clj:::/home/tchalvak/sites/threadhack/ClojureX/lib/jlin
13:12tchalvakSo I have all these files actually loaded, so that's good.
13:12tchalvakI'm using ClojureX, if y'all are familiar.
13:13tchalvakWhich allows me to push some jar paths into a .clojure file on a project to project basis, and it's apparently working.
13:13Chousuketchalvak: that's not right.
13:13Chousuketchalvak: you should have the root of the blog dir in the classpath, not the blog files itself
13:14tchalvakNow I just have to figure out how to actually access the namespaces in the jars.
13:14tchalvakRight, I was kinda confused by that, I'll try that then.
13:14Chousukeso that you can have (ns blog.pages) etc.
13:15hiredmantchalvak: you have some clojure files (.clj) on the classpath, that is not going to work
13:15hiredmanI should say in the classpath
13:15hiredmanjars and directories go on the classpath
13:16Chousukeie. if it's /foo/bar/blog/some.clj, add /foo/bar/ to the classpath
13:16tchalvakChousuke: that applies to both .jar files and .clj files?
13:16Chousukejar files are added directly
13:16Chousukethey represent a directory
13:16tchalvakChousuke: Ok, I'll edit based on that then.
13:17Chousukethey contain a /foo/bar/whatever.clj hierarchy
13:17Chousukethe point is that in java, and in clojure, a namespace segment corresponds to a directory
13:17Chousukeexcept the last one, which is the file/class
13:18Chousukeso if you have some directory or jar in a classpath, the directories under it are going to represent namespaces
13:18Chousukeagain, a jar is essentially just the dir hierarchy packaged into a zip file. you could extract it and it'd work just the same :)
13:23bsteuberstuartsierra: thx for the information
13:24stuartsierranp
13:34tchalvakChousuke: 'lright, I guess I'm part of the way there, I'll have to go back to the book now and start at the beginning.
13:34tchalvakChousuke: Thanks.
13:42joshua-choiI've been reading http://www.assembla.com/wiki/show/clojure/Clojure_Compiler_in_Clojure.
13:42joshua-choiWhat does "written in Clojure" mean?
13:42joshua-choiAs in, clojure.core and other libraries that use no direct Java and no eval?
13:42chouserno, that page is just about the compiler
13:43slyphonwow, STM FTW
13:43joshua-choichouser: So it doesn't have to be in "pure" Clojure then?
13:43chouserwhich is currently clojure/lang/Complier.java
13:43slyphontalk about "a good idea"
13:43joshua-choiWell, that's written in Java.
13:43chouserjoshua-choi: oh, I see. yeah, I think it will strive to be pretty pure
13:44cemerickso, I wonder who's going to knock out a far shorter/simpler version of this... http://wiki.github.com/FaKod/Circuit-Breaker-for-Scala/
13:44joshua-choichouser: Does "pure" mean end-dependent on clojure.core and special forms only?
13:44chouserthat is, the reader gives it clojure structures, and the compiler analysis phase will produce nested clojure records.
13:45joshua-choiClojure records?
13:45chouserthe step after that is to produce jvm bytecode, and of course that will use java and be java-specific.
13:45chouseryeah, defrecord instances.
13:45joshua-choiThe reader would spit out raw lists, vectors, maps, and sets. What would need to be translated into records from those?
13:46chouserright, that's what the analysis phase of comiplation does now -- takes the raw lists, vectors, etc. and produces a tree of Java objects.
13:46chouserthe new code would be in clojure instead, do roughly the same kind of analysis and produce a tree of records.
13:46joshua-choiWhat would need to turn into objects? Functions?
13:47joshua-choiOh, I see
13:47chouserthe analysis phase includes all macroexpansion, type inference, and the necessary gathering of data about primtives, local scopes, local-clearing (to prevent head-holding), etc.
13:48joshua-choiWould it matter if the reader was in pure Clojure too? Or could the current Java-implemented reader suffice for the compiler?
13:49chouserThe reader can be ported to clojure independently. The interface between the reader and compiler is very well understood, so you should be able to mix-n-match implementations.
13:49chousera couple people have written more or less complete Clojure readers in Clojure now.
13:50joshua-choiReally? I wrote one too, but I didn't know that there were others.
13:50chouserChousuke and hiredman each wrote one
13:51chouserthat's not including things very like clojure readers that the various syntax highlighters may have.
13:51joshua-choiDo you know if their sources are on GitHub?
13:52chouserI think one of the early steps for ccinc will be to make the interface between the compiler's analysis phase and emit phase as stable and accessible as the reader->compiler interface. That will allow compilers and emitters to be developed independently as well.
13:54joshua-choiThe difference, I think, is that the reader-compiler phase uses standard Clojure data structures, while the compiler current emits weird Java objects that I don't get. :)
13:55joshua-choiI don't dare to figure them out.
13:55chouserright, that's why I want that to change early, into nice printable records
13:55chouserI'm actually kinda itching to get started on that, but I have this pesky book to finish first...
13:55joshua-choiIt's not that urgent, though, anyway, right?
13:55hiredmanjoshua-choi: http://github.com/hiredman/clojure/blob/readerII/src/clj/clojure/reader.clj
13:56chouserhiredman: thanks. I was getting close...
13:56chouseroh, I'm in readerIII ...maybe not so close.
13:56stuartsierraI started sketching out plans for a reader that was entirely table-based.
13:57joshua-choihiredman: Whoo, that is amazing, and dense. Why did you put your helper methods in a letfn?
13:58hiredmanjoshua-choi: to avoid var lookups in the generated bytecode
13:59joshua-choihiredman: Does it make it that much slower? I've always wondered if I should use let instead of def for my parser libraries...
14:00hiredmanhttp://groups.google.com/group/clojure-dev/browse_frm/thread/b20ce4b2c226ffcf/26860813d1c39ba1?lnk=gst&amp;q=reader#26860813d1c39ba1
14:00hiredmanit's not a speed thing it is a bootstrapping thing
14:00joshua-choiAh
14:04Chousukemy reader is out of date now though :P
14:04hiredmanditto(?)
14:05chouserwhat's changed in the reader??
14:05Chousukemeta warnings? :
14:05hiredman^ deprication at least
14:06chouseroh
14:06ChousukeI think I might still be missing some obscure features
14:06Chousukeand to be honest this thing has basically no design :P I wrote it as I thought it
14:07Chousukehttp://github.com/Chousuke/clojure/blob/clojure-reader/src/clj/clojure/lang/reader.clj
14:07hiredmanhttp://www.thelastcitadel.com/images/syntax.png
14:08hiredmantrace of the method for reading syntax quote stuff
14:08joshua-choiDid you generate that?
14:08ChousukeI toyed with writing a restartable reader but after I had a restartable string reader I stopped; I wish Clojure had continuations
14:09Chousukeoh, and yeah, syntax-quote is horror
14:09hiredmanjoshua-choi: yes
14:09ChousukeI tried implementing it as a macro at first but gave up after a lot of frustration
14:10joshua-choiChousuke: When I wrote mine, I cheated and just used `syntax-quote.
14:10ad4mIs there a way to add annotations to a class created with proxy?
14:11hiredmanwell, generated as in walked through the code trying to figure out what it did
14:11joshua-choiad4m: I don't think so. It is unfortunate.
14:11joshua-choihiredman: Ah, I meant if you used some program to do it for you.
14:11ad4mWhat about gen-class?
14:12ChousukeI don't think Clojure has any support for annotations
14:12joshua-choiIt's a commonly requested feature. But comparatively low in priority, I think.
14:13ad4mIs there any sort of work around?
14:13chousercan you use the Java reflection API to adjust annotations?
14:14ad4mI don't know. I don't know that much about Java.
14:14joshua-choiDo you have a Java library that requires them?
14:15joshua-choiIn any case, I found http://tutorials.jenkov.com/java-reflection/annotations.html from Google
14:15sexpbot"Java Reflection: Annotations"
14:15ad4mYes, I'm using a library named Netty
14:16technomancyevery time people ask about annotations, it's for netty. I wonder if you could write one Java wrapper around Netty that would let it be used without annotations and be done with it.
14:16technomancywould probably be less work than adding annotations to clojure
14:17technomancypareto principle, etc, etc.
14:17hiredmanad4m: have you seen http://github.com/texodus/saturnine?
14:18ad4mhiredman: Nope, but the one line description makes it sound interesting. I'll check it out.
14:19danlarkinI love this: "clojure.contrib.logging integration (is this a feature?)"
14:21ad4mThanks for the various ideas
14:42zakwilsonI am frequently impressed by the well-reasoned explanations of design decisions posted to clojure.org.
14:52zakwilsonIs fnparse the only game in town for a Clojure parser library?
14:54replacazakwilson: the only one I know about, but some folks have also used antlr
15:21jfieldshow do I change {:a {:b 1}} to {:a {:b 2}}
15:21chouser,(update-in {:a {:b 1}} [:a :b] inc)
15:21clojurebot{:a {:b 2}}
15:21Licenserjfields:
15:21Licenserwhat chouser sayd
15:21jfieldscool, thanks all
15:22jfields,(update-in {:a {:b 1} :c {:d 1} [:a :b] inc)
15:22clojurebotUnmatched delimiter: )
15:22jfields,(update-in {:a {:b 1} :c {:d 1}} [:a :b] inc)
15:22clojurebot{:a {:b 2}, :c {:d 1}}
15:26Raynes"If the main difference between Scala and Clojure is syntax then the main difference between an F-22 Raptor and Boeing 777 is paint color." - James Iry on Twitter.
15:27chouserWhich demands an answer to the question, which is which?
15:29LauJensenIncredible that the discussion is still going. Remind me to be careful what I blog about if I'm ever Head of Development anywhere, people pay attention :)
15:31slyphondoh, does 'binding' create a recursion point?
15:31chousernope
15:31slyphonhrm
15:32slyphonchouser: https://gist.github.com/f1044271c41c0880bee6
15:32slyphon error: java.lang.IllegalArgumentException: Mismatched argument count to recur, expected: 0 args, got: 1 (jms_internal.clj:177)
15:32slyphoni thought that recur would re-enter from the top of the fn
15:33chouserhm, that's a reasonable assumption. :-)
15:33slyphonok! :D
15:33slyphonhooray for not being crazy
15:33slyphonohhhh
15:33dnolen"@jamesiry and Clojure is the nimble single-seat F-22, Scala the enterprise passenger-bearing beast, right? ;)" - David Nolen on Twitter
15:33slyphonjta/with-user-transaction is a macro
15:34chouserhm, binding acts funny in a recur loop.
15:34slyphonah
15:34slyphonno TCO for you!
15:35RaynesI wish that MMEmail guy would do a full on JavaMail Clojure wrapper or similar.
15:35chouserslyphon: you're expecting *session* to retain it's newly-bound value when you recur there?
15:35slyphonchouser: yeah, that was the idea
15:35chouserI think it might actually behave that way currently, though I don't know that I'd rely on that.
15:35slyphoni don't *really* need to recur there
15:36slyphoni can just call myself again, it's not like it's a recursive algorigthm
15:36slyphoner
15:36slyphonalgorithm
15:37chouseroh my.
15:37slyphon_awaychouser: ?
15:38chouserbinding acts really weird with recur
15:38slyphon_awaythat's good to know
15:38chouserlike 'set!' almost
15:38slyphon_awayouch!
15:39chouseroh, maybe not. weird
15:39hiredmanrecur is gnarly, really tco would make things much simpler
15:40chouser,(loop [a 1] (prn *print-level*) (when (< a 3) (binding [*print-level* 10] (recur (inc a)))))
15:40clojurebot30 10 10
15:40chouser,*print-level*
15:40clojurebot30
15:41chouseractually ... that's exactly right. 'recur' inside binding acts like a recursive call, with the original value restored on final exit.
15:41chouser,(loop [a 1] (prn *print-level*) (when (< a 5) (binding [*print-level* a] (recur (inc a)))))
15:41clojurebot30 1 2 3 4
15:45Chousukechouser: I think that's a good demonstration of how dynamic scope is not "visually" intuitive like lexical scope :)
15:46Chousukeeven though it often appears to be
15:46stuartsierraI've come to the conclusion that dynamic scope is a bug.
15:47chouserheh
15:47Chousukekind of like goto is a bug
15:48chouserbut there are so many clever tricks it can do
15:50rfgIt makes some java interop stuff much more bearable but one can certainly feel dirty using it.
15:51chouserit's not really dirty until you start using 'set!' to return multiple values across multiple stack frames.
15:55ChousukeI did that in my implementation of read-time syntax-quote
15:56chouserclojure.lang.Compiler does it in several places.
15:57ChousukeI certainly hope the cinc compiler will avoid any dynamic binding
15:57chouseryeah, and mutable fields.
15:58Chousukeit's a bit difficult to make compiler information available to "outsiders" if it's all context-dependent and has dynamic scope :/
15:58chouserwell, outsiders don't need to see it until it's done mutating ...but, yeah.
15:58chouserit shouldn't do that.
16:03slyphondoes the CLR do TCO?
16:04slyphonthey just rolled out F#
16:10slyphonanyone know what handles the channel logging/publishing in here?
16:10kotarakslyphon: ask chouser
16:14chouserslyphon: my IRC client logs everything, and then I have a clj program that converts it to html and rsyncs to the web server.
16:14slyphonchouser: HA!
16:14slyphonawesome
16:14slyphon*way* more low-tech than i expected
16:14cemerickThe channel logs have a bus factor of 1, though. :-P
16:15hiredman 59M #clojure.log
16:16dcnstrctword on the street is that Oracle will be charging for it's JRE very soon. =^o If this were to happen would it bother you folks ?
16:16cemerickdcnstrct: linky?
16:16slyphondcnstrct: i highly suspect that's FUD
16:16hiredmanis that the word on the street?
16:17hiredmanI think thats the word on the "what's new" on reddit from a few days ago that didn't get enough votes to make the front page
16:17cemerickI doubt they're that stupid.
16:17slyphonanyway, isn't gcj like *nearly* there?
16:17dcnstrcthttp://www.sun.com/software/star/odf_plugin/
16:17sexpbot"Sun ODF Plugin for Microsoft Office"
16:17slyphondcnstrct: yes, that's totally different
16:17hiredmangcj is garbage
16:18hiredmanwell, it might be good for something
16:18dcnstrctaccording to someone @ oracle's tech support many of their previously free offerings are going to be behind a paywall
16:18dcnstrctincluding the jre
16:18hiredmanbut it is not a general purpose jvm
16:18dcnstrctbut this is just second hand info
16:19slyphonhiredman: i was being "arch"
16:19dcnstrctmy question though is would it matter much to you guys ? are you perfectly happy with OpenJDK ?
16:20cemerickdcnstrct: I think we'd have to actually see something concrete supporting the premise before thinking about much.
16:20slyphoni've used the mac version of openjdk, it did what i needed it to do
16:20slyphonnot w/ clojure, but with jruby
16:20dcnstrctcemerick, it's just a conspiracy theory @ the moment, but it would explain why James Gosling resigned in protest.
16:21slyphonreally? i think he might not have liked the culture @ oracle
16:21slyphoni mean, he'd been employed at Sun with *that* sr. team for like how many years?
16:21hiredmandanlarkin says if you use the openjdk you'll run into bugs, but I have used it, and haven't to my knowledge run into such
16:22Licenserhmm ruby makes me sad this days :(
16:23hiredmanpffft
16:23hiredmanwho cares, just release a jvm with tailcalls
16:23hiredmanor fixnums
16:23hiredmanwell, I think I'd prefer tailcalls
16:24LicenserI want a jvm that just works
16:24Licenserapple should make one
16:24Licenserwith a nice apple logo and a full metal frame
16:24hiredmanLicenser: I have one of those
16:24dcnstrctyes and then they should mandate that users can only use it with the java programming language
16:24Licenserdcnstrct: nah I doubt it
16:25Licenserapple prefares objective C
16:25dcnstrctoh ya gp
16:25Licenserthey'll kill java and make ojective C or ruby the main language on the jvm
16:25hiredmanas it happens the compiler I am working on is source to source and generates java source code
16:26Licenserhmm I strongly doubt that oracle will make the jre payware
16:26Licenserit would kill it entirely
16:26dcnstrctunless their intention is to kill it
16:26rfgAnyone want to hazard a guess when dalvik will be "fast enough" for clojure?
16:26rfg*if/when
16:26Licenserdcnstrct: if I'm not mistaken their projects use java quite a lot right? At least the middleware sector
16:27Licenserwhat I fear more is that they go to neglect java
16:27dakronerfg: I thought the concern was more in dalvik's garbage collector than its speed
16:27cemerickTheir entire app business is JVM-based. Why talk about conspiracy theories?
16:27hiredmanrfg: needs a good gc and jit, but as far as I know google's priority is battery life
16:28stuartsierraI thought the problem with dalvik was startup time for Clojure RT
16:28dcnstrctthey could still run their app business while charging for manditory support for jvm downloads
16:28Licensercemerick: yea but it does not mean that they will keep the 'wishes' of the comunity in mind anything like sun
16:28Licenserdcnstrct: but half the world would kill them for that :P
16:28dcnstrcthahaha
16:28Licenserand people would stop using the jvm as platform
16:28Licenserwhich would hurt the jvm
16:29dcnstrctwell the openjdk stuff would just get stronger
16:29dcnstrctand oracle would have to spend less time thinking about the jvm
16:29Licenseror .net and the M thingy
16:29dcnstrctbecause it would be "pushed into the open source" more
16:30dcnstrctthey did the same thing to solaris.. it's free but with a mandatory $90 support contract
16:30dcnstrctpeople still use solaris
16:31slyphonmy whole shop is solaris
16:31Licenserwow they now charge for solaris? Since when
16:32Licenserdownloaded it just like 2 weeks ago
16:32slyphononly if you're running it on non-sun hardware
16:32slyphoniirc
16:32Licenserah okay I use it on a v440
16:32dcnstrctsee.. they're rolling out this new policy on all kinds of stuff that used to be free
16:32dcnstrctweek after week
16:33slyphondcnstrct: are you just trying to drive Oracle's stock price down?
16:33dcnstrctLOL
16:33dcnstrctbusted
16:33mfexhi all, how do I map a function over each value in a hash-map?
16:33dcnstrctsell damn you all
16:33dcnstrctsell
16:33hiredmanclojurebot: ticker ORCL
16:34clojurebotORCL; -0.05
16:34dcnstrctw00t!
16:35cemerick,(map inc (map val {:a 0 :b 1}))
16:35clojurebot(1 2)
16:35Licenserdcnstrct: I loved sun as a company and I'm very sad they got bought too, and oracle isn#t the same ;(
16:35cemerickmfex: ^^
16:35cemerickor...
16:35cemerick,(map (comp inc val) {:a 0 :b 1})
16:35clojurebot(1 2)
16:36dcnstrctlicenser, care to speculate about what sun's big mistake was ? why did they end up selling ?
16:36mfexcemerick, I want to new values bound to the same keys in a map again
16:36cemerickah
16:36Licenserdcnstrct: because oracle had way more money
16:36cemerickI think there might be a map-map fn to do just that in contrib somewhere. Otherwise, you can do...
16:36dcnstrct$_$
16:36sexpbotCommand not found. No entiendo lo que est?s diciendo.
16:36mfexcemerick, so (?? inc {:a 1 :b 2}) -> {:a 2 :b 3}
16:36Licenseralso I think sun's buiggest mistake was that they were always briliant with new ideas but never got to an end.
16:37LicenserAlso MySql was a big compeditor for oracle
16:37cemerick,(into {} (for [[k v] {:a 0 :b 1}] [k (inc v)]))
16:37clojurebot{:a 1, :b 2}
16:37cemerickmfex: ^^
16:37hiredmanI find it hard to fathom how mysql competes with anything
16:37mfexcemerick, thanks
16:38Licenserhiredman: it might not be geniuse but it is widely used
16:38cemerickmfex: there is a map-map fn floating around somewhere though, that simplifies that a little
16:38hiredman,fmap
16:38clojurebot#<MultiFn clojure.lang.MultiFn@3e6962>
16:38dcnstrctsqlite beats it for most of the use cases I care about
16:39hiredman,`fmap
16:39clojurebotclojure.contrib.generic.functor/fmap
16:39hiredman,(fmap inc {:a 1 :b 2})
16:39clojurebot{:a 2, :b 3}
16:39cemerickyeah, there you go :-)
16:39cemerickhiredman: you know contrib well for someone that doesn't use it. ;-)
16:40mfexeven better, thanks
16:42hiredmancemerick: well, you know, you keep an eye out, snag anything interesting that floats by
16:43lancepantzi saw a thread in the google group that mentioned flightcaster.com as the largest site with clojure in production
16:43lancepantzdoes anyone know otherwise?
16:43cemerickSounds plausible.
16:43cemerickDo they publicize figures of any kind?
16:43technomancyprobably depends on how you measure it
16:43technomancyLOC, cluster size, team size, etc.
16:45slyphonis there something in contrib that does bean but can set values too?
16:45lancepantzi'm not sure, but their alexa rank is 330,252
16:45cemerickthem's some hardcore metrics! ;-)
16:45lancepantzmakes me nervous
16:46slyphon"How many spyware infected nop-heads can you attract to *your* site?"
16:50dnoleninteresting JavaScript V8 looks like it's faster than Python 3 or Ruby 1.9. Good target for Clojure?
16:52dcnstrctit sure would be cool to have that be 100% clojure
16:52dcnstrctgo ahead and get started on it would ja ?
16:53hiredmanclojurebot: scriptjure?
16:53clojurebotGabh mo leithscéal?
16:53hiredmanclojurebot: google scriptjure
16:53clojurebotFirst, out of 57 results is:
16:53clojurebotarohner&#39;s scriptjure at master - GitHub
16:53clojurebothttp://github.com/arohner/scriptjure
16:54dcnstrctif you called it scriptjure people who write frameworks on top of it would use a biblical naming scheme
16:54dcnstrctand that could get pretty ridiculous fast
16:55hiredmanadam begat cain and cain begat seth(?) and ...
16:55pjstadighehe
16:55rfgEcclejiastes
16:56pjstadigpjalms
16:56dcnstrctjejus
16:58dcnstrctis it plain text search for in-memory arrays ?
17:00dcnstrctahh it's that plus transactions and compression.
17:03stuartsierraAnybody here read the RSpec book from Pragmatic ?
17:04Raynesstuartsierra: No, but it's on my to-read list right after War and Peace and the Common Lisp spec.
17:05stuartsierraumm, not exactly a ringing endorsement
17:06dcnstrctI like test/spec a lot better
17:07dcnstrctit does all the main stuff you'd need and it's 1/50th the code size
17:07technomancymy thoughts on rspec: http://technomancy.us/118
17:07sexpbot"in which a hypothetical death occurs in order that a real one may be avoided - Technomancy"
17:08slyphontechnomancy: :D
17:09slyphonrspec is proof of what happens when "the void stares back into you"
17:09chouser40KLOC of ruby!?
17:09slyphonchouser: it ain't pretty
17:11nurvwell, i worked for a comp that had about 1.2MLOC of lisp
17:11nurvnot CL
17:11chousernurv: elisp?
17:11chouser;-)
17:12nurvno no
17:12nurvan in-house dialect
17:12chouserah
17:12slyphonyeeeeeeeeeeeeeeeeeeuuuuwwwww!
17:12nurvit "mostly" worked
17:12chouserheh
17:12zakwilsonWas it the source code for the OS and all included software on a Lisp machine?
17:12nurvthat is, until it didn't
17:13nurvnope, although that would be great
17:13zakwilsonDid the people who wrote most of the code actually understand Lisp?
17:13nurvit ran on hp-ux and some ibm 390s machines
17:13cemericktechnomancy: LOL @ bludgeon :-D
17:14nurvzakwilson, it depends on the project they were working
17:14zakwilsonbludgeon is pretty funny. It needs more possible outputs though.
17:14nurvthere were some great coders and some awful ones too
17:14nurvbut at least it was challenging an fun
17:15nurv*and
17:15zakwilsonPerhaps *what* you could bludgeon to death with a printout of the source code. (e.g. a fly, a mouse, a whale)
17:15technomancy=)
17:15zakwilsonI'd enjoy working at a company that wrote lots of Lisp.
17:15hiredmanlisp has been many things to many people
17:16nurvbtw, rebooting...bbl
17:16hiredman~google the evolution of lisp
17:16clojurebotFirst, out of 24500 results is:
17:16clojurebotThe Evolution of Lisp
17:16clojurebothttp://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.85.8331&amp;rep=rep1&amp;type=pdf
17:16hiredmanbleh
17:16hiredmanthere are free pdfs if you google
17:22stuartsierratechnomancy: bludgeon install fails for me
17:23technomancy=(
17:23technomancyyeah, looks like there's some bitrot
17:23stuartsierraI like the concept though
17:24technomancythe code is mostly there to make the joke better
17:24mmarczykBLUDGEON_PAGES = 500 # TODO: is this accurate?
17:24mmarczyklol :-)
17:24mmarczykum, hi
17:25stuartsierra500 pages is only about 2.5 inches thick
17:25dcnstrctare we talking about text on both sides ?
17:25technomancyI was going for a standard ream like for a photocopier
17:25technomancyif you pack it tightly enough it could be deadly... maybe. further research is required.
17:25stuartsierranot sufficiently deadly, in my opinion
17:26stuartsierra'cause I've tried bludgeoning the photocopier and never made a dent
17:26technomancypatches welcome =)
17:28stuartsierrawell, I just bought the RSpec eBook, will report how it goes
17:28technomancythis is also assuming you have the advantage of surprise
17:29stuartsierraah
17:29mmarczyktechnomancy: I've read your last blog entry on submissions, very enlightening for me
17:30mmarczykguess I'll be re-sending my clojure-mode patch
17:30mmarczykso, just wanted to ask, would a git-prepared patch file be preferable to a pull request or does it not matter?
17:31technomancymmarczyk: I have a slight preference for pull requests
17:31mmarczykalright
17:31mmarczykI'll make a fresh fork, put my stuff on a topic branch, then send one
17:31technomancyfor the record, I like all kinds of submissions
17:31technomancyso don't stress over it. =)
17:32mmarczyk:-)
17:32mmarczykthat's about the coloured repl, btw
17:32mmarczykthere's also a swank bit to that
17:32Licenserif someone is interested I wrote togehter a little article about how to make libs nicely multy version compatible: http://blog.licenser.net/2010/04/22/on-clojure-libs-and-versions
17:32sexpbot"lice! : On clojure libs and versions."
17:32technomancysweet
17:32Licenseralso I fixed my blog after a day of work
17:32Licenserdoh
17:32mmarczykso... would a defadvice be ok inside swank
17:33mmarczykor would that be better as an "extra recommendation" in the readme
17:33mmarczyk(or do I not make sense now...)
17:33mmarczykhm... guess swank uses an advice on M-x slime anyway
17:33MadWombathello
17:34Licenserhi MadWombat
17:34MadWombatHow do you use nth-of-type or first-of-type in enlive?
17:34technomancymmarczyk: sorry, don't have time to check the context on that. it's probably ok though.
17:34mmarczyksure
17:37slyphonhrm
17:48dnolenMadWombat: you need an extra set of square brackets, [[:div (nth-of-type 2)]]
17:52raekLicenser: *bookmarked*
17:53raekhonestly, hadn't thought about that stuff
17:56kotarakLicenser: *daumenhoch* for the version range tip. This should be promoted more!
17:56Licenserthanks :) I am glad if it helpes
17:59Licenserweöö bed time for me, night people!
18:07livingstonso if I'm working with a swank project with lein and emacs...
18:08livingstonif I want to work with a lot of source code, what's the preferred way to load it all in / manage that?
18:10_atolivingston: I use ido-mode for quickly switching between buffers, if that's what you mean
18:11_atoothers use things like speedbar to show a tree of files
18:11livingstonno i just mean loading all my source, when the project open although my classpath is set nothing is loaded
18:11dnolenlivingston: I used desktop-save and desktop-read
18:12dnolenthat saves all your open buffers to a file that can be read later
18:12dnolenno so hot for multi project setups but works well enough for me.
18:12livingstondnolen: oh that sounds useful (but that's another problem)
18:13dnolenoh, you mean loading all of your source and sending it to the repl?
18:13_atolivingston: if you mean loading into clojure not emacs, just have some main namespace which loads all the others?
18:13livingstonyeah getting the code into clojure
18:14livingstonin lisp there was a thing called asdf which managed the pacakage and file dependencies and would load and compile etc.
18:14technomancylivingston: in CL, you mean.
18:14technomancysorry, pet peeve
18:15livingstoni would think lein or something would help me with that too, but I haven't found examples of anything like it.
18:15technomancyif you (use 'top.level.ns.that.requires.all.others :reload-all) it would do it
18:15technomancyprovided you have such a top-level ns
18:15livingstontechnomancy: prior to about 2 years ago lisp and common lisp were fairly interchangable (what else would you be using?), but yes I agree
18:16technomancyno love for MACLISP? come on guys...
18:16technomancy=)
18:16livingstonoh, really? that's all I have to do?
18:17_atodoes CL make things really hard or something?
18:17livingstonthat's pretty sweet, but wait how will it know what order to load all my files in?
18:18livingston_ato: no it doesn't, things like ASDF make managing CL pretty straightforward
18:18nurvMACLISP... there is an implementation for it to the JVM too.
18:18nurvDidn't play much with it though.
18:19_atolivingston: the order you specify... if namespace A use/requires B, which in turn use/requires C and then D then that's then they'll be loaded in the order C D B A
18:19_ato(assuming they all do so at the top of their code anyway)
18:19livingstonthat makes sense, although... what if I have the same ns in two different files? or is that really bad practice?
18:20slyphongah
18:20nurvtechnomancy|away maybe you'll enjoy this: http://github.com/hz7k-nzw/lapin
18:20_brian2_noob question, i am trying to use exception handler (from dnolen's enlive tutorial) http://clojure.pastebin.com/QMZeeZnq but I get "Don't know how to create ISeq from: java.lang.Boolean" when i run it
18:20slyphonhttps://gist.github.com/898a45ef78d87bc521ce
18:21_atolivingston: then it's only going to pick up one of them, the one that's named to match the namespace (yes it is bad practice)
18:21slyphoni'm trying to dynamically call a set method here, but i can't seem to get the escaping syntax correct
18:22_atoyou can probably get around that by using load-file or some such (kind of like a C #include) but normally you should have namespaces correspond 1 to 1 to files.
18:22livingstonoh, ok, well, I should stop that then...? but it just seems if I have a lot of code for a ns that naturally falls in a few big chucks I could split the files, but then you're saying they should then have their own subordinate ns each?
18:23_atothat's how I think it's intended to work, yes.
18:23livingston_ato: ok that makes sense. in CL we could spread it out, but then you specified each file in ASDF and their file level dependancies, so I was expecting to have to do something like that
18:24livingstonand I guess I could roll my own equivalent of that but why bother if I get it for free with some ns disipline
18:24dnolen_brian2_ it just looks like your try/catch syntax is wrong right? true is outside the expr
18:25_brian2_dnolen> ok thnks
18:25_atoyep, and in my opinion by having namespaces match files then it's easier to remember where stuff is defined
18:26livingstonwell that makes it more like java than CL but that's ok, I've conceeded that that's going to happen to me as I move forward with clojure ;)
18:28mmarczykactually clojure.core is split into a couple of files
18:28mmarczykand there's a bunch of (load "...") forms in core.clj
18:28mmarczykso it's perfectly possible, if not necessarily great for readability
18:29livingstonI guess there's no real difference from writing (load foo) vs (use foo)
18:29livingstonand the net effect is basically the same
18:29mmarczykwell actually there are fairly significant differences
18:30mmarczyka separate ns can be reloaded separately
18:30technomancycore is not always a good example to follow
18:31mmarczykwell that I'm entirely in agreement with :-)
18:31livingstonyou could just load one of the files though again independently, I think. but the separate ns is probably better...
18:32livingstonalthough then you need a lot of "use" code everywhere to avoid having the qualify the heck out of everything
18:34_brian2_dnolen> I'm not sure, I'm just substituting (html/html-resource (java.net.URL. url)) into this (try
18:34_brian2_(Class/forName class-name) true
18:34_brian2_(catch ClassNotFoundException _ false)) from the book
18:34mmarczyklivingston: maybe see http://onclojure.com/2010/02/17/managing-namespaces/ and http://code.google.com/p/clj-nstools/
18:34sexpbot"Managing namespaces &laquo; On Clojure"
18:36livingstonmmarczyk: cool thanks for the pointers
18:37mmarczyksure
18:37_atolivingston: yep, for imports within a project I tend to just 'use all the symbols rather than listing just the ones I want explicitly as is usually recommended, since it's the one project if you introduce something that conflicts you'll know immediately when you try to run it, so it's easy to fix. It's too much hassle and repetition otherwise in my opinion. Listing symbols is definitely a good idea for between projects thoguh.
18:57livingstonso regarding our previous discussion about namespace and files... if I have a ns foo and that breaks down into foo.bar and foo.baz but there is no actual foo code anymore, I could just create a foo ns that requires (or uses) both?
18:58livingstonand I would put that foo ns defining code in just a foo.clj file and that's it?
18:59livingstonthere seems to be a naming convention for ".core" though, what's the deal there?
19:00rfgThis is strange. I have some code where if it reads (first thing) it hangs the repl, but changing it to (take 1 thing) it works.
19:01mmarczykI believe that a namespace foo.bar corresponds to a bar class in the foo package
19:01mmarczykand with a "single-segment" namespace you're putting your class into the default package, or whatever that's called in Java
19:02livingstonmmarczyk: makes sense I was just trying to figure out how to define/name the foo ns based on best practice
19:03livingstonthere seems to be a "core" naming convention that I was trying to understand
19:03mmarczykwell, anyway, if you want a foo.bar.baz namespace, but no foo.bar namespace
19:03mmarczykyou don't need a separate .clj file for foo.bar
19:03Raynesmmarczyk: Thanks for that correction earlier.
19:05livingstonI know, I want to break up my code into more files though, and based on some previous advice I think I will give each file it's own ns...
19:05mmarczykRaynes: which correction? you're welcome anyway, though :-)
19:05livingstonbut then I want to create a parent ns to kinda glom it all back together
19:05Raynesmmarczyk: I said "vars are immutable" when that isn't what I actually meant. You corrected me.
19:06rfgAh, I see what my problem was.
19:09mmarczykRaynes: ah, you mean in Clojure 101
19:09RaynesIndeed.
19:10mmarczykwell, I do use the same mental picture
19:11mmarczykof shadowing, I mean
19:11mmarczykfor locals, which I hope came across from my posting
19:13mmarczykincidentally, I'm rather enjoying clj101 already :-)
19:17mmarczyklivingston: not sure why you'd want to do that
19:18livingstonso that then I don't have to say :use bar baz etc.. I can just use the parent package/namespace
19:18mmarczykthat Google Code project of Konrad Hinsen's might help you with that
19:20livingstonhow do I get clojure to tell me what it thinks the classpath is?
19:21livingstonmmarczyk: yeah I'll probably end up using konrad's ns+
19:21rfg(System/getProperty "java.class.path")
19:22BorkdudeI also saw this somewhere: (println (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))))
19:22Borkdude
19:22mmarczyk(filter #(.startsWith (name %) "foo.bar") (clojure.contrib.find-namespaces/find-namespaces-on-classpath))
19:23mmarczykthough I suppose that's borderline ridiculous
19:23Borkdudewhat exactly is the difference?
19:23mmarczykbut you could map clojure.core/use over that
19:25livingstonthanks. I just wanted to make sure it could see my class, turned out I had a typo somewhere else...
19:28livingstonif I use a ns foo that itself uses a ns foo.bar don't I get all the symbols in foo and foo.bar?
19:29arohnerdoes anyone have a function for elegantly handling functions with optional parameters in the middle
19:29arohnerlike defn
19:29arohner(defn-magic foo [a b? c])
19:29technomancylivingston: that's what ns+ is for
19:30livingstonarohner: why can't you put them at the end?
19:30technomancybut no, nothing like that is in clojure yet. I have hopes that template namespaces will get included some day.
19:30arohnerlivingston: cause I want it this way :-)
19:30livingstontechnomancy: oh ok, I though I got it all for some reason since the subordinate symbols do all exist in the parent ns
19:31livingstonarohner: then you have to just use a & rest and pull off the end ones OR
19:31technomancythere's not really any such thing as a parent ns. the hierarchy is an illusion.
19:32livingston(defn foo [a c] (foo ([a default-for-b c]) ([a b c] ....))
19:33livingstontechnomancy: right, right of course, but I was referring to foo as the parent in the context of (ns foo (use bar)) ... I thought maybe if I used foo I should get all of foo and bar
19:33livingstonbecause I though the use brought bar's symbols into the foo ns.
19:34mmarczykarohner: how about (defn foo ([a c] (foo a default-b c)) ([a b c] ...))?
19:34mmarczyklivingston: use isn't transitive
19:35arohnerlivingston mmarczyk: yeah, I guess that'll work. thanks
19:35mmarczykin fact, it most definitely shouldn't be
19:36livingstoni wouldn't really think you would want it to be, but I thought I read it as actually creating the symbols and adding them to the "parent" ns
19:37mmarczyknot really
19:37mmarczyksee the refer function and the refer method on ns objects
19:37livingstonwell this certainly makes package organization more of a pain.. I think I'll definately get Konrad's ns+ now
19:50rfgIs anyone using 1.2 with lein?
19:51livingstonrfg: i was, but I just broke it, I think..
19:51rfgI tried changing to 1.2 in project.clj but running lein deps gives errors.
19:51livingstonwhat errors are you seeing?
19:52livingstonI was running that just fine but now tried to add in ns+ from here: http://code.google.com/p/clj-nstools/
19:52sexpbot" clj-nstools - Project Hosting on Google Code"
19:52livingstonbut it's telling me it's missing 1) org.apache.maven:super-pom:jar:2.0
19:53technomancysuper-pom is maven's way of saying "the current project"
19:53technomancyso it's missing one of your project's deps; read up higher in the output
19:54livingstonKonrad's nstools needs 1.2 master and clojure contrib master , but I'm not quite sure how to figure out what to tell lein to make sure I have what he requires
19:56rfglivingston: http://paste.lisp.org/display/98174
19:57livingstonrfg: that's very much like what i'm seeing, if not exactly
19:58livingstonso if i'm staring at a github page, how can i figure out exactly what string I need to pass lein to get a given version?
20:03_atorfg: 1.2 hasn't been released; try "1.2.0-master-SNAPSHOT" instead of "1.2.0"
20:04rfgCheers, will give that a go.
20:04livingston_ato: what contrib library goes with that?
20:04_ato"1.2.0-SNAPSHOT" i think
20:06livingstonthat seems to work...
20:07livingston(except it doesn't for konrad's code I'll email him: UnsupportedOperationException: nth not supported on this type: PersistentArrayMap)
20:07livingston_ato: so how am I supposed to know what tags like "1.2.0-SNAPSHOT" are available for download? / figure that out?
20:08_atothe way I do it is look here: http://build.clojure.org/snapshots/org/clojure/ and here http://build.clojure.org/releases/org/clojure/
20:08sexpbot"Index of /snapshots/org/clojure/"
20:09livingstonOH, huh
20:10livingstonso does lein talk directly to github? or does it go there? because I was looking at tags on github, and there's one called "par" for better support of the parallelization code
20:12_atolein goes there and http://clojars.org/repo/
20:12sexpbot"Index of /repo/"
20:12_atonot github
20:14livingstonthat makes sense.
20:23livingstonwell, that's unfortunate...
20:23MadWombatthis is weird, I have an HTML page whith table based layout, there is a single table under body, that contains all the other nested tables. Yet (select page [:body :> :table]) returns 6 separate tables. Am I misunderstanding the way :> works in enlive?
20:23livingstonI emailed Konrad about nstools, but his autoresponder told me he's out for the week
20:24livingstonanyone have ns+ working?
20:37dcnstrcthttp://www.lisperati.com/clojure-spels/casting.html
20:37sexpbot"Casting SPELs with Clojure - Home -"
20:39dcnstrctthis is not quite as psychedellic as Ruby's beginner book.. but it looks just as useful and is perhaps even easier to read.
20:40lancepantzreferring to why's poignant guide?
20:40dcnstrctabsolutely
20:41dcnstrctback in the day it was the cartoon foxes or the half-japanese docs, or the prag book
20:42dcnstrctI like this wizard book a little better than why_'s stuff
20:42lancepantznaa, i like the foxes
20:42dcnstrctwell I don't dine on swine so maybe that's why_ I'm a little bias
20:42dcnstrctthe chunky bacon meme got a little out of control and I never quite got it.
20:43dcnstrctthis lisp wizard is a boozer
20:44dcnstrctadmittedly that's probably worse for the community than chunky bacon..
20:47dnolennot sure if somebody's already mentioned this here, but KirinDave's podcast is pretty cool: http://www.redmonk.com/cote/2010/04/22/makeall002/
20:48danlarkinpretty glorious headshot there
20:58joshua-choiIt's a shame that Why disappeared from the Internet.
21:01lancepantzyeah, pretty strange
21:10livingstonwhat's the best way to file a bug report on the 1.2.0-master-SNAPSHOT build?
21:10dnolenlivingston: is this something you built from source?
21:11hiredman1.2.0-master-SNAPSHOT is being constantly rebuilt on hudson
21:11livingstonthere's a bug in the ns macro
21:11livingstonno
21:11hiredmanthat is what SNAPSHOT means
21:11livingstonoh that makes sense
21:11dnolenwhat I meant was, where did you get that from? clojars?
21:12livingstonum, whatever lein just gave me
21:12hiredmanthat comes from hudson
21:12hiredmanbuild.clojure.org
21:12dnolenhiredman: interesting, I did not know lein pulled from hudson.
21:13hiredmanbuild.clojure.org keeps a maven repo
21:13livingstonso where do I report the bug? assembla?
21:14hiredmanwhat makes you think you have a bug?
21:16dnolenlivingston: I think it's best to bring it up on the ML or here, have people reproduce. You may need a CA to file a bug (I forget)
21:16livingstonthis generates an exception: (ns foo "doc" {:author "livingston"})
21:17hiredmanwhy wouldn't that?
21:17mmarczykum, why wouldn't it?
21:17mmarczyk:-)
21:17livingstonwhich is odd, because you would expect code like that everywhere
21:17hiredmanhave you read the docs for ns?
21:17livingstonthe docs on ns say the args are {:arglists '([name docstring? attr-map? references*])}
21:18mmarczyk(ns #^{:author "livingston" :doc "a cool ns to do foo efficiently"} foo)
21:19livingstonit's not my code, it used to work that way... the ns for KonradHinsen's nstools is defined that way
21:20hiredmanlivingston: are you sure you are on the latest SNAPSHOT build?
21:20hiredman(works for me)
21:20dnolenditto
21:20livingstonyes. is there anyway to make the repl tell me?
21:20hiredman*clojure-version*
21:20hiredman,*clojure-version*
21:20clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}
21:21livingstonshoot - it says 1.1.0
21:21hiredmanare you using lein repl?
21:21livingstondamn
21:21livingstonI'm using lein
21:21livingstonbut starting it from swank-clojure-project in emacs
21:22dnolenlivingston: that should work, in your lib directory do you have multiple clojure jars ?
21:22livingstonI thought that was supposed to be a safe way to avoid the fact that lein prefers 1.1.0
21:23livingstonyes there are multiple there
21:23dnolenremove the 1.1.0 one
21:23dnolenlein doesn't really do anything in the way of cleanup
21:23livingstoni just ran lein clean and lein deps and it's gone...
21:24dnolengreat, yet another thing I did not know about.
21:25mmarczyklivingston: which exception are you seeing?
21:25livingstondamn - ok it's all good now
21:25livingstonit was saying it couldn't call nth on a persistent map
21:29livingstonthis is the really bad thing about the bleeding edge - every once in a while you get really cut (that was a few hours I'd like to have back)
21:30mmarczykwell, I'm using the very latest checkout from GitHub right now
21:30mmarczyknothing seems broken
21:31dnolenlivingston: luckily 1.2.0 is really close, lein is converging on it as well as clojure-contrib.
21:31livingstonno it's all fine now - it was the 1.1.0 jar that was left laying around by lein
21:31mmarczykah, ok
21:31livingstonwhy are you going from github?
21:31mmarczykoh, by the way
21:31mmarczykI was going to ask
21:32livingstonand when will the good parallelization stuff get mainlined?
21:32mmarczykdoes the current lein HEAD pull in two versions each of ant and ant-launcher
21:32dnolenlivingston: ?
21:32livingstonmmarczyk: ask me? , yeah, shoot...
21:32mmarczykfor other people, or is it just me
21:33mmarczyklivingston: I use my own jars for a play-around REPL
21:33livingstondnolen: ? what ?
21:34livingstonmmarczyk: what do you mean, like your own modified one?
21:35mmarczyknot necessarily, just ones which I built here myself
21:35mmarczykfor no particular reason
21:35livingstonoh, well, why bother? unless you like to give bug reports back
21:35mmarczykI already have the sources, I build them to see if anything breaks, then it's more convenient to just use those jars
21:35mmarczykthen do a separate download
21:35mmarczykI like to file bug reports when I encounter bugs :-)
21:36mmarczykthat happened once so far with c.c build process
21:36mmarczykanyway, that's just something I like to do
21:37livingstonI don't have multiple ant anythings that I can see,... but lein grabs a ton of stuff I don't ask for, I only ask for clojure, clojure-contrib and swank... maybe if I asked for ant specifically i'd get doubles on things or smethign
21:37mmarczykum, no, I mean the leiningen project itself
21:37livingstonoh -
21:38mmarczyknvm, I'll bring this up when technomancy appears
21:39livingstonI can look .. to tell you the truth, I don't even know where lein puts all it's stuff?
21:43mmarczykare you using the stable version or a snapshot from GH?
21:44mmarczykif the former, then I guess you need a launcher script and the rest sits in a jar in your local maven repo
21:45livingstonme, for lein? it is the stable one there's the script to download and then it seems to like to manage itself, yeah
21:45livingstonoh, it just runs itself right out of the maven repo?
21:46mmarczyksee vim $(which lein) if you're on *nix
21:48livingstonhuh, wouldn't have thought to do it that way myself, but hey less copies of stuff - which is surprising, given the lein general take on that otherwise
21:48mmarczyksome irony in that I suppose ;-)
21:49mmarczykbtw, how's your unifier coming along?
21:50livingstonit's good the unifier is just an extremely tiny piece of what I'm ramping up to
21:51livingstonI was hoping to be further along with a minimalist RDF interface by now
21:53livingstonthanks for your comments
21:53mmarczyknot at all, that was lots of fun
21:54livingstonit's all going to end up open source so there will be a chunk of code come out regularly, probably
21:56mmarczykcool
21:56mmarczykand what kind of project is it?
21:56livingstonI do natural language understanding
21:57livingstonactually my real interest is memory, but the NLP is in there too, since I'm interested in how memory can facilitate nlp
21:58uberjarI thought NLP is a way to hypontize girls into comming back to your apartment.
21:58uberjarNeuro-linguistic programming
21:59livingstonyeah it's odd, they can both share a lot of the same concepts too, like memory, etc. makes googling a pain
22:00mmarczyklivingston: in this case I'll definitely be reading your code
22:00mmarczykshould be of interest to me
22:01livingstonwhat do you do?
22:01uberjarlivingston, how do you do parts of speech tagging ?
22:01mmarczykI'm a logician, mostly
22:01uberjardo you have a big dictionary of words and their parts of speech ?
22:02livingstonuberjar: no and yes...
22:02livingstonso bottom up approachs to NLP take things through pipelines that almost always start with POS tagging
22:04livingstonI use a top-down approach to language (because I believe NLP isn't bottom up) and can leverage other things like memory and context which is important to understanding everything
22:04livingstonthe approach I use is called DMAP (Direct Memory Access Parsing)
22:05livingstonwhere patterns of text and memory references are mapped to other memory references -- basically.
22:05livingstonso if the patterns use POS information we look it up and try to leverage it, but there's nothing about the approach that requires it
22:06uberjarinteresting
22:06lancepantzuberjar: most words have more than one sense that have multiple possible parts of speech
22:06uberjarwhere do you get your lexicon file for when you do look it up ?
22:06uberjaris that right word for it ?
22:06livingston(also I'm punting a little because I'm rewriting it from scratch so I don't have all the details for the new one yet - this is my second DMAP)
22:07lancepantzthe "best" way to solve the problem is using an iterative rule based tagger, look up the brill tagger
22:07lancepantzthe most complete lexicon is wordnet
22:07livingstonlancepantz: yes there is a lot of ambiguity in language - it's everywhere
22:08lancepantzword sense disambiguation :)
22:08livingstonwhich is why we focus on meaning and integrating with the underlying memory right away, since that's what it's all about anyway
22:08livingstonif we get information from a POS tagger or whatever along the way, great
22:09livingstonuberjar: there will be some form of lexicon you have to know what things mean
22:09livingstonbut that's kind of what the patterns are too - "if you see this input it means this"
22:10lancepantzi don't thinkg meaning doesn't really has any implications in nlp, what is important is quantifying conceptual similarity
22:10lancepantzthat's all that meaning really is
22:10lancepantzi worked alot on measuring word similarity at a previous job
22:11livingstontalk to the biologists I work with ... things mean things to them ;)
22:11uberjarthe only NLP problem I've ever been up against was back in my spamming daze when I needed to build an autoresponder that could try to extract first names out of incomming messages. I ended up just trying to match every captialized word against a first name wordlist.
22:11livingstonit's not just about words though - it's the whole utterance in context that meaning can be derrived from
22:11livingstoneven who's saying it can change the meaning
22:11uberjarthen I would try 3 different POS taggin libraries to rule out words.. when too many made the cut
22:12uberjarthe problem was the larger my first name wordlist the more false positives
22:13hamzagents, is there a func anywhere in contrib that can tell me if a val is with in a given range?
22:14mistrahi
22:14mistraClojure and Java
22:14qbg,(<= 2 5 7)
22:14clojurebottrue
22:14livingstonaren't < and > n-ary?
22:14lancepantzlivingston: in my case it was always trying to measure the similarity of one collection of words to another
22:14lancepantzgranted, i was working on search though, so the problem may be different from yours
22:14livingstonyeah ok, that's what I thought (re: < and >)
22:15livingstonlancepantz: I'm actually trying to understand the text - extract information from it
22:15slyphonargh
22:15lancepantzcan you share an example?
22:15mistrait compiles to jvm bytecode
22:15slyphonwho here is good at macroexpansion?
22:16uberjar,(println "I am")
22:16clojurebotI am
22:16slyphonuberjar: :)
22:16mistrait compiles to jvm bytecode
22:16livingstonlancepantz: biologist publish 2,000 journal-level quality articles a *day* they can't keep up
22:16mistrawatchign the videos on youtube
22:16mistrasearch clojure
22:17livingstonlancepantz: we are trying to say extract what proteins interact with what other proteins, or partisipate in a given funcational pathway, or...
22:17lancepantzinteresting
22:18mistrano want...statement
22:18mistrahave coffee and have video on subject.... = me happay
22:18uberjarmistra, yes.. think of java as a turtle.. clojure is what happens afer the turtle had mutagen for breakfast. It is still a turtle underneath but now it can do more.
22:18livingstonslyphon: the best thing to do is start with an example of what you want to produce and then write code that cons it up like data
22:19slyphonlivingston: well
22:20slyphonsorry, one sec
22:20mistraok uberjar
22:20livingstonby the way clojurebot should have answered your question, that he is good at macroexpansion - better than all of us ;)
22:20uberjarhe did!
22:21mistrauberjar you mean 100 times as slow as C?
22:22uberjarit's pretty fast
22:22uberjarfor something that takes out it's own trash
22:22livingstonlol i totally missed that, very cute
22:23uberjar;)
22:23mistraand processors seem to have moved along quite smartly in the last fifty years uberjar
22:26slyphonhttps://gist.github.com/29aaebed045617f5d595
22:27uberjarmistra, processors were getting smarter, but some programming technologies were getting dumber.. at least for a while
22:27slyphoni can't understand how to escape things properly so that at line 11, it treats the value in setter# as the sym
22:28mistrawhich ones however are smart? uberjar
22:28slyphoninstead of taking the autogenerated symbol name literally
22:28livingstonso you should always have an example of the input and the code you expect to be produced...
22:29slyphoni'm looking at the expansion
22:29mistrawhich ones however are smart? to go with modern quad, octal and other processors uberjar
22:29uberjarmistra, the ones with Lots of Irritating Superfluous Parentheses
22:29uberjarmistra, functional languages.. ones that avoid mutable state
22:30mistraokay
22:30mistraso AmigaE is out
22:30livingstonwhat you probably want ...
22:30slyphonlivingston: i just updated it with the macroexpand
22:30uberjarmistra, you can do it in C.. it's just painful
22:31livingstonis setter currently contains a string of the name and you acttually want the symbol, call symbol on that
22:31slyphonhmm
22:32livingstonthe macro expand is helpful, but you really want an example of just the plain code you expect your macro to produce
22:32slyphonNo matching method found: symbol for class mbox.harpo.errors.BogusSetter
22:32slyphoni think '.' is doing something evil
22:32mistrauberjar How old are you anyway?
22:32livingstonthen you start building a macro up that generates that exact code
22:32uberjarmistra, you want one that makes meta-programming easily
22:33uberjarmistra, my first CPU was a 486
22:33mistrabut is too smart not to know ars technica jeremy reimer..... amiga info
22:33mistrayes
22:33mistralanguage, irc bot that is realistic leading to one that is useful
22:33mistra I like blot
22:33mistra I like hEx
22:34livingstonpresuming the map is fixed set of stuff, i would have the macro write it out not produce the doseq bit - if the map isn't fixed, but set at runtime then there is very little reason for you to do that with a macro, just use a function
22:35mistrawho's te other one....Z?
22:36livingstonif you are going the macro route I would expect the output of your macro to be simply (do (. obj set-foo 8) (. obj set-bar 9)) so make your macro produce that list of stuff
22:36uberjarmistra, ask the wizard http://www.lisperati.com/clojure-spels/casting.html
22:36sexpbot"Casting SPELs with Clojure - Home -"
22:37livingstonslyphon: I'd normally gladly stay and keep helping but I'm so hungry I'm shaking I have to go... good luck. if i'm on later, I'll check in
22:38slyphoncool, thanks anyway
22:38slyphongood suggestions
22:38livingstonlater everyone and thanks for all the fish, I mean, help.
22:44mmarczykslyphon: why not just make it a function?
22:44slyphonmmarczyk: i'm workin on it
22:51mmarczykslyphon: actually I just realised why this perhaps should be a macro, d'oh
22:51mmarczykanyway
22:51mmarczykhttp://gist.github.com/376105
22:51mmarczykwould this work?
22:51slyphonyeah, . is a special form
22:52slyphoni could try that :)
22:52mmarczykplease do :-)
22:52slyphonyeah it's the ~@(map ) bit that i don't really know
22:54slyphondoh
22:54slyphonbrb, baby just woke up
22:54mmarczyk:-)
22:55slyphonoh, cool
22:56slyphonI Did Not Know That
22:56slyphonhrm
22:56mmarczyk:-)
22:56mmarczyk~@ splices whatever comes next into the sequence it occurs in
22:56clojurebot@ is splicing unquote
22:57mmarczykthanks, clojurebot :-)
22:58slyphonyeah, it's kind of like, it makes sense when you use it to splat a bunch of forms that are handed to the macro, but it kind of confuses me when you're generating it *inside* the macro
22:58slyphonhmm
22:58slyphonWrong number of args passed to: core$map
22:58mmarczykargh
22:58slyphonyeah, i see it
22:58mmarczykright, of course
22:58mmarczykI'll fix the gist too
22:58slyphonso you zip that?
22:58mmarczyk(done)
22:59slyphon:)
22:59slyphonoh, right
22:59slyphonmap takes multiple args
22:59slyphon(duh)
22:59slyphonoof
22:59slyphonMalformed member expression
22:59mmarczykbtw, where are the camelize and upcase functions coming from?
22:59slyphonoh
22:59slyphonone sec
22:59slyphoni ported them from rails, basically
23:00mmarczykoh, ok
23:00mmarczykok, I see one more thing to fix
23:01mmarczykjust a sec
23:01slyphonhttp://gist.github.com/376119
23:01slyphonthat's the other bits
23:02slyphonmmarczyk: ^^
23:02slyphonoh
23:02slyphongah
23:02mmarczykmake that two things
23:03mmarczykdone now, updated the gist
23:03mmarczykshould work
23:03mmarczyk(macroexpand-1 '(update-bean *bs*{:foo-bar 7 :byte-property 8}))
23:03mmarczyk(clojure.core/doto *bs* (. setfoo-bar 7) (. setbyte-property 8))
23:03mmarczyk
23:03mmarczyk(with my stand-ins for as-str, camelize, upcase)
23:03slyphon:)
23:03slyphonhttp://gist.github.com/376119
23:04mmarczykcool, thanks! :-)
23:04slyphonsure
23:04slyphonnow i just have to put *your* code at the bottom
23:06slyphonmmarczyk: it works!
23:06slyphonhooray!
23:08mmarczyk:-)))
23:13slyphonmmarczyk: ok, now to figure out what the hell this is doing :)
23:15mmarczykyup, that would be the next step ;-)
23:16mmarczykoh, only I might mean it in a different way, since this has just reminded me how I don't really get the Java beans stuff
23:16slyphonhah
23:17slyphonyeah, i just wanna learn why this works and the thing i did didn't
23:17slyphonbrb
23:29mmarczyk(added a slightly different version to the gist, moving the map outside of ~@; doesn't matter much)