Question about IntelliJ Plugin
If I split my code across files, how do I make it so that the REPL can see all the code? For example, if I have a main.clj and a tests.clj, when I run the REPL from one of the two files, it only sees the definitions from that file, not everything in the project. What's the right way to do this? 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: errors?
But how do you get rid of the (NO_SOURCE_FILE:0) messages for every single error? I'd really like to know the line number of the function that threw the error. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: design patterns for event driven applications
Anatoly Yakovenko a écrit : basically i am dealing with a 3rd party library, (interactive brokers tws api), that takes an interface with lots of different methods that it calls when an event occurs. like received market data, received order, etc... It provides another interface that basically generates these events. Some of the events are statefull, like i canceled an order, i get a response that the order cancel was received, and then i get a confirmation that the order was canceled. If i was implementing this in haskell, (i am at the moment, but writing the bindings is a pain in the arse), i would pump all the events into a Chan, essentially a lazy evaluated sequence used to get stuff from IO, and write a parser on top of that. This first part is rather easy to port to Clojure, use a BlockingQueue to buffer events received by the callback interface: (def #^java.util.concurrent.BlockingQueue q (java.util.concurrent.LinkedBlockingQueue.)) and in your consumer thread, turn it into a sequence: (def s (repeatedly #(.take q))) ; (EOS handling is left as an exercise) For the parser part, I'm afraid there's no such thing right now. Maybe can you build upon Konrad's monads library? HTH Christophe -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.blogspot.com/ (en) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Clojure, swank-clojure, and Debian
Hello, I'm trying to start learning Clojure, but I fail miserably at some point trying to get a decent IDE to work. - First, Enclojure for Netbeans has lot of bugs, it is inusable for me at this stage. - I'm not used to Eclipse nor Intellijea, so I discard both. - I'm used to Emacs, and have used Slime and SBCL with success before, but I must admit that it was too easy: all I had to do is apt-get install sbcl slime. So I found this guide: http://riddell.us/clojure/ It is for Ubuntu, but I do not see that the process could not be the same for Debian. I followed the entire guide, checked and rechecked everything. But when I want to start slime, I get: (add-classpath file:home/javi/program/clojure/swank-clojure/) (require 'swank.swank) (swank.swank/ignore-protocol-version 2009-03-09) (swank.swank/start-server /tmp/slime.20900 :encoding iso-latin-1- unix) Clojure user= nil user= java.lang.Exception: Unable to resolve symbol: lazy-seq in this context (core.clj:70) user= java.lang.Exception: No such var: swank.swank/ignore-protocol- version (NO_SOURCE_FILE:5) user= java.lang.Exception: No such var: swank.swank/start-server (NO_SOURCE_FILE:7) user= And Slime refuses to full start. I am just in the point of giving up and forget Clojure, so please help me. What I missed? Thank you. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: VimClojure 2
Hello Mark and fellow Vimmers, Am 14.03.2009 um 03:56 schrieb Mark Feeney: Anyway, user error, as you predicted above :) Things are working much better now. I hope I didn't sound too harsh! If so, I apologise! But this is really my experience from my daily life (also on the real user side, not only developer side)! Pick an arbitrary topic and the chances are large, that it is a problem due to misuse by the user. * Namespaces * Exceptions * Macros (one of my favourites) * Eval (another one of my favourites) * Excel * CD players (tapping the tray instead of using the close button) * ... Of course, software can be made more robust, but for a hobby project, like VimClojure, I think there can be some level of goodwill expected from the user that the software is not perfect. And while writing this I noticed, that \ef actually tries to require the namespace when it does not exist. So VimClojure already tries as best as possible to be robust here. :) Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature
Re: Clojure, swank-clojure, and Debian
Ok, I can answer myself, thanks to maacl in the IRC: Download clojure-mode: git clone git://github.com/jochu/clojure-mode.git And put this: (add-to-list 'load-path /path/to/clojure-mode) (require 'clojure-mode) in .emacs, restart, and M-x clojure-install. Really fantastic. The guide I tried to follow is just broken. Thank you. On 14 mar, 10:22, Javier javu...@gmail.com wrote: Hello, I'm trying to start learning Clojure, but I fail miserably at some point trying to get a decent IDE to work. - First, Enclojure for Netbeans has lot of bugs, it is inusable for me at this stage. - I'm not used to Eclipse nor Intellijea, so I discard both. - I'm used to Emacs, and have used Slime and SBCL with success before, but I must admit that it was too easy: all I had to do is apt-get install sbcl slime. So I found this guide: http://riddell.us/clojure/ It is for Ubuntu, but I do not see that the process could not be the same for Debian. I followed the entire guide, checked and rechecked everything. But when I want to start slime, I get: (add-classpath file:home/javi/program/clojure/swank-clojure/) (require 'swank.swank) (swank.swank/ignore-protocol-version 2009-03-09) (swank.swank/start-server /tmp/slime.20900 :encoding iso-latin-1- unix) Clojure user= nil user= java.lang.Exception: Unable to resolve symbol: lazy-seq in this context (core.clj:70) user= java.lang.Exception: No such var: swank.swank/ignore-protocol- version (NO_SOURCE_FILE:5) user= java.lang.Exception: No such var: swank.swank/start-server (NO_SOURCE_FILE:7) user= And Slime refuses to full start. I am just in the point of giving up and forget Clojure, so please help me. What I missed? Thank you. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: What is Clojure NOT good for?
On 6 Mrz., 17:07, lprefonta...@softaddicts.ca wrote: I know some business where HR and IT managers come back with this mantra that they can find Java and .Net coders, anything else is too risky or too scarce on the market. Right. I am sure a lot of those managers really think that way. If they go the Java route, then it will be no problem to hire more developers. They just overlook that when they write their programs in Lisp, then they won’t need as many devs. I don’t want to go into numbers, as it depends on the specific requirements. But in general it is true that a good bunch less developers can do with Lisp what more programmers can do with Java. Many HR departments do not understand anything about software development in general and the profile of individuals needed. It’s always good to have a Lisper as the head of the software department. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: What is Clojure NOT good for?
On 6 Mrz., 19:21, Phil Hagelberg p...@hagelb.org wrote: The only other thing I can think of is short-lived command-line tools that need subsecond launch times. The Lisp repl is the command-line. There is no starting time of the JVM involved. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: filter1 interesting?
On 9 Mrz., 16:34, Stuart Sierra the.stuart.sie...@gmail.com wrote: On Mar 8, 3:20 pm, André Thieme splendidl...@googlemail.com wrote: I regularily stumble upon the (first (filter predicate coll)) pattern. Maybe we can add a filter1 for that? In the Clojure project itself I found this two times, in core.clj for the ns macro, and in genclass.clj in find-field. Also in the clojure-contrib project it shows up two times (again in the core.clj of Clojure for CLR, and in clojurescript.clj). I do use this pattern, but if I were naming it I think I'd call it find-first. But that's scarcely shorter than (first (filter ...), which is why I've never actually defined it. Yesterday someone else suggested to eliminate the (first (filter ..)) pattern. In Common Lisp it is called FIND. But that is already taken. I agree with you that find-first is not really much easier. It reduces indeed some complexity, as it eliminates one level of nesting, but to make it useful it would need a short name. Christophe Grand suggest (seek ...), which I personally like. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Promise for absense of side effects
On 9 Mrz., 20:42, Raoul Duke rao...@gmail.com wrote: ok oops that didn't work, sorry -- i mean to send this link: http://www.ccs.neu.edu/home/samth/typed-scheme/manual/ That is not too far away of what I had in mind. What I would like is if it were even a bit more optional. Typed Scheme allows to have a specific module statically typed without having to touch the others. I would like to go even further, by allowing in the same file/module to have code as we have it today, and code for which the compiler can give us support by doing compile time checks. At two places we would need a hook to add typing information. This could happen via metadata. Those places are: variable binding (such as def, let or function parameters), and the return values of functions. A global or namespace based switch would be also a nice thing to have. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Promise for absense of side effects
Hi, Am 14.03.2009 um 12:38 schrieb André Thieme: At two places we would need a hook to add typing information. This could happen via metadata. Those places are: variable binding (such as def, let or function parameters), and the return values of functions. A global or namespace based switch would be also a nice thing to have. I remember some presentation of someone doing this for, I think, Python. There you hint things, where the type is known and the compiler inferred the rest as far as possible. What cannot be inferred was cast to a special type called dynamic. So this roughly worked like type hints in Clojure. Just with a bit more inference and dynamic meaning reflection. However, I can't seem to find the video anymore. I think it was a Google techtalk How something like this could be implemented, where some types life in the Java class space while others exist in the Clojure map space I'm not that of a specialist for language implementation. :) Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature
VimClojure 2.0.0 Exception while reading a .clj
When I try to read a clojure source file, I have the following exception: Error detected while processing function vimclojure#ExecuteNailWithInput: line 23: E605: Exception not caught: Couldn't execute Nail! /home/steph/src/ vimclojure -2.0.0/ng de.kotka.vimclojure.nails.NamespaceOfFile /tmp/v42025/1 Error detected while processing /home/steph/.vim/ftplugin/clojure.vim: line 131: E171: Missing :endif Error detected while processing function SNR5_LoadFTPlugin: line 17: E170: Missing :endfor The nailgun server is running. Anyone has a clue? Thank you, Stephane --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Dynamic loading of code (a la Python)?
Hi all. I've been working on a piece of code (an xml-rpc server) in Python (actually Jython), and one of its features is the capability of loading modules (connectors in Java) during runtime. Not only are these modules dynamically loaded on request (their names passed as arguments in a string), but they are only visible in the lexical scope of the specific method/function, the resources being released as soon as that same scope is left. Now, I would love to recode this stuff in Lisp, especially Clojure. But is it possible to pull this off? From what I've been reading, it actually doesn't seem like it. Rock --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: VimClojure 2.0.0 Exception while reading a .clj
Hi, Am 14.03.2009 um 13:33 schrieb stephaner: When I try to read a clojure source file, I have the following exception: Error detected while processing function vimclojure#ExecuteNailWithInput: line 23: E605: Exception not caught: Couldn't execute Nail! /home/steph/src/ vimclojure -2.0.0/ng de.kotka.vimclojure.nails.NamespaceOfFile /tmp/v42025/1 Error detected while processing /home/steph/.vim/ftplugin/clojure.vim: line 131: E171: Missing :endif Error detected while processing function SNR5_LoadFTPlugin: line 17: E170: Missing :endfor The nailgun server is running. Anyone has a clue? Please check the following: - The ng *server* needs the following in the Classpath: vimclojure.jar, clojure.jar, clojure-contrib.jar - Does running the client manually work? ng de.kotka.vimclojure.nails.NamespaceOfFile your_src.clj Does this give an exception? There were several threads in the past days just about this problem. Maybe check for them also. Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature
Re: filter1 interesting?
Christophe Grand suggest (seek ...), which I personally like. IMHO seek is pretty good for a number of reasons: short, implies first result. Minor objection would be that folks may not think it's what they want because of how it's used in C where they'd expect it to take a number of bytes and a block. (filter-one ...) or (find-first ...) are both ok to me ... and preferable to (first (filter ...)) the latter being an idiom you have to discover on your own. Another very minor problem with the idiom is that the docs say that filter returns a lazy sequence, but it doesn't say that the order has to be the same as how the original sequence would be consumed. Having an actual function makes the concept of first concrete. It unties it from filter having to be the implementation. yeah (seek ...) is pretty good. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: VimClojure 2.0.0 Exception while reading a .clj
Hi Mr Brandmeyer, The server is running: NGServer started on 127.0.0.1, port 2113. Here is the output using the client alone: ~/src/vimclojure-2.0.0$ ./ng de.kotka.vimclojure.nails.NamespaceOfFile /home/steph/testsrc/test.clj java.lang.ClassNotFoundException: de.kotka.vimclojure.nails.NamespaceOfFile at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) Thank you, Stephane On Mar 14, 8:49 am, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 14.03.2009 um 13:33 schrieb stephaner: When I try to read a clojure source file, I have the following exception: Error detected while processing function vimclojure#ExecuteNailWithInput: line 23: E605: Exception not caught: Couldn't execute Nail! /home/steph/src/ vimclojure -2.0.0/ng de.kotka.vimclojure.nails.NamespaceOfFile /tmp/v42025/1 Error detected while processing /home/steph/.vim/ftplugin/clojure.vim: line 131: E171: Missing :endif Error detected while processing function SNR5_LoadFTPlugin: line 17: E170: Missing :endfor The nailgun server is running. Anyone has a clue? Please check the following: - The ng *server* needs the following in the Classpath: vimclojure.jar, clojure.jar, clojure-contrib.jar - Does running the client manually work? ng de.kotka.vimclojure.nails.NamespaceOfFile your_src.clj Does this give an exception? There were several threads in the past days just about this problem. Maybe check for them also. Sincerely Meikel smime.p7s 5KViewDownload --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: VimClojure 2
Hi Meikel, Regarding namespaces, I would appreciate help understanding what looks like a heisenbug. I have a file at t2/data/core.clj, with namespace t2.data.core The namespace (ns t2.data.core) does not :import or :use anything. I open such file by :edit t2/data/core.clj When switching to another buffer and then back, sometimes it complains with a long error, the now famous line 23 nail error. But sometimes it does not (?). Restarting vim solves this problem, until it catches on again. It would help a lot if the error was more specific: which expression failed? What was the nailgun trying to do? The current error basically says nothing other than an error ocurred in the nailgun. The shell where the nailgun server was opened doesn't print anything. It would be a good place to print this nailgun server indigestions. Also to note here that these multiline nailgun errors are a pain to have in the vim minibuffer, for one has to press return several times until the entire message of the error is printed in full. A Scratch buffer or the shell where the nailgun runs would be a better place, leaving perhaps a single line such as Error: check ng shell in the minibuffer. Regarding the \sr Repl: On occasions, it throws an error, altough the Scratch buffer opens anyway with an inactive Repl in it (the cursor is at the top instead of after the prompt, and no expressions may be entered with return.) If I close it with esc :bd, and retype \sr, then the Repl opens fine. It's puzzling. And happens at random times. Also: the \sr Repl becomes (again, sometimes) irresponsive (i.e. doesn't evaluate anything) when I accidentally press control+w control+w while in insert mode, which deletes one or two lines, depending upon when I realize so. What is the proper way to reenable it, short of :bd and \sr again? It's true that most errors are on the user side. I've experienced this both as user and as developer receiving bizarre complains from users of my software. I my experience, detailed how-tos with detailed, precise examples of operation go a very long way, much more than any description in a manual. Thanks for VimClojure. I'm loving it despite all the unexpected reactions. Albert -- Albert Cardona http://albert.rierol.net --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: filter1 interesting?
What about overloading first to accept a predicate? (first even? (iterate inc 1)) = 2 On Sat, Mar 14, 2009 at 8:58 AM, e evier...@gmail.com wrote: Christophe Grand suggest (seek ...), which I personally like. IMHO seek is pretty good for a number of reasons: short, implies first result. Minor objection would be that folks may not think it's what they want because of how it's used in C where they'd expect it to take a number of bytes and a block. (filter-one ...) or (find-first ...) are both ok to me ... and preferable to (first (filter ...)) the latter being an idiom you have to discover on your own. Another very minor problem with the idiom is that the docs say that filter returns a lazy sequence, but it doesn't say that the order has to be the same as how the original sequence would be consumed. Having an actual function makes the concept of first concrete. It unties it from filter having to be the implementation. yeah (seek ...) is pretty good. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: VimClojure 2.0.0 Exception while reading a .clj
Hi, Am 14.03.2009 um 14:50 schrieb stephaner: Here is the output using the client alone: ~/src/vimclojure-2.0.0$ ./ng de.kotka.vimclojure.nails.NamespaceOfFile /home/steph/testsrc/test.clj java.lang.ClassNotFoundException: de.kotka.vimclojure.nails.NamespaceOfFile at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) Thank you, That means, that your vimclojure.jar is broken. It contains the nailgun server (since it is running) but not the generated class files from clojure. I just cut'n'pasted your command and it works for me. Please rebuild your jar and check whether there are failures in the process. You can also check the content of the jar with the jar command: jar tf vimclojure.jar. Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature
Re: VimClojure 2.0.0 Exception while reading a .clj
hi I have soluved the same problem. the conclusion is when ant made vimclojure.jar, ant failed compiling it. Please check local.propaties out. or you modify 'CLOJURE', 'CLOJURECONTRIB' and 'VIMCOLJUREHOME' of my installer.sh. This script works on sh/bash/zsh ... installer.sh #!/bin/sh # installer.sh - a simple vimclojure installer. # Please rewrite CLOJURE, CLOJURECONTRIB and VIMCLOJUREHOME. # The example is that CLOJURE is ~/opt/clojure/clojure.jar, # that CLOJURECONTRIB is ~/opt/clojure-contrib/clojure-contrib.jar # and that VIMCLOJUREHOME is ~/opt/vimclojure . CLOJURE=${HOME}/opt/clojure/clojure.jar CLOJURECONTRIB=${HOME}/opt/clojure-contrib/clojure-contrib.jar NAILGUNCLIENT=ng VIMCLOJUREHOME=${HOME}/opt/vimclojure cp -r {autoload,doc,ftdetect,ftplugin,indent,syntax} ${HOME}/.vim ant -Dnailgun-client=${NAILGUNCLIENT} -Dclojure.jar=${CLOJURE} - Dclojure-contrib.jar=${CLOJURECONTRIB} # ./ngserver is a shell script for clojure server of vimclojure. echo '#!/bin/sh' ngserver echo java -cp ${CLOJURE}:${CLOJURECONTRIB}:${VIMCLOJUREHOME}/ vimclojure.jar com.martiansoftware.nailgun.NGServer 127.0.0.1 ngserver chmod 755 ngserver # If 'ng' don't add on $PATH, please erase '#' of the below. # echo let vimclojure#NailgunClient=\${VIMCLOJUREHOME}/ng\ $ {HOME}/.vimrc -- end of the script On Mar 14, 10:50pm, stephaner stepha...@gmail.com wrote: Hi Mr Brandmeyer, The server is running: NGServer started on 127.0.0.1, port 2113. Here is the output using the client alone: ~/src/vimclojure-2.0.0$ ./ng de.kotka.vimclojure.nails.NamespaceOfFile /home/steph/testsrc/test.clj java.lang.ClassNotFoundException: de.kotka.vimclojure.nails.NamespaceOfFile at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) Thank you, Stephane On Mar 14, 8:49 am, Meikel Brandmeyer m...@kotka.de wrote: Hi, Am 14.03.2009 um 13:33 schrieb stephaner: When I try to read a clojure source file, I have the following exception: Error detected while processing function vimclojure#ExecuteNailWithInput: line 23: E605: Exception not caught: Couldn't execute Nail! /home/steph/src/ vimclojure -2.0.0/ng de.kotka.vimclojure.nails.NamespaceOfFile /tmp/v42025/1 Error detected while processing /home/steph/.vim/ftplugin/clojure.vim: line 131: E171: Missing :endif Error detected while processing function SNR5_LoadFTPlugin: line 17: E170: Missing :endfor The nailgun server is running. Anyone has a clue? Please check the following: - The ng *server* needs the following in the Classpath: vimclojure.jar, clojure.jar, clojure-contrib.jar - Does running the client manually work? ng de.kotka.vimclojure.nails.NamespaceOfFile your_src.clj Does this give an exception? There were several threads in the past days just about this problem. Maybe check for them also. Sincerely Meikel smime.p7s 5KViewDownload --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: VimClojure 2.0.0 Exception while reading a .clj
Hi again, I did try using your install script, build with ant seems ok, but still get the same error: ./ng de.kotka.vimclojure.nails.NamespaceOfFile /home/steph/testsrc/ test.clj java.lang.ClassNotFoundException: de.kotka.vimclojure.nails.NamespaceOfFile at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at com.martiansoftware.nailgun.NGSession.run(Unknown Source) st...@stephane-laptop:~/src/vimclojure-2.0.0$ jar tf vimclojure.jar META-INF/ META-INF/MANIFEST.MF README.txt LICENSE.txt de/ de/kotka/ de/kotka/vimclojure/ de/kotka/vimclojure/backend.clj de/kotka/vimclojure/gencompletions.clj de/kotka/vimclojure/nails.clj de/kotka/vimclojure/repl.clj de/kotka/vimclojure/util.clj de/kotka/vimclojure/gencompletions$_main__5.class de/kotka/vimclojure/gencompletions$with_out_file__2.class de/kotka/vimclojure/gencompletions.class de/kotka/vimclojure/gencompletions__init.class de/kotka/vimclojure/util$fn__61.class de/kotka/vimclojure/util$fn__64.class de/kotka/vimclojure/util$fn__67$fn__70.class de/kotka/vimclojure/util$fn__67.class de/kotka/vimclojure/util$fn__75.class de/kotka/vimclojure/util$fn__78.class de/kotka/vimclojure/util$fn__81.class de/kotka/vimclojure/util$fn__87.class de/kotka/vimclojure/util$fn__90.class de/kotka/vimclojure/util$fn__93.class de/kotka/vimclojure/util$fn__96.class de/kotka/vimclojure/util$print_usage__36.class de/kotka/vimclojure/util$splitted_match__24$fn__26.class de/kotka/vimclojure/util$splitted_match__24$fn__30.class de/kotka/vimclojure/util$splitted_match__24.class de/kotka/vimclojure/util$str_cat__17.class de/kotka/vimclojure/util$str_cut__10.class de/kotka/vimclojure/util$str_wrap__13.class de/kotka/vimclojure/util$type_of_completion__84.class de/kotka/vimclojure/util$with_command_line_STAR___40$fn__44.class de/kotka/vimclojure/util$with_command_line_STAR___40.class de/kotka/vimclojure/util$with_command_line__55$fn__57.class de/kotka/vimclojure/util$with_command_line__55.class org/ org/apache/ org/apache/tools/ org/apache/tools/ant/ org/apache/tools/ant/ExitException.class com/ com/martiansoftware/ com/martiansoftware/nailgun/ com/martiansoftware/nailgun/builtins/ com/martiansoftware/nailgun/Alias.class com/martiansoftware/nailgun/AliasManager.class com/martiansoftware/nailgun/LongUtils.class com/martiansoftware/nailgun/NGConstants.class com/martiansoftware/nailgun/NGContext.class com/martiansoftware/nailgun/NGExitException.class com/martiansoftware/nailgun/NGInputStream.class com/martiansoftware/nailgun/NGOutputStream.class com/martiansoftware/nailgun/NGSecurityManager.class com/martiansoftware/nailgun/NGServer$NGServerShutdowner.class com/martiansoftware/nailgun/NGServer.class com/martiansoftware/nailgun/NGSession.class com/martiansoftware/nailgun/NGSessionPool.class com/martiansoftware/nailgun/NailStats.class com/martiansoftware/nailgun/ThreadLocalInputStream.class com/martiansoftware/nailgun/ThreadLocalPrintStream.class com/martiansoftware/nailgun/builtins/DefaultNail.class com/martiansoftware/nailgun/builtins/NGAlias.class com/martiansoftware/nailgun/builtins/NGClasspath.class com/martiansoftware/nailgun/builtins/NGServerStats.class com/martiansoftware/nailgun/builtins/NGStop.class com/martiansoftware/nailgun/builtins/NGVersion.class com/martiansoftware/nailgun/builtins/builtins.properties com/martiansoftware/nailgun/nailgun-version.properties My java version on Ubuntu 8.10: java -version java version 1.6.0_10 Java(TM) SE Runtime Environment (build 1.6.0_10-b33) Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode) Is it possible it's a security acces of the ng server? Thank you, Stéphane --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Promise for absense of side effects
On Mar 14, 1:08 pm, Meikel Brandmeyer m...@kotka.de wrote: I remember some presentation of someone doing this for, I think, Python. There you hint things, where the type is known and the compiler inferred the rest as far as possible. What cannot be inferred was cast to a special type called dynamic. So this roughly worked like type hints in Clojure. Just with a bit more inference and dynamic meaning reflection. Something like that would probably play nice with the JVM's future invokedynamic-instruction (or the .NET CLI's forthcoming dynamic vars). --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Dynamic loading of code (a la Python)?
On Mar 14, 11:44 am, Rock rocco.ro...@gmail.com wrote: Now, I would love to recode this stuff in Lisp, especially Clojure. But is it possible to pull this off? From what I've been reading, it actually doesn't seem like it. It's certainly possible to load in resource at runtime. Indeed, that's how Clojure's use, require and load functions work. However, I don't believe it's possible to apply a namespace only to a specific lexical scope. - James --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: filter1 interesting?
I've added a seek function to clojure.contrib.seq-utils: (defn seek Returns the first item of coll for which (pred item) returns logical true. Consumes sequences up to the first match, will consume the entire sequence and return nil if no match is found. [pred coll] (first (filter pred coll))) -Stuart Sierra --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Dynamic loading of code (a la Python)?
On Mar 14, 12:44 pm, Rock rocco.ro...@gmail.com wrote: Hi all. I've been working on a piece of code (an xml-rpc server) in Python (actually Jython), and one of its features is the capability of loading modules (connectors in Java) during runtime. Not only are these modules dynamically loaded on request (their names passed as arguments in a string), but they are only visible in the lexical scope of the specific method/function, the resources being released as soon as that same scope is left. Now, I would love to recode this stuff in Lisp, especially Clojure. But is it possible to pull this off? From what I've been reading, it actually doesn't seem like it. Loading namespaces and classes can be done fully dynamic at runtime (and this is actually the default behavior when you're not using the AOT-compilation capabilities of Clojure; regular late binding). To release the resources (classes loaded on demand), you'd have to use a dedicated classloader, since the JVM only unloads loaded classes when their classloader is GCd. As for lexically scoping loaded classes, is this a security issue or do you just want to avoid polluting the global namespace? --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: VimClojure 2.0.0 Exception while reading a .clj
Hi, Am 14.03.2009 um 16:16 schrieb stephaner: de/kotka/vimclojure/backend.clj de/kotka/vimclojure/nails.clj de/kotka/vimclojure/repl.clj These don't get compiled. There is definitively an error in the ant build. How do you invoce ant? Did you create the local.properties file as the README states? Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature
Re: VimClojure 2.0.0 Exception while reading a .clj
Hi again, There are some errors in the build process. First here is my local.properties clojure.jar=/home/stephane/src/clojure/clojure.jar clojure-contrib.jar=/home/stephane/src/clojure-contrib/clojure- contrib.jar nailgun-client=ng I did built it with either a single : ant and a build script: CLOJURE=/home/stephane/src/clojure/clojure.jar CLOJURECONTRIB=/home/stephane/src/clojure-contrib/clojure-contrib.jar NAILGUNCLIENT=ng VIMCLOJUREHOME=/home/stephane/opt/vimclojure-2.0.0 cp -r {autoload,doc,ftdetect,ftplugin,indent,syntax} /home/ stephane/.vim ant -Dnailgun-client=${NAILGUNCLIENT} -Dclojure.jar=${CLOJURE} - Dclojure-contrib.jar=${CLOJURECONTRIB} Building I get the following error: nailgun-server: [javac] Compiling 1 source file to /home/stephane/src/ vimclojure-2.0.0/classes [javac] Compiling 21 source files to /home/stephane/src/ vimclojure-2.0.0/classes [javac] Note: /home/stephane/src/vimclojure-2.0.0/src/com/ martiansoftware/nailgun/builtins/NGClasspath.java uses or overrides a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [copy] Copying 2 files to /home/stephane/src/vimclojure-2.0.0/ classes aot: [java] Compiling de.kotka.vimclojure.gencompletions to /home/ stephane/src/vimclojure-2.0.0/classes [java] Compiling de.kotka.vimclojure.util to /home/stephane/src/ vimclojure-2.0.0/classes [java] java.lang.Exception: Unable to resolve symbol: type in this context (util.clj:285) [java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute (ExecuteJava.java:194) [java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:764) [java] at org.apache.tools.ant.taskdefs.Java.executeJava (Java.java:218) [java] at org.apache.tools.ant.taskdefs.Java.executeJava (Java.java:132) [java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java: 105) [java] at org.apache.tools.ant.UnknownElement.execute (UnknownElement.java:288) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) [java] at java.lang.reflect.Method.invoke(Method.java:597) [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute (DispatchUtils.java:106) [java] at org.apache.tools.ant.Task.perform(Task.java:348) [java] at org.apache.tools.ant.Target.execute(Target.java:357) [java] at org.apache.tools.ant.Target.performTasks(Target.java: 385) [java] at org.apache.tools.ant.Project.executeSortedTargets (Project.java:1337) [java] at org.apache.tools.ant.Project.executeTarget (Project.java:1306) [java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets (DefaultExecutor.java:41) [java] at org.apache.tools.ant.Project.executeTargets (Project.java:1189) [java] at org.apache.tools.ant.Main.runBuild(Main.java:758) [java] at org.apache.tools.ant.Main.startAnt(Main.java:217) [java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java: 257) [java] at org.apache.tools.ant.launch.Launcher.main (Launcher.java:104) [java] Caused by: java.lang.Exception: Unable to resolve symbol: type in this context (util.clj:285) [java] at clojure.lang.Compiler.analyze(Compiler.java:4032) [java] at clojure.lang.Compiler.analyze(Compiler.java:3978) [java] at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java: 2756) [java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4190) [java] at clojure.lang.Compiler.analyze(Compiler.java:4017) [java] at clojure.lang.Compiler.analyze(Compiler.java:3978) [java] at clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:3678) [java] at clojure.lang.Compiler$TryExpr$Parser.parse (Compiler.java:1867) [java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4188) [java] at clojure.lang.Compiler.analyze(Compiler.java:4017) [java] at clojure.lang.Compiler.analyze(Compiler.java:3978) [java] at clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:3678) [java] at clojure.lang.Compiler$FnMethod.parse(Compiler.java: 3513) [java] at clojure.lang.Compiler$FnMethod.access$1100 (Compiler.java:3390) [java] at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2952) [java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4186) [java] at clojure.lang.Compiler.analyze(Compiler.java:4017) [java] at clojure.lang.Compiler.analyze(Compiler.java:3978) [java] at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java: 2756) [java] at
Re: VimClojure 2.0.0 Exception while reading a .clj
Hi I did get it working, I had to pull out of svn and rebuild clojure and clojure-contrib. Thank you everyone for your help, Stéphane On Mar 14, 11:53 am, stephaner stepha...@gmail.com wrote: Hi again, There are some errors in the build process. First here is my local.properties clojure.jar=/home/stephane/src/clojure/clojure.jar clojure-contrib.jar=/home/stephane/src/clojure-contrib/clojure- contrib.jar nailgun-client=ng I did built it with either a single : ant and a build script: CLOJURE=/home/stephane/src/clojure/clojure.jar CLOJURECONTRIB=/home/stephane/src/clojure-contrib/clojure-contrib.jar NAILGUNCLIENT=ng VIMCLOJUREHOME=/home/stephane/opt/vimclojure-2.0.0 cp -r {autoload,doc,ftdetect,ftplugin,indent,syntax} /home/ stephane/.vim ant -Dnailgun-client=${NAILGUNCLIENT} -Dclojure.jar=${CLOJURE} - Dclojure-contrib.jar=${CLOJURECONTRIB} Building I get the following error: nailgun-server: [javac] Compiling 1 source file to /home/stephane/src/ vimclojure-2.0.0/classes [javac] Compiling 21 source files to /home/stephane/src/ vimclojure-2.0.0/classes [javac] Note: /home/stephane/src/vimclojure-2.0.0/src/com/ martiansoftware/nailgun/builtins/NGClasspath.java uses or overrides a deprecated API. [javac] Note: Recompile with -Xlint:deprecation for details. [javac] Note: Some input files use unchecked or unsafe operations. [javac] Note: Recompile with -Xlint:unchecked for details. [copy] Copying 2 files to /home/stephane/src/vimclojure-2.0.0/ classes aot: [java] Compiling de.kotka.vimclojure.gencompletions to /home/ stephane/src/vimclojure-2.0.0/classes [java] Compiling de.kotka.vimclojure.util to /home/stephane/src/ vimclojure-2.0.0/classes [java] java.lang.Exception: Unable to resolve symbol: type in this context (util.clj:285) [java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute (ExecuteJava.java:194) [java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:764) [java] at org.apache.tools.ant.taskdefs.Java.executeJava (Java.java:218) [java] at org.apache.tools.ant.taskdefs.Java.executeJava (Java.java:132) [java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java: 105) [java] at org.apache.tools.ant.UnknownElement.execute (UnknownElement.java:288) [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [java] at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) [java] at java.lang.reflect.Method.invoke(Method.java:597) [java] at org.apache.tools.ant.dispatch.DispatchUtils.execute (DispatchUtils.java:106) [java] at org.apache.tools.ant.Task.perform(Task.java:348) [java] at org.apache.tools.ant.Target.execute(Target.java:357) [java] at org.apache.tools.ant.Target.performTasks(Target.java: 385) [java] at org.apache.tools.ant.Project.executeSortedTargets (Project.java:1337) [java] at org.apache.tools.ant.Project.executeTarget (Project.java:1306) [java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets (DefaultExecutor.java:41) [java] at org.apache.tools.ant.Project.executeTargets (Project.java:1189) [java] at org.apache.tools.ant.Main.runBuild(Main.java:758) [java] at org.apache.tools.ant.Main.startAnt(Main.java:217) [java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java: 257) [java] at org.apache.tools.ant.launch.Launcher.main (Launcher.java:104) [java] Caused by: java.lang.Exception: Unable to resolve symbol: type in this context (util.clj:285) [java] at clojure.lang.Compiler.analyze(Compiler.java:4032) [java] at clojure.lang.Compiler.analyze(Compiler.java:3978) [java] at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java: 2756) [java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4190) [java] at clojure.lang.Compiler.analyze(Compiler.java:4017) [java] at clojure.lang.Compiler.analyze(Compiler.java:3978) [java] at clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:3678) [java] at clojure.lang.Compiler$TryExpr$Parser.parse (Compiler.java:1867) [java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4188) [java] at clojure.lang.Compiler.analyze(Compiler.java:4017) [java] at clojure.lang.Compiler.analyze(Compiler.java:3978) [java] at clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:3678) [java] at clojure.lang.Compiler$FnMethod.parse(Compiler.java: 3513) [java] at clojure.lang.Compiler$FnMethod.access$1100 (Compiler.java:3390) [java] at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2952) [java] at
Re: VimClojure 2.0.0 Exception while reading a .clj
Hi, Am 14.03.2009 um 16:53 schrieb stephaner: [java] java.lang.Exception: Unable to resolve symbol: type in this context (util.clj:285) You are missing the type function, which was added in a recent SVN version (rev 1307). At the moment VimClojure relies on a more recent SVN revision. Please update at least to 1307 and try again. As soon as the magic 1.0 is released I will synchronise VimClojure with the Clojure releases. Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature
Re: Dynamic loading of code (a la Python)?
On Mar 14, 4:27 pm, pmf phil.fr...@gmx.de wrote: On Mar 14, 12:44 pm, Rock rocco.ro...@gmail.com wrote: Hi all. I've been working on a piece of code (an xml-rpc server) in Python (actually Jython), and one of its features is the capability of loading modules (connectors in Java) during runtime. Not only are these modules dynamically loaded on request (their names passed as arguments in a string), but they are only visible in the lexical scope of the specific method/function, the resources being released as soon as that same scope is left. Now, I would love to recode this stuff in Lisp, especially Clojure. But is it possible to pull this off? From what I've been reading, it actually doesn't seem like it. Loading namespaces and classes can be done fully dynamic at runtime (and this is actually the default behavior when you're not using the AOT-compilation capabilities of Clojure; regular late binding). To release the resources (classes loaded on demand), you'd have to use a dedicated classloader, since the JVM only unloads loaded classes when their classloader is GCd. As for lexically scoping loaded classes, is this a security issue or do you just want to avoid polluting the global namespace? Well, basically the way things are now, my jython xml-rpc server recieves a request to do a certain operation remotely (say on target foo) and consequently loads the specific connector (where I work, we call it an agent) to perform the operation, for instance a SOAP request for identity management and provisioning on a remote target. The module gets loaded in Python (Jython) something like this: proxy = __import__(name) # where name is a string proxy.doOperation(*args) After leaving the method where the above two lines of code are located, the module stored in proxy is no longer accessible, and the resources are released. That's cool because, even better than the namespace, you don't clutter your memory with unused modules. We've got around 50 agents at the moment, but we don't need to have them loaded in memory at the same time, but only on demand obviously. Rock --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: ANN: A pretty printer for Clojure
I just tried it, this is fantastic! We'll finally be able to debug macros while keeping our sanity. Many thanks for this and I hope it will be added directly into Clojure. On Mar 12, 3:05 am, Tom Faulhaber tomfaulha...@gmail.com wrote: I have now released the first version of my pretty printer as part of my cl-format library. It is released under the EPL. The pretty printer has two functions that you probably care about: (pprint obj) will pretty print the given object, and (pp) at the REPL will pretty print the last result output, i.e. the value in *1. The pretty printer currently supports two modes: simple and code. Simple mode prints structure in a standard way that's good for data. Code mode understands lots of Clojure forms (defn, binding vectors, condp, etc.) and attempts to print them in an idiomatic way. Cl-format is on github athttp://github.com/tomfaulhaber/cl-format. There is a Readme there with instructions, examples, limitations and futures. I won't even try to put examples here, because google groups wreaks havoc on formatting. The simplest way to get some pretty printing happiness: 1) Download the jar:http://github.com/tomfaulhaber/cl-format/raw/master/release/cl-format... 2) Put it in your classpath. 3) Fire up your REPL 4) (use 'com.infolace.format) 5) Use pprint and pp as described above. This is definitely a first release and there are sure to be bugs. And I know there are things missing. So let me know if you're having problems and I'll try to get things fixed up ASAP. Enjoy! Tom --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: filter1 interesting?
(first even? (iterate inc 1)) = 2 to me that sounds like something with real staying power ... like it should have always worked that way ... but I don't have much experience with lisp --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Dynamic loading of code (a la Python)?
On Mar 14, 5:06 pm, Rock rocco.ro...@gmail.com wrote: proxy = __import__(name) # where name is a string proxy.doOperation(*args) After leaving the method where the above two lines of code are located, the module stored in proxy is no longer accessible, and the resources are released. That's cool because, even better than the namespace, you don't clutter your memory with unused modules. We've got around 50 agents at the moment, but we don't need to have them loaded in memory at the same time, but only on demand obviously. The following might point into the direction you need. ;; simple function to get a fresh classloader (defn make-fresh-classloader [] (proxy [java.lang.ClassLoader] [])) ;; Global var, since we want something bindable (def *my-classloader*) ;; Use a fresh classloader in a binding-form (binding [*my-classloader* (make-fresh-classloader)] (comment Your code, in which the classes you want to be disposed later should be loaded via the fresh classloader, not via the system classloader)) Assuming you leak neither newly allocated Class-objects nor instances thereof outside the binding-block, the created classloader will be GCd (along with classes loaded by it) sometime after the binding-block has been executed (allocated Classe-objects retain a reference to their classloader, so leaking them would prevent the classloader from being GCd). --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: errors?
Try frequently doing: (use :reload 'fully.qualified.name.of.my.file) When you are interactively adding code to the REPL (by typing or through Slime or whatever) it doesn't know the line number. If you reload the file containing the offending code, it will. I usually have a comment block like this on the bottom of modules I'm working on: (comment (use :reload 'this.current.file) (use 'clojure.contrib.stacktrace) (e) (use 'clojure.contrib.trace) ) That way I can pop down there, reload the file, ensure that stacktrace is loaded, and run the (e) command (to show the exception) without any effort. On Sat, Mar 14, 2009 at 2:42 AM, Mark Engelberg mark.engelb...@gmail.comwrote: But how do you get rid of the (NO_SOURCE_FILE:0) messages for every single error? I'd really like to know the line number of the function that threw the error. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: design patterns for event driven applications
Hasn't someone been working on a Clojure vesion of Parsec? On Sat, Mar 14, 2009 at 4:31 AM, Christophe Grand christo...@cgrand.netwrote: Anatoly Yakovenko a écrit : basically i am dealing with a 3rd party library, (interactive brokers tws api), that takes an interface with lots of different methods that it calls when an event occurs. like received market data, received order, etc... It provides another interface that basically generates these events. Some of the events are statefull, like i canceled an order, i get a response that the order cancel was received, and then i get a confirmation that the order was canceled. If i was implementing this in haskell, (i am at the moment, but writing the bindings is a pain in the arse), i would pump all the events into a Chan, essentially a lazy evaluated sequence used to get stuff from IO, and write a parser on top of that. This first part is rather easy to port to Clojure, use a BlockingQueue to buffer events received by the callback interface: (def #^java.util.concurrent.BlockingQueue q (java.util.concurrent.LinkedBlockingQueue.)) and in your consumer thread, turn it into a sequence: (def s (repeatedly #(.take q))) ; (EOS handling is left as an exercise) For the parser part, I'm afraid there's no such thing right now. Maybe can you build upon Konrad's monads library? HTH Christophe -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.blogspot.com/ (en) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: design patterns for event driven applications
Hi, Am 14.03.2009 um 18:42 schrieb Jeffrey Straszheim: Hasn't someone been working on a Clojure vesion of Parsec? I started a port of Parsec, but it is not in a usable state. But there are alternatives like, eg. http://github.com/joshua-choi/fnparse Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature
Re: Clojure, swank-clojure, and Debian
On Mar 14, 5:42 am, Javier javu...@gmail.com wrote: Ok, I can answer myself, thanks to maacl in the IRC: Download clojure-mode: git clone git://github.com/jochu/clojure-mode.git And put this: (add-to-list 'load-path /path/to/clojure-mode) (require 'clojure-mode) in .emacs, restart, and M-x clojure-install. Really fantastic. The guide I tried to follow is just broken. Thank you. On 14 mar, 10:22, Javier javu...@gmail.com wrote: Hello, I'm trying to start learning Clojure, but I fail miserably at some point trying to get a decent IDE to work. - First, Enclojure for Netbeans has lot of bugs, it is inusable for me at this stage. - I'm not used to Eclipse nor Intellijea, so I discard both. - I'm used to Emacs, and have used Slime and SBCL with success before, but I must admit that it was too easy: all I had to do is apt-get install sbcl slime. So I found this guide: http://riddell.us/clojure/ It is for Ubuntu, but I do not see that the process could not be the same for Debian. I followed the entire guide, checked and rechecked everything. But when I want to start slime, I get: (add-classpath file:home/javi/program/clojure/swank-clojure/) (require 'swank.swank) (swank.swank/ignore-protocol-version 2009-03-09) (swank.swank/start-server /tmp/slime.20900 :encoding iso-latin-1- unix) Clojure user= nil user= java.lang.Exception: Unable to resolve symbol: lazy-seq in this context (core.clj:70) user= java.lang.Exception: No such var: swank.swank/ignore-protocol- version (NO_SOURCE_FILE:5) user= java.lang.Exception: No such var: swank.swank/start-server (NO_SOURCE_FILE:7) user= And Slime refuses to full start. I am just in the point of giving up and forget Clojure, so please help me. What I missed? Thank you. Yeah, sorry about that. Clojure continues to have breaking changes because it's still young, and SLIME refuses to have a stable release, so it's sometimes hard to coordinate the two. Welcome to the bleeding edge! Allen --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Question about IntelliJ Plugin
Hi Mark, The classpaths for the IntelliJ plugin are not quite setup properly. This is how I'm working around this. Clojure requires the folder that contains the clojure source code to be in the classpath. I did this in IntelliJ, by attaching a new library to the current project which points to the src folder of the project. Hope this helps -Patrick --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Bytecode optimization
Rich has done a lot of work to make sure that when you are working with primitives, the JVM bytecode ends up being very similar to what Java would generate. See http://clojure.org/java_interop#toc36 Thanks, Stu On Thu, Mar 12, 2009 at 6:20 PM, Howard Lewis Ship hls...@gmail.com wrote: Well, at some point I'll open up the code and check. Though I'll be overly tempted to write some comments, fix the indentation and write some tests if I do! On Thu, Mar 12, 2009 at 2:36 PM, Jarkko Oranen chous...@gmail.com wrote: On Mar 12, 11:15 pm, Howard Lewis Ship hls...@gmail.com wrote: I have to wonder a bit about the ability to optimize. Everything boils down to one of the seven or so basic forms. That's a lot of function calls to do even small things, like adding numbers. You might think that simple math would be optimized and inlined, but it isn't: Clojure user= (doc +) - clojure.core/+ ([] [x] [x y] [x y more]) Returns the sum of nums. (+) returns 0. nil user= (ns clojure.core) #Namespace clojure.core clojure.core= (defn + [x y] (* x y)) #'clojure.core/+ clojure.core= (+ 3 5) 15 clojure.core= This implies, to me, that Clojure is doing a full functional call, with dynamic lookup via the namespace, even for +. I think this is mistaken. Sure, for (+ foo bar) calls in the repl Clojure will do a full lookup, but if you have addition in a tight loop, the JVM should notice this and optimise it further. (I think Clojure also does some kind of caching.) You can also use type casts to make clojure use primitive instead of boxed math, bringing performance very close to Java. Now, it's probably true that the most straightforward Clojure implementation of an algorithm is likely not quite as fast as the Java equivalent, with a few tricks, you can often get pretty close. I don't have very in-depth knowledge of how Clojure handles these performance issues, but I believe your assumption is overly pessimistic. :) -- Jarkko -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Performance tips for Clojure
There is a interface 'Counted' that a lot of Clojure data structures implement to indicate that they provide O(1) for (count). Thanks, Stu On Fri, Mar 13, 2009 at 4:59 AM, Christophe Grand christo...@cgrand.netwrote: Christian Vest Hansen a écrit : I think that count is O(n) for lists, no? Count is O(1) for lists but O(n) for a chain of conses. Clojure user= (let [l (apply list (range 10))] (time (dotimes [_ 100] (count l Elapsed time: 169.710116 msecs nil user= (let [l (apply list (range 40))] (time (dotimes [_ 100] (count l Elapsed time: 167.664046 msecs nil user= (let [l (reduce #(cons %2 %1) nil (range 10))] (time (dotimes [_ 100] (count l Elapsed time: 662.121862 msecs nil user= (let [l (reduce #(cons %2 %1) nil (range 100))] (time (dotimes [_ 100] (count l Elapsed time: 5316.110567 msecs nil -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.blogspot.com/ (en) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: errors?
Try frequently doing: all of this sounds like it would be great if i understood enough of it all to make some patches to the source code -- it strikes me as rather newbie-unfriendly the way it currently all works. $0.02. sincerely. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Question about IntelliJ Plugin
Oops, my bad. Could you create appropriate ticket for us to fix it? With best regards, Ilya 2009/3/14 CuppoJava patrickli_2...@hotmail.com Hi Mark, The classpaths for the IntelliJ plugin are not quite setup properly. This is how I'm working around this. Clojure requires the folder that contains the clojure source code to be in the classpath. I did this in IntelliJ, by attaching a new library to the current project which points to the src folder of the project. Hope this helps -Patrick --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Main Function for Program Entry Point
Is it a good idea or a bad idea to provide a main() function as the program's entry point? As an example, I have a program at http://is.gd/ndTV. If you look at the bottom you'll see (unless and until I change it) the specification of a main function, and then a call to it. I'm aware that I could just list the contents of main() outside any function, and it would work the same way. So which approach is better, and why? Thanks, Keith --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: What is Clojure NOT good for?
i really am curious about how good clojure can be as a language for prototyping new *languages* (and new paradigms). this has always been a strength of lisp and scheme, but they both support imperative as well as functional programming. as an example: how easy would it be to implement a language like Processing in clojure? i am not saying it is impossible (or even hard). i just honestly do not know. and would be very helpful to hear what others think. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---