#clojure logs

2010-05-24

00:02rdsrrava: in my emacs/swank setup, if there's a compilation problem, my cursor is placed at the point where the problem is
00:04ravais that a config option?
00:04rdsrI don't doing any configs
00:05rdsr*remember*
00:05ravahow are you compiling? C-c C-c ? or slime-compile-file?
00:05ravabe back in a little while
00:06DeusExPikachuwhy does the builtin classloader change in the repl after each line? So for example, (.deref (clojure.lang.Compiler/LOADER)) is called during different lines in a repl and outputs different classloaders, but when repeated in a dotimes loop is refers to the same value?
00:06DeusExPikachus/value?/object?
00:08rdsrC-c CK
00:08rdsrC-c C-k
00:12rdsrrava: It doesn't seem to place the cursor if the error is in a different file/ns
00:13rdsrrava: just prints the line number in the exception mesg
00:36ravabk, sorry
00:38ravayah, not seeing it run in repl from a yank
00:45ravaits annoying because it's a wrong args exception, and by looking at doc strings everything seems good.
00:49johnmn3I'm having such a hard time getting swing to swing
01:12remleduffWhat's the problem johnmnmn?
01:56empthelp needed. failed to install labrepl in Netbeans/Eclipse since some error getting incanter, anyone else has encountered such a problem and any suggestions to overcome?
02:02remleduffempt: What error? Something about a var already being defined?
02:04emptI recall it as cant get incanter downloaded when building labrepl in netbeans
02:04emptnow I try to do it again to copy the very error
02:06empt[ERROR]Transitive dependency resolution for scope: compile has failed for your project.
02:06empt[ERROR]Error message: Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.
02:06empt[ERROR] org.incanter:incanter-full:jar:1.2.0-20100327.041516-10
02:06empt[ERROR]from the specified remote repositories:
02:06empt[ERROR] central (http://repo1.maven.org/maven2),
02:06empt[ERROR] clojars (http://clojars.org/repo/),
02:06empt[ERROR] incanter (http://repo.incanter.org),
02:06empt[ERROR] clojure-snapshots (http://build.clojure.org/snapshots),
02:06empt[ERROR] clojure (http://build.clojure.org/releases),
02:06empt[ERROR] clojure-releases (http://build.clojure.org/releases)
02:06empt[ERROR]Path to dependency:
02:06unfo->_>
02:06empt[ERROR] 1) labrepl:labrepl:jar:0.0.1
02:06empt[ERROR] 2) org.incanter:incanter-full:jar:1.2.0-SNAPSHOT
02:06empt[ERROR]Group-Id: labrepl
02:06empt[ERROR]Artifact-Id: labrepl
02:06empt[ERROR]Version: 0.0.1
02:06unfo-empt, please use paste services
02:06empt[ERROR]From file: /home/empt/NetBeansProjects/RelevanceLabRepl/pom.xml
02:06empt------------------------------------------------------------------------
02:06remleduffPlease don't paste into the channel, put it in a gist or paste
02:06emptFor more information, run with the -e flag
02:06emptsorry
02:06emptyes
02:07remleduffThere's no such incanter version as 1.2.0-SNAPSHOT on clojars
02:08remleduffhttp://clojars.org/repo/incanter/incanter/
02:08emptso?
02:09emptI am using the origin without modifying; and should I modify some where to get it work?
02:10remleduffOh, incanter in labrepl is coming from repo.incanter.org
02:11remleduffMaybe there's something wrong with that server or labrepl is using a bad version
02:13emptok, I'm too new to understand the process but it seems I would better wait for them to have the things fixed
02:13remleduffActually, that seems to work fine for me
02:14emptbad luck of me :)
02:14remleduffCan you reach repo.incanter.org ?
02:14emptok I will try it
02:16emptmy god that's the issue. the mad ccp gfw seems to have blocked the site here in China
02:17emptnow I'll try to enable the proxy and retry
02:19emptand it's available now from firefox after proxy turned on so I'll retry it
02:20remleduffYou may need to delete your <HOME>/.m2/repository/org/incanter subdirectories to make sure maven actually retries. Sometimes it will cache a failure and stop trying
02:21emptthank you I was just about to ask this :)
02:24emptand a 'clean and build ' is sufficient after deleting?
03:33sjuxaxHey guys. I am new to Clojure and though I am somewhat familiar with Lisp, I haven't done much hard work in it, which will be apparent by the time I ask my question. I just want to be clear on this. The parentheses represent a block to evaluate, right?
03:34sjuxax So, like (filter odd? (nums)) happens because () means eval and first thing is function name, next things are arguments, and odd? doesn't need any extra eval, but I want the nums eval'd because I really want odd? to receive the sequence I had previously defined as "nums", right?
03:34sjuxaxI just think things would be easier to grok if I understood the parentheses usage : )
03:36mmarczykparens cause the Lisp reader to construct a list, which is then passed on to eval (at a conceptual level, anyway)
03:36mmarczykif the list is non-empty, eval takes a look at the first element of the list
03:37mmarczykif it is a symbol naming a special form, the whole thing is handed off to a "handler" for that special form
03:37mmarczyk(e.g. if, fn)
03:37mmarczykif it is some other symbol, it is resolved in the current context
03:38mmarczykif it happens to name a macro, the macro function is invoked and whatever it returns is fed back to eval
03:38mmarczykotherwise we either have a symbol naming a Var which holds a function or something which is not a symbol
03:38mmarczykeither way, the expression only makes sense if that thing evaluates to a function
03:39mmarczykonce eval has the function in hand, it proceeds to evaluate all arguments in turn, then passes them to the function
03:39mmarczykso, in particular, the "odd?" in your example is evaluated -- the result happens to be a function and that function is passed to filter as its first argument
03:42mmarczykalso, functions need not be specified by name when in the operator position -- e.g. ((fn [x y] (* x (+ x y))) 3 5) is a perfectly valid expression; macros and special forms do
04:07sjuxaxthanks mmarczyk
04:31sjuxaxThe difference between defn and fn is that fn is only used for anonymous functions, right?
04:31sjuxaxOtherwise all the same syntax etc?
04:32mmarczykwell, fn forms actually evaluate to functions
04:32mmarczykso they can be used in the operator position in expressions etc.
04:32mmarczykdefn = def + fn
04:32mmarczykcompletely different purpose, evaluates to a Var
04:32mmarczykbut yeah, the syntax is mostly the same
08:22angermanException in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: No matching field found: setFaceCountAndAttributes for class de.jreality.scene.IndexedFaceSet
08:22angermandoes that make any sense for http://www3.math.tu-berlin.de/jreality/api/de/jreality/scene/IndexedFaceSet.html
08:22angerman?
08:24spariev_angerman: can you show code that invokes setFaceCountAndAttributes ?
08:25hoeckthere is no such _field_ in that class
08:25angerman (.. cmp getGeometry setFaceCountAndAttributes Attribute/INDICES (DoubleArrayArray$Array. (swap-faces)))
08:25angermanhoeck: Ohh that's right.
08:25angermanHmm :/
08:26angermanyea. -> and -?-> are nice :D
08:26hoeckis .. the same as -> but only for method-invokation?
08:26angermanthough I'm always getting confused with ->
08:27angermanhmm I should use baces
08:27mmarczykhoeck: yup
08:28hoeck(-> cmp .getGeometry (.setFaceCountAndAttributes Attribute/INDICES) (DoubleArrayArray$Array. (swap-faces))) ?
08:28mmarczykthere's a syntactic difference in that with .. you don't prefix method names with dots
08:28hoeckah, yes
08:28hoecksorry, maybe you wanted this: (-> cmp .getGeometry (.setFaceCountAndAttributes Attribute/INDICES (DoubleArrayArray$Array. (swap-faces))))
08:29hoeckangerman: because in your expression, setFaceCountAttrs is called without any args, this might have caused the "no such field" error
08:30mmarczykapparently a lot of people have been calling .. non-idiomatic lately, with -> the preferred replacement... that's too bad, IMO, as I prefer the feel of .. for method chains
08:31angermanhoeck: yep, got confused in the .. syntax
08:31chousermmarczyk: rhickey stands by .. last I knew
08:31mmarczykchouser: really happy to hear that, thanks :-)
08:31chouserI tried to talk him out of it, but failed. :-)
08:32mmarczykgood. :-P
08:32mmarczyk;-)
08:34spariev_so, with .. it would be (.. cmp getGeometry
08:34spariev_ (setFaceCountAndAttributes Attribute/INDICES (DoubleArrayArray$Array. (swap-faces))))
08:36hoeckspariev_: from what I've learned right now, right :)
08:37angermanHm. This whole jreality project wished to have immutable datastructures
08:37angermanand bolted them onto java ...
08:37angermanHmm....
08:44rshI want to call a string named some function as the function itself... how would you do it?
08:46Chousukeconvert to a symbol, resolve the symbol to a var, and call that.
08:47rshcalling (var (symbol "+")) gives me error PersistentList can't be cast to Symbol
08:47Chousukevar is a special form
08:47Chousukeyou want (resolve (symbol "+"))
08:48Chousukewhich either returns nil, a Class instance, or a Var
08:48rshworks great, thanks
08:50Licensermmarczyk: I looked at your function problem is it needs to match the beginning of the string, but I'll try to make it a two way test
08:51rseniorwhen creating a new instance of a defrecord, where the defrecord exists in another namespace, do you always have to fully qualify it?
08:52rseniori.e. even when I'm already pulling in all the items from that namespace via a use
08:53mmarczykLicenser: you mean clj-id?
08:53mmarczyk?
08:54mmarczykI thought it did match on bos
08:54Licenseryap
08:55mmarczykhm :-)
08:55mmarczyknot sure I understand then
08:57mmarczykohhh, ok, I think I got it :-P
08:57mmarczyksorry for the delay ;-)
08:58mmarczykwell
08:58mmarczykthere's the option of using the find method on the Matcher
08:59hoeckrsenior: yes, because you refer to the defrecord via its classname, you will have to import it if you do not want to fully qualify it
09:00mmarczykand then use .start() to see if the match started at the given position
09:00mmarczykthen you could drop the ^ from the regex
09:01mmarczyk(find takes an int to indicate where it's supposed to start matching)
09:01rseniorhoeck: thanks, that's what I thought
09:03Licensermmarczyk: it's not really faster
09:04mmarczykLicenser: yeah, I guess the more complicated this becomes, the less likely it is to be of any benefit :-(
09:05Licenser*nods*
09:05mmarczykback to optimising regexes then
09:05mmarczykoh bother.
09:10Licenserhmm mmarczyk it seems it it takes more idents then the original regexp
09:10mmarczykthat's possible, I might not have been all that thourough with testing
09:10mmarczykany examples?
09:11Licenserno just the output of scanning core.clj
09:12Licenser83418 tokens with your code 40663 with mine
09:13Licenserah there we go
09:13Licenserokay there wasa $ in the end which is wrong in my implementation
09:13Licensersadly still slower :(
09:14Licenserhttp://gist.github.com/411839 is what I made out of it
09:15Licenserbut I found out why it was 10 times slower :P
09:16mmarczykoh? :-)
09:17Licenseryea bug infront of the compulter
09:17mmarczyk:-)
09:17mmarczykI wonder if this would be faster with the let moved inside the function
09:17Licensersee when I read 250ms for 40k tokens
09:17mmarczykhm :-)
09:18LicenserI thought okay so (/ 40000 2.5)
09:18Licenser~ 17k tokens per second
09:18clojurebotTitim gan éirí ort.
09:18mmarczyk(.. valid-chars (matcher s) (find idx)) isn't faster?
09:18LicenserI'm not entirely sure what that does
09:19Licenseroh wait 1.2 has no re- prefixes any more right?
09:20Licenserbut find can't take an idex
09:20mmarczykfind here is a method on java.util.regex.Matcher
09:21mmarczykc.c.string has funny names in 1.2 (with -re at the end), but the names in clojure.core are the same
09:22mmarczykso what the above does is (1) take the regex, (2) build a matcher for this regex on top of the given string, (3) find the first match of the regex in the string occurring no earlier than at index idx
09:23mmarczykhm, actually you'd probably have to do something like
09:23mmarczyk(let [m (.. valid-chars (matcher s))]
09:23mmarczykouch...
09:24mmarczyk(let [m (.. valid-chars (matcher s))] (.find m idx) (== (.start m) idx))
09:24mmarczykthat would tell you whether there's a match at the starting position you specified
09:24mmarczykI think
09:26mmarczykoh bother... title case not yet implemented
09:26Licenserah I see
09:26LicenserI think the problem is if you use ^ and index it always returns false
09:26LicenserI tried that I think
09:26Licensersince ^ can't match with an index
09:27mmarczykyes
09:27mmarczyktherefore you'd drop the ^
09:27mmarczyk....um
09:27Licenserbut then it would match (((123 abc too
09:27mmarczykand totally kill your performance I guess
09:27Licensersince abc is a ident
09:27Licenserand make it silly ;)
09:28mmarczykwell it would match, but the match would start some way past the index you specified
09:28Licenser^ is needed since it must only match when it is exactly the same
09:28Licenseryes some where past
09:28mmarczykso then you'd call .start, see that the match begins to far to the right
09:28Licenserbut that would tell me 'in the remaining code there is an ident somewhere' which isn#t exactly what a highlighter needs to know ;)
09:28mmarczykand decide that there's no match where you started (even though apparently there is one further on)
09:28mmarczykyeah
09:29mmarczykin fact, you're better of not trying to find out :-)
09:29LicenserI need to know 'is the next token an ident'
09:29Licenser^^
09:29mmarczykthen maybe it's best to use substring
09:30Licenserthat is what I do
09:30mmarczyksomehow creating all those extra strings seems wasteful, though
09:31mmarczykyeah, well then you could see how the regex with ^ with substrings and the .. thing fares
09:31mmarczykbut actually
09:31mmarczykI guess what you really want to do
09:31mmarczykis to tokenise the string first
09:31mmarczykat a primitive level -- split at whitespace and brackets
09:32mmarczykwith some complications because of comments, I guess
09:32mmarczykand then apply some regex magic to the individual fragments
09:33mmarczykthen it makes sense to have a function checking whether a particular string -- the whole of it -- is ok as an identifier
09:35Licensermmarczyk: bt that would e wrong
09:35Licensersee (+ 1) split it by a space won't work
09:36mmarczykwell, literally splitting at whitespace won't work
09:36Licenserto split it you need to scan it sadly
09:36mmarczykbut doing a lazy lexing step would
09:36Licenserhmm can you explain that?
09:37mmarczykgo through the string keeping track of whether you're in a comment, a string / regex literal
09:37mmarczykand a stack of open brackets
09:37mmarczyk(maybe)
09:37Licensermmarczyk: yes that might work for clojure but univerally it likely will not
09:37Licensera
09:37mmarczykby "in a comment" I mean "inside a line comment"
09:38mmarczykI don't think there's any programming language you can't split into tokens in a single traversal :-)
09:39mmarczykparsing is another matter, of course, but initial splitting should always be possible
09:40LicenserI'm not sure if it wil be faster
09:40mmarczykwell, you can be lazy about it
09:40mmarczykand then there's some room for optimisations
09:41Licensersince it does the string twice
09:41mmarczyke.g. only try regexes which might succeed given the first char of a token
09:41naeuhow would i create an infinite collection I can take from with a function that is continually applied to the previous result?
09:41mmarczykthe first pass does nothing interesting though
09:41mmarczykso it won't really slow you down
09:42mmarczykand once you do it, you no longer need to allocate huge strings over and over again
09:42mmarczyk(say, 250k chars for your source at the start, then 250k - the first 10 for the first token, then that - 5 for the second token etc.)
09:42sethsnaeu: have you tried iterate?
09:42seths,doc iterate
09:42clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.core/doc
09:42seths,(doc iterate)
09:42clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
09:43naeuseths: looks perfect, thanks
09:45Licenserhmmm
09:45Licensermmarczyk: subs doesnot allocate new strings AFAIK
09:47sethsI think I am trying to misuse reify... should I not use it inside defmacro?
09:47seths,(defprotocol IFoo (bar [_]))
09:47clojurebotDENIED
09:47sethsack
09:47mmarczykLicenser: hm, can't say that I'm sure about this, but the javadoc would suggest that a new string is return
09:48sethsanyways, this works: (bar (reify IFoo (bar [_])))
09:48sethsbut this doesn't: (defmacro make-foo [] (reify IFoo (bar [_]))) (bar (make-foo))
09:48sethsnew error to me: Can't embed object in code, maybe print-dup not defined
09:49Licensermmarczyk: I am not 100% sure sadly but I heared this earlyer
09:53_fogus_seths: I don't think there is anything inherently wrong with using reify in a defmacro
09:54sethsactually, to self reply, this works: (defmacro make-foo [] `(reify IFoo (bar [_])))
09:55sethsnow I have to puzzle through my real code which has other problems
09:55mmarczyk,(.. #"asdf" (matcher (StringBuilder. "asdfasdf")) (find 0))
09:55clojurebottrue
09:55_fogus_seths: Does the expansion of your snippet above look correct to you?
09:56mmarczykLicenser: another option :-) -- remove a bit from the front later, trim periodically
09:56mmarczykLicenser: but I hope you're right about the strings
09:56LicenserI hope too
09:57Licensermmarczyk: yea I did that first but it didn't made a difference
09:57mmarczykLicenser: nope
09:57mmarczyktry this:
09:57mmarczyk(def s "asdfasdf")
09:58mmarczyk(def w (java.lang.ref.WeakReference. s))
09:58mmarczyk(def t (subs t 4))
09:58mmarczyk(System/gc)
09:58mmarczyk(.get w)
09:58seths_fogus_: actually probably not: (clojure.core/reify euler.fu/IFoo (euler.fu/bar [euler.fu/_]))
09:58seths_fogus_: I haven't looked at the latest MEAP, does it have the chapter on macros?
09:58_fogus_seths: That's what I was thinking. ;-)
09:59_fogus_seths: It does.
09:59Licenserof case s is still there you defed it
09:59seths_fogus_: yay, 'scuse me then
10:00mmarczykwell, actually that doesn't prove all that much, does it... but at least now I really need to read about substring somewhere (the docs aren't explicit enough :-/)
10:01_fogus_seths: I think in this case capture and/or autogensym might fix your expansion
10:01mmarczykhttp://dmst.aueb.gr/dds/pubs/conf/2008-PCI-dtrace/html/GS08.html
10:01mmarczyksearch for "methods that have allocated the most objects"
10:02mmarczykbut anyway, obviously substring needs to allocate a new String object, but whether there's any memory sharing is a different matter... wouldn't really expect it, but hey.
10:02Licensermmarczyk: what I heared is that the substring is not copying the data but refering to it
10:03Licensermeaning also that unless you copy the data the original string won't be GC'ed
10:04spariev_mmarczyk: http://fishbowl.pastiche.org/2005/04/27/the_string_memory_gotcha/
10:04spariev_If you call substring(), you will get back a new String object containing a pointer to the same char[] array as the original string, just with a new offset and length to match the chunk you were after
10:06mmarczykspariev_: thanks for the link!
10:06mmarczykmy Google-fu failed me today :-)
10:07mmarczykthanks for improving my Java-fu, Licenser & spariev_
10:07spariev_mmarczyk: np :)
10:07Licensermmarczyk: I am sorry :P
10:07mmarczyk:-)
10:07mmarczykhm? what for?
10:08Licenserfor improving your java :P
10:08spariev_lol
10:08mmarczykoohhhh.
10:08mmarczyk:-D
10:09seths_fogus_: thanks!
10:09chouserIs there an object that does similar sharing but on byte arrays instead of chars?
10:10_fogus_seths: any time
10:16spariev_chouser: here's what i found http://stackoverflow.com/questions/618396/in-java-is-where-a-way-to-create-a-subarray-that-will-point-to-a-portion-of-a-bi
10:19chouserspariev_: excellent, thanks.
10:20spariev_chouser: glad I helped :)
10:22angermandoes anyone use os x and a wireless bt keyboard?
10:23angermansince I got my US layout one, when ever I push M-s I get ß ... which is very not helpful when using emacs with paredit. Well using emacs at all without a meta key is kinda annoying.
10:25ChousukeI think alt is not meta on OS X.
10:26Chousukeyou probably need to set the mac-command/option/whatever-modifier variables to other values to make it work.
10:26angermanChousuke: ah, well it's in Aquamacs at least.
10:27cemerickAFAIK, most everyone maps command to meta?
10:27angerman(e.g. I've been using that key-combo all along, just since the new keyboard it's scewed up... )
10:27ChousukeProbably configured differently from the emacs default
10:27Licenserangerman: in aquaemacs there is a setting for meta with german keyboard and such things
10:27Licensers
10:27Licenserso your alt and stuff work propperly on the keys where you need it
10:27Chousukecemerick: I have caps lock as meta and cmd as control
10:28angermanwell. the weird thing is, (using the same software, using the same aquamacs, using a US layout macbook) it did work.
10:28angerman(after installing the BT US layout keyboard) ... it stopped and gave me these special chars.
10:28Chousukemaybe the bt keyboard sends a different key code :/
10:29angermanto me it looks like os x is somehow grabbing the alt key before any app can.
10:29angermanChousuke: no. Best part: _now_ the keyboard on the macbook does the same strange behaviour
10:29Chousukehttp://www.emacswiki.org/emacs/MetaKeyProblems
10:32mmarczykLicenser: btw, are you using ":" + basic-identifier for non-namespaced-keywords?
10:32Licenseryes I think so
10:32mmarczykapparently :123 also creates a keyword
10:33mmarczyk(not sure why'd anyone want to do that, but...)
10:33Licensero.O
10:33Licensernarf
10:33mmarczyktoday was the first time I made that typo ;-)
10:34LicenserI think you even can create random string keywords
10:34Licenser,(keyword "I want cookies!!!"
10:34clojurebotEOF while reading
10:34Licenser,(keyword "I want cookies!!!")
10:34clojurebot:I want cookies!!!
10:34Licensero.O
10:34Licenserthat isn't readable :P
10:34mmarczykwell, if you call keyboard or symbol, you can make keywords and symbols out of any string
10:34mmarczykincluding empty
10:34Licenser,(pr-str (keyword "I want cookies!!!"))
10:34clojurebot":I want cookies!!!"
10:34mmarczykbut :123 is a readable literal
10:34spariev_,(keyword ";-)")
10:34clojurebot:;-)
10:34mmarczyknot sure if it's documented to be a no-no, possibly it is
10:35mmarczyk,(str :;-))
10:35clojurebotInvalid token: :
10:35LicenserI like my <3 function
10:35mmarczyk,(str :123)
10:35clojurebot":123"
10:35mmarczyk:-)
10:35Licenserwhich is entirely valid but rhicky didn't wanted it in c.c :(
10:35angermanhaha.
10:35angermanOk, found it. This was _really_ stupid of me :/
10:36angermanAquamacs now features swapping alt as option key using C-;
10:36angermansorry guys
10:37Licenserhmm hmm
10:50jfieldsif you have an interface with two methods
10:50jfields void write(ByteArray msg);
10:50jfields void write(ByteArray msg, int startPosition, int bytesToSend);
10:50jfieldshow do you proxy that?
10:51jfieldsI tried to define it twice in proxy with different arity, but I get Caused by: java.lang.IllegalArgumentException: Method 'write' redefined
10:52angermandid you try to define it using multiple arity?
10:52Chousukeyou need to use the fn syntax for multiple arities
10:52angerman(write ([msg pos send] bleh) ([msg] blah))
10:53jfieldscool thanks
11:29seths_fogus_: I went with a function-making function (using reduce and update-in): https://gist.github.com/dff8b0becc9d2c8b1bc8
11:42_fogus_seths: Yay! No macros needed. That's the best way to write a macro... don't ;-)
11:51alpheusSince I'm new to clojure, what was the thinking behind this deprecation?"WARNING: reader macro ^ is deprecated; use meta instead"
11:54_fogus_alpheus: The intention is to use ^ for type hints
11:55alpheusthanks
12:01replaca_fogus_, chouser: congrats on your draft!
12:01chouserreplaca: thanks!
12:02_fogus_replaca: Thank you!
12:02chouserstill plenty to do of course. illustrations, for example. :-)
12:02_fogus_oh yeah... those. :p
12:02replacachouser: of course, but we need to celebrate our progress
12:10chouserreplaca: indeed. Hooray!
12:11chouserthat's one step closer to not writing a book!
12:11chouserfunny how goals change
12:11_fogus_I miss the days when I was not writing a book
12:12chouserI keep running into situations that want an 'invoke' function these days.
12:13_fogus_chouser: You mean making something invokeable.. via some protocol?
12:13chouserno, just (defn invoke [f & args] (apply f args))
12:13joshua-choiSame here.
12:14chouserAn Invokable protocol would be good too, but that's something else. :-)
12:14_fogus_You want funcall? Why not throw in #'f while you're at it? (just kidding)
12:16chouserhuh. it is funcall isn't it.
12:16_fogus_yes. I was just being snarky
12:17chouserbut it's a good point.
12:21replacaheh: (defmacro invoke [f & args] `(apply ~f ~@args [])) :-)
12:35iwillighey does anyone know how to do 1e-9 in clojure ?
12:36iwilligi need to use a double literal
12:36_fogus_,1e-9
12:36clojurebot1.0E-9
12:37_fogus_??
12:37iwillighttp://java.comsci.us/etymology/literal/double.html
12:38iwilligmmm that does not work for me
12:38iwilligoh
12:38iwillignever mind
12:39iwilligtanks _fogus_
12:39iwilligthanks
12:39_fogus_iwillig: I hope I was helpful.
12:40iwilligwell you made me realize how silly i was being... so yes :)
13:35riddochcI could use some help with a macro I'm writing...
13:36seths,3r20
13:36clojurebot6
13:36slyphonhow do you refer to state within an instance method?
13:36slyphon(this :state) ?
13:36chouserslyphon: for gen-class?
13:36chouser(.state this)
13:36slyphonyeah
13:36slyphonahh
13:36slyphonand "this" is implicit, right?
13:37chouserno
13:37slyphonno?
13:37chouserfirst arg of the defn
13:37slyphonah
13:37slyphonty
13:38chouserriddochc: http://clojure-log.n01se.net/macro.html
13:38chouserriddochc: actually, I'm not sure that form still works, but those are the questions to answer so we can help.
13:41riddochcchouser: Very convenient, thanks. Though I see 'clojure' isn't an option in the colorize menu.
13:41chouserriddochc: yeah. lisppaste doesn't have a colorizer.
13:41chouserif someone wants to write one, I think they'd accept it. ...but it has to be written in Common Lisp.
13:49riddochcHm. I think half my problem is that I'm trying to write a macro so I can call another macro, because the second macro basically amounts to `(with-sh-dir "/path/workdir" (sh "/path/bin/program" ~@rest))
13:52chouseryou can just (apply sh :dir "workdir" "program" rest)
13:52riddochcNow that I'm looking at how with-sh-dir works, yeah, that solves my entire problem.
13:52chouseryay! :-)
13:53riddochcAnd makes a lot of the rest of my code simpler.
13:54chouserriddochc: cool. That actually makes me quite happy. To me, that's a sign of a good API.
13:54OForerohello
13:54defnshell-out hsa a with-sh-dir?
13:54defncool
13:54OForeroI remember seeing a video where someone started a local server? with the documentation used for a project
13:55defnautodoc
13:55OForeroprobably using lein .... does anyone knows how to do that_
13:55riddochcdefn: Yeah, and it seemed like the right thing to use, until I realized that the whole dynamic binding thing wasn't what I needed.
13:55defnOForero: yeah, that's autodoc
13:55OForerook ... googling
13:55defnyou need to add autodoc to your dev dependencies
13:55defnthen run lein deps
13:55defnthen lein autodoc
13:56defnyou can get autodoc from clojars.org
14:03joshua-choiHas anyone been able to get a Leiningen project that uses Clojure 1.2 to work with Autodoc?
14:04OForerojust did
14:04OForero1.2.0-master-SNAPSHOT
14:04joshua-choiDo you encounter any errors when you do "lein autodoc" or "lein help"?
14:05OForerolein help crash
14:05OForeroa warning about the reader macro and a ClassCastException
14:05OForerobut I can do autodoc
14:05joshua-choiYes. Do you get the same with "lein autodoc"?
14:05joshua-choiOh, really?
14:05joshua-choiI cannot; I get the same error
14:06OForeroand Swank which is the one why I got lein in the first place
14:06OForerocompile also fails
14:06joshua-choiActually, it's a different error, but it's still an error.
14:06joshua-choiDo those errors happen only with your projects that use Clojure 1.2?
14:06OForeronope ... autodoc works
14:07OForeroI am not sure
14:07joshua-choiWhen I run "lein autodoc", I get, "java.io.FileNotFoundException: Could not locate clojure/contrib/string__init.class or clojure/contrib/string.clj on classpath".
14:07OForerothat is because it can not compile
14:07rdsr OFreoro: can u try running lein help from inside the lib folder
14:07rdsrI do get the same exception under the project root folder
14:07OForeroI was having a ton of problems related to those not found Ex
14:07rdsrbut not under the lib folder
14:08joshua-choiOForero: Did you have to do anything to make "lein autodoc" work?
14:08OForerountil I move my clj files to reflect the namespace names
14:08OForerowith the name of the file being the last part of the name space
14:08OForeroI also used
14:08OForero:source-path "src/main/clojure"
14:09joshua-choiAh, perhaps that's it.
14:09redalastorI want to use berkeleydb 4.0.103 (the latest) and know nothing about maven. I added [com.sleepycat/je "4.0.103"] to my leiningen config but it isn't working. Oracle's page about maven for bdb is here: http://www.oracle.com/technology/software/products/berkeley-db/je/maven.html
14:09OForeroyep lein help works inside the lib dir
14:10joshua-choiSame for me.
14:10OForerojoshua-choi: not really ... jut add the dep to project.clj, did a lein deps and autodoc
14:10OForeroand inside the source directory
14:11OForeroI have a/b/c/d.clj
14:11joshua-choiOForero: Hmm. I wonder what could be the problem. Okay, what version of org.clojure/clojure-contrib are you using? I'm using 1.2.0-master-SNAPSHOT.
14:11OForerofor a ns named a.b.c.d
14:11OForeroyes that one
14:12OForerocontrib is plain SNAPSHOT without master
14:13OForerois there anyway to tell autodoc to create docs for the included libraries?
14:14joshua-choiOForero: Are you using the new contrib libraries such as clojure.contrib.string?
14:14joshua-choiIf not, that would explain some things...
14:14OForerolein compile also works but does nothing ... probably because I am not using any >gen-class
14:14OForeroright now contrib is just there looking pretty
14:15OForeroI am just starting with this
14:15joshua-choiI mean, are you using the old libraries (Like clojure.contrib.str-utils) or the new libraries (like clojure.contrib.string)?
14:16OForerothat is what I mean ... right now my file has no (use ) clause
14:16OForeroit is just 57 lines
14:17OForerodoing some structs and map operations ... and using refs
14:17OForerothat is it ...
14:17joshua-choiI see. Could you temporarily add "(require clojure.contrib.string)" to your (ns ...) form at the top of your program and see if it fails?
14:18OForero:require?
14:19joshua-choiYeah, sorry. :require.
14:20OForeronope ... it works
14:20OForeroI mean lein autodoc
14:20joshua-choiOh, I meant if your program itself fails to compile.
14:20OForerocould you pastie the error?
14:21OForerodo you need me to add :gen-class also_
14:21joshua-choiI pasted the bottom of it above.
14:21joshua-choiNo, that's not necessary.
14:21joshua-choiActually, I'm going to try something myself.
14:21joshua-choiI'm going to check if changing my [org.clojure/clojure-contrib "1.2.0-master-SNAPSHOT"] to [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] will fix it.
14:22OForeroah ok
14:22OForeroI do not have master in contrib
14:22OForerothat gave me problems
14:22OForeromaster is only for clojure
14:22OForero[org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]
14:22joshua-choiAutodoc itself now works!
14:23joshua-choiYes, thanks for your help.
14:23OForeroone question more
14:23joshua-choiIt looks like the latest master snapshot isn't up-to-date.
14:23OForerocan autodoc generate docs for the libraries_
14:24_na_ka_na_hey guys .. anyone knows how I can get a FIFO queue ds in clojure?
14:24joshua-choiOForero: Could you elaborate?
14:24OForerolike if ones want the documentation relevant only to what you are using in one place?
14:24chouser_na_ka_na_: persistent or blocking?
14:24OForerowell, lets say I use clojure, contrib and another one
14:25_na_ka_na_chouser: persistent, is it easy to implement that using existing vector or list?
14:25OForeroinstead of going and searching the doc for each one individually ... generate a local doc directory containing the doc for all of my used libraries
14:26joshua-choiOForero: I don't think so, but I'm not sure I understand your question.
14:26_na_ka_na_chouser: both vector and list work only from one side efficiently .. whereas a queue should needs both sides ..
14:27joshua-choi_na_ka_na_: I think there's a PersistentQueue built into Clojure, but it's kind of hidden because it's not ready for primetime.
14:27chouserclojure.lang.PersistentQueue
14:27_na_ka_na_joshua-choi: thx, but will it be made available in 1.2?
14:28chouserit's perfectly usable and reliable
14:28joshua-choichouser: My mistake. But why are there no functions specifically related to it in the core API? Like a "queue" function.
14:28_na_ka_na_hmm .. any ideas why don't we have in native Clojure?
14:29chouseronly the constructor function is missing. peek, pop, and conj all work
14:29_na_ka_na_or it is planned .. but low priority?
14:30chouserwell, many cases where you want a queue, you actually want a blocking queue for workflow management, and using PersistentQueue for that would be an abuse
14:30chouserjava.util.concurrent.BlockingQueue should be used instead
14:31OForerowell another way of putting it ...can autodoc generate docs from a jar? given that many clojure jars are just packaged code?
14:31chouserI'm not sure what has to happen before rhickey would privide a queue constructor.
14:32chouser,(-> clojure.lang.PersistentQueue/EMPTY (conj 1) (conj 2) (conj 3) peek)
14:32clojurebot1
14:33chouserit's been around since before 1.0, and hasn't changed substantially in that time.
14:33chouserhasn't needed to. works great.
14:34joshua-choiI was suspicious of it because there's no constructor function. But if it works fine, that's fine.
14:34chouserjust don't use it for work flow. don't poll it. don't use it to communicate work tasks to threads.
14:34chouser...or Rich will yell at me.
14:35cemerickI presume it's waiting for a generalized queue abstraction.
14:35joshua-choicemerick: All this time?
14:35_na_ka_na_hmm thanks! .. conj, peek, pop all work? what else is needed for a queue? .. how do i check if its empty? (nil? (seq q))
14:35joshua-choiNo, there was a reason at the time of Clojure 1.0.
14:35cemerickjoshua-choi: well, bigger fish have needed frying.
14:35joshua-choiPerhaps.
14:35joshua-choi_na_ka_na_: Just use (empty? q).
14:35chouser_na_ka_na_: right, it's seqable, so (seq q) or (empty? q)
14:36cemerickThat, and it's not exactly clear what a generalized queue abstraction should look like. It'd be a corollary to seqs, which took, what, 2 years to be massaged into their current form?
14:37joshua-choicemerick: In any case, I am very excited at the prospect of Clojure's Java interfaces becoming Clojure protocols.
14:37joshua-choiWell, I got the impression that that was going to happen.
14:37chouseryeah, I'm excited too. PFn
14:37_na_ka_na_the doc for empty? says - Please use the idiom (seq x) rather than (not (empty? x)) .. why is that?
14:38ChousukeI wonder about the fn protocol
14:38joshua-choi_na_ka_na_: Yeah, I wondered that too. It's just shorter; that's why.
14:38Chousukehow would you actually implement that? :/
14:38chouser_na_ka_na_: shorter and less confusing -- no negations.
14:38_na_ka_na_hmm :) ok
14:38chouseryou don't want to not stop saying a thing isn't empty.
14:38joshua-choichouser: Oh, are protocols being named with P prefixes nowadays?
14:39chouserjoshua-choi: dunno. :-)
14:39joshua-choiHeh.
14:40Chousuke_na_ka_na_: (not (empty? ...)) is actually equivalent to (not (not (seq ...))) :P
14:40mabes_na_ka_na_: right, do a (source empty?)
14:40_na_ka_na_Chousuke: Yup I figured that .. just wanted to confirm if there was some gottcha corner cases ..
14:41_na_ka_na_mabes: thanks got it!
14:41joshua-choiI wish there was a way to attach metadata to functions within (fn ...) forms. Otherwise, it's not possible to give any of the functions in a (letfn ...) metadata.
14:41OForerodo you guys are all Emacs hardcores?
14:41joshua-choiI myself don't use Emacs.
14:41chousernope
14:41OForerowhat do you ude?
14:41remleduffdmiller2718: I just wanted to point out RE: your protocols-in-CLR proposal that Protocols aren't allowed to have zero-arg functions. Not sure if that would make a difference in your thinking about how to make properties fit.
14:41OForerouse?
14:41clojurebotchouser is ruthless about breaking other people's code
14:42ChousukeI use emacs but I'm not hardcore at all :P
14:42joshua-choiclojurebot: Shut up
14:42clojurebotI don't understand.
14:42cemerickenclojure now -- keeping a close eye on CCW for eclipse
14:42_na_ka_na_Hmm .. interesting question .. what % people are using emacs/slime/swank ? guesstimates ?
14:43OForeroI had to change the ket map ... cause trying to code in emacs with a Swiss mac keyboard is not a pleasant exp ...
14:43_na_ka_na_I used vimclojure in the beginning .. but now ccw coz of Java goodies
14:43joshua-choiI use TextWrangler, a Mac OS X editor. It's not very good for Clojure, but its Command-B shortcut highlights the current parenthesized phrase, which is very useful
14:43joshua-choiI am considering using Enclojure, but Netbeans takes a lot of my computer's energy.
14:45OForerook ... I use IntelliJ also... but did not like the REPL
14:45_na_ka_na_chouser: what editor do you use?
14:45_na_ka_na_any idea what Rich uses?
14:45_na_ka_na_:P
14:45joshua-choi_na_ka_na_: Rich I know often uses a Mac OS X Emacs editor called Aquamacs or something.
14:46chouserRich has mocked me for my use of vim. He uses emacs and some commercial IDE -- JetBrains or something.
14:46OForeroyep ... that is why I got that one ... with paredit ...
14:46joshua-choiI found Vim a lot easier than Emacs
14:46chouserit's all about the keybindings for me.
14:47joshua-choiBoth are very hard though
14:47chouserthese days.
14:47Dawgmatix30 mins with the tutorial built into emacs and youre all set
14:47RaynesEmacs isn't that hard.
14:47chouserreally not. But I shouldn't engage in editor discussions.
14:47_na_ka_na_i am also so used to vim .. i tried to emacs .. but found it tough ..
14:47chouserThis is me trying to stop...
14:48wdouglastry harder... =)
14:48joshua-choiOn a different topic, functions now have metadata.
14:48chouseryay!
14:48RaynesThe hardest part about Emacs and Vim is ignoring the people who exaggerate how hard they are to learn.
14:48joshua-choiWould it be possible at all to add a metadata parameter to the fn form? And letfn, while we're at it?
14:48somniumthe emacs default keybindings are just there to keep the user base from growing too rapidly
14:48OForerodoes anyone knows exactly how metadata work_
14:48OForero?
14:48joshua-choiRaynes: I don't think I'm exaggerating. :(
14:48Raynesjoshua-choi: I beg to differ. ;)
14:48zakwilsonOForero: Yes, I'm sure someone does.
14:48chouserjoshua-choi: can't you just stick reader metadata on the fn name?
14:48joshua-choiI really tried both for two months each.
14:49joshua-choichouser: Can I?!
14:49joshua-choiWait, no
14:49chouserhm.
14:49joshua-choiAre you talking about the name in (fn name ...)?
14:49joshua-choiIf fn uses that name's metadata, that's awesome
14:49RaynesI managed to be able to use both editors in a matter of hours. Some people have different experiences, but I've seen people claim stuff like "it takes years to be able to use these editors" and other garbage.
14:49cemerickThere was a recent thread somewhere that discussed how multimethods now need to be ns-unmap'd in order to be able to redefine the dispatch fn. Can't find it now -- anyone have a link handy?
14:49RaynesI suppose it depends on how you approach it.
14:50somniumI like vim's syntax highlighting for .el files
14:50chouserjoshua-choi: no, I guess it doesn't. looks like you may have to use with-meta
14:50OForeroI better say it like: does anyone here knows in which file is metadata implemented?
14:51joshua-choichouser: Unfortunately, you can't do that in letfn.
14:51_na_ka_na_Raynes: I guess once you are comfortable with one of those .. you really don't like to shift .. it just feels slowwwww ..
14:51joshua-choiThat actually does matter to me.
14:51chouserjoshua-choi: what would you do with such metadata?
14:51joshua-choiFnParse, a parsing library I'm making, uses function metadata for various things
14:52_na_ka_na_I have a general question .. how are people using metadata in actual code? .. I haven't thought of any use till now.
14:52joshua-choiletfn is useful for making mutually recursive parsing "rules", which are implemented as functions.
14:52redalastorHow do I ask leningen to look into other maven repositories? Or do I add that to maven directly?
14:52joshua-choiOtherwise, def is required.
14:52chouserjoshua-choi: I see. putting it on the name gets it passed through to the compiler, but apparently it isn't picked up there.
14:53joshua-choi_na_ka_na_: In my experience, metadata isn't useful when you are using maps or records. But it is useful for other things like functions or vectors.
14:53OForero:repositories {"clojure-releases" "http://build.clojure.org/releases&quot;}
14:53chouserwouldn't be hard to fix, I'd guess.
14:53remleduffredalastor: :repositories in your defproject form
14:53joshua-choichouser: It would be *great* if this enhancement was done.
14:53angermanhow much will I hate obj-c 2 when I'm used to clojure?
14:54joshua-choichouser: The only point of that name parameter, by the way, is otherwise to name the class that that function spawns, right?
14:54remleduffAny time you look at the clojure api docs, you're using metadata indirectly that autodoc used to generate the web pages ;)
14:54_na_ka_na_joshua-choi: An example for metadata+vectors?
14:54chouserjoshua-choi: no, it can be used in the body of the function to refer to itself
14:54joshua-choi_na_ka_na_: Um, I don't have any. Ha ha. But for functions, I use them to validate them, label them, and so on.
14:54joshua-choichouser: Ah. That's right.
14:55_na_ka_na_remleduff: I meant usage in your code..
14:55redalastorIt's working, thanks.
14:55joshua-choi_na_ka_na: Anyways, can I file an enhancement request? I don't know how it works or if I'm allowed to.
14:56joshua-choiOops, that was to chouser.
14:56_na_ka_na_joshua-choi: you meant to ask me? :)
14:57Raynesangerman: Stick your hand in a blender and hit "Liquefy" -- That much.
14:57chouserjoshua-choi: you can bring it up on the clojure or clojure-dev groups
14:57angermanRaynes: _that_ bad?
14:57joshua-choichouser: clojure-dev is only for people who signed those contributor forms, though, right?
14:57chouserum, probably, yeah.
14:58Raynesangerman: Well, maybe not quite that bad. ;)
14:58joshua-choichouser: Yeah, I'll ask on the clojure group then. Hopefully it won't get ignored. :|
14:58chouserLast I knew, Rich said he read every message on the clojure group, so presumably no response means he's not interested.
14:58angermanRaynes: well, gotta dive in some day :D
14:58chouserthis is our process. *shrug*
14:59joshua-choiangerman: I heard that Clojure is to be eventually implemented in Objective-C, once the compiler is boot-strapped or something.
14:59joshua-choichouser: All right. Thanks a lot for your help.
14:59chouserI can bring it up on clojure-dev, but my posts there generally don't seem to get very far either.
14:59angermanRaynes: wanted to learn Haskell as well ...
14:59angermanjoshua-choi: seriously?
14:59joshua-choiangerman: Yeah, definitely. Same for .NET.
15:00Raynesangerman: Haskell is cool.
15:00joshua-choiIt won't be good for the iPhone or iPad though, since neither have garbage collection.
15:00chouserthe hawaiian's have arrived
15:00RaynesIf you're into beating your brain with a stick and then setting your skull on fire for a while.
15:00angermanRaynes: I do know ocaml though.
15:00joshua-choiRaynes: Haskell is easier than Emacs or Vim. Hyuk hyuk
15:00somniumhaskell has a great emacs mode
15:00angermanjoshua-choi: hmm. yea, that wouldn't work anyway I guess...
15:01angermanisn't there that haskell emacs equivalent?
15:01Raynesangerman: Still applies.
15:01Raynesjoshua-choi: Heh.
15:01somniumymacs? its kinda 30% complete
15:01angermanRaynes: Hmm. Will have fun then :D
15:01RaynesThere is Yi.
15:01somniumyi, thats what I meant
15:02angermanyes
15:02_na_ka_na_joshua-choi: where did u hear about abt .. Obj C ?
15:02angermanokay another fancy langauge question, what makes python better then clojure?
15:02Raynestechnomancy: I thought you were going to factor in Factor this year? When does that parade start?
15:02joshua-choi_na_ka_na_: A month (?) ago in this IRC room. You can probably find info if you search the archives.
15:03joshua-choiangerman: Python is great. But immutability is very, very, very, very good.
15:03joshua-choiSeparating immutable structures from mutable reference objects is *wonderful*.
15:04joshua-choiIt's amazing if doing this is actually performance-practical.
15:04joshua-choiAnd it is.
15:04Raynesangerman: http://www.bestinclass.dk/index.php/2009/10/python-vs-clojure-evolving/
15:05_na_ka_na_I dunno python at all .. so a noobish question .. why is it soo popular?
15:05angerman_na_ka_na_: well. it's not php, pretty easy to get into and quite pleasant
15:06_na_ka_na_Lots of people who I meet .. say .. oh we're moving to Python .. is it because Google uses it?
15:06angermanat least to me it always feels like python is also a little less syntax noisy than ruby.
15:06OForeroI couldn't do python ... that white space will bring bad memories (cobol)
15:06angermanHm. I did learn python to get going with django.
15:06joshua-choi_na_ka_na_: It's because Python is a good and useful language. And yes, Google (and quite a few other companies) are using it.
15:06chouserif you limit yourself to languages people have heard of, there aren't actually that many choices
15:07angermanchouser: [VBA,VB,C,Java,C++,Python?,Ruby?]
15:07chouseramong those, python's dynamic behavior gives it fairly little competition.
15:08chouserangerman: something like that, yeah. :-)
15:08angermanoh. I missed PHP :D... and PERL maybe. Though only if you meet peeple with beards
15:08chouserprobably perl and ... exactly.
15:08joshua-choiangerman: I am very fond of Perl. PHP isn't so welcome, but I'm a tad irrational.
15:08angermanok. since the advert of .NET probably C# as well.
15:09chousermaybe lua
15:09angermanPerl? gives me very bad memories.
15:09chouserjavascript
15:09angermanchouser: only by those who played WoW :D
15:09joshua-choiangerman: Lua is actually used in a lot of games. I recall that a ton of games in the Apple App Store use it.
15:10somniumanyone checked out scheme2js?
15:10angermanI had to use Perl at one of my part time jobs. At a semi large system-on-chip design house. ...
15:11_na_ka_na_http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
15:11somniumit seems like quite a high quality compiler (from INRIA of ocaml fame), but I had to about trip over it to find it
15:11angermanIt's been the worst time I had ... so maybe my view is biased by the setting I got to know Perl.
15:12_na_ka_na_lol that tiobe site .. has Lisp/Scheme/Clojure grouped into one .. haha
15:12_na_ka_na_but nice to see Clojure !
15:12angermanjoshua-choi: well. use it as in use it to develop the game or use it as in allow the user to extend the game?
15:13_na_ka_na_any ideas how C is getting more and more popular?
15:13angermansince only the letter would make it creep into the users recognition.
15:13joshua-choiangerman: In the game itself, in its core logic. I don't think there are any programmable iPhone/iPod games now.
15:13angermanjoshua-choi: probably
15:13somnium_na_ka_na_: curly braces and segfaults have a certain rustic appeal
15:14angerman_na_ka_na_: well. what's weird is that obj-c got such a boost.
15:14_na_ka_na_somnium: :P then why did it go down few years back .. see the graph
15:14joshua-choiangerman: That's because the iPhone and its sister products are doing so well, so companies want in
15:15_na_ka_na_well people are crazy about iP*
15:16_na_ka_na_well Java seems to heading downnnnn
15:16angermanjoshua-choi: that's probably right. I only had very little exposure to obj-c, mostly due to fixing some bugs here and there. And some to obj-j
15:16angerman_na_ka_na_: interesting metric would be. Java and Java+(JVM hosted languages)
15:17_na_ka_na_Hmm right
15:17joshua-choi_na_ka_na_: Java is still widely used in enterprise server programs. On the mobile and desktop application side, not so much, though JavaFX is interesting
15:17angermanI'm wondering whether java has lost to the other languages or if the JVM as a whole is on a decline
15:17joshua-choiJava itself is not going away anytime soon any more than C or C++ are
15:17angermanjoshua-choi: android?
15:17_na_ka_na_joshua-choi: Yup Oracle are putting in lots of $$ into JavaFX
15:17joshua-choiAndroid, I guess
15:18joshua-choiNo, I wouldn't count on it, though
15:18angermanI'm actually playing with the thought of putting Droid on my iPhone
15:19joshua-choiIt'd be Snoracle, wouldn't it?
15:19angermanwell as close as it can get to snorkel :D
15:20joshua-choiDo you have an reason why the merger matters to you? The JVM?
15:22_na_ka_na_As long as they let James Gosling make the decisions.. it'd be fine I guess
15:22OForeroGosling left Oracle already
15:22angermanWell I'm probably not young... and langauges will come and go. But I somehow grew up with java and java's been sun.
15:23OForeroI remember some jokes about the option of he going to the EPFL
15:23OForerojoshua-cho: the main brain behind java and the JVM
15:23angermanso I'd just like some perspective stability from oracle.
15:23_na_ka_na_OForero: When did he leave?? I attended a sun (ya still sun!) tech days few months back .. and he was still there
15:24OForeroI remember seeing that news around april ...
15:24OForerohttp://www.reuters.com/article/idUSTRE63B4HV20100412
15:26OForerois there any way to do types in Clojure? ... or I am just having dirty thoughts?
15:26joshua-choiOForero: There are now new ways, but they may be strange to you.
15:26OForeroyou mean the protocols?
15:27joshua-choiTake a look at http://clojure.org/datatypes and http://clojure.org/protocols
15:27joshua-choiYeah
15:27joshua-choiOr are you talking about type hierarchies?
15:28joshua-choiI've got to go. Have a nice day, everyone.
15:28OForeroI think I do not what I am talking about :-)
15:29OForerojust experimenting
15:29OForerobye thanks for the links
15:30chouserI'm working on a staticly typed dsl on top of clojure. It's the least-clojurey thing I've ever expanded into clojure code.
15:30chouserdifferent rules for resolution of locals, for example.
15:30chouserit's a bit amazing what I'll do for money. :-)
15:31Dawgmatixwrite code in perl ?
15:31Dawgmatix:D
15:31OForerostatically typed clojure? any chance I can take a look at it without having to die afterwards?
15:31angermanHmm... so what's so amazing about jMonkeyEngine?
15:31chouserOForero: no
15:31chouserthey're not java types
15:32chousershouldn't have said anything. I guess my point was you can make clojure be what you want to a large extent.
15:32OForeroI do not want java types ... I just want safer functions ... like for example working with only a given struct
15:33remleduffYou can get pretty far with preconditions
15:33OForerois that a commercial project? or the secret version of Clojure.Next :D
15:35OForerostructs are maps ... which means ... no concrete type is created, right?
15:36chouserstructs are dead. use defrecord
15:38OForerooh no, I have zombies in my code :D
15:38OForeroI am reading about them right now
15:40OForeroall that explanations on the terms of host make me think about SciFi B movies
15:41remleduffIt's kind of a shame that all the struct stuff was in core, it would be nice if they were safely in their own, easily ignored namespace
15:58angermanI never had a problem with the clojure core.
15:59angermanbut incanter is just huge. esp. if you want to use only a tiny part :(
16:25ihodesWould anyone be so kind as to help me with this little problem;having trouble calling .getAbsolutePath on my seq of Files: (map .getAbsolutePath (file-seq (java.io.File. *post-dir*)))
16:26angermanihodes: does (map #(.getAbsolutePath %) (file-seq (java.io.File. *post-dir*))) work?
16:26ihodesah that will work! let me try
16:27ihodesabsolutely does
16:27ihodesthanks so much. so Java functions are second-class huh?
16:27Chousukejava methods are not functions at all :)
16:27angermanwell. I don't think it really is a _function_
16:27ihodesoh truth.
16:27Chousukethey're not first-class even in Java
16:27Dawgmatixany pointers to papers on persistent data structures (like the ones clojure implements)
16:27ihodeshaha absolutely right. man it's been a while since I've thought about Java. makes total sense! thank you so much
16:29hoeck~google chris okasaki
16:29clojurebotFirst, out of 1950 results is:
16:29clojurebotChris Okasaki
16:29clojurebothttp://www.eecs.usma.edu/webs/people/okasaki/
16:29hoeckDawgmatix: ^^
16:30Dawgmatixthanks hoeck, do you mean the book on functional data structures by okasaki ?
16:30ChousukeThere are also useful blog posts like http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/
16:31hoeckhaven't read that, only looked over the paper which describes the idea behind the clojure ds
16:31Dawgmatixthanks chousuke
16:32Dawgmatixdo you mean "Simple Confluently Persistent Catenable Lists" hoeck ?
16:34Borkdude,(clojure-version)
16:34clojurebot"1.2.0-master-SNAPSHOT"
16:34Borkdude,(map #(apply str %) (partition-by identity "1011011000"))
16:34clojurebot("1" "0" "11" "0" "11" "000")
16:35chouserneat
16:35hoeckDawgmatix: sorry, don't know which one exactly
16:35Dawgmatixnp hoeck
16:36hoeckDawgmatix: the clojure source also mentions kahrs and larsen
16:42Dawgmatixtarjan shows up in almost all data structures papers :)
16:44Fossithe okasaki is quite good
16:44Fossiand rich (obv) built on a lot of stuff in there
16:45Dawgmatixokay
16:47Fossiit's a good read :)
16:48Dawgmatix:)
17:06wiresclojure rules!! :D
17:10Borkdudewires: yeah :)
17:10Licenserhmm why is the code run in repl a good bist faster then in a jar?
17:12chousercoincidence
17:13Licensersure? Because it is mostly reproducable
17:14Licenserperhaps my self written time is off but I don't see how
17:40arkahncan anyone tell me why this bombs? (take 1 (map process (line-seq rdr))
17:40arkahnI get the following: Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of args passed to: core$take (core2.clj:0)
17:41arkahncore2.clj is the file I'm running against clojure
17:42arkahn(map process (line-seq rdr)) works, but returns nothing because it's a lazy seq of a lazy seq
17:44arkahnsorry, last thing - full 'program' can be found here: http://gist.github.com/412458
17:54Licenserarkahn: how about using first?
17:54arkahnthen I get a nearly identical exception: Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of args passed to: core$first (core2.clj:0)
17:56Licenserarkahn: you forgot a )
17:56arkahnoh noes...
17:57Licenser=)
17:57arkahnLicenser: thank you
17:58Licenseryou're welcome
17:58AWizzArd:-)
17:58Borkdude,(-:
17:58clojurebotInvalid token: -:
17:59Borkdude,:- )
17:59clojurebot:-
18:01arkahncurrently, is there a dominant editor/ide/combo for writing clojure code?
18:01arkahner ... that people predominantly use?
18:02arkahnemacs+slime seems to be a fav
18:02lancepantz_yep
18:07BorkdudeI use it too, most people do I think
18:12arkahnman, clojure changes everything: how I think and now which editor to use ; )
18:16lancepantz_i switched from vim to emacs, it was a really good decision
18:18Borkdudearkahn: yes, Clojure made me into an Emacs user as well
18:18Borkdudearkahn: I even use it now to talk in IRC...
18:21Borkdudegtg, bye
18:21arkahnsee you
18:41wiresis there a library that does 'pattern matching' or 'type checking' of clojure values?
18:41leafwthese are different things
18:41wiresyes
18:41leafwI know of "matchure", for pattern matching
18:42wiresi want to match types and values, e.g. I want to restrict input to a function to "a map with a key :cheese witch has a value a vector with 3 elements", etc.
18:42wiresleafw: let met chack matchure, thanks
18:44wiresleafw: thanks, that looks decent enough for now.
20:23technomancyRaynes: nah, Factor is for 2011. this year it's Duby.
20:24technomancylow-level JVM stuffs
20:59tcrayforddoes clojure.java.io/writer fail sometimes to create writers out of sockets?
21:00tcrayford(those are java.net.Sockets)
21:03tcrayfordI can get it working using reader, but not writer
21:20krumholt_can i look up the functions for an interface like sequential?
21:43technomancykrumholt_: functions or methods?
21:46krumholt_technomancy, both preferably
21:49technomancykrumholt_: in slime you can do C-c S-i to show all methods on an interface/class
21:49technomancythere's something like that in c.c.repl-utils too, but I only use the slime one
21:49krumholt_technomancy, i'll try that thanks
21:49tcrayfordclojure.contrib.repl-utils/show to be exact
21:50Raynestechnomancy: Why Duby?
21:51technomancyRaynes: for android dev; you need the perf of a low-level language.
21:51technomancyRaynes: persistent data structures suuuuuuuuuck if you don't have a good GC
21:52Raynestechnomancy: I see. :)
21:52joshua-choiI don't we'll be seeing practical Clojure apps in phones for a long time
21:53emacsenwhat are people's favorite sax-like XML parser for clojure?
21:59AntonyBlakeyDo you specifically want a push-model parser or just something that doesn't create a DOM. I generally prefer using pull parsers.
22:00emacsenAntonyBlakey, something that doesn't create a dom, as my input XML ranges from 1 meg to 300gb
22:00AntonyBlakeyhttp://www.extreme.indiana.edu/xgws/xsoap/xpp/
22:01emacsenthis appears to be pure Java
22:01AntonyBlakeyPull parsing is so much easier to code for because you effectively build a recursive descent processor using the pull parser as a token source.
22:02AntonyBlakeySure, but why is that a problem - the interface is *very* narrow and it's just a token source.
22:02emacsenAntonyBlakey, I don't know Java well, just barely enough to interface it with Clojure
22:03AntonyBlakeyXML parsing is a commodity technology, so using a Java lib is going to be your best shot.
22:03AntonyBlakeyAnd this is just a jar, so you only need to know the interop to use it.
22:04emacsenI don't even see any docs
22:05AntonyBlakeyhttp://www.xmlpull.org/
22:05emacsenthx
23:17Raynesmmarczyk: Holy hell! I Just realized it was you that wrote my accepted answer here: http://stackoverflow.com/questions/1931875/when-is-it-ok-to-use-an-ioref
23:18RaynesThanks for that again, by the way. <3
23:29technomancyso @(promise) is my new favourite way to test timeout behaviour.
23:29technomancydown with Thread/sleep!
23:39danlarkin@(promise) rocks
23:40remleduffHow does it help you with timeouts?
23:41technomancyremleduff: it just helps you cause them
23:41technomancysince derefing a promise that's not in scope anywhere else is guaranteed to block.
23:42technomancyforevah
23:42remleduffah
23:42danlarkinI think there could be some clever tests written that involve promise and empty?
23:48vIkSiThi all
23:48vIkSiTwhats the best method to split an integer into a sequence
23:48vIkSiT?
23:52dnolenvIkSiT: what do you mean?
23:53vIkSiTdnolen, well - converting 1234 to [1 2 3 4]
23:58dnolen,(map #(Integer/parseInt %) (map str (seq (str 1234))))
23:58clojurebot(1 2 3 4)
23:59vIkSiThmm, yes I thought of that..
23:59vIkSiTI was trying to do it another way - divide by 10 and return rem as a sequence element