2009-06-06
| 07:59 | alrex021 | I am having a problem using the :use to import my functions from another clj file. |
| 07:59 | alrex021 | http://pastebin.com/ma22491 |
| 07:59 | alrex021 | I get a Caused by: java.lang.Exception: Unable to resolve symbol: add-message in this context |
| 08:10 | Chousuke | alrex021: why do you have :gen-class in the concurrency namespace? |
| 08:11 | alrex021 | Chousuke: 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:13 | Chousuke | alrex021: what command are you using to run your code? |
| 08:14 | alrex021 | I am actually using the Enclojure in Netbeans which seems to generate the Java classes at compile time. |
| 08:14 | Chousuke | hm |
| 08:15 | Chousuke | it shouldn't really matter whether it's compiled or not. |
| 08:15 | alrex021 | But the code seems fine? I'm not missing something obvious? |
| 08:15 | Chousuke | hmm |
| 08:16 | alrex021 | Chousuke: I'm new to Clojure so am afraid I could very easily be doing something stupid |
| 08:16 | Chousuke | It seems fine. This is just a guess, but try changing the (:use (com.lunasoftworks.concurrency)) to (:use (com.lunasoftworks concurrency)) |
| 08:17 | Chousuke | that way, it matches the doc string examples |
| 08:17 | alrex021 | I 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:17 | Chousuke | though the dotted form should work too :/ |
| 08:18 | alrex021 | Chousuke: well you no what, it worked |
| 08:18 | Chousuke | hmm :) |
| 08:18 | alrex021 | skipping the last dot that is before concurrency |
| 08:18 | alrex021 | (:use (com.lunasoftworks concurrency)) |
| 08:18 | alrex021 | interesting :) |
| 08:18 | Chousuke | the :use form works so that you can list multiple namespaces after the prefix. |
| 08:19 | Chousuke | (:use (clojure.contrib strutils2 sql monads)) like that |
| 08:19 | alrex021 | Ahh, I have seen that |
| 08:19 | Chouser | perhaps (:use com.lunasoftworks.concurrency) would also work? |
| 08:20 | Chousuke | right. |
| 08:20 | Chousuke | try that :) |
| 08:20 | Chouser | ...using inner parens only with the dotted form? |
| 08:20 | clojurebot | ????? ???? |
| 08:20 | alrex021 | though whats funny is that I got get a syntax error or something similar at compile time complaining about my :use. .. |
| 08:21 | alrex021 | Chouser: oh ok, regarding your last line, let me give that a try..\ |
| 08:22 | alrex021 | Ahhhh, you right. Dropping the parents when not specifying the multiple uses, works |
| 08:22 | alrex021 | So to confirm, this works too: (:use com.lunasoftworks.concurrency) |
| 08:22 | Chousuke | require's documentation is out of date :/ |
| 08:22 | Chousuke | For example, the lib 'x.y.z has root directory <classpath>/x/y/z; root resource <classpath>/x/y/z/z.clj. |
| 08:23 | Chousuke | not true anymore :P |
| 08:23 | alrex021 | Chousuke: In your opinion, which way would be recommended: (:use com.lunasoftworks.concurrency) OR (:use (com.lunasoftworks concurrency)) |
| 08:23 | Chousuke | either is fine |
| 08:24 | Chousuke | use whichever you like :) |
| 08:25 | alrex021 | gr8 :) thx Chousuke for your help |
| 12:50 | tayssir | Hi! 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:58 | dnolen | tayssir: add-classpath doesn't return a value, it returns nil. |
| 13:59 | Anniepoo | hmm.... 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:05 | Anniepoo | Strange, 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:20 | Drakeson` | 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:21 | kotarak | Drakeson`: (require '(clojure.contrib [def :as def] [duck-streams :as ds])) |
| 14:21 | kotarak | Drakeson`: there are things like import-ns or so. But in general the answer to 2) is: no. |
| 14:22 | Drakeson` | kotarak: thanks |
| 14:25 | Drakeson` | 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:25 | Anniepoo | anybody recognize this problem with La Clojure? |
| 14:25 | Anniepoo | Language with ID 'Clojure' is already registered: class org.jetbrains.plugins.clojure.ClojureLanguage |
| 14:25 | Anniepoo | java.lang.Throwable |
| 14:25 | Anniepoo | at com.intellij.openapi.diagnostic.Logger.error(Logger.java:48) |
| 14:25 | Anniepoo | at com.intellij.lang.Language.<init>(Language.java:70) |
| 14:25 | Anniepoo | at com.intellij.lang.Language.<init>(Language.java:55) |
| 14:25 | clojurebot | clojure is the bestest programming language available. |
| 14:25 | Anniepoo | at com.intellij.lang.Language.<init>(Language.java:51) |
| 14:25 | Anniepoo | at org.clojure.intellij.ClojureLanguage.<init>(ClojureLanguage.java:24) |
| 14:25 | Anniepoo | at org.clojure.intellij.file.ClojureFileType.<init>(ClojureFileType.java:42) |
| 14:25 | Anniepoo | at org.clojure.intellij.file.ClojureFileType.<clinit>(ClojureFileType.java:34) |
| 14:25 | Anniepoo | at org.clojure.intellij.file.ClojureFileTypeLoader.createFileTypes(ClojureFileTypeLoader.java:23) |
| 14:25 | Anniepoo | at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.a(FileTypeManagerImpl.java:185) |
| 14:26 | Anniepoo | at com.intellij.openapi.fileTypes.impl.FileTypeManagerImpl.<clinit>(FileTypeManagerImpl.java:333) |
| 14:26 | Anniepoo | at java.lang.Class.forName0(Native Method) |
| 14:26 | Anniepoo | at java.lang.Class.forName(Class.java:247) |
| 14:26 | kotarak | Anniepoo: please use a paste |
| 14:26 | kotarak | lisppaste8: url |
| 14:26 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 14:28 | lisppaste8 | Anniepoo pasted "alreadyAClojure" at http://paste.lisp.org/display/81460 |
| 14:30 | kotarak | Drakeson`: I don't think so. Jars cannot be reloaded AFAIK. |
| 14:31 | Drakeson` | kotarak: thanks. it is important to know. |
| 14:33 | kotarak | Drakeson`: 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:33 | kotarak | Anniepoo: maybe you installed a older version of the plugin? |
| 14:34 | kotarak | And now the new one has a conflict with that? |
| 14:34 | Anniepoo | yes, good possibility |
| 14:35 | Anniepoo | I removed a bunch of plugins I wasn't using, cause I was tired of the long startup time, |
| 14:35 | Anniepoo | including the disabled 'clo jet' - might have been that? |
| 14:36 | Drakeson` | 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:36 | kotarak | Drakeson`: you can do that with .clj files to. Then use eg. (require :reload ...) or (require :reload-all ...) to reload the .clj files. |
| 14:37 | kotarak | Drakeson`: but that's limited to file system files. files in jars are different. |
| 14:37 | kotarak | Anniepoo: no clue. I don't have use IntelliJ. Just guessing from the failure messages... |
| 14:38 | Anniepoo | yah, hoped it was something somebody had a formulaic answer for |
| 14:38 | Anniepoo | going to try removing and reinstalling la clojure |
| 14:38 | Drakeson` | 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:39 | kotarak | Drakeson`: 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:40 | kotarak | The file has to follow the usual nameing conventions. |
| 14:42 | Drakeson` | kotarak: that's great. thanks a lot. |
| 14:45 | kotarak | Drakeson`: you are welcome |
| 14:57 | quidnunc | cgrand: Is it possible to use xml-zip functions on the results returned by enlive's select? |
| 15:51 | leafw | I 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:51 | leafw | what has changed? Having clojure.jar in the -Dclojure.jar=... is no enough? |
| 15:53 | leafw | also, how can one get clojure.jar itself to be compiled with AOT? |
| 16:00 | kotarak | leafw: 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:01 | leafw | kotarak: thanks. But it's not compiling now -- clojure-contrib.jar, at least. |
| 16:01 | kotarak | Let me check here. |
| 16:03 | hoeck | leafw: just compiled it here, what says your ant output? |
| 16:05 | leafw | now it compiles, after I compiled clojure.jar again (?) |
| 16:05 | leafw | 2.6 mb clojure-contrib.jar, as expected |
| 16:05 | leafw | no idea what was happening here. |
| 16:06 | hiredman | my clojure-contrib.jar is around 4mb |
| 16:06 | leafw | by the way, my custom-build GUI clojure REPL stopped working after clojure svn revision 1352 |
| 16:06 | kotarak | o.O |
| 16:07 | kotarak | 4mb! Mine is also around 2.5mb |
| 16:07 | leafw | hiredman: what JVM? Lots of inlining in 4m! |
| 16:08 | leafw | if 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:09 | hiredman | 4.1M clojure-contrib.jar |
| 16:10 | kotarak | leafw: one call the repl function form clojure.main with lots of callbacks to configure everything. There is also a stream-repl somewhere. |
| 16:10 | hiredman | java -cp clojure.jar clojure.main will print out a nice help message |
| 16:11 | cp2 | 450MHz P3 running F@H |
| 16:12 | cp2 | im such a contributor |
| 16:12 | leafw | hiredman: no help message here. How do you make it show? |
| 16:13 | leafw | I am going to try to emulate clojure.main, simply. |
| 16:13 | hiredman | oh |
| 16:13 | hiredman | huh, I thought it printed out the help message if called with no args |
| 16:13 | leafw | no, goes to repl directly. |
| 16:14 | hiredman | so there is a repl for you |
| 16:14 | kotarak | leafw: you lookup the docstring of clojure.main/repl or so. |
| 16:14 | kotarak | you can ... |
| 16:20 | leafw | it's very frustrating. I had a working REPL in a GUI, and not anymore. I keep getting : REQUIRE.invoke(CLOJURE_MAIN) |
| 16:21 | leafw | sorry |
| 16:21 | leafw | java.lang.ExceptionInInitializerError |
| 16:21 | leafw | at clojure.lang.Namespace.<init>(Namespace.java:32) |
| 16:21 | leafw | at clojure.lang.Namespace.findOrCreate(Namespace.java:122) |
| 16:21 | leafw | at Clojure.Clojure_Interpreter.<clinit>(Clojure_Interpreter.java:47) |
| 16:21 | leafw | which basically means, touching the Namespace makes it fail. |
| 16:21 | kotarak | Look at the cause. |
| 16:21 | leafw | 4 concatenated causes |
| 16:21 | kotarak | It will tell you why there was in ExceptionInInitializerError. |
| 16:22 | leafw | yes kotarak , I know. The problem is: what does clojure need to start accepting commands/statements? |
| 16:23 | leafw | before, one just did a refer to the user namespace |
| 16:23 | leafw | now that is not accepted. |
| 16:23 | leafw | (Exception) |
| 16:24 | leafw | none 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:24 | leafw | before, with the non-dummy clojure.lang.Repl class, it was clear. |
| 16:25 | leafw | now, with clojure.main, its no longer clear -- or what the main has it's not sufficient. Merely copying it fails. |
| 16:32 | leafw | needless to sya, very frustrating |
| 16:32 | leafw | s/sya/say/ |
| 16:32 | kotarak | Hmm.. What happens if you call clojure.main/repl directly? |
| 16:32 | leafw | kotarak: no such method ... it's legacy_repl(...) |
| 16:33 | leafw | which 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:34 | leafw | i.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:34 | leafw | and I cannot do so, because it would start at REPL in stdout, which is not what I want. |
| 16:35 | leafw | I don't want to start a REPL. I have my own LineNumberingPushbackReader that reads from a TextArea after return. |
| 16:36 | kotarak | leafw: have a look in src/clj/clojure/main.clj for the repl function. |
| 16:37 | leafw | looking |
| 16:37 | kotarak | leafw: it let's specify read and write hooks and such |
| 16:38 | leafw | kotarak: I am reading the doc for repl-read. Sounds interesting |
| 16:38 | kotarak | leafw: a little further the docstring of repl should also be interesting for you. |
| 16:39 | leafw | on it atm |
| 16:43 | leafw | so essentially I have to define new thread-bound vars *in* and *out* and all should be fine |
| 16:43 | leafw | after invoking main fn. |
| 16:44 | leafw | up to know I was also manually managing *e, *1, *2, *3 and others |
| 16:44 | leafw | doesn'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:48 | leafw | so 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:49 | leafw | I see no advantage to using clojure read fn |
| 16:50 | kotarak | leafw: read is maybe the more stable API |
| 16:50 | leafw | I would still have to set a new *in* everytime, and call invoke on the "repl-read" Var. |
| 16:50 | leafw | the problem is I don't understand at all what changed. Why it can't work now. |
| 16:51 | leafw | the Exceptions are totally not useful |
| 16:57 | leafw | failing 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:01 | leafw | I think I am starting to understand the problem: the reader assumes there is a valid *in* anyway somewhere. |
| 17:02 | leafw | but I cannot set it via RT.var because RT.var itself is throwing that error. |
| 17:06 | leafw | it puzzles me beyond end that clojure.main can call, in its static private variables, RT.var(...), but I can't: throws an Exception. |
| 17:13 | elight | Hi all. Anyone know if there's been any movement toward getting Clojure running on Android? |
| 17:14 | elight | I converted the Clojure JAR to Dalvik bytecodes but the blasted thing barfs when I try to run it in the emulator from shell. |
| 17:14 | kotarak | elight: There is. |
| 17:14 | kotarak | elight: you could search the google group for threads. |
| 17:14 | elight | kotarak: I've done a bit of googling. Information seems sparse. Mostly that Rich has been considering it. |
| 17:15 | kotarak | elight: there was someone working on it. Maybe you can ask him directly. |
| 17:15 | elight | kotarak: Huh. K, thanks. |
| 17:16 | elight | Just dying to have something other than vanilla Java to work in. Vanilla Java is hell.... |
| 17:17 | elight | kotarak: Hrmmm... git://github.com/remvee/clojure.git clojure-androi ? |
| 17:17 | elight | kotarak: Hrmmm... git://github.com/remvee/clojure.git clojure-android ? (typo) |
| 17:18 | kotarak | elight: ? I don't know. Never used Android.... |
| 17:18 | elight | kotarak: ah, ok |
| 17:19 | kotarak | elight: I would just contact the author of the threads in the group. |
| 17:19 | kotarak | It seems he got relatively far.. |
| 17:19 | leafw | kotarak, how does the nailgun server run clojure? That is conceptually similar--source code available? |
| 17:21 | kotarak | leafw: 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:21 | kotarak | This happens in src/de/kotka/vimclojure/nails.clj in the Repl nail. |
| 17:23 | leafw | kotarak: ok. |
| 17:23 | kotarak | leafw: it basically uses *in* etc. provided by nailgun. |
| 17:23 | leafw | kotarak: I tried running clojure.main.main(new String[0]) and ... it fails. Fails! Can only be run from the command line |
| 17:23 | kotarak | That magic is in the defnail macro, IIRC |
| 17:26 | leafw | considering 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:28 | cgrand | quidnunc`: it depends -- you may need to change select* |
| 17:37 | lisppaste8 | cgrand pasted "zip-select for quidnunc`" at http://paste.lisp.org/display/81467 |
| 17:40 | Anniepoo | I 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:41 | drewolson | hey 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:41 | drewolson | i'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:41 | drewolson | *in an |
| 17:43 | hiredman | you 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:44 | drewolson | hiredman: awesome, that's exactly what i was looking for |
| 17:44 | drewolson | will that binding affect all namespaces? |
| 17:45 | hiredman | hmmm |
| 17:46 | hiredman | actually, there is the possibilty for a lot of complexity there, so I am note sure |
| 17:46 | hiredman | I ahve used it in a few similar situations across namespaces |
| 17:46 | drewolson | right, 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:47 | drewolson | i'd like the function in foo to behave in a specific way for a given test. seems tricky. |
| 17:51 | drewolson | hiredman: actually, that did seem to work |
| 18:50 | Anniepoo | I 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:51 | tbatchelli1 | I think it's Ctrl+J, but I believe it only works when looking up Java methods, but not for clojure vars |
| 18:51 | Anniepoo | hmm |
| 18:52 | tbatchelli1 | the lookup of documentation on clojure variables and functions is not implemented yet, according to Ilya |
| 18:52 | Anniepoo | thanks |
| 18:52 | Anniepoo | I must be confusing it with ctrl shift I for the java function lookup |
| 20:21 | chouser | ,Math/PI |
| 20:21 | clojurebot | 3.141592653589793 |
| 20:26 | cp2 | Cherry/PI |
| 20:28 | chouser | ,Cherry/PI |
| 20:28 | clojurebot | yummy! |