Re: defrecord with default values
Hi, first of all we should start with the form we finally want to have: (defrecord Foo [a b c]) (defn make-Foo [ {:keys [a b c] :or {a :x c :z}}] (Foo. a b c)) ; Use as: (make-Foo :b :f) = (Foo. :x :f :z) The only annoying part is the boilerplate of defining make-Foo. What we would like to write is: (defrecord+ Foo [[a :x] b [c :z]]) So how do we get from the lower form to the upper form? Basically you have that already, but you should not make the constructor a macro, but a function. General note: You want to use almost always vectors instead of lists to group things. Vectors are the Right Tool here. Lists are much less in important in Clojure than in other Lisp-like languages. Besides their role in code representation. (Note: a seq is not a list) Then we have to define the constructor function. Here we exploit the old new operator to save us from modifying the type symbol. Well, and that's basically it. There is no need for eval and related dark magic. (defmacro defrecord+ [record-name fields-and-values record-body] (let [fields-and-values (map #(if (vector? %) % [% nil]) fields-and- values) fields(vec (map first fields-and-values)) default-map (into {} fields-and-values)] `(do (defrecord ~record-name ~fields ~...@record-body) (defn ~(symbol (str make- (name record-name))) [ {:keys ~fields :or ~default-map}] (new ~record-name ~...@fields) And the result: user= (defrecord+ Foo [[a :x] b [c :z]]) #'user/make-Foo user= (make-Foo :b :f) #:user.Foo{:a :x, :b :f, :c :z} user= (macroexpand-1 '(defrecord+ Foo [[a :x] b [c :z]])) (do (clojure.core/defrecord Foo [a b c]) (clojure.core/defn make-Foo [ {:or {a :x, b nil, c :z}, :keys [a b c]}] (new Foo a b c))) (macroexpand output formatted for readability) This can be easily extended, that the constructor also allows arbitrary other keywords, besides the usual defined fields. This is left to the astute reader as an excerise. ;) Hint: there is also :as in destructuring. Bottom line: Avoid macros at all cost! If a function does the job, use a function! They are easier to write, can be passed around, can be apply'd, ... Hope this helps. Sincerely Meikel -- 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 your first post. 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: Documentation tools
Hey Mark, I don't know of any publicly available tools besides autodoc. My understanding is that Zack was keeping the source to clojuredocs closed, at least for now. While I assume his extraction code is in Clojure, the actual clojuredocs presentation code is a Ruby on Rails app [1] Whether autodoc is the right basis for what you would like depends on exactly what you would like. The issue of running on Windows is a red herring. While it does have bugs on Windows, I don't think they'd be difficult to fix. They seem to mostly be of the form of not using path separators correctly and being disciplined enough about using java.io.File instead of just hacking up file name strings. A motivated user should be able to get it all working pretty quickly, I would think (patches very welcome!). It's on my list to do, but I haven't gotten to it yet. The real issue is whether you want information in comments, in formatted docstrings or in non-docstring metadata. Since docstrings are already metadata and I didn't want to mess with their usability in other contexts, I took the last approach. I don't think putting the info in comments (as naturaldocs does) would really be in the Clojure style. Having a tool that detected standard formatting in doc strings seems like the right way to go to me. The trick would be finding a format that wasn't ugly or confusing to people accessing docstrings another way (like from Slime or the REPL). Examples, on the other hand, might go better in a separate metadata field. Hmmm... All of this should be possible to build on top of autodoc fairly easily. Autodoc basically has four parts: - collect-info walks the source tree (by loading each file in turn) and returns a structure describing the public variable it found there, organized by namespace. - build-html generates a directory of html (and optionally a JSON index) based on this data. - The HTML templates, CSS files and images used to create the default format used on clojure.github.com/clojure. These are all replaceable as long as you keep the tags that the build-html code uses (assuming you want that information). - the rest of the goop deals with the nastiness of automating git interactions, creating doc trees that span branches, handling the fact that the program is written in Clojure and also used to document multiple, incompatible versions of Clojure, generate supporting docs written using markdown, etc. Two easy things to do would be: - Recognize additional metadata fields in collect info and use them in build-html (category markers, for instance), or - After collect-info, parse the docstrings themselves and add elements to the generated structures to represent docstring-embedded data. Then use that in build-html. Note that if you want to pull info from comments, autodoc probably isn't the right tool since it's driven completely from the compiled namespaces and metadata. I am happy to see people fork autodoc[2] and twist it to their own vision of what makes great documentation. This is a nice area in which to improve stuff. I'll happily integrate changes that fit the main mission of autodoc. Enjoy, Tom [1] http://groups.google.com/group/clojure/browse_thread/thread/a97d472679f2cade/53eec6db0ca0c82f?lnk=gstq=clojuredocs+ruby#53eec6db0ca0c82f [2] Here it is: http://github.com/tomfaulhaber/autodoc -- 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 your first post. 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: Binding and temporary global state
On 6 September 2010 23:22, Cameron Pulsford cpuls...@gmail.com wrote: [...] Changing my declares to defs did the trick did though and learning Does this break it again? (do (def *macros*)) Because that's all that declare does: user= (macroexpand-1 '(declare *macros*)) (do (def *macros*)) -- Michael Wood esiot...@gmail.com -- 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 your first post. 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: Documentation tools
Docstrings seem designed for fairly terse comments about the nature of the function. It's great for providing little hints about how the function works to jog one's memory by typing (doc ...) in the REPL, or for searching with find-doc. But I just don't think I can fit the kind of full documentation I want all into a docstring without ruining its REPL usefulness. My instinct is to put those sorts of things into comments. I think adding a huge Clojure metadata map in front of the var would hinder code readability. Hmmm, I wonder if maybe there would be a way to use a macro to add metadata to the var separate from the function? E.g., (document my-function metadata) That might make the metadata approach more palatable... As a side note, I wish Clojure had some sort of block commenting capability. Both (comment ...) and #_ require well formed code to follow and sometimes it's just nice to be able to comment out a block of text. -- 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 your first post. 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: Documentation tools
Hi, 2010/9/7 Mark Engelberg mark.engelb...@gmail.com: Docstrings seem designed for fairly terse comments about the nature of the function. It's great for providing little hints about how the function works to jog one's memory by typing (doc ...) in the REPL, or for searching with find-doc. But I just don't think I can fit the kind of full documentation I want all into a docstring without ruining its REPL usefulness. Indeed. Though the docstring for e.g. gen-class is quite extensive and could serve as a counter-example. Javadoc has an interesting property: it considers that the first sentence serves as a summary for the doc. The sentence delimiter is just the point in the case of javadoc. Out of my head: instead of writing doc in several places, maybe something like that could be used. it could be associated with some clojure.core/*short-docstring* global var that (doc), (find-doc) could use for displaying the short or full form ? My instinct is to put those sorts of things into comments. I think adding a huge Clojure metadata map in front of the var would hinder code readability. Hmmm, I wonder if maybe there would be a way to use a macro to add metadata to the var separate from the function? E.g., (document my-function metadata) That might make the metadata approach more palatable... Sure. A lot of things are already placed as metadata of the var and not of the function the var is holding, anyway. As a side note, I wish Clojure had some sort of block commenting capability. Both (comment ...) and #_ require well formed code to follow and sometimes it's just nice to be able to comment out a block of text. I remember having seen #| |# block commenting reader macro to be on the todo list of Rich, many months ago. -- 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 your first post. 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: agents, await and Swing thread
Just a quick thought (and before I've had my coffee no less!), but I think what I'd do is replace the boolean *end-search* with a *search-state* var that could be either :idle, :running or :stopping. Then in search-stops, just set *search-state* to :stopping -- you don't need to actually wait for the agents to finish, you just need to know that the current condition is waiting for the search to end so you don't quit the app or start a new search until the cleanup is finished. Then when you do hit some task that needs to wait until the agents are done, you can go ahead and await the agents (i.e. if you're quitting and it doesn't matter if there's a hang), or spawn a thread that will await the agents before starting the new search. You could also run a cleanup thread that would check the state of your search agents and set the *search-state* from :stopping back to :idle once all the search agents had finished. Mark -- 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 your first post. 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: external clojure lib
Hello Sunil , Using windows xp , just got into clojure , not much knowledge Thanks AV On Sep 6, 8:00 pm, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hi Abraham, Make sure that the jar file of the external library you are referring to is in path. If you are developing clojure code .. I would strongly advice you to use leiningen which takes care of a lot of these things for you. Btw. what is the development environment you are using? .. Try to be a little more elaborate when you ask questions like these.. Sunil. On Mon, Sep 6, 2010 at 3:50 PM, Abraham Varghese vincent@gmail.comwrote: Dear all , How to get external clojure libs workng in my system? like clojure.contrib , etc? Thanks in advance AV -- 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 your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=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 Note that posts from new members are moderated - please be patient with your first post. 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: clojure Image/video processing?
I'd be happy to show my frame-hash implementation as long as you won't laugh too hard at it. I'll throw it up on github sometime soon after I clean it up a bit. I like it because a video treated as just a sequence of hash-maps which flows through an image processing pipeline. Sounds excellent - please post it at your earliest convenience :) I have to say I've been surprised at the state of video in java. It's time to make it better with a clojure library devoted to pulling together the best of all these different methods. Sounds good to me. I'm just starting on a rather complex project pulling in (currently) webcam input and processing the video, and need access to this anyway. If there's nothing out there, time to roll up my sleeves and get on it. Let me know if you're looking to start on it any time soon. -- Sean Grove -- 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 your first post. 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: agents, await and Swing thread
On Sep 6, 5:48 pm, K. kotot...@gmail.com wrote: Hello, I've got a concurrency problem and it's not really clear to me how to solve it. I have a Swing GUI doing a search in background with agents and the results are displayed one after the other, also in background. Here is, largely simplified, how I do it: (defvar- *end-search* (atom false)) ;; this will be called from a Swing listener, when the user clicks on the 'Search' button ;; so this is called from the swing thread (defn on-search-begins [] ;; (reset! *end-search* false) (send *search-agent* do-search)) (defn do-search [state] ;; while (deref *end-search*) is false and while there are results for the search, do (do-swing ;; we are not in a swing thread within the agent, so we need to call do-swing (display-result swingview result) ;; search ends? yes, then (do-swing (display-search-is-ended swingview))) When the user clicks on the 'Stop' button, the following function will be called from the Swing thread: (defn search-stops [] (reset! *end-search* true) ;; NOW we need to wait for the agents to stop (await *search-agent*)) The problem is: the call to await results in a deadlock. I suspect this is because the call to await is made from the Swing thread, and once the value of the *end-search* atom is set to true the agent try to access the Swing thread but can't because the thread is waiting. What solution would you propose to solve this problem? My 2 cents: move the processing of user actions off the Swing thread (the EDT) and leave there only the stuff that interacts with the GUI (which I suppose is what your do-swing already does). Even without a deadlock it's bad practice to make long blocking calls in the EDT because that will freeze the GUI. -- 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 your first post. 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
Leiningen + dropbox
Hello, I am trying to set up an env that would be hosted on my dropbox or usb stick so i can access it anywhere. Problem is that it works at home, but at work lein deps is unable to fetch the jars. C:\TEMP\My Dropbox\dev\hello-wwwlein deps Downloading: org/clojure/clojure/1.2.0/clojure-1.2.0.pom from central Downloading: org/clojure/clojure/1.2.0/clojure-1.2.0.pom from clojure and so on, and maven exceptions at the end. I have write access only to Temp directory. Where lein is keeping its stuff that it downloads? Or maybe some network access issue? Any ideas how i can check for that? Best regards, Karol Adamiec -- 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 your first post. 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: agents, await and Swing thread
Hi, Several questions / thoughts: 2010/9/6 K. kotot...@gmail.com: Hello, I've got a concurrency problem and it's not really clear to me how to solve it. I have a Swing GUI doing a search in background with agents and the results are displayed one after the other, also in background. Here is, largely simplified, how I do it: (defvar- *end-search* (atom false)) ;; this will be called from a Swing listener, when the user clicks on the 'Search' button ;; so this is called from the swing thread (defn on-search-begins [] ;; (reset! *end-search* false) (send *search-agent* do-search)) Mmm, an agent without state always rings a bell in my head. There's a smell of abuse of the agent concept here. Aren't you just using it for its commodity to start a new thread. If so, you could as well just use a future, for example, and then you'll have simpler semantics. Or you could just (Thread/start) your fn (but then you introduce java clearly in the code, so maybe just using a future is the right balance). Agents carry with them a lot of semantics, so readers of you code may have unsatisfied expectations on your usage ... until they get it and think: ok it's just an 'agent abuse'. (defn do-search [state] ;; while (deref *end-search*) is false and while there are results for the search, do (do-swing ;; we are not in a swing thread within the agent, so we need to call do-swing (display-result swingview result) As said by others, I suppose result is computed outside the do-swing form so that the Swing thread is blocked as few as possible ;; search ends? yes, then (do-swing (display-search-is-ended swingview))) When the user clicks on the 'Stop' button, the following function will be called from the Swing thread: (defn search-stops [] (reset! *end-search* true) ;; NOW we need to wait for the agents to stop (await *search-agent*)) It would be interested to know in the first place why you have to add this call to await at all ? Anyway, to just answer your question, maybe your (display-search-is-ended swingview) call could be placed right after the (await) call, but in another thread ? As in (defn search-stops [] (reset! *end-search* true) (future (await *search-agent*) (display-search-is-ended swingview))) But all in all, I'm not sure the overall smells indicate that there must be another way, probably radically differently structured, to do all this. I'm thinking about something with watchers on refs / atoms... -- 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 your first post. 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: Leiningen + dropbox
Solved. The problem was maven proxy settings. After adding settings.xml file to home works like a charm. I am answering here for future googlers. Best regards, Karol Adamiec On Tue, Sep 7, 2010 at 12:44 PM, Karol Adamiec karol.adam...@gmail.comwrote: Hello, I am trying to set up an env that would be hosted on my dropbox or usb stick so i can access it anywhere. Problem is that it works at home, but at work lein deps is unable to fetch the jars. C:\TEMP\My Dropbox\dev\hello-wwwlein deps Downloading: org/clojure/clojure/1.2.0/clojure-1.2.0.pom from central Downloading: org/clojure/clojure/1.2.0/clojure-1.2.0.pom from clojure and so on, and maven exceptions at the end. I have write access only to Temp directory. Where lein is keeping its stuff that it downloads? Or maybe some network access issue? Any ideas how i can check for that? Best regards, Karol Adamiec -- 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 your first post. 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
can't def m-bind because namespace
java.lang.Exception: Name conflict, can't def m-bind because namespace: user refers to:#'clojure.contrib.monads/m-bind What namespace help doc. should I read to resolve this issue ? Maybe I should not read about monads first. -- 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 your first post. 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: can't def m-bind because namespace
http://clojure.org/namespaces You should require clojure.contrib.monad and bot use it. (ns my-namespace (:require (clojure.contrib.monad :as m)) m/m-bind, for example. Then you can define your own m-bind without conflict with an existing one. On Tue, Sep 7, 2010 at 1:13 PM, MohanR radhakrishnan.mo...@gmail.com wrote: java.lang.Exception: Name conflict, can't def m-bind because namespace: user refers to:#'clojure.contrib.monads/m-bind What namespace help doc. should I read to resolve this issue ? Maybe I should not read about monads first. -- 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 your first post. 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 -- 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 your first post. 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: defrecord with default values
Awesome! Thanks so much! Anthony On Sep 7, 2:10 am, Meikel Brandmeyer m...@kotka.de wrote: Hi, first of all we should start with the form we finally want to have: (defrecord Foo [a b c]) (defn make-Foo [ {:keys [a b c] :or {a :x c :z}}] (Foo. a b c)) ; Use as: (make-Foo :b :f) = (Foo. :x :f :z) The only annoying part is the boilerplate of defining make-Foo. What we would like to write is: (defrecord+ Foo [[a :x] b [c :z]]) So how do we get from the lower form to the upper form? Basically you have that already, but you should not make the constructor a macro, but a function. General note: You want to use almost always vectors instead of lists to group things. Vectors are the Right Tool here. Lists are much less in important in Clojure than in other Lisp-like languages. Besides their role in code representation. (Note: a seq is not a list) Then we have to define the constructor function. Here we exploit the old new operator to save us from modifying the type symbol. Well, and that's basically it. There is no need for eval and related dark magic. (defmacro defrecord+ [record-name fields-and-values record-body] (let [fields-and-values (map #(if (vector? %) % [% nil]) fields-and- values) fields (vec (map first fields-and-values)) default-map (into {} fields-and-values)] `(do (defrecord ~record-name ~fields �...@record-body) (defn ~(symbol (str make- (name record-name))) [ {:keys ~fields :or ~default-map}] (new ~record-name ~...@fields) And the result: user= (defrecord+ Foo [[a :x] b [c :z]]) #'user/make-Foo user= (make-Foo :b :f) #:user.Foo{:a :x, :b :f, :c :z} user= (macroexpand-1 '(defrecord+ Foo [[a :x] b [c :z]])) (do (clojure.core/defrecord Foo [a b c]) (clojure.core/defn make-Foo [ {:or {a :x, b nil, c :z}, :keys [a b c]}] (new Foo a b c))) (macroexpand output formatted for readability) This can be easily extended, that the constructor also allows arbitrary other keywords, besides the usual defined fields. This is left to the astute reader as an excerise. ;) Hint: there is also :as in destructuring. Bottom line: Avoid macros at all cost! If a function does the job, use a function! They are easier to write, can be passed around, can be apply'd, ... Hope this helps. Sincerely Meikel -- 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 your first post. 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: can't def m-bind because namespace
On Tue, Sep 7, 2010 at 2:13 PM, MohanR radhakrishnan.mo...@gmail.com wrote: Maybe I should not read about monads first. ...and report your findings here or blog somewhere if you don't mind :) I've been reading a lot about monads lately and can't get my head around it yet so any help appreciated (I'm coming from Java and Clojure is my first real functional language - that's why it causes headaches, I believe). Jacek -- Jacek Laskowski Notatnik Projektanta Java EE - http://jaceklaskowski.pl http://twitter.com/jaceklaskowski -- 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 your first post. 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: Extending Clojure's STM with external transactions
On Sep 5, 8:56 pm, Alyssa Kwan alyssa.c.k...@gmail.com wrote: Any thoughts on how to marshal functions? What about vars and dynamic binding? I don't think marshaling closures will ever happen without changes to Clojure itself. I haven't looked into how much work it would require, or how much it would impact Clojure's performance. It always seemed like an excessively lofty goal anyway: if I could save plain Clojure data structures (all primitives, all fully-evaluated collections, and all records), I would be happy with it. In truth, I always wanted to extend Cupboard to support some kind of semi-magical distributed storage (like Oracle Coherence, but with better persistence guarantees — database-like rather than cache-like), but wanted to get single-node basics working properly first. The latest BDB JE has some replication built-in, and I planned to use it. As for dynamic binding, I'm not sure what you mean. The bound value will evaluate using Clojure's normal rules when cupboard.core/make- instance runs, and go into the database. cupboard.core/query will then read it and make the value part of the returned map (it should really be a Clojure 1.2 record). The code doesn't do anything except save and restore fully-evaluated data structures. Incidentally, Cupboard wraps BDB transactions, and does not attempt to work with Clojure's STM subsystem. I always considered this a weakness, but a difficult one to resolve. To counterbalance it, I planned to avoid mixing STM and on-disk data structures in the same code. -- 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 your first post. 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: can't def m-bind because namespace
On Tue, Sep 7, 2010 at 4:04 PM, Nicolas Oury nicolas.o...@gmail.com wrote: Hope that helps. It did. Thanks. Would you share some examples of its use in Clojure apps? I'd love seeing more examples where a monad-based solution is contrasted/compared to its more traditional, common approach. I wonder why monads are not extensively used? Is the category theory the reason to its little use (= people don't understand monads' value?). Jacek -- Jacek Laskowski Notatnik Projektanta Java EE - http://jaceklaskowski.pl -- 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 your first post. 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: Typical usage of Compojure
On 5 September 2010 20:53, HB hubaghd...@gmail.com wrote: It is public idea in Ruby community that Sinatra is best used for rapid prototyping and creating API for web application. This opinion tends to come from developers used to larger web frameworks like Ruby on Rails. I don't agree with this. RoR makes certain assumptions about what you want to build, and doesn't work well if you're doing something different. There is also a trend away from large frameworks that do everything, to modular frameworks that allow you to pick and choose. Look at Rails 3; they've factored out a lot of ActiveRecord into the more generic ActiveModel interface, and a lot of their server code has been removed and instead replaced with greater Rack integration. Web development in Clojure is tending toward this ideal. One has a basic framework that abstracts the underlying HTTP server (Ruby has Rack, Clojure has Ring), and then different libraries are used to augment that. The end result is the same, but you have more choice in how you put your application. That said, choice isn't always good, and I expect at some point people will create a thin layer that pulls together several libraries and a directory structure. For example, Leiningen, Compojure, Ring, Hiccup and Carte have equivalent functionality to most of Ruby on Rails. - 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 Note that posts from new members are moderated - please be patient with your first post. 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: can't def m-bind because namespace
Monads are mostly used because they are necessary in Haskell. In Clojure the urgent need is not there. However, you can sure get some cleaner and/or more composable code if you use monads in your advantage. 2010/9/7 Jacek Laskowski ja...@laskowski.net.pl: On Tue, Sep 7, 2010 at 4:04 PM, Nicolas Oury nicolas.o...@gmail.com wrote: Hope that helps. It did. Thanks. Would you share some examples of its use in Clojure apps? I'd love seeing more examples where a monad-based solution is contrasted/compared to its more traditional, common approach. I wonder why monads are not extensively used? Is the category theory the reason to its little use (= people don't understand monads' value?). Jacek -- Jacek Laskowski Notatnik Projektanta Java EE - http://jaceklaskowski.pl -- 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 your first post. 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 -- Linux-user #496644 (http://counter.li.org) - first touch of linux in 2004 Demandoj en aŭ pri Esperanto? Questions about Esperanto? Vragen over Esperanto? Perguntas sobre o Esperanto? - http://demandoj.tk -- 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 your first post. 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: Documentation tools
Perhaps you would be interested in postdoc: http://github.com/markmfredrickson/postdoc Postdoc allows structured documentation, runnable examples, and related items based on namespaced identifiers. One was to allow for separate files that included the documentation away from the code, so as not to clutter up the source with more information than necessary. Coders still write short doc strings. Additional information is included in a separate namespace and is only an (import ...) away. E.g. --- foo.clj (ns foo) (def add1 adds one to its argument [x] (+ 1 x)) (def add2 adds two to its argument [x] (add1 (add1 x))) --- foo/doc.clj (ns foo.doc (:use postdoc)) (postdoc add1 :examples [; (add1 3) = 4\\n(add1 3)] :categories [:example-functions :arithmetic] :references [[Wikipedia Entry http://en.wikipedia.org/wiki/ Foo] http://www.example.com;] :see-also [#'add2]) Right now, the postdoc function stuffs everything into the docstring, but it would be easy enough to have a global option for that and an (extended-doc) function to spit out the additional info on request. I started this project was to make the Incanter docs accessible to scrapping. It is an example of another large project that is well documented. The docs are detailed and comprehensive, but contained entirely in docstrings (usually well structured). I spent some time moving them over to the postdoc format, but I haven't pushed the Incanter community to accept the postdoc format. Here's an example of a real file, documented: http://github.com/markmfredrickson/incanter/blob/postdoc/modules/incanter-core/src/incanter/doc/core.clj -Mark On Sep 7, 3:25 am, Mark Engelberg mark.engelb...@gmail.com wrote: Docstrings seem designed for fairly terse comments about the nature of the function. It's great for providing little hints about how the function works to jog one's memory by typing (doc ...) in the REPL, or for searching with find-doc. But I just don't think I can fit the kind of full documentation I want all into a docstring without ruining its REPL usefulness. My instinct is to put those sorts of things into comments. I think adding a huge Clojure metadata map in front of the var would hinder code readability. Hmmm, I wonder if maybe there would be a way to use a macro to add metadata to the var separate from the function? E.g., (document my-function metadata) That might make the metadata approach more palatable... As a side note, I wish Clojure had some sort of block commenting capability. Both (comment ...) and #_ require well formed code to follow and sometimes it's just nice to be able to comment out a block of text. -- 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 your first post. 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: external clojure lib
still i am not getting , i meant to say that , i want to use clojure.contrib. libraries , how to make it work with my system . from where this lib has to copied and which directory to copy... may be lib is clj's files Anybody' Thanks in advance AV On Sep 7, 11:02 am, Abraham Varghese vincent@gmail.com wrote: Hello Sunil , Using windows xp , just got into clojure , not much knowledge Thanks AV On Sep 6, 8:00 pm, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hi Abraham, Make sure that the jar file of the external library you are referring to is in path. If you are developing clojure code .. I would strongly advice you to use leiningen which takes care of a lot of these things for you. Btw. what is the development environment you are using? .. Try to be a little more elaborate when you ask questions like these.. Sunil. On Mon, Sep 6, 2010 at 3:50 PM, Abraham Varghese vincent@gmail.comwrote: Dear all , How to get external clojure libs workng in my system? like clojure.contrib , etc? Thanks in advance AV -- 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 your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=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 Note that posts from new members are moderated - please be patient with your first post. 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: Documentation tools
Hi, I'd recommend looking at how plt-scheme solved this problem (see [1]). They actually defined alternative readers in which either prose or code can be the default input mechanism (with the other escaped in some way). I don't know if Clojure's reading system is quite flexible enough to support something like this. In the case of Clojure's documentation it seems the main decision is whether the extended documentation and examples should live intermingled with the source code, or should later be applied to the core function symbols from some external location. Cheers -- Eric Also, Probably not appropriate to the immediate need at hand, but (to self promote) if you happen to use Emacs and you would like a robust literate-programming / reproducible-research tool for Clojure, Org-mode now supports weaving, tangling, and inline execution of embedded code [2] in many languages [3] including Clojure [4]. Laurent PETIT laurent.pe...@gmail.com writes: Hi, 2010/9/7 Mark Engelberg mark.engelb...@gmail.com: Docstrings seem designed for fairly terse comments about the nature of the function. It's great for providing little hints about how the function works to jog one's memory by typing (doc ...) in the REPL, or for searching with find-doc. But I just don't think I can fit the kind of full documentation I want all into a docstring without ruining its REPL usefulness. Indeed. Though the docstring for e.g. gen-class is quite extensive and could serve as a counter-example. Javadoc has an interesting property: it considers that the first sentence serves as a summary for the doc. The sentence delimiter is just the point in the case of javadoc. Out of my head: instead of writing doc in several places, maybe something like that could be used. it could be associated with some clojure.core/*short-docstring* global var that (doc), (find-doc) could use for displaying the short or full form ? My instinct is to put those sorts of things into comments. I think adding a huge Clojure metadata map in front of the var would hinder code readability. Hmmm, I wonder if maybe there would be a way to use a macro to add metadata to the var separate from the function? E.g., (document my-function metadata) That might make the metadata approach more palatable... Sure. A lot of things are already placed as metadata of the var and not of the function the var is holding, anyway. As a side note, I wish Clojure had some sort of block commenting capability. Both (comment ...) and #_ require well formed code to follow and sometimes it's just nice to be able to comment out a block of text. I remember having seen #| |# block commenting reader macro to be on the todo list of Rich, many months ago. Footnotes: [1] http://lambda-the-ultimate.org/node/4017 http://docs.racket-lang.org/scribble/index.html [2] http://orgmode.org/worg/org-contrib/babel/index.php [3] http://orgmode.org/worg/org-contrib/babel/languages.php#langs [4] http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.php -- 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 your first post. 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: JSON lib of choice?
On Mon, Sep 6, 2010 at 19:50, Wilson MacGyver wmacgy...@gmail.com wrote: I figure enough time has passed that I want to bring this up again. For JSON, are you using clojure.contrib.json or clj-json? Why? We use org.danlarkin.json, because it encodes and decodes (contrib.json didn't when we made our decision) and it was the first hit in the google listings for clojure json. If anyone gets around to doing some real world perf analysis and there is a significant winner then we may switch. -- 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 your first post. 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: external clojure lib
You've seen a lot of recommendations for Leiningen. I suggest you try it out: everyone seems to think it will solve your problem (Hint: it will). But even if you have no idea what it is, the fact that everyone is suggesting it means you should try it out before you simply repeat the question you've asked already. On Sep 7, 8:36 am, Abraham vincent@gmail.com wrote: still i am not getting , i meant to say that , i want to use clojure.contrib. libraries , how to make it work with my system . from where this lib has to copied and which directory to copy... may be lib is clj's files Anybody' Thanks in advance AV On Sep 7, 11:02 am, Abraham Varghese vincent@gmail.com wrote: Hello Sunil , Using windows xp , just got into clojure , not much knowledge Thanks AV On Sep 6, 8:00 pm, Sunil S Nandihalli sunil.nandiha...@gmail.com wrote: Hi Abraham, Make sure that the jar file of the external library you are referring to is in path. If you are developing clojure code .. I would strongly advice you to use leiningen which takes care of a lot of these things for you. Btw. what is the development environment you are using? .. Try to be a little more elaborate when you ask questions like these.. Sunil. On Mon, Sep 6, 2010 at 3:50 PM, Abraham Varghese vincent@gmail.comwrote: Dear all , How to get external clojure libs workng in my system? like clojure.contrib , etc? Thanks in advance AV -- 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 your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.comclojure%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=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 Note that posts from new members are moderated - please be patient with your first post. 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: external clojure lib
On Tue, 7 Sep 2010 08:36:27 -0700 (PDT) Abraham vincent@gmail.com wrote: still i am not getting , i meant to say that , i want to use clojure.contrib. libraries , how to make it work with my system . from where this lib has to copied and which directory to copy... may be lib is clj's files As other have pointed out, the usual way to deal with this is with java infrastructure tools (maven and leiningen) or your IDE. If you really want to start using clojure without having to deal with the java infrastructure, my writeup at http://www.mired.org/home/mwm/papers/simple-clojure.html covers the basics. I've recently updated it to include data on generating jar files, more for completeness sake than anything else, as you wouldn't want to do that on a regular basis. mike -- Mike Meyer m...@mired.org http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O ascii ribbon campaign - stop html mail - www.asciiribbon.org -- 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 your first post. 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: Documentation tools
On Tue, Sep 7, 2010 at 1:25 AM, Mark Engelberg mark.engelb...@gmail.com wrote: Docstrings seem designed for fairly terse comments about the nature of the function. It's great for providing little hints about how the function works to jog one's memory by typing (doc ...) in the REPL, or for searching with find-doc. I think this is true of function-level docstrings. However, don't forget that namespaces can have docstrings as well. That's where I like to put overview-type documentation. Javadoc has an interesting property: it considers that the first sentence serves as a summary for the doc. The sentence delimiter is just the point in the case of javadoc. Emacs docstrings work this way too; the first line must stand alone and provide a summary. I think this would be a great convention to adapt for Clojure, but that cat may already be out of the bag. -Phil -- 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 your first post. 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
How to :use a defrecord from another source file and namespace?
I'm having trouble writing code in one namespace that instantiates a type that is defined in another namespace. I have two source files: other.clj defines a function called my-fn and a type called huss: (ns my-project.other) (defrecord huss [x y z]) (defn my-fn [] (println my-fn)) core.clj can successfully call my-fn from the other file but I try to instantiate huss and I get an ClassNotFoundException (ns my-project.core (:use [my-project.other])) (my-fn) ; doesn't work... gives java.lang.IllegalArgumentException: Unable to resolve classname: huss (println (huss. 1 2 3)) What's the reason for this? Is it intended to work like this and what can I do in order to define a type in one source file (and namespace) and use it in another? Cheers, Chris -- 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 your first post. 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: How to :use a defrecord from another source file and namespace?
Types created by deftype defrecord are Java classes and you'd have to use :import to bring them into another namespace: (ns ... (:import my-project.other.huss)) Or if you have multiple types, (:import [foo.bar Wibble Wobble]) It might be simpler to define a factory function and use that (through :use / :require): ;; in my-project.other (defn make-huss [x y z] (huss. x y z)) ;; ...then use make-huss in project.core Sincerely, Michał -- 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 your first post. 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: cool compiler-project?
Hi, I'm trying to develop a clojure compiler for LLVM. may need a small nudge in the right direction. anyone who can mentor me on this project? Thanks Sreeraj. -- 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 your first post. 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: RFC: updated c.c.logging with some breaking changes
These seem like good changes to me! Any plans to push? -- 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 your first post. 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: How to :use a defrecord from another source file and namespace?
On 7 September 2010 23:56, Chris Jenkins cdpjenk...@gmail.com wrote: why don't I fall back on defstruct and defmulti, at least until performance becomes important I believe defrecord was meant to supersede defstruct, but apparently defstruct is not (yet?) marked as deprecated in 1.2, so sure, that might be a reasonable way to go at least for now. Of course, you could also just use regular maps (switching to something more suited to the task when the app's performance and/or memory profile requires that). Sincerely, Michał -- 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 your first post. 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.contrib.trace not working on 1.2?
Why does c.c.trace give different output on 1.2 than it did on 1.1? From http://learnclojure.blogspot.com/2010/02/slime-2009-10-31-user-defn-fib-n-if-n-2.html On 1.1 user (dotrace (fib) (fib 3)) TRACE t1880: (fib 3) TRACE t1881: |(fib 2) TRACE t1882: ||(fib 1) TRACE t1882: ||= 1 TRACE t1883: ||(fib 0) TRACE t1883: ||= 0 TRACE t1881: |= 1 TRACE t1884: |(fib 1) TRACE t1884: |= 1 TRACE t1880: = 2 2 user On 1.2 user dotrace (fib) (fib 3)) TRACE t11624: (fib 3) TRACE t11624: = 2 Thanks, Scott -- 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 your first post. 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: clojure.contrib.trace not working on 1.2?
Hm, I would guess that the self-call gets hard-wired, since if you define fib thus: (defn fib [n] (if (#{0 1} n) n (+ (#'fib (- 2 n)) (#'fib (dec n) then it works as you expect. Not that I'm really sure what's happening; just a conjecture. Also, I believe I already bumped into this behaviour when playing with alternative tracing schemes, but never realised its new to 1.2... interesting. Sincerely, Michał -- 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 your first post. 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
2 lein swank instances on same project and compiling src from emacs
I have two lein swanks going on different ports against the same project. I open up two slime-connect's in emacs. How can I compile (C-c C-k) my core.clj to the two different slime-connect's. hhh -- 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 your first post. 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: 2 lein swank instances on same project and compiling src from emacs
I don't think you can do that, but you can connect to the same swank instance twice with M-x slime-connect and function updates will be reflected in both repls. --Robert McIntyre On Tue, Sep 7, 2010 at 8:54 PM, HiHeelHottie hiheelhot...@gmail.com wrote: I have two lein swanks going on different ports against the same project. I open up two slime-connect's in emacs. How can I compile (C-c C-k) my core.clj to the two different slime-connect's. hhh -- 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 your first post. 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 -- 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 your first post. 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
ANN: Indyvon - GUI library
Hi, I have recently published Indyvon -- an experimental multithreaded GUI library for Clojure. The main idea behind the library is that base UI element (called layer) does not define any state (has no location, size, parent element). Dynamic layout of layers is captured at the rendering time and remembered for event processing until the next repaint is complete. Java 2D API is used for rendering. Source code: http://bitbucket.org/kryshen/indyvon/src See README there for a more detailed description. src/net/kryshen/indyvon/demo.clj contains runnable example. Currently only some basic layers are implemented (no normal widgets) and I have no plan to build a complete GUI toolkit. I am using the library in another project for graph visualization. Expect bad English style (I am not native speaker) in readme and docstrings, corrections are welcome. -- Mikhail -- 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 your first post. 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: Documentation tools
Phil Hagelberg p...@hagelb.org writes: On Tue, Sep 7, 2010 at 1:25 AM, Mark Engelberg mark.engelb...@gmail.com wrote: [...] Javadoc has an interesting property: it considers that the first sentence serves as a summary for the doc. The sentence delimiter is just the point in the case of javadoc. Emacs docstrings work this way too; the first line must stand alone and provide a summary. I think this would be a great convention to adapt for Clojure, but that cat may already be out of the bag. +1 for complete sentences on the first line of a doc-string (whether period or newline delimited). Another elisp convention which I find very useful is using `' to quote function names e.g. `map'. Documentation browsers can then link these names to the documentation of the quoted function. This is especially useful in a functional languages where function composition is the norm. Clojure is certainly young enough for new conventions to emerge, especially with some buttressing from documentation tools. Best -- Eric -- 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 your first post. 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: Documentation tools
On Tue, Sep 7, 2010 at 1:25 AM, Mark Engelberg mark.engelb...@gmail.com wrote: Docstrings seem designed for fairly terse comments about the nature of the function. It's great for providing little hints about how the function works to jog one's memory by typing (doc ...) in the REPL, or for searching with find-doc. But I just don't think I can fit the kind of full documentation I want all into a docstring without ruining its REPL usefulness. I'm watching this thread and I'm wondering what kind of documentation people are talking about here. I've always been used to using self-documenting function / variable names and short comments for documenting everything. Clearly you guys are talking about something much bigger than this and I'd like a bit more insight into that. Who are you writing this documentation for? How detailed does it need to be? Why are good function and variable names and a short summary not enough? Genuinely curious about this. -- Sean A Corfield -- (904) 302-SEAN Railo Technologies, Inc. -- http://getrailo.com/ An Architect's View -- http://corfield.org/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood -- 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 your first post. 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
giws a window for people using c/c++ into clojure ..
Hello everybody, I recently came across giws http://www.scilab.org/products/other/giws a tool to call java code from c/c++ all it really needs to generate all the jni-wrappers is a simple xml file which indicates the class name and the member functions .. some thing as simple as ... package name=example2 object name=MyObjectWithArray method name=getMyString returnType=String[] /method method name=getMyInts returnType=int[] /method method name=doNothingPleaseButDisplay returnType=void param type=int[] name=plop / param type=short[] name=plop2 / /method method name=setMyStrings returnType=void param type=String[] name=plop / /method method name=dealingWithBooleans returnType=boolean[] param type=boolean[] name=plop / /method /object /package given clojure's power of macros .. it should be possible to automate the creation of this xml for every clojure-structure and function by redefining the *defstruct* and *defn * and other similar macros .. I would like to give it a shot .. I am kind of new to all these things .. so would like to hear what the clojure community has to say about this... Thanks in advance, Sunil. -- 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 your first post. 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