#clojure logs

2009-06-06

07:59alrex021I am having a problem using the :use to import my functions from another clj file.
07:59alrex021http://pastebin.com/ma22491
07:59alrex021I get a Caused by: java.lang.Exception: Unable to resolve symbol: add-message in this context
08:10Chousukealrex021: why do you have :gen-class in the concurrency namespace?
08:11alrex021Chousuke: Though it will then use the name of my file as the class name for compilation. If I take it out, it still gives me a same problem
08:13Chousukealrex021: what command are you using to run your code?
08:14alrex021I am actually using the Enclojure in Netbeans which seems to generate the Java classes at compile time.
08:14Chousukehm
08:15Chousukeit shouldn't really matter whether it's compiled or not.
08:15alrex021But the code seems fine? I'm not missing something obvious?
08:15Chousukehmm
08:16alrex021Chousuke: I'm new to Clojure so am afraid I could very easily be doing something stupid
08:16ChousukeIt seems fine. This is just a guess, but try changing the (:use (com.lunasoftworks.concurrency)) to (:use (com.lunasoftworks concurrency))
08:17Chousukethat way, it matches the doc string examples
08:17alrex021I am just truing to learn here to group a set of functions into their own file and then use the :use to load them
08:17Chousukethough the dotted form should work too :/
08:18alrex021Chousuke: well you no what, it worked
08:18Chousukehmm :)
08:18alrex021skipping the last dot that is before concurrency
08:18alrex021(:use (com.lunasoftworks concurrency))
08:18alrex021interesting :)
08:18Chousukethe :use form works so that you can list multiple namespaces after the prefix.
08:19Chousuke(:use (clojure.contrib strutils2 sql monads)) like that
08:19alrex021Ahh, I have seen that
08:19Chouserperhaps (:use com.lunasoftworks.concurrency) would also work?
08:20Chousukeright.
08:20Chousuketry that :)
08:20Chouser...using inner parens only with the dotted form?
08:20clojurebot????? ????
08:20alrex021though whats funny is that I got get a syntax error or something similar at compile time complaining about my :use. ..
08:21alrex021Chouser: oh ok, regarding your last line, let me give that a try..\
08:22alrex021Ahhhh, you right. Dropping the parents when not specifying the multiple uses, works
08:22alrex021So to confirm, this works too: (:use com.lunasoftworks.concurrency)
08:22Chousukerequire's documentation is out of date :/
08:22Chousuke For example, the lib 'x.y.z has root directory <classpath>/x/y/z; root resource <classpath>/x/y/z/z.clj.
08:23Chousukenot true anymore :P
08:23alrex021Chousuke: In your opinion, which way would be recommended: (:use com.lunasoftworks.concurrency) OR (:use (com.lunasoftworks concurrency))
08:23Chousukeeither is fine
08:24Chousukeuse whichever you like :)
08:25alrex021gr8 :) thx Chousuke for your help
12:50tayssirHi! Does anyone know a resource where I can learn why add-classpath isn't supposed to work on Emacs/Slime? (When I try it, it just returns nil and doesn't seem to update anything. I realize it's not considered good to use, but I can't find a page explaining why it should fail silently..)
12:58dnolentayssir: add-classpath doesn't return a value, it returns nil.
13:59Anniepoohmm.... I seem to have broken my La Clojure install. When I try to 'Edit configurations' I don't see any entries - Add Configuration I see two entries for Clojure Script. Setting up based on either one, then trying to run - just returns me to an Edit Configurations dialog.
14:05AnniepooStrange, adding a trivial Java class with a main and setting up a config for it fixes the problem. It then becomes possible to set up Clojure scripts normally
14:20Drakeson`1) how can I make an alias for "clojure.contrib" to make it easier to load things? 2) Is it possible to have a :use at the top of the file in the ns form that pulls in some other libraries? (an [empty] meta "library")
14:21kotarakDrakeson`: (require '(clojure.contrib [def :as def] [duck-streams :as ds]))
14:21kotarakDrakeson`: there are things like import-ns or so. But in general the answer to 2) is: no.
14:22Drakeson`kotarak: thanks
14:25Drakeson`assume I run clojure by doing: java -cp all.jar clojure.main . Is it possible to ask such running instance of clojure to re-load all.jar (meanwhile, all.jar has possibly been changed on the disk)?
14:25Anniepooanybody recognize this problem with La Clojure?
14:25AnniepooLanguage with ID 'Clojure' is already registered: class org.jetbrains.plugins.clojure.ClojureLanguage
14:25Anniepoojava.lang.Throwable
14:25Anniepoo at com.intellij.openapi.diagnostic.Logger.error(Logger.java:48)
14:25Anniepoo at com.intellij.lang.Language.<init>(Language.java:70)
14:25Anniepoo at com.intellij.lang.Language.<init>(Language.java:55)
14:25clojurebotclojure is the bestest programming language available.
14:25Anniepoo at com.intellij.lang.Language.<init>(Language.java:51)
14:25Anniepoo at org.clojure.intellij.ClojureLanguage.<init>(ClojureLanguage.java:24)
14:25Anniepoo at org.clojure.intellij.file.ClojureFileType.<init>(ClojureFileType.java:42)
14:25Anniepoo at org.clojure.intellij.file.ClojureFileType.<clinit>(ClojureFileType.java:34)
14:25Anniepoo at org.clojure.intellij.file.ClojureFileTypeLoader.createFileTypes(ClojureFileTypeLoader.java:23)
14:25Anniepoo at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.a(FileTypeManagerImpl.java:185)
14:26Anniepoo at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.<clinit>(FileTypeManagerImpl.java:333)
14:26Anniepoo at java.lang.Class.forName0(Native Method)
14:26Anniepoo at java.lang.Class.forName(Class.java:247)
14:26kotarakAnniepoo: please use a paste
14:26kotaraklisppaste8: url
14:26lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
14:28lisppaste8Anniepoo pasted "alreadyAClojure" at http://paste.lisp.org/display/81460
14:30kotarakDrakeson`: I don't think so. Jars cannot be reloaded AFAIK.
14:31Drakeson`kotarak: thanks. it is important to know.
14:33kotarakDrakeson`: there are things like Java Rebel, which reload classes. But I don't know how that works. And whether this includes a changed jar.
14:33kotarakAnniepoo: maybe you installed a older version of the plugin?
14:34kotarakAnd now the new one has a conflict with that?
14:34Anniepooyes, good possibility
14:35AnniepooI removed a bunch of plugins I wasn't using, cause I was tired of the long startup time,
14:35Anniepooincluding the disabled 'clo jet' - might have been that?
14:36Drakeson`kotarak: I guess I think too pythony. In python I can place a new thing.py in the PATH and then ask the running instance to import thing.
14:36kotarakDrakeson`: you can do that with .clj files to. Then use eg. (require :reload ...) or (require :reload-all ...) to reload the .clj files.
14:37kotarakDrakeson`: but that's limited to file system files. files in jars are different.
14:37kotarakAnniepoo: no clue. I don't have use IntelliJ. Just guessing from the failure messages...
14:38Anniepooyah, hoped it was something somebody had a formulaic answer for
14:38Anniepoogoing to try removing and reinstalling la clojure
14:38Drakeson`kotarak: is there a path I can put new-thing.clj after I started running a clojure instance, and then ask the running instance to require it?
14:39kotarakDrakeson`: You can add a directory to your classpath. Then start the JVM: java -cp my-dir:clojure.jar clojure.main -r. Copy a file to my-dir. "require" it.
14:40kotarakThe file has to follow the usual nameing conventions.
14:42Drakeson`kotarak: that's great. thanks a lot.
14:45kotarakDrakeson`: you are welcome
14:57quidnunccgrand: Is it possible to use xml-zip functions on the results returned by enlive's select?
15:51leafwI am trying to compile clojure-contrib.jar with AOT, but it's not happening: I don't get the 1.7mb file but a .jar file of ~300 kb like the slim.jar one
15:51leafwwhat has changed? Having clojure.jar in the -Dclojure.jar=... is no enough?
15:53leafwalso, how can one get clojure.jar itself to be compiled with AOT?
16:00kotarakleafw: AFAIK, clojure.jar is per default AOT compiled. The non-compiled one is clojure-slim.jar. "ant -Dclojure.jar=..." was enough to AOT compile contrib when I check the last time.
16:01leafwkotarak: thanks. But it's not compiling now -- clojure-contrib.jar, at least.
16:01kotarakLet me check here.
16:03hoeckleafw: just compiled it here, what says your ant output?
16:05leafwnow it compiles, after I compiled clojure.jar again (?)
16:05leafw2.6 mb clojure-contrib.jar, as expected
16:05leafwno idea what was happening here.
16:06hiredmanmy clojure-contrib.jar is around 4mb
16:06leafwby the way, my custom-build GUI clojure REPL stopped working after clojure svn revision 1352
16:06kotarako.O
16:07kotarak4mb! Mine is also around 2.5mb
16:07leafwhiredman: what JVM? Lots of inlining in 4m!
16:08leafwif anyone knows of a nice way to create a REPL with recent versions, please let me know. The old clojure.lang.Repl is basically deprecated, and currently devoid of any content. How does one use clojure.main for a Repl?
16:09hiredman4.1M clojure-contrib.jar
16:10kotarakleafw: one call the repl function form clojure.main with lots of callbacks to configure everything. There is also a stream-repl somewhere.
16:10hiredmanjava -cp clojure.jar clojure.main will print out a nice help message
16:11cp2450MHz P3 running F@H
16:12cp2im such a contributor
16:12leafwhiredman: no help message here. How do you make it show?
16:13leafwI am going to try to emulate clojure.main, simply.
16:13hiredmanoh
16:13hiredmanhuh, I thought it printed out the help message if called with no args
16:13leafwno, goes to repl directly.
16:14hiredmanso there is a repl for you
16:14kotarakleafw: you lookup the docstring of clojure.main/repl or so.
16:14kotarakyou can ...
16:20leafwit's very frustrating. I had a working REPL in a GUI, and not anymore. I keep getting : REQUIRE.invoke(CLOJURE_MAIN)
16:21leafwsorry
16:21leafwjava.lang.ExceptionInInitializerError
16:21leafwat clojure.lang.Namespace.<init>(Namespace.java:32)
16:21leafwat clojure.lang.Namespace.findOrCreate(Namespace.java:122)
16:21leafwat Clojure.Clojure_Interpreter.<clinit>(Clojure_Interpreter.java:47)
16:21leafwwhich basically means, touching the Namespace makes it fail.
16:21kotarakLook at the cause.
16:21leafw4 concatenated causes
16:21kotarakIt will tell you why there was in ExceptionInInitializerError.
16:22leafwyes kotarak , I know. The problem is: what does clojure need to start accepting commands/statements?
16:23leafwbefore, one just did a refer to the user namespace
16:23leafwnow that is not accepted.
16:23leafw(Exception)
16:24leafwnone of the 4 causes have anything to do with my application. They are all lost in the undocumented realm of what does clojure need to start up its machinery.
16:24leafwbefore, with the non-dummy clojure.lang.Repl class, it was clear.
16:25leafwnow, with clojure.main, its no longer clear -- or what the main has it's not sufficient. Merely copying it fails.
16:32leafwneedless to sya, very frustrating
16:32leafws/sya/say/
16:32kotarakHmm.. What happens if you call clojure.main/repl directly?
16:32leafwkotarak: no such method ... it's legacy_repl(...)
16:33leafwwhich is just final static private Var LEGACY_REPL = Var.intern(CLOJURE_MAIN_NS, Symbol.create("legacy-repl")) and then REQUIRE.invoke(CLOJURE_MAIN) and then LEGACY_REPL.invoke(RT.seq(args))
16:34leafwi.e. it creates symbols, it require them, and then it invokes them (?) as if that was supposed to do something. Are this magic tokens?
16:34leafwand I cannot do so, because it would start at REPL in stdout, which is not what I want.
16:35leafwI don't want to start a REPL. I have my own LineNumberingPushbackReader that reads from a TextArea after return.
16:36kotarakleafw: have a look in src/clj/clojure/main.clj for the repl function.
16:37leafwlooking
16:37kotarakleafw: it let's specify read and write hooks and such
16:38leafwkotarak: I am reading the doc for repl-read. Sounds interesting
16:38kotarakleafw: a little further the docstring of repl should also be interesting for you.
16:39leafwon it atm
16:43leafwso essentially I have to define new thread-bound vars *in* and *out* and all should be fine
16:43leafwafter invoking main fn.
16:44leafwup to know I was also manually managing *e, *1, *2, *3 and others
16:44leafwdoesn't look like it'll do it for me, but at the same time it doens't return anything ... it's a bit onfusing.
16:48leafwso far I was using *out* only, and relying on LineNumberingPushbackReader lnpr = new LineNumberingPushbackReader(new StringReader(text)); and a Object r = LispReader.read(lnpr, false, EOF, false); to parse it.
16:49leafwI see no advantage to using clojure read fn
16:50kotarakleafw: read is maybe the more stable API
16:50leafwI would still have to set a new *in* everytime, and call invoke on the "repl-read" Var.
16:50leafwthe problem is I don't understand at all what changed. Why it can't work now.
16:51leafwthe Exceptions are totally not useful
16:57leafwfailing at something as basic as : static final Var in_ns = RT.var("clojure.core", "in-ns"); I had created clojure-core before that as: static final Symbol CLOJURE = Symbol.create("clojure.core");
17:01leafwI think I am starting to understand the problem: the reader assumes there is a valid *in* anyway somewhere.
17:02leafwbut I cannot set it via RT.var because RT.var itself is throwing that error.
17:06leafwit puzzles me beyond end that clojure.main can call, in its static private variables, RT.var(...), but I can't: throws an Exception.
17:13elightHi all. Anyone know if there's been any movement toward getting Clojure running on Android?
17:14elightI converted the Clojure JAR to Dalvik bytecodes but the blasted thing barfs when I try to run it in the emulator from shell.
17:14kotarakelight: There is.
17:14kotarakelight: you could search the google group for threads.
17:14elightkotarak: I've done a bit of googling. Information seems sparse. Mostly that Rich has been considering it.
17:15kotarakelight: there was someone working on it. Maybe you can ask him directly.
17:15elightkotarak: Huh. K, thanks.
17:16elightJust dying to have something other than vanilla Java to work in. Vanilla Java is hell....
17:17elightkotarak: Hrmmm... git://github.com/remvee/clojure.git clojure-androi ?
17:17elightkotarak: Hrmmm... git://github.com/remvee/clojure.git clojure-android ? (typo)
17:18kotarakelight: ? I don't know. Never used Android....
17:18elightkotarak: ah, ok
17:19kotarakelight: I would just contact the author of the threads in the group.
17:19kotarakIt seems he got relatively far..
17:19leafwkotarak, how does the nailgun server run clojure? That is conceptually similar--source code available?
17:21kotarakleafw: this is really a big hack. It "starts" a class. The class is generated via gen-class. In the class the whole environment is tugged away, because the connection are not contiguous. For each connect, the env is swapped in and stored away again after evaluating the request.
17:21kotarakThis happens in src/de/kotka/vimclojure/nails.clj in the Repl nail.
17:23leafwkotarak: ok.
17:23kotarakleafw: it basically uses *in* etc. provided by nailgun.
17:23leafwkotarak: I tried running clojure.main.main(new String[0]) and ... it fails. Fails! Can only be run from the command line
17:23kotarakThat magic is in the defnail macro, IIRC
17:26leafwconsidering current state of things, until someone can explain conclusively ( rhickey ) why clojure.main.main(new String[0]); cannot be run from wnywhere lese except the command line, I go back a dozen commits. What a pain.
17:28cgrandquidnunc`: it depends -- you may need to change select*
17:37lisppaste8cgrand pasted "zip-select for quidnunc`" at http://paste.lisp.org/display/81467
17:40AnniepooI had found some way of getting a popup of the doc string for lib function in La Clojure. Now I've lost track of it. Can someone please tell me what it is?
17:41drewolsonhey all. i'm working on a clojure wrapper of the github api and had a question about the best way to test functions that will eventually make an http request
17:41drewolsoni'm an oo language, i'd usually just stub out the http call but i'm not sure how to approach this in clojure
17:41drewolson*in an
17:43hiredmanyou factor out the actually http-request into the simplest function you can, then when testing, you just (binding [http-request-fn somedummy-fn] tests here)
17:44drewolsonhiredman: awesome, that's exactly what i was looking for
17:44drewolsonwill that binding affect all namespaces?
17:45hiredmanhmmm
17:46hiredmanactually, there is the possibilty for a lot of complexity there, so I am note sure
17:46hiredmanI ahve used it in a few similar situations across namespaces
17:46drewolsonright, that's what i was thinking... i have a namespace for user requests, which uses a method in a namespace called "foo" to make the http request
17:47drewolsoni'd like the function in foo to behave in a specific way for a given test. seems tricky.
17:51drewolsonhiredman: actually, that did seem to work
18:50AnniepooI had found some way of getting a popup of the doc string for lib function in La Clojure. Now I've lost track of it. Can someone please tell me what it is?
18:51tbatchelli1I think it's Ctrl+J, but I believe it only works when looking up Java methods, but not for clojure vars
18:51Anniepoohmm
18:52tbatchelli1the lookup of documentation on clojure variables and functions is not implemented yet, according to Ilya
18:52Anniepoothanks
18:52AnniepooI must be confusing it with ctrl shift I for the java function lookup
20:21chouser,Math/PI
20:21clojurebot3.141592653589793
20:26cp2Cherry/PI
20:28chouser,Cherry/PI
20:28clojurebotyummy!