Var clojure.core/refer is unbound???

2009-12-18 Thread Gorsal
So im trying to do some extremely simple AOT. However, when i run the following code i get an error which i swear ive seen before but i dont quite remember how to fix it! (ns console.TheConsole (:gen-class :extends org.eclipse.ui.console.IOConsole :constructors {[] [String org.eclipse.jface.

Constructor Errors in gen-class

2009-11-02 Thread Gorsal
I have a question. When you do a gen-class and specify incorrect constructor arguments, is an error supposed to be produced? Currently, in the eclipse clojure plugin, clojure silently doesn't create the class. (gen-class :name "NAME" :init init :post-init post-init :construct

Re: java.lang.ClassFormatError: Duplicate field name&signature in class file

2009-11-01 Thread Gorsal
Looking at this again, i notice that ViewPart is an abstract class. Can we extend these ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com N

java.lang.ClassFormatError: Duplicate field name&signature in class file

2009-11-01 Thread Gorsal
Im having difficulties using gen-class in some cases (clojure.core/gen-class :name rcp.MyView :extends org.eclipse.ui.part.ViewPart :prefix "MyView362" :init init) (clojure.core/defn MyView362init [] [[] []]) (clojure.core/defn MyView362createPartControl [this parent] (println "HI"

Re: Error messages

2009-10-29 Thread Gorsal
My environment is enclojure on netbeans. Ive compiled all of the code for swank-clojure. However, when i call a function which produces a certain error (in a new case, attempting to call some invalid java method on a java object) i get the no source file thing. So im guessing that somehow i have t

Re: Error messages

2009-10-29 Thread Gorsal
Oh, my actual question was to ask why the general NO_SOURCE_FILE would appear and how to fix it, the specific error message was just an example. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post

Re: Error messages

2009-10-29 Thread Gorsal
Sorry. I was just compiling everything and changing some code so it broke. Where it actually came from is probably irrelevant, i have gotten the phrase 'NO_SOURCE_FILE' when compiling before. --~--~-~--~~~---~--~~ You received this message because you are subscribed

Error messages

2009-10-29 Thread Gorsal
Often , i get error messages like #http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---

Re: KeyTest$_init_307.class vs KeyTest_init?

2009-10-27 Thread Gorsal
Thx. That should work:) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient

Re: KeyTest$_init_307.class vs KeyTest_init?

2009-10-26 Thread Gorsal
Sweet! So that worked. However, even though unlikely, i would like to avoid symbol collision. So i tried something like this (ns ide.handlers (:use clojure.contrib.with-ns)) (defmacro new-handler-class [classname-sym event & body] (let [hinted-this (with-meta 'this {:tag classname-sym})]

Re: KeyTest$_init_307.class vs KeyTest_init?

2009-10-26 Thread Gorsal
I just realize i wasn't putting those functions in an ns . So (defmacro new-handler-class [n event & body] `(do (ns ~n (:gen-class :extends ~'org.eclipse.ui.commands.AbstractHandler :init ~'init)) (binding [*ns* (find-ns '~n)] (defn ~'-init [] [[][]]) (defn ~

KeyTest$_init_307.class vs KeyTest_init?

2009-10-26 Thread Gorsal
Im attempting to create a named class inside another namespace like this: (ns ide.handlers (:import [org.eclipse.ui.commands AbstractHandler])) (defmacro new-handler-class [n event & body] `(do (ns ~n (:gen-class :extends ~'org.eclipse.ui.commands.AbstractHandler :init ~'init))

Re: Equivalents from java

2009-10-26 Thread Gorsal
Thanks. Now i know to also use doc :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - plea

Equivalents from java

2009-10-25 Thread Gorsal
So i've been trying to find two equivalents to keywords in java. The first one is synchronized. is there any syncrhonized keyword in clojure? More importantly, however, ive been trying to do somethign like this (proxy [AbstractHandler] [] (execute [~var] ~...@body)) What is the equival

Bindings

2009-10-22 Thread Gorsal
I would like to know if the following way is the only method to introduce global bindings which affect a new thread one starts. (let [global-var *global-var*] (with-thread nil (binding [*global-var* global-var] ))) Just wanted to make sure there wasn't anything easier:) --~--~--

Bindings

2009-10-22 Thread Gorsal
I would like to know if the following way is the only method to introduce global bindings which affect a new thread one starts. (let [global-var *global-var*] (with-thread nil (binding [*global-var* global-var] ))) Just wanted to make sure there wasn't anything easier:) --~--~--

Re: Redirecting Output

2009-10-21 Thread Gorsal
According to this thread http://www.velocityreviews.com/forums/t142870-inputstream-and-selector.html the channel produced from at least the InputStream of system.in is always blocking . probably the same here. oh well... --~--~-~--~~~---~--~~ You received this messa

Re: Redirecting Output

2009-10-21 Thread Gorsal
So, ive been trying this out and it hasn't quite been working out. First, im getting a inputstream from a Process. Then i'm getting a channel from it using Channels/newChannel. This gives me a ReadableByteChannelImpl which claims to implemen tInterruptibleChannel http://www.docjar.org/docs/api/jav

Once-only macro

2009-10-21 Thread Gorsal
I was just idly wondering: even after searching google, i haven't seen the once-only macro+clojure pop up any results. Its easy to implement, but I was wondering if there was some reason people weren't using this to avoid multiple evaluation in macros. Is something else used? --~--~-~--~-

Re: Uninterning a function

2009-10-21 Thread Gorsal
Yep, thats exactly it. Merci! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be pa

Uninterning a function

2009-10-21 Thread Gorsal
I'm trying to unintern a function i accidently defined in a namespace which collides with another function i'm importing . i can't seem to find an unintern, or undef, or anything to do this? How do i achieve this? Thanks~~ --~--~-~--~~~---~--~~ You received this me

Re: Redirecting Output

2009-10-20 Thread Gorsal
Yep, dual core machine. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient

Re: Redirecting Output

2009-10-19 Thread Gorsal
oh, and jprint is basically equivalent to print --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are modera

Redirecting Output

2009-10-19 Thread Gorsal
I'm trying to redirect the input i receive from a BufferedInputStream to the repl. I'm trying something like this: (defmacro with-thread [nm & body] `(let [thread# (Thread. (fn [] (do ~...@body)))] (if ~nm (.setName thread# ~nm)) (.start thread#) thread#)) (defn redirect-stream [nm

Redirecting Output

2009-10-19 Thread Gorsal
I'm trying to redirect the input i receive from a BufferedInputStream to the repl. I'm trying something like this: (defmacro with-thread [nm & body] `(let [thread# (Thread. (fn [] (do ~...@body)))] (if ~nm (.setName thread# ~nm)) (.start thread#) thread#)) (defn redirect-stream [nm

Re: Using 'future' ?

2009-10-18 Thread Gorsal
Thanks. I think now that i recall i have made that mistake before. I must differentiate - fn and #()! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googl

Re: Using 'future' ?

2009-10-18 Thread Gorsal
So now that the future is working, I'm attempting to print from an actual java thread. Like this (defmacro with-thread [nm & body] `(let [thread# (Thread. #(fn [] (do ~...@body)))] ~@(if nm `((.setName thread# ~nm))) (.start thread#) thread#)) (with-thread nil (println "Hasdfasd

Re: Clojure Cheat Sheet

2009-10-18 Thread Gorsal
lo, never looked at the bottom. I shall do that next time! Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new

Using synchronized keyword

2009-10-18 Thread Gorsal
I was wondering how to used the java keyword synchronized in clojure? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from

Re: Using 'future' ?

2009-10-18 Thread Gorsal
Hey, is there any way to separate the out view from the repl view so i don't have to switch back and forth? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@

Re: Using 'future' ?

2009-10-18 Thread Gorsal
Thanks, this works. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with

Clojure Cheat Sheet

2009-10-18 Thread Gorsal
All right, so this is probably way off topic, but what software was used to create the clojure cheat sheet? http://clojure.org/cheatsheet I really like the format and would like to make one for my own utilities so that I can actually remember what general utility functions i have written! --~--~--

Re: What do you use for asdf-like functionality?

2009-10-18 Thread Gorsal
Now that I think about it im guessing ant is used. Though if i don't want to compile the clojure files, i guess i might be able to use lancelet to simply define a series of loading? Perhaps... --~--~-~--~~~---~--~~ You received this message because you are subscribe

Using 'future' ?

2009-10-18 Thread Gorsal
I'm attempting to use the function future to start something in another thread. However, in the netbeans enclojure plugin, when i type it into the repl, it becomes non-responsive. Is this just a bug in the enclojure plugin or would this be normal? (future (let [input-stream (:input-stream *li

What do you use for asdf-like functionality?

2009-10-18 Thread Gorsal
Coming from lisp, i am used to an asdf like functionality. Recently I have been reorganizing my code and placing all my general utilities under one package, utils. Under it i have a file for each time of utility, string, macro, etc. Then i have a package.clj file. Basically, I want the user to be

Re: ANN: Clojure live-repl

2009-10-18 Thread Gorsal
That's very slick. I'm going to use this:) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated -

Re: Printing to *out* in another thread

2009-10-18 Thread Gorsal
Dang, you're ri ght, I didn't even notice. This is a nice feature, separating everything. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegrou

Re: Printing to *out* in another thread

2009-10-17 Thread Gorsal
I just tried this on the eclipse clojure repl, it works. So i guess it is an enclojure thing! (.println System/out "HI") also doesn't work on the netbeans repl, but does on the enclojure. I'll ask on the enclojure mailing group. Thanks for the help! --~--~-~--~~~---~--~

Re: Printing to *out* in another thread

2009-10-17 Thread Gorsal
I'm not using emacs. I'm using netbeans and the enclojure plugin. What normal clojure repl are u using? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goog

Re: Printing to *out* in another thread

2009-10-17 Thread Gorsal
Well, i should say, no print output occurs in the repl, which i assume is where it is supposed to appear? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@go

Re: Printing to *out* in another thread

2009-10-17 Thread Gorsal
Hmm.. This doesn't appear to work. When i go (wa-debug-make) and then (wa-debug-print "HI") it returns # The agent has been logged with the value "HI", but no print output occurs. I'm using the netbeans enclojure plugin, btw. --~--~-~--~~~---~--~~ You received this

Printing to *out* in another thread

2009-10-17 Thread Gorsal
How am i supposed to print to the output from another thread? I want, for example, (future (println "HI")) to print hi. It doesn't. Merci! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to thi

Code Walkers for Clojure

2009-09-20 Thread Gorsal
I was just wondering if there was some code walkers for clojure out there, sort of like arnesi for common lisp. In arnesi, it would parse all of the code into objects. A free variable would be a free-variable- reference and a bound variable would be else, and a function form would be an applicatio

Re: Redefining Special Forms

2009-09-17 Thread Gorsal
Yes, that would work. I keep forgetting the try finally acts like unwind-protect. Even if the thread is killed the finally process will execute. Ehh... On Sep 17, 5:50 pm, John Harrop wrote: > On Thu, Sep 17, 2009 at 6:15 PM, Gorsal wrote: > > Or maybe i could simply push to the globa

Re: Redefining Special Forms

2009-09-17 Thread Gorsal
, 5:12 pm, Gorsal wrote: > Thanks for the replies! > Before I start doing something silly, I would like to ask another > question. The eventual goal of all of this is to establish bindings > which also affect the same global variable in other namespaces (these > other namespaces wil

Re: Redefining Special Forms

2009-09-17 Thread Gorsal
Thanks for the replies! Before I start doing something silly, I would like to ask another question. The eventual goal of all of this is to establish bindings which also affect the same global variable in other namespaces (these other namespaces will 100% have the same global variable). In other wo

Re: Redefining Special Forms

2009-09-17 Thread Gorsal
Oh. And just as a quick other question, do global bindings affect threads which are started in the same ns? Like (binding [*global* 2] (with-thread (print *global*) ;;prints 2??? )) On Sep 17, 11:33 am, Gorsal wrote: > Basically i need to redefine the meaning of a special form. Wh

Redefining Special Forms

2009-09-17 Thread Gorsal
Basically i need to redefine the meaning of a special form. While i am willing to change the name for things like ns to defpackage, i am not willing to change the name of forms like apply and defn to achieve my goals. Instead, i would like to redefine them for my own needs. Of course, i will be us

Re: Unwind-protect?

2009-09-15 Thread Gorsal
Ah, I thought there was a contrib out there for unwind-protect . I guess its so trivial that no one wrote it. lol. On Sep 15, 12:25 pm, Joost wrote: > On 15 sep, 18:19, Jarkko Oranen wrote: > > > Unwind-protect? Isn't that a Common Lisp thing? Sounds like you got > > the wrong mailing list :) >

Unwind-protect?

2009-09-15 Thread Gorsal
I was just wondering about the unwind-protect form, I've heard that it doesn't protect against certain types of exits, but what exactly are these exits? I've heard return, break, and continue statements said but i can't seem to find these statements in clojure. Any examples? --~--~-~--~---

Using Clojure with Swank

2009-09-11 Thread Gorsal
Hello ! I need to rewrite a swank implementation which is in java for the Cusp plugin. Looking around, I saw swank-clojure. I thought i would ask more knowledgeable people than me whether it is what i'm looking for (crosses fingers!). (1) The plugin currently starts a lisp implementation and load

Class function alwayrs returns java.lang.class??

2009-09-10 Thread Gorsal
Hello. I'm trying to use (class String) to get the class object for the String class. However, nomatter what class typ ei pass, i always get java.lang.Class back. Is this the way its supposed to work? Thx! --~--~-~--~~~---~--~~ You received this message because yo

Re: Unsupported binding form

2009-09-08 Thread Gorsal
ons of > the functions, as well as the body.") > > Your maybe doing a similar error in other parts of the code where the > implementation detail are closer to the public API, and that may explain > your error ? > > 2009/9/8 Gorsal > > > > > # > (G__1852 2)

Re: Unsupported binding form

2009-09-08 Thread Gorsal
(set! *print-level* 8) ;;so you can see all of macroexpand-1 ;;MISC Utilities ;; ;; (defn mklst [item] (if (list? item) item (list item))) (defn lassoc [item lst] (first (filter #(= (first (mklst %)) item) lst))) (defmacro llet [bind & body] `(let ~(vec (mapcat #(if-no

Unsupported binding form

2009-09-08 Thread Gorsal
# So, I'm porting Paul Grahm's condlet macro to clojure. I've done it except when i evaluate it it gives me the above error. However, when I macroexpand-1 it it evaluates fine. The only difference between evaluating the macroexpansion vs the other way is that the (gensym) vars are now regular var

Is not public error?

2009-09-07 Thread Gorsal
(script.env/def-ns script.ParenMatcher (:gen-class :implements [org.eclipse.jface.text.source.ICharacterPairMatcher] :state state :init init :methods [[setPainter [org.eclipse.jface.text.source.MatchingCharacterPainter] void]]) (:use script.genutils) (:import (org.eclipse

Re: Anyone else working on a Common Lisp style "loop"?

2009-09-07 Thread Gorsal
Heh, I've always wanted one of these. Anyways, I think that instead of emulating loop , you should try to somewhat emulate iterate. You would need a code walker, though, because you probably wouldn't want to use brackets for all the special case loop constructs. Is there one for clojure? I don't k

Dynamically Changing Functions in Compiled Code

2009-09-05 Thread Gorsal
I am trying to add clojure code to an eclipse plugin. To do so, the code i compiled into class files via the clojure-dev plugin. I have a generate class, ParenMatcher, which i use ever so often. This class has a function which i would like to change dynamically while debugging it. In other words,

Importing All from java package?

2009-09-03 Thread Gorsal
Hello! I was just wandering if it was possible to import all from a java package . For example, in java i can do import org.eclipse.jface.text.*; And i can use IDocument, which is contained under org.eclipse.jface.text.IDocument; In clojure, I try (ns ParenMatcher (:gen-class :implements