if-let bug
Consider the two definitions: (defn if-let-good [str] (if-let [rest (seq (drop-while (partial = \a) str))] (first rest) "empty")) (defn if-let-bad [seq] (if-let [rest (seq (drop-while (partial = \a) seq))] (first rest) "empty")) The only difference between them is the name of the arg: "str" in the good definition, "seq" in the bad definition. (if-let-good "") => "empty" (if-let-bad "") aborts with: java.lang.String cannot be cast to clojure.lang.IFn [Thrown class java.lang.ClassCastException] -- 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: if-let bug
Hello David, what's the question ? 2011/1/5 David > Consider the two definitions: > > (defn if-let-good [str] > (if-let [rest (seq (drop-while (partial = \a) str))] >(first rest) >"empty")) > > (defn if-let-bad [seq] > (if-let [rest (seq (drop-while (partial = \a) seq))] >(first rest) >"empty")) > > The only difference between them is the name of the arg: "str" in the > good > definition, "seq" in the bad definition. > > (if-let-good "") > => "empty" > > (if-let-bad "") > > aborts with: > > java.lang.String cannot be cast to clojure.lang.IFn > [Thrown class java.lang.ClassCastException] > > -- > 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: if-let bug
On Wednesday, January 5, 2011 11:06:34 AM UTC+1, David wrote: > > Consider the two definitions: > > (defn if-let-good [str] > (if-let [rest (seq (drop-while (partial = \a) str))] > (first rest) > "empty")) > > (defn if-let-bad [seq] > (if-let [rest (seq (drop-while (partial = \a) seq))] > (first rest) > "empty")) > > The only difference between them is the name of the arg: "str" in the > good > definition, "seq" in the bad definition. > > (if-let-good "") > => "empty" > > (if-let-bad "") > > aborts with: > > java.lang.String cannot be cast to clojure.lang.IFn > [Thrown class java.lang.ClassCastException] > Clojure is a Lisp-1: it has a single namespace for functions and variables. If you call your parameter seq, you're shadowing the definition of the seq function (and trying to call the seq parameter as a function, which is the source of the exception you're getting). -- 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: ANN: Gloss, a byte-format DSL
Nothing :( $ lein repl "REPL started; server listening on localhost:32399." user=> (use '[gloss core io]) nil user=> (defcodec t (repeated (string :utf-8 :delimiters ["\n"]) :delimiters ["\0"])) #'user/t user=> (decode t (.getBytes "blabla\nhihi\njg\0 g\n\0")) java.lang.Exception: Cannot evenly divide bytes into sequence of frames. (NO_SOURCE_FILE:0) What I think is happening is that repeated reads up to the first \0 and then tries to fit the subframes inside of that. What I think it *should* do is, check the next byte for a delimiter, if not, read a subframe, rinse and repeat. Pepijn On Jan 2, 7:38 pm, Zach Tellman wrote: > There was a bug in repeated, which is fixed now. Pull the latest from > github or clojars and let me know how it goes. > > Zach > > On Jan 2, 3:29 am, "pepijn (aka fliebel)" > wrote: > > > > > > > > > Okay, clicked send to early. The header also contains 0-bytes, so the > > repeated stops 'mid-sentence' and tries to balance things. Is there > > any way Gloss can handle nested structures like this? > > > On Jan 2, 12:20 pm, "pepijn (aka fliebel)" > > wrote: > > > > Hi, > > > > Thanks for helping out. After using codecs rather than frames, I get > > > even weirder errors. > > > > My code now gives me: java.lang.Exception: Cannot evenly divide bytes > > > into sequence of frames. > > > > Hard coding the header followed by a terminating :byte works as it > > > should: > > > > (decode (compile-frame [tag tstring (header tag (memoize #(compile- > > > frame [(name %) tstring (get-tag %)])) (comp symbol first)) :byte]) > > > data) > > > [:compound "hello world" ["string" "name" "Bananrama"] 0] > > > > So the problem seems to be with the repeated. Investigating that, I > > > copied an example from the introduction page, and this is the result: > > > (defcodec t (repeated (string :utf-8 :delimiters ["\n"]) :delimiters > > > ["\0"])) > > > (encode t ["foo" "bar" "baz"]) > > > java.lang.IllegalArgumentException: Don't know how to create ISeq > > > from: java.nio.HeapByteBuffer > > > ((# > > > #) > > > (# > > > #) > > > > But on the other hand: > > > (decode t (.getBytes "blabla\nhihi\ng\n\0")) > > > ["blabla" "hihi" "g"] > > > > This gives me the same error as my code, but since the header in my > > > code seems correct, I don't see why it has leftover bytes. > > > (decode t (.getBytes "blabla\nhihi\ng\0")) > > > java.lang.Exception: Cannot evenly divide bytes into sequence of > > > frames. > > > > By the way, is there an easy way to get something readable out of > > > encode? Like Unix hexdump, or even just a seq of integers. Debugging > > > is a weak point in Gloss so far, if you ask me. > > > > Thanks! > > > > Pepijn de Vos > > > > On Jan 1, 10:47 pm, Zach Tellman wrote: > > > > > The header->body function in (header ...) must return a codec, so you > > > > need to call compile-frame on the vector you're generating. Since you > > > > don't want to call compile-frame every time you decode a frame, you > > > > can memoize the function. A version that does both can be found > > > > athttps://gist.github.com/762031. > > > > > I agree that the way the enumeration and types are blurred in your > > > > code is a little confusing. You could create a stronger distinction > > > > by calling your enumerated types :tag-byte, :tag-int32, etc, and then > > > > defining a map from those tags onto :byte, :int32, and so on. > > > > > Zach > > > > > On Jan 1, 1:01 pm, "pepijn (aka fliebel)" > > > > wrote: > > > > > > Hey, > > > > > > I am trying Gloss for reading NBT [1] files. > > > > > > First thing I did like is that it seems to make things real easy. > > > > > First thing I did not like is the weak separation between types > > > > > like :byte and extra data like :foo. > > > > > > I think I'm nearly done with the NBT reader [2], but I ran into a > > > > > problem. Whatever I put in the header form, I get exceptions like > > > > > this: > > > > > > java.lang.IllegalArgumentException: No implementation of > > > > > method: :sizeof of protocol: #'gloss.core.protocols/Writer found for > > > > > class: clojure.lang.PersistentVector > > > > > > Only thing it mentions in the stacktrace [3] is methods on a reify, > > > > > which calls the same method again, or in the most recent case, just > > > > > return nil. > > > > > > [1]http://www.minecraft.net/docs/NBT.txt > > > > > [2]https://gist.github.com/761997 > > > > > [3]http://pastebin.com/AqrsbjuS > > > > > > On Nov 28 2010, 8:14 pm, Zach Tellman wrote: > > > > > > > You're right, that's an omission from the frame syntax. I'll add > > > > > > the > > > > > > ability for all or part of the frame to be scoped as (little- > > > > > > endian ...) and (big-endian ...), with big-endian as the default. > > > > > > > Just as a side-note, though, Calx [1] is already handling little- > > > > > > endian data by using encode-to-buffer, where it's writing to a > > > > > > buffer > > > > > > whose endianness has been preset. This obviously isn'
Re: Knuth's literate programming "tangle" function in Clojure
The literate programming is actually a contrib to org-mode. http://orgmode.org/worg/org-contrib/babel/ Ive actually used it to create my emacs.el, by having code in emacs.org and have init.el tangle out the emacs code. Of course i never documented anything and did it for the novelty of being able to organize all that code in one file, instead of expanding it to other files :) -- 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 write a protected java method in clojure
I need to know the way we can write a clojure code for a program like this. --- import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import clojure.lang.RT; import com.vaadin.Application; import com.vaadin.terminal.gwt.server.AbstractApplicationServlet; public class Clojure4Vaadin extends AbstractApplicationServlet { @Override protected Class getApplicationClass() throws ClassNotFoundException { return Application.class; } ... I don't know how to write this method in Clojure. Please can some one write this in clojure. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from 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: ClojureQL 1.0.0 now released
Hey everybody, Just a quick heads up that ClojureQL 1.0.0 is now released. All interfaces should be final and there are no known bugs. Works out of the box with PostgreSQL and MySQL but the compiler is a multimethod so you can implement your own backend if you need to work with other database backends. If you do so, please consider contributing it to ClojureQL :) All the info is found on http://www.clojureql.org but for those of you who haven't tried it out yet, I recommend watching this (dated) video: http://vimeo.com/16958466 Big thanks to everybody who has helped make this happen, Lau -- 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 write a protected java method in clojure
2011/1/5 Thilina Piyasundara > I need to know the way we can write a clojure code for a program like > this. > > --- > import javax.servlet.ServletException; > import javax.servlet.http.HttpServletRequest; > import clojure.lang.RT; > import com.vaadin.Application; > import com.vaadin.terminal.gwt.server.AbstractApplicationServlet; > > public class Clojure4Vaadin extends AbstractApplicationServlet { > >@Override >protected Class getApplicationClass() >throws ClassNotFoundException { >return Application.class; >} > ... > > > I don't know how to write this method in Clojure. Please can some one > write this in clojure. > (ns app.Clojure4Vaadin (:import com.vaadin.Application) (:gen-class :extends com.vaadin.terminal.gwt.server.AbstractApplicationServlet)) (defn -getApplicationClass [this] Application) HTH, -- Laurent -- 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: Knuth's literate programming "tangle" function in Clojure
>Just discovered org-mode myself --- does anyone know of guide to using >it with clojure for a total newbie? I havent actually used it for clojure per se. I was just imagining how it could be used. You have the ability to embed arbitrary code (from many different languages). You can edit the code in its own emacs major mode and then it will automatically be saved back once done. You can then document it using org-modes awesome abilities. However, this is sort of clumsy. I would rather be able to have all of my code in all of its 'little files' arranged in directories. And when im editing the clojure files, i would like to be like 'oh, i want to document this better/introduce the motivation etc! And then automatically have the code, or parts of the code, copied to the org file and then i could document it. And then jump back to the code to continue developing. And have changes in the clojure file automatically reflected in the org file. I was thinking that 'chunk' labels could be embedded in the source code (like in marginalia in github: just comments like ;;##Block Name) so that we wouldn't have to have all code in one file in one chunk, but could split it up. -- 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: ANN: ClojureQL 1.0.0 now released
Congratulation, you've finally made it! P.S.: Nice job on the website! On Jan 5, 9:14 am, LauJensen wrote: > Hey everybody, > > Just a quick heads up that ClojureQL 1.0.0 is now released. All > interfaces should be final and there are no known bugs. Works out of > the box with PostgreSQL and MySQL but the compiler is a multimethod so > you can implement your own backend if you need to work with other > database backends. If you do so, please consider contributing it to > ClojureQL :) > > All the info is found onhttp://www.clojureql.orgbut for those of you > who haven't tried it out yet, I recommend watching this (dated) > video:http://vimeo.com/16958466 > > Big thanks to everybody who has helped make this happen, > Lau -- 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
Faster ring reload middleware
G'day, Ring ships with some development middleware that reloads the supplied namespaces every request. This is fantastic for quick iterative development, particularly because the JVM takes so long to start. However as soon as you have more than a few namespaces every request becomes rather slow - even if there are no source changes the middleware reloads all supplied namespaces. I have tweaked the ring reload middleware to only reload the namespaces if at least one file below the supplied directory has been modified: (defonce src-mtime (atom 0)) (defn read-src-mtime [dir] (reduce (fn [a b] (+ a (.lastModified b))) 0 (file-seq dir))) ;; Copied and modified from ring.middleware.reload (defn wrap-reload "Wrap an app such that before a request is passed to the app, each namespace identified by syms in reloadables is reloaded if any file has changed below the identified source directory. Currently this requires that the namespaces in question are being (re)loaded from un-jarred source files, as apposed to source files in jars or compiled classes." [app dir reloadables] (fn [req] (let [new-mtime (read-src-mtime dir)] (if (> new-mtime @src-mtime) (do (swap! src-mtime (constantly new-mtime)) (doseq [ns-sym reloadables] (require ns-sym :reload) (app req))) There are two ways in which I can immediately see that this could be improved: 1. Don't pass in src directory as well as namespaces. If the user just specifies the src directory then we can infer all of the namespaces? 2. Don't reload all namespaces when a file is changed - only the affected namespaces. I think this can become tricky. Anyway the current implementation works well for me and I thought it might benefit others. Any feedback welcome. Can I provide a patch or pull request for ring? Cheers, David -- 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
Emacs `align' function customization for Clojure
Hi, I just recently became aware of the built-in `align' [1] function for Emacs while looking for a nice way to auto-align some hash-maps in my Clojure code. This was easily done using align with the following piece of customization. #+begin_src emacs-lisp (add-to-list 'align-lisp-modes 'clojure-mode) (add-to-list 'align-rules-list '(clojure-keyword-map (regexp . ":[^\s]+\\(\s+\\).+") (group . 1) (modes . align-lisp-modes))) #+end_src Then marking the following code and calling `align' will turn this #+begin_src clojure {:byte [1 byte] :char [1 char] :int16 [2 short] :uint16 [2 uint16] :int32 [4 int] :uint32 [4 uint32] :int64 [8 long] :uint64 [8 uint64] :float32 [4 float] :float64 [8 double] } #+end_src into this #+begin_src clojure {:byte[1 byte] :char[1 char] :int16 [2 short] :uint16 [2 uint16] :int32 [4 int] :uint32 [4 uint32] :int64 [8 long] :uint64 [8 uint64] :float32 [4 float] :float64 [8 double] } #+end_src I wonder if anyone else has written any similar Emacs alignment rules for Clojure which they would be interested in sharing? Thanks -- Eric Footnotes: [1] , | align is an interactive Lisp function in `align.el.gz'. | | (align BEG END &optional SEPARATE RULES EXCLUDE-RULES) | | Attempt to align a region based on a set of alignment rules. | BEG and END mark the region. If BEG and END are specifically set to | nil (this can only be done programmatically), the beginning and end of | the current alignment section will be calculated based on the location | of point, and the value of `align-region-separate' (or possibly each | rule's `separate' attribute). | | If SEPARATE is non-nil, it overrides the value of | `align-region-separate' for all rules, except those that have their | `separate' attribute set. | | RULES and EXCLUDE-RULES, if either is non-nil, will replace the | default rule lists defined in `align-rules-list' and | `align-exclude-rules-list'. See `align-rules-list' for more details | on the format of these lists. | | [back] ` -- 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: if-let bug
Nevermind - it was late, and I found the error message cryptic. Sorry for throwing up a red herring. On Jan 5, 5:30 am, Alessio Stalla wrote: > On Wednesday, January 5, 2011 11:06:34 AM UTC+1, David wrote: > > java.lang.String cannot be cast to clojure.lang.IFn > > [Thrown class java.lang.ClassCastException] > > Clojure is a Lisp-1: it has a single namespace for functions and variables. > If you call your parameter seq, you're shadowing the definition of the seq > function (and trying to call the seq parameter as a function, which is the > source of the exception you're getting). -- 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: Faster ring reload middleware
Ring enhancement and patches are best posted to the "ring-clojure" group. There's a chance they might be missed if only posted to the Clojure group. Regarding wrap-reload, your enhancements would put it halfway between the current wrap-reload, and the wrap-reload-modified middleware available as a third-party library: https://github.com/weavejester/ring-reload-modified I'm therefore inclined to keep wrap-reload the way it is, and leave more sophisticated behaviour up to other middleware functions. Incidentally, are you familiar with the "lein-ring" plugin for Leiningen? https://github.com/weavejester/lein-ring The lein-ring plugin provides a command for starting a development web server. Any modifications to the source files are automatically reloaded using the wrap-reload-modified middleware. - James On 5 January 2011 16:21, David Jagoe wrote: > G'day, > > Ring ships with some development middleware that reloads the supplied > namespaces every request. This is fantastic for quick iterative > development, particularly because the JVM takes so long to start. > However as soon as you have more than a few namespaces every request > becomes rather slow - even if there are no source changes the > middleware reloads all supplied namespaces. I have tweaked the ring > reload middleware to only reload the namespaces if at least one file > below the supplied directory has been modified: > > > (defonce src-mtime (atom 0)) > > (defn read-src-mtime [dir] > (reduce > (fn [a b] > (+ a (.lastModified b))) 0 (file-seq dir))) > > ;; Copied and modified from ring.middleware.reload > (defn wrap-reload > "Wrap an app such that before a request is passed to the app, each > namespace identified by syms in reloadables is reloaded if any file > has changed below the identified source directory. Currently this > requires that the namespaces in question are being (re)loaded from > un-jarred source files, as apposed to source files in jars or > compiled classes." > [app dir reloadables] > (fn [req] > (let [new-mtime (read-src-mtime dir)] > (if (> new-mtime @src-mtime) > (do > (swap! src-mtime (constantly new-mtime)) > (doseq [ns-sym reloadables] > (require ns-sym :reload) > (app req))) > > There are two ways in which I can immediately see that this could be improved: > > 1. Don't pass in src directory as well as namespaces. If the user just > specifies the src directory then we can infer all of the namespaces? > 2. Don't reload all namespaces when a file is changed - only the > affected namespaces. I think this can become tricky. > > Anyway the current implementation works well for me and I thought it > might benefit others. Any feedback welcome. > > Can I provide a patch or pull request for ring? > > > Cheers, > David > > -- > 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: Faster ring reload middleware
Hi James, On 5 January 2011 18:50, James Reeves wrote: > Ring enhancement and patches are best posted to the "ring-clojure" > group. There's a chance they might be missed if only posted to the > Clojure group. Ok, will do that in future. > > Regarding wrap-reload, your enhancements would put it halfway between > the current wrap-reload, and the wrap-reload-modified middleware > available as a third-party library: > > https://github.com/weavejester/ring-reload-modified > > I'm therefore inclined to keep wrap-reload the way it is, and leave > more sophisticated behaviour up to other middleware functions. > > Incidentally, are you familiar with the "lein-ring" plugin for Leiningen? > > https://github.com/weavejester/lein-ring > > The lein-ring plugin provides a command for starting a development web > server. Any modifications to the source files are automatically > reloaded using the wrap-reload-modified middleware. Thanks for pointing those out, I wasn't aware of either of them. Cheers, David -- 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: Emacs `align' function customization for Clojure
On Tue, Jan 4, 2011 at 9:10 PM, Eric Schulte wrote: > I wonder if anyone else has written any similar Emacs alignment rules > for Clojure which they would be interested in sharing? Alignment rules for let and defroutes are at the top of my most wanted list. (let [n(count content-divs) width500 widthpx (str width "px") scrollable-id(or scrollable-id (str "scrollable" (rand-int 100))) scrollable-fname (symbol scrollable-id)] (defroutes app (GET "/" _ (main-page)) (GET "/subscribe" _ (slices site-header subscribe-button)) (GET "/test" request (slices jquery (dom (alert ~(:remote-addr request))) (html [:h1 "Hi"]) (css [:h1 :color "blue"] -- 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: Knuth's literate programming "tangle" function in Clojure
On 1/5/2011 9:27 AM, Seth wrote: Just discovered org-mode myself --- does anyone know of guide to using it with clojure for a total newbie? I havent actually used it for clojure per se. I was just imagining how it could be used. You have the ability to embed arbitrary code (from many different languages). You can edit the code in its own emacs major mode and then it will automatically be saved back once done. You can then document it using org-modes awesome abilities. However, this is sort of clumsy. I would rather be able to have all of my code in all of its 'little files' arranged in directories. Just out of curiosity, what is the advantage of maintaining code in 'little files'? The main reason people use an IDE is that they get a whole-project view. The IDE lets you move around and find things as though your project was effectively one big file. It really is a kind of patch on the little-file organization. What is it about 'little file format' that is actually useful? Except for habit, is there a real advantage? Conceptually separate efforts, such as the Clojure-contrib effort could be done in separate volumes. But you would expect this kind of natural organization, just as you might expect a multi-volume story like the Asimov Foundation series. Wouldn't a well organized contrib literate document be useful? When you program and reach for your books, don't you find a good index and cross-reference the best way to find the idea you need? And when im editing the clojure files, i would like to be like 'oh, i want to document this better/introduce the motivation etc! And then automatically have the code, or parts of the code, copied to the org file and then i could document it. And then jump back to the code to continue developing. Viewing the step of 'documenting the code' as just another step in development is one of the reasons that documentation is rarely done and even more rarely done well. The target audience is usually another developer so tools like Javadoc exist to make it easy to look up class details. What tools exist to support whole-project, idea-to-implementation documentation? Viewing documentation as a phase of development is conceptually and actually very different from viewing the project as a literate effort. Development targets the machine whereas a literate effort targets people. The difference in target audience makes a qualitative difference in what you write, when you write it, and why you write it. There is nothing about the Javadoc organization (to pick on one tool) that encourages or even supports the 'idea-to-implementation' flow. Are there open source examples of documentation from the ideas to the implementation? Literate programming allows you to reorganize your code by ideas. For instance, in the clojure example, the PersistentTreeMap class is split into its subclasses like Node. Okasaki's work starts with the idea of Nodes so we highlight and explain the Node structure of PersistentTreeMap before we get into the top level class details. In this way you motivate the need for the Node class and 'bring the reader along' so that when they get to PersistentTreeMap they already understand Nodes. Because of the way Java forces you to organize your code you have to introduce the PersistentTreeMap class before you introduce the Node class. This is the late 90s and we ought to be able to organize our code any way we want rather than be forced to organize it for the compilers, linkers, and loaders. Why would we want to organize our code for the convenience of our tools? And have changes in the clojure file automatically reflected in the org file. I was thinking that 'chunk' labels could be embedded in the source code (like in marginalia in github: just comments like ;;##Block Name) so that we wouldn't have to have all code in one file in one chunk, but could split it up. Having literate code in more than one file is certainly possible because Latex supports an 'include' command. You could include the code chunks or you could include the chapters and keep them in 'litte file format'. I'm not sure what advantage this confers. Working in a single file or working in multiple files is pretty transparent. Emacs lets me split buffers in the same file as easily as having two files in split windows. Finding things is SO much easier (hey, its certainly in THIS file :-) ) The hardest initial part is using apt-get texlive. The difference is not the physical organization but the mental organization. A single file format gives the impression of a book and with that comes the skills of organizing the material for presenting the ideas in a logical fashion. It is this change of mental viewpoint that is the critical part of literate programming rather than the tools like emacs-org-mode or latex. The mental transition to this style of programming is at least as hard as the mental transition from Object Oriented programming to Functional programming. In my experience, the gain is wo
Re: My first Clojure program: request for code review
Hi Ken, Sorry for the very late response; I've been away for a friend's wedding. Though I'm not sure if I will end up using this macro frequently, it was highly educational to step through its inner workings. Thank you very much for putting it together. On Dec 23 2010, 11:07 pm, Ken Wesson wrote: > On Fri, Dec 24, 2010 at 12:06 AM, Benny Tsai wrote: > >> You're welcome. Sorry I couldn't be of greater help. If you want, I > >> could throw together a quickie macro for grabbing a few items from > >> either end of a seq. > > Sure, that would be cool :) > > OK, here goes ... > > (defmacro ends [[[firsts mid lasts] sequence] & body] > (let [nl (count lasts)] > `(let [s# (seq ~sequence) > �...@firsts & ~mid] (drop-last ~nl s#) > ~lasts (drop (- (count s#) ~nl) s#)] > �...@body))) > > user=> (ends [[[a b c] d [e f]] (range 10)] [a b c d e f]) > [0 > 1 > 2 > (3 4 5 6 7) > 8 > 9] > > As you can see, it expects a binding vector of two items, the second a > seqable and the first a vector of first, mid, lasts. Firsts and lasts > are vectors of symbols, and mid is a symbol. The first items of the > seq are assigned to the firsts symbols, in order; the last items to > the lasts, in order; and whatever's left over in the middle to mid. > > If the sequence is short enough, odd things happen: > > user=> (ends [[[a b c] d [e f]] (range 5)] [a b c d e f]) > [0 1 2 nil 3 4] > > Here the firsts and lasts exhaust the seq; mid ends up nil. Since nil > can generally stand in for an empty seq this is OK. > > user=> (ends [[[a b c] d [e f]] (range 4)] [a b c d e f]) > [0 1 nil nil 2 3] > > This is a bit more bothersome. [0 1 2 nil 2 3] might be preferred > here. If so the macro needs a slight modification. What do you say? -- 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: ANN: Tom Faulhaber: "Lisp, Functional Programming, and the State of Flow" video available
On Mon, Jan 3, 2011 at 11:14 AM, Alan Dipert wrote: > I'm happy to announce that Tom Faulhaber's Conj talk, "Lisp, > Functional Programming, and the State of Flow" is now available on > Clojure's blip.tv page: http://clojure.blip.tv/file/4521022/ Thanks for your work on making the videos available! I just watched this one, and one thing about the editing could use a little work: the video of the speaker in the corner and the audio isn't matched up with the video of the slides. In this one, the video of the slides is a little behind the audio, which is okay, but the video of Luke VanderHart's slides on zippers is substantially ahead of the audio - by 20-30 seconds. Seeing a different slide from the one actually being discussed makes it quite hard to follow! -- Chris Riddoch -- 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: Trick to getting bindings in a repl
Clojure's vars maintain bindings in ThreadLocals[1]. I'm pretty sure accessing ThreadLocals of other threads can't be done. Looking at ThreadLocal and Thread sources, you might be able to dig around private and package-private fields to get at them. Generally a bad idea. FWIW, the Enclojure REPL is available as a standalone Swing component[2], which may or may not be a good basis for your work. Also FWIW, you might want to take a look at nREPL[3], which is an attempt to provide a common network-capable Clojure REPL (currently used by ccw and vimclojure AFAIK). The benefit for you there would be that the thread-local state of each REPL connection (its "session", for lack of a better term) can be queried at will, asynchronously from code that your users might want to send to the REPL. Cheers, - Chas [1] http://download.oracle.com/javase/6/docs/api/java/lang/ThreadLocal.html [2] http://www.enclojure.org/The+Enclojure+REPLs+%28Not+just+for+Netbeans!%29 [3] https://github.com/clojure/tools.nrepl On Dec 30 2010, 11:34 am, Mike wrote: > I'm doing something kind of tricky...I'm running a REPL in my Java > Swing application. I do something like: > > public class MyConsoleClass extends OurEmbeddedInterpreterClass { > // ... > > // inner class > private class ReplRunner extends Thread { > public void run() { > Namespace MYNS = Namespace.findOrCreate(Symbol.create("myns")); > Var ACCESS_ME = Var.intern(MYNS, Symbol.create("*me*")); > Var.pushThreadBindings(RT.map(RT.IN, myIn, RT.OUT, myOut, > RT.ERR, myErr, ACCESS_ME, MyConsoleClass.this); > BufferedReader script = getMagicInitScript(); > Compiler.load(script, getScriptPath(), getScriptFile()); > } > } > // ...somewhere, make a ReplRunner and launch it when you're > supposed to > > } > > The "magic init script" is what runs the repl. The ins and outs are > mapped into Swing components so you can type commands, it passes to > the repl, and then output comes back to a text pane or the equivalent. > > Now, my GUI app puts a KeyListener on the input component so that when > the TAB key is pressed, it runs a completion routine (Java callback) > to try to complete your command. I wrote a function (in Clojure, > inside the magic init script) that returns all the completions based > on the current command. My Java callback looks like: > > // a method in MyConsoleClass...CodeCompletion is our own little > helper struct... > public List getCompletions(String cmd) { > Var getFn = RT.var("myns", "get-completions"); > try { > List result = (List) > getFn.invoke(cmd); > return result; > catch(Exception e) { /* handle e omitted */ } > return null; > > } > > The problem is, get-completions uses dir-fn and ns-map to gather > bindings based on the context of the command. But it's being invoked > in the AWT event thread (which calls this getCompletions method), NOT > the ReplRunner thread that I launch (which is of course just looping > infinitely waiting on input). So all the local bindings (including > *me* that I bound in ReplRunner.run()) are missing from the results. > > Does anybody have any ideas how I can jack into the repl thread to > grab the bindings from it? I don't think any of Clojure's concurrency > constructs will help me here, because I need to interfere with a > thread that's essentially blocked at the time of the (synchronous) > completion call. > > Sorry if this isn't fully specified and hurried...I can't paste the > code directly here because of NDA. If you need more details I can > provide them. > > Thanks in advance for any ideas... > Mike -- 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
Notice: c.c.json parser and clojure.lang.Ratio
Hi, It turns out that c.c.json/json-str will spit out Ratio's in a manner which is not json compliant. (json-str [3/4]) => "[3/4]" This parses correctly in the reverse situation: (read-json (json-str [3/4])) => [3/4] When being read [1] we switch over to using the clojure form reader so this problem is masked, however this is not the case for other parsers [2] such as mozilla's spider monkey as well as V8/Chrome [3]. I'm unclear on what the correct course of action in this case should be. Cheers, mike [1] https://github.com/clojure/clojure-contrib/blob/master/modules/json/src/main/clojure/clojure/contrib/json.clj#L124 [2] https://gist.github.com/766992 [3] http://picasaweb.google.com/lh/photo/8Rj_vqDMviL4WsUjP6JIVcATd3TVUBzXoXciG6VLJdU -- 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 in 2010
On Tue, Jan 4, 2011 at 19:06, Miki wrote: > If someone is interested in some other statistics, please let me know and > I'll try to make it happen. > > The most talkative person per session would be interesting :) though perhaps session time is a PITA to establish particularly across days boundaries. -- 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
problem with stream
Hello everybody, I'm trying to use clojure to parse web sites. Unfortunately there is some problem with following code (used library is Apache Commons HTTP Client): (defn request [url] (let [client (new org.apache.http.impl.client.DefaultHttpClient)] (with-open [rdr (reader (.getContent (.getEntity (.execute client (new org.apache.http.client.methods.HttpGet url) ] (let [content (line-seq rdr)] (.shutdown (.getConnectionManager client)) content ) ) ) ) Executing that function with (request "http://www.google.com/";) I get a stream closed exception. Obviously "content" is not executed in the let command (at least I think so) but after the stream is closed. Can somebody help me please? -- 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: problem with stream
On Wed, Jan 5, 2011 at 4:40 PM, rainerh wrote: > Hello everybody, > > I'm trying to use clojure to parse web sites. Unfortunately there is > some problem with following code (used library is Apache Commons HTTP > Client): > > (defn request [url] > (let [client (new org.apache.http.impl.client.DefaultHttpClient)] > (with-open [rdr (reader > (.getContent > (.getEntity > (.execute client (new > org.apache.http.client.methods.HttpGet url) > ] Opens the stream. > (let [content (line-seq rdr)] Creates a lazy seq that will try to read from the stream to realize elements. > (.shutdown (.getConnectionManager client)) Closes stream (doesn't with-open handle this automatically?) > content Returns unrealized lazy-seq. Client tries to use lazy seq, lazy seq tries to realize item, stream is closed => StreamClosedException. Either process the seq inside the with-open (pass request a closure that it calls with the seq) or realize it (loading the whole file in memory) by changing the code to (defn request [url] (let [client (new org.apache.http.impl.client.DefaultHttpClient)] (with-open [rdr (reader (.getContent (.getEntity (.execute client (new org.apache.http.client.methods.HttpGet url)] (let [content (doall (line-seq rdr))] (.shutdown (.getConnectionManager client)) content The "doall" will force the lazy seq to realize all of its elements while the connection is still open. -- 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: ANN: Gloss, a byte-format DSL
Thanks for sharing this library, I found reading your code to be very useful. I need to be able to read and write elf files from within Clojure code, and Gloss initially looked like a good option. However much of the streaming support and frame-based conception got in the way of my particular needs. In the end I have written a much simpler collection of functions which supports parsing binary files into lists of bytes, manipulating these lists, and then writing the lists back to binary files. This is heavily influenced by the code in Gloss. See https://github.com/eschulte/bin-ed Anyways just thought I'd share, if anyone notices anything in the code which doesn't make sense, or could be more easily accomplished in some other way please do let me know. Thanks -- 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
clojure.java.shell hanging issues
Hello everyone, A while back there was some discussion on the fact that clojure.java.shell can hang under various circumstances, and some patches were submitted: http://dev.clojure.org/jira/browse/CLJ-392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel But doesn't seem to have made it into the release. Is there a known way to avoid these issues? I suspect my particular problem is the output of my process is too big for the buffer. Perhaps a reasonable hack is to increase the buffer size, but I wouldn't know which one to increase. Is it clojure.contrib.io/*buffer-size* ? I'm also running several instances of clojure.java.shell/sh in a pmap, I assume that is safe? Thanks in advance. -- 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: Compiling dynamically created namespaces, without on-disk source code?
Thanks for the suggestion. My cursory googling has given me the impression that is a function of the classloader, or otherwise requiring some serious hackery. See http://stackoverflow.com/questions/2737285/java-is-there-a-way-to-obtain-the-bytecode-for-a-class-at-runtime The particular use case I have in mind is interactively developing distributed applications. You punch in some functions in the REPL, and then want to move them to remote nodes. That would be pretty awesome. On Mon, Jan 3, 2011 at 7:46 AM, Stuart Sierra wrote: > I mean the JVM bytecode generated by the Clojure compiler is not accessible > after it has been loaded. The JVM stores it somewhere, internally, but > there's no way to get at it. > -Stuart Sierra > clojure.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 -- 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: ANN: Gloss, a byte-format DSL
also, here's a patch to Gloss which I've used locally but which may be generally useful. Cheers -- Eric "Eric Schulte" writes: > Thanks for sharing this library, I found reading your code to be very > useful. > > I need to be able to read and write elf files from within Clojure code, > and Gloss initially looked like a good option. However much of the > streaming support and frame-based conception got in the way of my > particular needs. > > In the end I have written a much simpler collection of functions which > supports parsing binary files into lists of bytes, manipulating these > lists, and then writing the lists back to binary files. This is heavily > influenced by the code in Gloss. See https://github.com/eschulte/bin-ed > > Anyways just thought I'd share, if anyone notices anything in the code > which doesn't make sense, or could be more easily accomplished in some > other way please do let me know. > > Thanks -- Eric >From a5888053767a0a3de798e432a15b26d98fa8b78f Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 3 Jan 2011 19:33:07 -0500 Subject: [PATCH] adding primitive support for uint16, uint32 and uint64 --- src/gloss/data/primitives.clj | 15 +++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/src/gloss/data/primitives.clj b/src/gloss/data/primitives.clj index 6f8ad4c..f524d21 100644 --- a/src/gloss/data/primitives.clj +++ b/src/gloss/data/primitives.clj @@ -26,6 +26,18 @@ (string? x) (-> x first int byte) :else (throw (Exception. (str "Cannot convert " x " to byte.") +(defn uint16 "Convert to a uint16" [x] + (let [int16 (short x)] +(if (neg? int16) (+ 0x1 int16) int16))) + +(defn uint32 "Convert to a uint32" [x] + (let [int32 (int x)] +(if (neg? int32) (+ 0x1 int32) int32))) + +(defn uint64 "Convert to a uint64" [x] + (let [int64 (long x)] +(if (neg? int64) (+ 0x1 int64) int64))) + (defmacro primitive-codec [accessor writer size typecast transform-fn] `(reify Reader @@ -54,7 +66,10 @@ (def primitive-codecs {:byte (primitive-codec .get .put 1 byte to-byte) :int16 (primitive-codec .getShort .putShort 2 short identity) + :uint16 (primitive-codec .getShort .putShort 2 uint16 identity) :int32 (primitive-codec .getInt .putInt 4 int identity) + :uint32 (primitive-codec .getInt .putInt 4 uint32 identity) :int64 (primitive-codec .getLong .putLong 8 long identity) + :uint64 (primitive-codec .getLong .putLong 8 uint64 identity) :float32 (primitive-codec .getFloat .putFloat 4 float identity) :float64 (primitive-codec .getDouble .putDouble 8 double identity)}) -- 1.7.1 -- 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: Funding 2011?
On 4 January 2011 19:20, Jon Seltzer wrote: > Why not update the funding from simple donation to a purchase of > clojure/core software like a refined version of the eclipse plugin or > some other incentive based approach? I think I understand why rich > might find 'donation' approach a bit uncomfortable. Perhaps the main distinction between the donation and purchase approaches is "paying for software development" vs. "paying for finished software". The first one may convey a sense of entitlement to influence where the project is going, whereas paying for a finished product is just that: You can read the features list / release notes before you buy. I was going to suggest an optional purchase price for Clojure 1.3 when it's finally released, without any "premium" content added -- just the option of paying for the new version, or not paying for it. However, in some way this *feels* very different to me compared to a donation, even if the expense would be the same, objectively. Maybe somebody else is able to put this feeling into words ... ? -- 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: Notice: c.c.json parser and clojure.lang.Ratio
> > I'm unclear on what the correct course of action in this case should be. > However this can be solved by transforming the ratios before and after to the jsonification: https://gist.github.com/767204 (clojure.walk/postwalk transform-ratio {:a [3/4] :b {:foo {:bar 3/4} :bar {:a 1}}}) => {:a [{:n 3, :d 4, :t "ratio"}], :b {:foo {:bar {:n 3, :d 4, :t "ratio"}}, :bar {:a 1}}} (clojure.walk/postwalk transform-ratio (clojure.walk/postwalk transform-ratio {:a [3/4] :b {:foo {:bar 3/4} :bar {:a 1}}})) => {:a [3/4], :b {:foo {:bar 3/4}, :bar {:a 1}}} ... and now with json: (clojure.walk/postwalk transform-ratio (json/read-json (json/json-str (clojure.walk/postwalk transform-ratio {:a [3/4] :b {:foo {:bar 3/4} :bar {:a 1}}} => {:a [3/4], :b {:foo {:bar 3/4}, :bar {:a 1}}} Thanks to benreesman, amalloy and fliebel in #clojure for guiding me this way. -- 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.java.shell hanging issues
(1) The ticket you reference is marked completed and the patches went in last July. Is it possible you are seeing a different problem? (2) Clojure does not depend on anything in the clojure.contrib namespace. (3) Running inside a pmap should be ok, but make sure you understand the interleavings you are seeing. Cheers, Stu > Hello everyone, > > A while back there was some discussion on the fact that > clojure.java.shell can hang under various circumstances, and some > patches were submitted: > > http://dev.clojure.org/jira/browse/CLJ-392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel > > But doesn't seem to have made it into the release. > > Is there a known way to avoid these issues? I suspect my particular > problem is the output of my process is too big for the buffer. > > Perhaps a reasonable hack is to increase the buffer size, but I > wouldn't know which one to increase. Is it > clojure.contrib.io/*buffer-size* ? > > I'm also running several instances of clojure.java.shell/sh in a pmap, > I assume that is safe? > > Thanks in advance. > > -- > 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: Funding 2011?
I completely understand the Rich desire to keep flexibility and fun in Clojure development. And I think it is important for the success of Clojure. As for me a donation is much more about what is already done and enforces little if any obligations. I hope Rich will accept them from people who decides to do so if that is still important for Clojure development. I really doubt that "sense of entitlement" is prevalent in the community. Personally I trust the decisions of Clojure team and believe they evolve the language in the best ways. -- 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.java.shell hanging issues
Hi, thanks for the quick response. Looking at the source code I'm not sure if the patches were applied. Maybe there was a "regression". The symptoms seem consistent with what was supposed to have been fixed. Following the clojure.org api docs, I clicked through on the source code link on http://richhickey.github.com/clojure-contrib/shell-api.html to get to https://github.com/richhickey/clojure-contrib/blob/a1c66df5287776b4397cf3929a5f498fbb34ea32/src/main/clojure/clojure/contrib/shell_out.clj#L83 and that doesn't look like the code in the patches, but maybe its pointing at the wrong place? I also tried to find the source code in https://github.com/clojure/clojure-contrib but failed. On Wed, Jan 5, 2011 at 4:16 PM, Stuart Halloway wrote: > (1) The ticket you reference is marked completed and the patches went in last > July. Is it possible you are seeing a different problem? > > (2) Clojure does not depend on anything in the clojure.contrib namespace. > > (3) Running inside a pmap should be ok, but make sure you understand the > interleavings you are seeing. > > Cheers, > Stu > >> Hello everyone, >> >> A while back there was some discussion on the fact that >> clojure.java.shell can hang under various circumstances, and some >> patches were submitted: >> >> http://dev.clojure.org/jira/browse/CLJ-392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel >> >> But doesn't seem to have made it into the release. >> >> Is there a known way to avoid these issues? I suspect my particular >> problem is the output of my process is too big for the buffer. >> >> Perhaps a reasonable hack is to increase the buffer size, but I >> wouldn't know which one to increase. Is it >> clojure.contrib.io/*buffer-size* ? >> >> I'm also running several instances of clojure.java.shell/sh in a pmap, >> I assume that is safe? >> >> Thanks in advance. >> >> -- >> 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 -- 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.java.shell hanging issues
Stumbled on another branch of documentation, the code described at https://github.com/clojure/clojure-contrib/blob/6e721ff777dd52801cafe693868d8118a62076de/src/main/clojure/clojure/contrib/shell.clj#L86 is also without the patches. On Wed, Jan 5, 2011 at 4:41 PM, kovas boguta wrote: > Hi, thanks for the quick response. > > Looking at the source code I'm not sure if the patches were applied. > Maybe there was a "regression". The symptoms seem consistent with what > was supposed to have been fixed. > > Following the clojure.org api docs, I clicked through on the source code link > on > > http://richhickey.github.com/clojure-contrib/shell-api.html > > to get to > > https://github.com/richhickey/clojure-contrib/blob/a1c66df5287776b4397cf3929a5f498fbb34ea32/src/main/clojure/clojure/contrib/shell_out.clj#L83 > > and that doesn't look like the code in the patches, but maybe its > pointing at the wrong place? > > I also tried to find the source code in > https://github.com/clojure/clojure-contrib but failed. > > > On Wed, Jan 5, 2011 at 4:16 PM, Stuart Halloway > wrote: >> (1) The ticket you reference is marked completed and the patches went in >> last July. Is it possible you are seeing a different problem? >> >> (2) Clojure does not depend on anything in the clojure.contrib namespace. >> >> (3) Running inside a pmap should be ok, but make sure you understand the >> interleavings you are seeing. >> >> Cheers, >> Stu >> >>> Hello everyone, >>> >>> A while back there was some discussion on the fact that >>> clojure.java.shell can hang under various circumstances, and some >>> patches were submitted: >>> >>> http://dev.clojure.org/jira/browse/CLJ-392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel >>> >>> But doesn't seem to have made it into the release. >>> >>> Is there a known way to avoid these issues? I suspect my particular >>> problem is the output of my process is too big for the buffer. >>> >>> Perhaps a reasonable hack is to increase the buffer size, but I >>> wouldn't know which one to increase. Is it >>> clojure.contrib.io/*buffer-size* ? >>> >>> I'm also running several instances of clojure.java.shell/sh in a pmap, >>> I assume that is safe? >>> >>> Thanks in advance. >>> >>> -- >>> 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 > -- 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: Knuth's literate programming "tangle" function in Clojure
Seth writes: > The literate programming is actually a contrib to org-mode. > http://orgmode.org/worg/org-contrib/babel/ > This has been moved out of contrib and into the Org-mode core, so with recent versions of Org-mode the code block "Literate Programming" and "Reproducible Research" support is built in. In fact when Emacs 24 is released this will be part of the Emacs core. > > Ive actually used it to create my emacs.el, by having code in > emacs.org and have init.el tangle out the emacs code. Of course i > never documented > anything and did it for the novelty of being able to organize all that > code in one file, instead of expanding it to other files :) I do this myself and find it very convenient. In fact I maintain a Literate fork of Phil Hagelberg's emacs-starter-kit which does exactly this, allowing you to keep you emacs customizations in either .org files or .el files. The git repo for this is here https://github.com/eschulte/emacs-starter-kit and the documentation (exported from the literate .org files) is here http://eschulte.github.com/emacs-starter-kit/ Cheers -- 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: Knuth's literate programming "tangle" function in Clojure
Hi, Seth writes: >>Just discovered org-mode myself --- does anyone know of guide to using >>it with clojure for a total newbie? > > I havent actually used it for clojure per se. I was just imagining how > it could be used. You have the ability to embed arbitrary code (from > many different languages). You can edit the code in its own emacs > major mode and then it will automatically be saved back once done. You > can then document it using org-modes awesome abilities. > However, this is sort of clumsy. > There are a variety of options here - you can write *all* of your code in a single large Org-mode file, and tangle out .clj files for compilation. - you can write *all* of your code in .clj files, and simply link to the code from your .org files - you can write some code in external .clj files, and some embedded in .org files - with current versions of Org-mode it is even possible to propagate changes from a tangled .clj file back into the code blocks in a .org file if e.g. you are working on a project with non-org users who would rather edit the .clj files directly. See the `org-babel-detangle' function. > > I would rather be able to have all of my code in all of its 'little > files' arranged in directories. And when im editing the clojure files, > i would like to be like 'oh, i want to document this better/introduce > the motivation etc! And then automatically have the code, or parts of > the code, copied to the org file and then i could document it. And > then jump back to the code to continue developing. And have changes in > the clojure file automatically reflected in the org file. I was > thinking that 'chunk' labels could be embedded in the source code > (like in marginalia in github: just comments like ;;##Block Name) so > that we wouldn't have to have all code in one file in one chunk, but > could split it up. I am a grad student and spend much of my time writing code and running experiments in Clojure. I do all of this in an environment of mixed .org and .clj files. I find I prefer to write larger libraries directly in .clj files, but then I often embed the snippets of code required for running experiments, generating tables/graphs and analyzing experimental results in code blocks embedded in Org-mode files. From these code blocks I can either tangle the clojure code out into executable scripts, or execute it /in situ/ in the .org file with the results dumped directly into my org-mode buffer. I find this to be a *very* comfortable research and development environment, although as one of the main developers of the code block support for Org-mode I'm certainly biased. Cheers -- 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: Knuth's literate programming "tangle" function in Clojure
Hi Tim, I'm confused as to what parts of LP practice are not supported by Org-mode. Are you aware that Org-mode files can be exported to formats more suitable for publication and human consumption (e.g. woven). See http://orgmode.org/manual/Exporting.html Tim Daly writes: > I looked at org-mode. > > Note that 'literate programming' involves writing literature > for other people to read. The executable code is included as > a 'reduction to practice' but the emphasis is on describing > the ideas. Rich has some powerful ideas that he has reduced > to running code. What we need to do is start with a description > of the ideas and bridge the gap to the actual implementation. > > Ideally you can read a literate program like a novel, from > beginning to end, and find that every line of code has a > 'motivation' for being introduced. The side-effect is that > there is a reason why the idea is implemented in a particular > way rather than 'just because it worked'. Literate programming > tends to improve code quality because you have to explain it. > > Emacs org-mode, on the other hand, is a useful development > technology but it really isn't literate programming. > I would be interested to hear your thoughts as to why Org-mode is not a literate programming tool. Thanks -- Eric > > Tim Daly > > On 1/4/2011 9:34 AM, Seth wrote: >> have you guys checked out org-mode + babel for emacs? This would be an >> excellent place to start to do literate programming. Interesting >> ideas ... maybe i will try this in my own 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: Knuth's literate programming "tangle" function in Clojure
For the most up-to-date and comprehensive documentation of using Org-mode to work with code blocks (e.g. Literate Programming or Reproducible Research) the online manual is also very useful. http://orgmode.org/manual/Working-With-Source-Code.html also, for a good review of Org-mode's support for the practices of Literate Programming and Reproducible Research, see this draft manuscript (currently in submission). http://cs.unm.edu/~eschulte/org-paper/ both the .org source and the exported .pdf are available Cheers -- Eric Hubert Iwaniuk writes: > I would say start here: > http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html > > Cheers, > Hubert > > > > On Tue, Jan 4, 2011 at 4:12 PM, Robert McIntyre wrote: >> Just discovered org-mode myself --- does anyone know of guide to using >> it with clojure for a total newbie? >> >> sincerely, >> --Robert McIntyre >> >> On Tue, Jan 4, 2011 at 9:57 AM, Hubert Iwaniuk wrote: >>> Hi Seth, >>> >>> Yes I did play with org-mode + babel for clojure. >>> It works great :-) >>> Just make sure you are using latest and greatest of org-mode. >>> >>> Cheers, >>> Hubert. >>> >>> >>> >>> On Tue, Jan 4, 2011 at 3:34 PM, Seth wrote: have you guys checked out org-mode + babel for emacs? This would be an excellent place to start to do literate programming. Interesting ideas ... maybe i will try this in my own 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 >>> >>> -- >>> 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 >> -- 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.java.shell hanging issues
All the code you are referring to is in clojure.contrib. Note the comment at the top of the files: ;; DEPRECATED in 1.2: Promoted to clojure.java.shell clojure.java.shell is clojure itself, you should not need contrib at all. Cheers, Stu > Stumbled on another branch of documentation, the code described at > > https://github.com/clojure/clojure-contrib/blob/6e721ff777dd52801cafe693868d8118a62076de/src/main/clojure/clojure/contrib/shell.clj#L86 > > is also without the patches. > > On Wed, Jan 5, 2011 at 4:41 PM, kovas boguta wrote: >> Hi, thanks for the quick response. >> >> Looking at the source code I'm not sure if the patches were applied. >> Maybe there was a "regression". The symptoms seem consistent with what >> was supposed to have been fixed. >> >> Following the clojure.org api docs, I clicked through on the source code >> link on >> >> http://richhickey.github.com/clojure-contrib/shell-api.html >> >> to get to >> >> https://github.com/richhickey/clojure-contrib/blob/a1c66df5287776b4397cf3929a5f498fbb34ea32/src/main/clojure/clojure/contrib/shell_out.clj#L83 >> >> and that doesn't look like the code in the patches, but maybe its >> pointing at the wrong place? >> >> I also tried to find the source code in >> https://github.com/clojure/clojure-contrib but failed. >> >> >> On Wed, Jan 5, 2011 at 4:16 PM, Stuart Halloway >> wrote: >>> (1) The ticket you reference is marked completed and the patches went in >>> last July. Is it possible you are seeing a different problem? >>> >>> (2) Clojure does not depend on anything in the clojure.contrib namespace. >>> >>> (3) Running inside a pmap should be ok, but make sure you understand the >>> interleavings you are seeing. >>> >>> Cheers, >>> Stu >>> Hello everyone, A while back there was some discussion on the fact that clojure.java.shell can hang under various circumstances, and some patches were submitted: http://dev.clojure.org/jira/browse/CLJ-392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel But doesn't seem to have made it into the release. Is there a known way to avoid these issues? I suspect my particular problem is the output of my process is too big for the buffer. Perhaps a reasonable hack is to increase the buffer size, but I wouldn't know which one to increase. Is it clojure.contrib.io/*buffer-size* ? I'm also running several instances of clojure.java.shell/sh in a pmap, I assume that is safe? Thanks in advance. -- 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 >> > > -- > 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: clojure.java.shell hanging issues
On Wed, Jan 5, 2011 at 8:00 PM, Stuart Halloway wrote: > All the code you are referring to is in clojure.contrib. Note the comment at > the top of the files: > > ;; DEPRECATED in 1.2: Promoted to clojure.java.shell At the top of which files? If you mean the library's source code, it's very likely he didn't read a single line of it -- just installed the contrib jar along with Clojure and then :required or :used it. If something people have been using in version x is deprecated in later version y, this needs to be announced somewhere more prominently than in its source code, like, oh, say, the main documentation page. Better yet, the compiler should say something -- javac emits warnings if you call a method marked deprecated with Javadoc; maybe we need a {:deprecated true} meta tag that can be used on defns and that makes clojure emit warnings when deprecated functions are called? (These can be printlns to stderr in the same vein as the warnings generated by (set! *warn-on-reflection* true).) -- 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
actors vs. Message Passing for HPC
Hello everybody, While I am familiar with Message Passing .. I am not familiar with the actors model.. but I know about jobim the actor library for clojure.. While I am exploring more about it myself.. I would like to hear from others as to how actors compare to Message passing? can they be used interchangeably in some sense from the point of view of High Performance Computing .. 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
Re: Knuth's literate programming "tangle" function in Clojure
On 1/5/2011 7:37 PM, Eric Schulte wrote: Hi Tim, I'm confused as to what parts of LP practice are not supported by Org-mode. Are you aware that Org-mode files can be exported to formats more suitable for publication and human consumption (e.g. woven). See http://orgmode.org/manual/Exporting.html I am truly impressed with the number of formats org-mode can support. Of course, I expect nothing less as a heavy emacs user. Tim Daly writes: I looked at org-mode. Note that 'literate programming' involves writing literature for other people to read. The executable code is included as a 'reduction to practice' but the emphasis is on describing the ideas. Rich has some powerful ideas that he has reduced to running code. What we need to do is start with a description of the ideas and bridge the gap to the actual implementation. Ideally you can read a literate program like a novel, from beginning to end, and find that every line of code has a 'motivation' for being introduced. The side-effect is that there is a reason why the idea is implemented in a particular way rather than 'just because it worked'. Literate programming tends to improve code quality because you have to explain it. Emacs org-mode, on the other hand, is a useful development technology but it really isn't literate programming. I would be interested to hear your thoughts as to why Org-mode is not a literate programming tool. I never said org-mode wasn't a 'literate programming tool'. It is clearly an outstanding version of a literate programming tool. What I said was that org-mode "really isn't literate programming". I am trying to distinguish between tool and task. Literate programming, as a tool, can be done with notepad. Literate programming, as a task, is a radical change of mindset. It is at least as difficult as going from Object Oriented programming to Functional programming. The point of the clojure.pamphlet file isn't to highlight how it was created (emacs, fundamental mode). The point is to begin to think about documentation as an "ideas to implementation", speaking from "human to human", way of looking at the problem. I made the machinery as simple as possible so people could experiment with a new way of creating software. It is hardly new, and it isn't my idea (see Knuth). I just have come to understand that it is a very efficient and effective way to develop software that can "live". Clojure breaks with the past in many ways. I am advocating breaking with the past in terms of the 'little files' idea, 'javadoc', and other ways of documenting. And, since Advocacy is Volunteering, I pretty much put myself into a position where I had to demonstrate what I was advocating. Thus, the Clojure in Small Pieces book. Thanks -- Eric Tim Daly On 1/4/2011 9:34 AM, Seth wrote: have you guys checked out org-mode + babel for emacs? This would be an excellent place to start to do literate programming. Interesting ideas ... maybe i will try this in my own 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: Knuth's literate programming "tangle" function in Clojure
On Wed, Jan 5, 2011 at 4:44 PM, Eric Schulte wrote: > For the most up-to-date and comprehensive documentation of using > Org-mode to work with code blocks (e.g. Literate Programming or > Reproducible Research) the online manual is also very useful. In literate programming org-mode, will Clojure code be properly highlighted and indented? Is there a keystroke (like Ctrl-c,Ctrl-k) that will evaluate the Clojure code in the entire file and send it to the swank REPL? Will stacktraces point at the correct line number? -- 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.java.shell hanging issues
Actually I did look at the source, but was just looking for the relevant bits of code rather than perusing the frontmatter. The main "problem" was just that there are a lot of references to the old lib lying around in various forms of documentation that seemed current. On Wed, Jan 5, 2011 at 5:07 PM, Ken Wesson wrote: > On Wed, Jan 5, 2011 at 8:00 PM, Stuart Halloway > wrote: >> All the code you are referring to is in clojure.contrib. Note the comment at >> the top of the files: >> >> ;; DEPRECATED in 1.2: Promoted to clojure.java.shell > > At the top of which files? If you mean the library's source code, it's > very likely he didn't read a single line of it -- just installed the > contrib jar along with Clojure and then :required or :used it. > > If something people have been using in version x is deprecated in > later version y, this needs to be announced somewhere more prominently > than in its source code, like, oh, say, the main documentation page. > Better yet, the compiler should say something -- javac emits warnings > if you call a method marked deprecated with Javadoc; maybe we need a > {:deprecated true} meta tag that can be used on defns and that makes > clojure emit warnings when deprecated functions are called? (These can > be printlns to stderr in the same vein as the warnings generated by > (set! *warn-on-reflection* true).) > > -- > 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: Knuth's literate programming "tangle" function in Clojure
On 1/5/2011 8:27 PM, Mark Engelberg wrote: On Wed, Jan 5, 2011 at 4:44 PM, Eric Schulte wrote: For the most up-to-date and comprehensive documentation of using Org-mode to work with code blocks (e.g. Literate Programming or Reproducible Research) the online manual is also very useful. In literate programming org-mode, will Clojure code be properly highlighted and indented? Is there a keystroke (like Ctrl-c,Ctrl-k) that will evaluate the Clojure code in the entire file and send it to the swank REPL? Will stacktraces point at the correct line number? It seems that your real question is whether Clojure knows about a literate document. It does not. But it would be possible to modify the reader behavior when given a pamphlet file. The REPL uses a line numbering reader. Anything between the last \end{chunk} and the next \begin{chunk} could be considered as comments to be ignored but the line numbers for the function would be correct and therefore the stack traces would be correct. I suppose it would be reasonably easy (there is no such thing as a simple job) to write a literate reader for the REPL. All it would need to know is where to turn-on and turn-off the normal read semantics. When I get to documenting the REPL I will look at how reading is done and think about writing a LiterateReader class. Tim -- 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 1.3 alpha 1 report - bitwise operations extremely slow
Anyone know what this bug was called in the bug tracker? I can't find it in the tracking database to determine the status. On Sat, Oct 2, 2010 at 5:42 PM, ataggart wrote: > I just submitted a patch for this issue. > > On Oct 1, 2:42 pm, ataggart wrote: >> I'm working on the latter right now. Note there's already a ticket >> for the reflection >> problem:https://www.assembla.com/spaces/clojure/tickets/446 >> >> On Oct 1, 12:24 pm, Nicolas Oury wrote: >> >> >> >> > > David pointed out what should have been the obvious overhead (I'll >> > > blame it on being up at 2am), and Nicolas pointed out the specific >> > > problem. >> >> > two solutions: >> >> > - writing all combinations of unboxed/boxed for every function >> > - having a more clever code generator that try to box every >> > primitive if it allows to prevent a reflective call. >> > (And maybe emit a "boxing warning") > > -- > 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: My first clojure web app
Neat, looks pretty nice. I love invitations to nit pick! database.clj (defn complete-todo [id] (dosync (ref-set *todo* (vec (remove #(= (get % :id) id) @*todo*) 1) ref-set is unnecessary you could re-factor this to use alter. The result is the same, but semantically set only applies when the new value cannot be calculated from the old. 2) If instead you defined *todo* as a map you could just say (alter *todo* dissoc id)... and your add function would be simpler also. Perhaps you wanted to preserve the order, in which case a sorted-map might be the ticket. Happy Clojuring :) On Sun, Jan 2, 2011 at 9:16 AM, Sean Allen wrote: > I finally moved on from messing around with stuff in the repl and trying to > get a firm grasp on all things clojure and dove into doing a little web > development with it. I hadn't used ring, compojure or enlive before so I > kept that functionality in the app really minimal. I'd appreciate feedback > on: > ways my clojure code could be improved/made more idiomatic. > things i did wrong with ring, compojure and enlive > code organization etc. > Thanks in advance to anyone who takes a look and gives me so feedback. > Code is on github at: https://github.com/SeanTAllen/Simple-Compojure-To-Do > -Sean- > > -- > 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: clojure.java.shell hanging issues
If you send me a pointer to the link that still pointed to richhic...@github I will fix it. Thanks, Stu > Actually I did look at the source, but was just looking for the > relevant bits of code rather than perusing the frontmatter. > > The main "problem" was just that there are a lot of references to the > old lib lying around in various forms of documentation that seemed > current. > > > > On Wed, Jan 5, 2011 at 5:07 PM, Ken Wesson wrote: >> On Wed, Jan 5, 2011 at 8:00 PM, Stuart Halloway >> wrote: >>> All the code you are referring to is in clojure.contrib. Note the comment >>> at the top of the files: >>> >>> ;; DEPRECATED in 1.2: Promoted to clojure.java.shell >> >> At the top of which files? If you mean the library's source code, it's >> very likely he didn't read a single line of it -- just installed the >> contrib jar along with Clojure and then :required or :used it. >> >> If something people have been using in version x is deprecated in >> later version y, this needs to be announced somewhere more prominently >> than in its source code, like, oh, say, the main documentation page. >> Better yet, the compiler should say something -- javac emits warnings >> if you call a method marked deprecated with Javadoc; maybe we need a >> {:deprecated true} meta tag that can be used on defns and that makes >> clojure emit warnings when deprecated functions are called? (These can >> be printlns to stderr in the same vein as the warnings generated by >> (set! *warn-on-reflection* true).) >> >> -- >> 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 -- 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.java.shell hanging issues
> On Wed, Jan 5, 2011 at 8:00 PM, Stuart Halloway > wrote: >> All the code you are referring to is in clojure.contrib. Note the comment at >> the top of the files: >> >> ;; DEPRECATED in 1.2: Promoted to clojure.java.shell > > At the top of which files? If you mean the library's source code, it's > very likely he didn't read a single line of it -- just installed the > contrib jar along with Clojure and then :required or :used it. > > If something people have been using in version x is deprecated in > later version y, this needs to be announced somewhere more prominently > than in its source code, like, oh, say, the main documentation page. This is partially in place already. Deprecated namespaces are marked as such with {:deprecated true}, and the top of the documentation page shows this (e.g. http://clojure.github.com/clojure-contrib/shell-api.html). However, the styling of the deprecation warning is such that it can be easily missed. > Better yet, the compiler should say something -- javac emits warnings > if you call a method marked deprecated with Javadoc; maybe we need a > {:deprecated true} meta tag that can be used on defns and that makes > clojure emit warnings when deprecated functions are called? (These can > be printlns to stderr in the same vein as the warnings generated by > (set! *warn-on-reflection* true).) Ticket created: http://dev.clojure.org/jira/browse/CLJ-706. Thanks, Stu -- 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: feedback on first compojure app: Sportello
On Sun, Jan 2, 2011 at 11:30 AM, Alex Baranosky wrote: > Any comments on style, technique or just anythings I missed would be greatly > appreciated. I'm really trying to expand my horizons and perfect the app as > a kind of kata. Sophisticated! I like it. I will take exception to the naming of "mapmap" I see that name pop up with all sorts of different meanings attached to it, so I had to read your implementation to understand it. Can I suggest "map-by-key" as more descriptive? "zip" appears on the surface to be similar to the core "flatten" function (maybe I'm missing a good reason why you can't use that instead). Regards, Timothy -- 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 1.3 alpha 1 report - bitwise operations extremely slow
The tickets that came forward from Assembla should have the same numbers they did in Assembla, since both ticketing systems start with ticket 1. Works in this case at least: http://dev.clojure.org/jira/browse/CLJ-446. Stu > Anyone know what this bug was called in the bug tracker? I can't find > it in the tracking database to determine the status. > > On Sat, Oct 2, 2010 at 5:42 PM, ataggart wrote: >> I just submitted a patch for this issue. >> >> On Oct 1, 2:42 pm, ataggart wrote: >>> I'm working on the latter right now. Note there's already a ticket >>> for the reflection >>> problem:https://www.assembla.com/spaces/clojure/tickets/446 >>> >>> On Oct 1, 12:24 pm, Nicolas Oury wrote: >>> >>> >>> > David pointed out what should have been the obvious overhead (I'll > blame it on being up at 2am), and Nicolas pointed out the specific > problem. >>> two solutions: >>> - writing all combinations of unboxed/boxed for every function - having a more clever code generator that try to box every primitive if it allows to prevent a reflective call. (And maybe emit a "boxing warning") >> >> -- >> 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 -- 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.java.shell hanging issues
One effective way to do it is to change the background color of either the whole page, or of the title (eg API for shell - clojure-contrib v1.2 (stable)) An analogous case that is handled well I think: http://reference.wolfram.com/mathematica/NonlinearRegression/ref/NonlinearRegress.html On Wed, Jan 5, 2011 at 6:40 PM, Stuart Halloway wrote: >> On Wed, Jan 5, 2011 at 8:00 PM, Stuart Halloway >> wrote: >>> All the code you are referring to is in clojure.contrib. Note the comment >>> at the top of the files: >>> >>> ;; DEPRECATED in 1.2: Promoted to clojure.java.shell >> >> At the top of which files? If you mean the library's source code, it's >> very likely he didn't read a single line of it -- just installed the >> contrib jar along with Clojure and then :required or :used it. >> >> If something people have been using in version x is deprecated in >> later version y, this needs to be announced somewhere more prominently >> than in its source code, like, oh, say, the main documentation page. > > This is partially in place already. Deprecated namespaces are marked as such > with {:deprecated true}, and the top of the documentation page shows this > (e.g. http://clojure.github.com/clojure-contrib/shell-api.html). > > However, the styling of the deprecation warning is such that it can be easily > missed. > >> Better yet, the compiler should say something -- javac emits warnings >> if you call a method marked deprecated with Javadoc; maybe we need a >> {:deprecated true} meta tag that can be used on defns and that makes >> clojure emit warnings when deprecated functions are called? (These can >> be printlns to stderr in the same vein as the warnings generated by >> (set! *warn-on-reflection* true).) > > Ticket created: http://dev.clojure.org/jira/browse/CLJ-706. > > Thanks, > Stu > > > -- > 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: feedback on first compojure app: Sportello
Thanks for the feedback Timothy, it is appreciated. map-by key is a good name, I'll change it to that. As far as I understand zip is different than flatten. (zip [[1 2] [3 4]]) => ((1 3) (2 4)) (zip [[1 2 3] [4 5 6]]) => ((1 4) (2 5) (3 6)) -- 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: feedback on first compojure app: Sportello
On Wed, Jan 5, 2011 at 10:09 PM, Alex Baranosky wrote: > Thanks for the feedback Timothy, it is appreciated. > map-by key is a good name, I'll change it to that. > As far as I understand zip is different than flatten. > (zip [[1 2] [3 4]]) => ((1 3) (2 4)) > (zip [[1 2 3] [4 5 6]]) => ((1 4) (2 5) (3 6)) So zip is just (partial apply (partial map list))? -- 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: Knuth's literate programming "tangle" function in Clojure
On Wed, Jan 5, 2011 at 8:39 PM, Tim Daly wrote: > On 1/5/2011 8:27 PM, Mark Engelberg wrote: >> On Wed, Jan 5, 2011 at 4:44 PM, Eric Schulte >> wrote: >>> >>> For the most up-to-date and comprehensive documentation of using >>> Org-mode to work with code blocks (e.g. Literate Programming or >>> Reproducible Research) the online manual is also very useful. >> >> In literate programming org-mode, will Clojure code be properly >> highlighted and indented? >> Is there a keystroke (like Ctrl-c,Ctrl-k) that will evaluate the >> Clojure code in the entire file and send it to the swank REPL? >> Will stacktraces point at the correct line number? >> > It seems that your real question is whether Clojure knows about > a literate document. It does not. But it would be possible to > modify the reader behavior when given a pamphlet file. The REPL > uses a line numbering reader. Anything between the last > \end{chunk} and the next \begin{chunk} could be considered > as comments to be ignored but the line numbers for the function > would be correct and therefore the stack traces would be correct. > > I suppose it would be reasonably easy (there is no such thing > as a simple job) to write a literate reader for the REPL. All > it would need to know is where to turn-on and turn-off the normal > read semantics. If we had custom reader macros in Clojure we wouldn't even be having this discussion; you would probably have already implemented it by now. :) -- 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.java.shell hanging issues
On Wed, Jan 5, 2011 at 9:40 PM, Stuart Halloway wrote: >> On Wed, Jan 5, 2011 at 8:00 PM, Stuart Halloway >> wrote: >>> All the code you are referring to is in clojure.contrib. Note the comment >>> at the top of the files: >>> >>> ;; DEPRECATED in 1.2: Promoted to clojure.java.shell >> >> At the top of which files? If you mean the library's source code, it's >> very likely he didn't read a single line of it -- just installed the >> contrib jar along with Clojure and then :required or :used it. >> >> If something people have been using in version x is deprecated in >> later version y, this needs to be announced somewhere more prominently >> than in its source code, like, oh, say, the main documentation page. > > This is partially in place already. Deprecated namespaces are marked as such > with {:deprecated true}, and the top of the documentation page shows this > (e.g. http://clojure.github.com/clojure-contrib/shell-api.html). > > However, the styling of the deprecation warning is such that it can be easily > missed. The granularity is limited to whole namespaces? Ick. How about: {:deprecated true} metadata can be attached to any var. (defnd ... ) sets this, so you can just change "defn" to "defnd" to deprecate a function. Deprecation shows up in the generated docs, along with the arities, docstring, etc.; and that includes on generated web pages like those for the contrib libraries. On generated web pages it can show up in blinking red 100 point Gothic if you like. And the compiler emits a warning when it compiles something that references a deprecated var, just as it does if *warn-on-reflection* is set and it compiles an interop call that needs reflection. -- 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: ANN: ClojureQL 1.0.0 now released
On Wed, Jan 5, 2011 at 6:14 AM, LauJensen wrote: > Just a quick heads up that ClojureQL 1.0.0 is now released. All > interfaces should be final and there are no known bugs. Looks really interesting. We're about to start moving some of our web app back end over to Clojure and this might be a good fit but I'd be a little concerned about performance and the docs don't give me enough data to figure that aspect out... Normally I'd expect systems like this to compile to a SQL prepared statement so arguments can be provided without needing to recompile the AST to SQL and recompile the SQL but I don't see anything like that in the docs (I see a mention of a (compile) function on the examples page but it isn't mentioned in the documentation). For example, with c.c.sql, I'd write something like: (sql/with-query-results rows ["SELECT dateofbirth, gender, zipcode FROM user WHERE id = ?" user-id] ( ... process rows ... )) With ClojureQL, the obvious query would be (I think): (-> (table :user) (select (where (= :id user-id))) (project [:dateofbirth :gender :zipcode])) But is that really the same? -- 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
Re: feedback on first compojure app: Sportello
I defined it as: (defn zip [seq-of-seqs] (apply map list seq-of-seqs)) -- 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: Knuth's literate programming "tangle" function in Clojure
On 1/5/2011 10:20 PM, Ken Wesson wrote: On Wed, Jan 5, 2011 at 8:39 PM, Tim Daly wrote: On 1/5/2011 8:27 PM, Mark Engelberg wrote: On Wed, Jan 5, 2011 at 4:44 PM, Eric Schulte wrote: For the most up-to-date and comprehensive documentation of using Org-mode to work with code blocks (e.g. Literate Programming or Reproducible Research) the online manual is also very useful. In literate programming org-mode, will Clojure code be properly highlighted and indented? Is there a keystroke (like Ctrl-c,Ctrl-k) that will evaluate the Clojure code in the entire file and send it to the swank REPL? Will stacktraces point at the correct line number? It seems that your real question is whether Clojure knows about a literate document. It does not. But it would be possible to modify the reader behavior when given a pamphlet file. The REPL uses a line numbering reader. Anything between the last \end{chunk} and the next \begin{chunk} could be considered as comments to be ignored but the line numbers for the function would be correct and therefore the stack traces would be correct. I suppose it would be reasonably easy (there is no such thing as a simple job) to write a literate reader for the REPL. All it would need to know is where to turn-on and turn-off the normal read semantics. If we had custom reader macros in Clojure we wouldn't even be having this discussion; you would probably have already implemented it by now. :) LispReader is a class that appears to have a read function that does Clojure s-expression parsing. Wrapping that around a LiterateReader stream would seem to do the job. The LiterateReader stream only has to change any non-chunk line into a Clojure comment by prepending a semicolon. The code to scan a line that begins with a \begin{chunk} or \end{chunk} does not seem all that challenging. In fact, a slightly smarter LiterateReader stream could be given the particular line as an argument and only call LispReader on that s-expression. So a LiterateReader with an optional line number argument would allow an editor to specify where to start .read. A reader macro would require special syntax. This may be reasonable but it seems that a simple (load-literate "filename" N) would be all that is needed, requiring no special syntax. Alternatively the reader could use the file extension so that pamphlet files would invoke the LiterateReader stream automatically. Or if the parse of the first line begins with \ then use LiterateReader. I'm documenting Bit-partitioned hash tries at the moment. I'll see if I can document the reader next and get an idea of exactly how it works and what it would take to change it. Tim Daly -- 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.java.shell hanging issues
On Wed, Jan 5, 2011 at 4:41 PM, kovas boguta wrote: > Following the clojure.org api docs, I clicked through on the source code link > on > > http://richhickey.github.com/clojure-contrib/shell-api.html I'm curious as to how you got here? I went to clojure.org, clicked API, clicked clojure.java.shell in the left column and ended up here: http://clojure.github.com/clojure/clojure.java.shell-api.html Clicking the source link took me here: https://github.com/clojure/clojure/blob/a2c95ef1bf6e34a455b469ac9ff18ddff7e9cef7/src/clj/clojure/java/shell.clj#L79 Looks like there are still erroneous links to out of date docs and the old repo? -- 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
Re: Knuth's literate programming "tangle" function in Clojure
Now that i think of it, it is mostly a fear of having decreased productivity in writing code that affected my statement that i liked the little files. Im used to, i suppose, developing code for a specific function in a file, being able to compile, goto line numbers where there are errors, send code to slime, etc. Looking over your example made things much clearer. Its like your guiding your reader to specific parts of the 'little files', describing the theory behind them, moving on, etc. And each code fragment has a chunk name associated with it, and all of them are combined into the final .clj file using the code fragment names (in a separate chunk). At first, i thought this would be less productive than simply putting all of the code in one clj file, but now that i think about it i think it would, with the appropriate tools. And it wouldn't even be too difficult, with org-mode (prefer it over latex any day!) Im going to start transferring a subsection of my program to literate programming, using org-mode. See how it goes... Oh, and Tim, you might want to take a closer look at org-mode. Instead of having to tangle out the code that builds everything, you could create an executable shell script block in org-mode - the makefile script could be tangled into a string using noweb syntax, and then everything could go from there. You can execute the block by hitting C- c c-c in the org file (or something like that). Pretty cool, in my opinion! -- 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 Quizzes?
I'm new to the Clojure community (admittedly, I'm only on chapter 6 of Clojure in Action, so my Clojure skills are sub-sub-par at the moment), but I was wondering if there were any weekly challenges for writing Clojure code like there is (was?) for Ruby, i.e: http://rubyquiz.com/ When I was starting my investigation into Ruby I found this type of weekly quiz incredibly insightful. Is there something similar for Clojure? Even Lisp would be fine, and I would think it would be interesting to compare approaches from others in the group. Thoughts? -- 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.java.shell hanging issues
In retrospect it probably wasn't clojure.org, but an adjacent tab I opened from a google search. richhickey.github.com has really high pagerank :) which can confuse things; also all these branches have nearly the same visual identity which makes it easy to forget what is going on. On Wed, Jan 5, 2011 at 7:46 PM, Sean Corfield wrote: > On Wed, Jan 5, 2011 at 4:41 PM, kovas boguta wrote: >> Following the clojure.org api docs, I clicked through on the source code >> link on >> >> http://richhickey.github.com/clojure-contrib/shell-api.html > > I'm curious as to how you got here? I went to clojure.org, clicked > API, clicked clojure.java.shell in the left column and ended up here: > > http://clojure.github.com/clojure/clojure.java.shell-api.html > > Clicking the source link took me here: > > https://github.com/clojure/clojure/blob/a2c95ef1bf6e34a455b469ac9ff18ddff7e9cef7/src/clj/clojure/java/shell.clj#L79 > > Looks like there are still erroneous links to out of date docs and the old > repo? > -- > 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 -- 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: Knuth's literate programming "tangle" function in Clojure
Mark Engelberg writes: > On Wed, Jan 5, 2011 at 4:44 PM, Eric Schulte wrote: >> For the most up-to-date and comprehensive documentation of using >> Org-mode to work with code blocks (e.g. Literate Programming or >> Reproducible Research) the online manual is also very useful. > > In literate programming org-mode, will Clojure code be properly > highlighted and indented? yes, Clojure code is displayed using the Emacs major mode for Clojure code, so the appearance is as you would expect. See this screenshot from the file I am working on at the moment, the upper frame is a .clj file and the lower is a .org file. http://i.imgur.com/kdbDp.png > > Is there a keystroke (like Ctrl-c,Ctrl-k) that will evaluate the > Clojure code in the entire file and send it to the swank REPL? Yes, C-c C-c evaluates the code block under the point, and many other keystrokes bind to various other functions [1], specifically C-c C-v b executes the entire buffer. > Will stacktraces point at the correct line number? No, this is one of the reasons that I currently tend to do large-scale development in .clj files and reserve embedded code for shorter chunks of code. That said I have successfully completed large clojure projects in which the entirety of the code was tangled from a single literate .org file. Cheers -- Eric Footnotes: [1] M-x org-babel-describe-bindings Major Mode Bindings Starting With C-c C-v: key binding --- --- C-c C-v a org-babel-sha1-hash C-c C-v b org-babel-execute-buffer C-c C-v d org-babel-demarcate-block C-c C-v e org-babel-execute-maybe C-c C-v f org-babel-tangle-file C-c C-v g org-babel-goto-named-src-block C-c C-v h org-babel-describe-bindings C-c C-v i org-babel-lob-ingest C-c C-v l org-babel-load-in-session C-c C-v n org-babel-next-src-block C-c C-v o org-babel-open-src-block-result C-c C-v p org-babel-previous-src-block C-c C-v r org-babel-goto-named-result C-c C-v s org-babel-execute-subtree C-c C-v t org-babel-tangle C-c C-v u org-babel-goto-src-block-head C-c C-v v org-babel-expand-src-block C-c C-v x org-babel-do-key-sequence-in-edit-buffer C-c C-v z org-babel-switch-to-session-with-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: Knuth's literate programming "tangle" function in Clojure
>>> >>> Emacs org-mode, on the other hand, is a useful development >>> technology but it really isn't literate programming. >>> >> I would be interested to hear your thoughts as to why Org-mode is not a >> literate programming tool. > I never said org-mode wasn't a 'literate programming tool'. It is clearly an > outstanding version of a literate programming tool. What I said was that > org-mode "really isn't literate programming". > Ok, then it sounds like we're in agreement. I just was confused by the use of "org-mode" as a verb to describe one particular task when it supports many disparate tasks, including LP as you have defined it. Thanks for the explanation. Cheers -- 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: Clojure 1.3 alpha 1 report - bitwise operations extremely slow
On Wed, Jan 5, 2011 at 6:42 PM, Stuart Halloway wrote: > The tickets that came forward from Assembla should have the same numbers they > did in Assembla, since both ticketing systems start with ticket 1. > > Works in this case at least: http://dev.clojure.org/jira/browse/CLJ-446. > > Stu That doesn't sound like the same bug discussed in this thread though. We were talking about how operators like bit-shift-left were super-slow under certain circumstances in 1.3. It's a reflection issue, sure enough, but is it the same issue discussed at ticket #446? -- 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: Knuth's literate programming "tangle" function in Clojure
On 1/5/2011 10:58 PM, Seth wrote: Now that i think of it, it is mostly a fear of having decreased productivity in writing code that affected my statement that i liked the little files. Im used to, i suppose, developing code for a specific function in a file, being able to compile, goto line numbers where there are errors, Try inserting a syntax error anywhere in the code. Then type 'make' to the shell. You'll get a traceback that shows you the exact line in the file that failed since the literate document is really feeding Java files to the compiler. This is forced by Java since there is a (bogus) connection between filename and contents. In any case, you still get the same traceback you always got. send code to slime, etc. Looking over your example made things much clearer. Its like your guiding your reader to specific parts of the 'little files', describing the theory behind them, moving on, etc. And each code fragment has a chunk name associated with it, and all of them are combined into the final .clj file using the code fragment names (in a separate chunk). The REPL makes it much easier to develop lisp code in a literate style because you can kill/yank an s-expression into a shell buffer (or use slime). My usual method of working is to build and test a function in the REPL. Once it works I have the source already in the file so I can just save it, build the whole system, run the tests, and make sure I didn't break anything (it takes less than a minute). At first, i thought this would be less productive than simply putting all of the code in one clj file, but now that i think about it i think it would, with the appropriate tools. And it wouldn't even be too difficult, with org-mode (prefer it over latex any day!) You see all of the source as one file. The compiler sees all of the source in little files. The beauty of literate programming is that you no longer have to pay attention to the compiler's failings. Im going to start transferring a subsection of my program to literate programming, using org-mode. See how it goes... Oh, and Tim, you might want to take a closer look at org-mode. Instead of having to tangle out the code that builds everything, you could create an executable shell script block in org-mode - the makefile script could be tangled into a string using noweb syntax, and then everything could go from there. You can execute the block by hitting C- c c-c in the org file (or something like that). Pretty cool, in my opinion! I used noweb (ref: Norman Ramsey) for years in Axiom. It is a useful tool. However I finally understood that I can get rid of the 'weave' function with a couple latex macros I wrote (see a prior post) and I could get rid of the 'tangle' function by modifying the reader. I patched lisp and build tangle directly into the image. Thus, with some simple changes I no longer need any special tools. That makes life simple and I like simple. Org-mode sounds great and from what I've seen from the docs it does everything but cook rice. I would highly recommend it as a tool if you like that sort of thing. It would integrate well in a slime environment if you like that sort of thing. ANYTHING that helps you write literate programs is a win in my book. I'm afraid that I have two personal failing that make org-mode unlikely. I don't like modes (My emacs mode table is smashed to be fundamental mode for everything). Editors should not change my source code. Thus, org-mode is "right-out", to quote Monty Python. Second, I'm addicted to Latex. Latex is an amazing program, simply stunning. I cannot imagine trying to write Clojure in Small Pieces without it. It is just a markup language like HTML and thus not hard to learn but it is also a turing complete language that has a huge ecosystem of tools and techniques. I am creating the graphics for CISP at the moment in Latex. I could do it using some other tool such as gimp but life would not be as simple and the clojure.pamphlet file would now need image files (more 'little files' cruft). But whatever works for you is great. Please post an example of a literate document using org-mode. We can then compare and contrast, as my English teacher used to say. It would be interesting to see another example of a literate document for Clojure. Slime and org-mode may be the proper way to go. Tim Daly -- 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: Knuth's literate programming "tangle" function in Clojure
On 1/5/2011 11:18 PM, Eric Schulte wrote: Mark Engelberg writes: On Wed, Jan 5, 2011 at 4:44 PM, Eric Schulte wrote: For the most up-to-date and comprehensive documentation of using Org-mode to work with code blocks (e.g. Literate Programming or Reproducible Research) the online manual is also very useful. In literate programming org-mode, will Clojure code be properly highlighted and indented? yes, Clojure code is displayed using the Emacs major mode for Clojure code, so the appearance is as you would expect. See this screenshot from the file I am working on at the moment, the upper frame is a .clj file and the lower is a .org file. http://i.imgur.com/kdbDp.png Is there a keystroke (like Ctrl-c,Ctrl-k) that will evaluate the Clojure code in the entire file and send it to the swank REPL? Yes, C-c C-c evaluates the code block under the point, and many other keystrokes bind to various other functions [1], specifically C-c C-v b executes the entire buffer. Will stacktraces point at the correct line number? No, this is one of the reasons that I currently tend to do large-scale development in .clj files and reserve embedded code for shorter chunks of code. That said I have successfully completed large clojure projects in which the entirety of the code was tangled from a single literate .org file. Can you post examples of these? I'd love to see some other examples. Cheers -- Eric Footnotes: [1] M-x org-babel-describe-bindings Major Mode Bindings Starting With C-c C-v: key binding --- --- C-c C-v a org-babel-sha1-hash C-c C-v b org-babel-execute-buffer C-c C-v d org-babel-demarcate-block C-c C-v e org-babel-execute-maybe C-c C-v f org-babel-tangle-file C-c C-v g org-babel-goto-named-src-block C-c C-v h org-babel-describe-bindings C-c C-v i org-babel-lob-ingest C-c C-v l org-babel-load-in-session C-c C-v n org-babel-next-src-block C-c C-v o org-babel-open-src-block-result C-c C-v p org-babel-previous-src-block C-c C-v r org-babel-goto-named-result C-c C-v s org-babel-execute-subtree C-c C-v t org-babel-tangle C-c C-v u org-babel-goto-src-block-head C-c C-v v org-babel-expand-src-block C-c C-v x org-babel-do-key-sequence-in-edit-buffer C-c C-v z org-babel-switch-to-session-with-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: Knuth's literate programming "tangle" function in Clojure
On 1/5/2011 11:19 PM, Eric Schulte wrote: Emacs org-mode, on the other hand, is a useful development technology but it really isn't literate programming. I would be interested to hear your thoughts as to why Org-mode is not a literate programming tool. I never said org-mode wasn't a 'literate programming tool'. It is clearly an outstanding version of a literate programming tool. What I said was that org-mode "really isn't literate programming". Ok, then it sounds like we're in agreement. I just was confused by the use of "org-mode" as a verb to describe one particular task when it supports many disparate tasks, including LP as you have defined it. So my comment was unclear. I so badly need an Editor-in-Chief to scan my emails for clarity, punctuation, and other things literate people ought have mastered by now. Sorry about that. Thanks for the explanation. Cheers -- 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: Knuth's literate programming "tangle" function in Clojure
> Can you post examples of these? I'd love to see some other examples. Sure thing, check out this old version of a file which tangles out into the directory layout expected by lein. http://gitweb.adaptive.cs.unm.edu/?p=asm.git;a=blob;f=asm.org;h=f043a8c8b0a917f58b62bdeac4c0dca441b8e2cb;hb=HEAD Also, this project has an org-mode front page with code examples, the html woven from this front page is shown at http://repo.or.cz/w/neural-net.git and the raw org file is available here http://repo.or.cz/w/neural-net.git/blob/HEAD:/neural-net.org I'll have to check out clojure.pamphlet, it sounds like an elegant alternative. It's always interesting to see other solutions in this space. For example I think scribble is a nice tool from the scheme world. http://lambda-the-ultimate.org/node/4017 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: Clojure Quizzes?
On Wed, Jan 5, 2011 at 8:04 PM, John Svazic wrote: > I'm new to the Clojure community (admittedly, I'm only on chapter 6 of Welcome!! > Clojure in Action, so my Clojure skills are sub-sub-par at the > moment), but I was wondering if there were any weekly challenges for > writing Clojure code like there is (was?) for Ruby, i.e: > > http://rubyquiz.com/ > > When I was starting my investigation into Ruby I found this type of > weekly quiz incredibly insightful. Is there something similar for > Clojure? Even Lisp would be fine, and I would think it would be > interesting to compare approaches from others in the group. Thoughts? Project Euler is something you might look at - it offers a variety of interesting problems that you can solve in any language (and I think it's particularly good for solving the same problem in multiple languages so you can compare them in the same context, which I find really helps me 'get' new languages). I think the Ruby Quiz is a great idea but I suspect it is a huge amount of work behind the scenes... -- 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
Re: Knuth's literate programming "tangle" function in Clojure
On 1/6/2011 12:03 AM, Eric Schulte wrote: Can you post examples of these? I'd love to see some other examples. Sure thing, check out this old version of a file which tangles out into the directory layout expected by lein. http://gitweb.adaptive.cs.unm.edu/?p=asm.git;a=blob;f=asm.org;h=f043a8c8b0a917f58b62bdeac4c0dca441b8e2cb;hb=HEAD I see that this file is using chunk markup but I don't see the "ideas-to-implementation" (I2I) explanation. That is, I don't see text that is written so someone like me can read the text, understand the ideas and how they translate to code. Also, this project has an org-mode front page with code examples, the html woven from this front page is shown at http://repo.or.cz/w/neural-net.git and the raw org file is available here http://repo.or.cz/w/neural-net.git/blob/HEAD:/neural-net.org I love the graphics in this example! But, alas, this also seems to be disconnected from the I2I property. But this is VERY encouraging since it shows that you can get beautifully formatted documents from the source. I'll have to check out clojure.pamphlet, it sounds like an elegant alternative. It's always interesting to see other solutions in this space. For example I think scribble is a nice tool from the scheme world. http://lambda-the-ultimate.org/node/4017 Take a look at http://daly.axiom-developer.org/clojure.pdf The key difference, at least from my perspective, is that the CISP is (well, is slowly being) organized around ideas. The goal is to introduce the ideas and explain them in enough detail to *motivate* the code that follows the explanation. If you handed your printed document (or pdf) to someone will they come away with enough understanding of neural networks to be able to explain your code? Can they read the pdf and know what to change and where to change it? Do they have literature references to follow for deeper information? Is there a usable index with proper cross references so they can hyperlink to the explanation and its associated code block? These things seem, in my opinion, necessary (but not sufficient) for the I2I property to hold. I think that the tool you have is very, very nice. It shows me that it would make a proper substitute for my beloved Latex as a viable alternative for literate programming. Tim Daly -- 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: ANN: Gloss, a byte-format DSL
I'm confused by what you expect the decoded value for that string to look like. Is it: [["blabla" "hi hi" "jg"] [" g"]] or [["blabla" "hi hi" "jg\0 g"]] Zach On Jan 5, 3:36 am, "pepijn (aka fliebel)" wrote: > Nothing :( > > $ lein repl > "REPL started; server listening on localhost:32399." > user=> (use '[gloss core io]) > nil > user=> (defcodec t (repeated (string :utf-8 :delimiters > ["\n"]) :delimiters ["\0"])) > #'user/t > user=> (decode t (.getBytes "blabla\nhihi\njg\0 g\n\0")) > java.lang.Exception: Cannot evenly divide bytes into sequence of > frames. (NO_SOURCE_FILE:0) > > What I think is happening is that repeated reads up to the first \0 > and then tries to fit the subframes inside of that. What I think it > *should* do is, check the next byte for a delimiter, if not, read a > subframe, rinse and repeat. > > Pepijn > > On Jan 2, 7:38 pm, Zach Tellman wrote: > > > > > > > > > There was a bug in repeated, which is fixed now. Pull the latest from > > github or clojars and let me know how it goes. > > > Zach > > > On Jan 2, 3:29 am, "pepijn (aka fliebel)" > > wrote: > > > > Okay, clicked send to early. The header also contains 0-bytes, so the > > > repeated stops 'mid-sentence' and tries to balance things. Is there > > > any wayGlosscan handle nested structures like this? > > > > On Jan 2, 12:20 pm, "pepijn (aka fliebel)" > > > wrote: > > > > > Hi, > > > > > Thanks for helping out. After using codecs rather than frames, I get > > > > even weirder errors. > > > > > My code now gives me: java.lang.Exception: Cannot evenly divide bytes > > > > into sequence of frames. > > > > > Hard coding the header followed by a terminating :byte works as it > > > > should: > > > > > (decode (compile-frame [tag tstring (header tag (memoize #(compile- > > > > frame [(name %) tstring (get-tag %)])) (comp symbol first)) :byte]) > > > > data) > > > > [:compound "hello world" ["string" "name" "Bananrama"] 0] > > > > > So the problem seems to be with the repeated. Investigating that, I > > > > copied an example from the introduction page, and this is the result: > > > > (defcodec t (repeated (string :utf-8 :delimiters ["\n"]) :delimiters > > > > ["\0"])) > > > > (encode t ["foo" "bar" "baz"]) > > > > java.lang.IllegalArgumentException: Don't know how to create ISeq > > > > from: java.nio.HeapByteBuffer > > > > ((# > > > > #) > > > > (# > > > > #) > > > > > But on the other hand: > > > > (decode t (.getBytes "blabla\nhihi\ng\n\0")) > > > > ["blabla" "hihi" "g"] > > > > > This gives me the same error as my code, but since the header in my > > > > code seems correct, I don't see why it has leftover bytes. > > > > (decode t (.getBytes "blabla\nhihi\ng\0")) > > > > java.lang.Exception: Cannot evenly divide bytes into sequence of > > > > frames. > > > > > By the way, is there an easy way to get something readable out of > > > > encode? Like Unix hexdump, or even just a seq of integers. Debugging > > > > is a weak point inGlossso far, if you ask me. > > > > > Thanks! > > > > > Pepijn de Vos > > > > > On Jan 1, 10:47 pm, Zach Tellman wrote: > > > > > > The header->body function in (header ...) must return a codec, so you > > > > > need to call compile-frame on the vector you're generating. Since you > > > > > don't want to call compile-frame every time you decode a frame, you > > > > > can memoize the function. A version that does both can be found > > > > > athttps://gist.github.com/762031. > > > > > > I agree that the way the enumeration and types are blurred in your > > > > > code is a little confusing. You could create a stronger distinction > > > > > by calling your enumerated types :tag-byte, :tag-int32, etc, and then > > > > > defining a map from those tags onto :byte, :int32, and so on. > > > > > > Zach > > > > > > On Jan 1, 1:01 pm, "pepijn (aka fliebel)" > > > > > wrote: > > > > > > > Hey, > > > > > > > I am tryingGlossfor reading NBT [1] files. > > > > > > > First thing I did like is that it seems to make things real easy. > > > > > > First thing I did not like is the weak separation between types > > > > > > like :byte and extra data like :foo. > > > > > > > I think I'm nearly done with the NBT reader [2], but I ran into a > > > > > > problem. Whatever I put in the header form, I get exceptions like > > > > > > this: > > > > > > > java.lang.IllegalArgumentException: No implementation of > > > > > > method: :sizeof of protocol: #'gloss.core.protocols/Writer found for > > > > > > class: clojure.lang.PersistentVector > > > > > > > Only thing it mentions in the stacktrace [3] is methods on a reify, > > > > > > which calls the same method again, or in the most recent case, just > > > > > > return nil. > > > > > > > [1]http://www.minecraft.net/docs/NBT.txt > > > > > > [2]https://gist.github.com/761997 > > > > > > [3]http://pastebin.com/AqrsbjuS > > > > > > > On Nov 28 2010, 8:14 pm, Zach Tellman wrote: > > > > > > > > You're right, that's an omission from the frame syntax. I'll add
Re: ANN: Gloss, a byte-format DSL
Thanks for the patch! It's too bad that Gloss wasn't directly suited to your needs, but I appreciate you taking the time to familiarize yourself with the code and add new functionality. Zach On Jan 5, 2:45 pm, "Eric Schulte" wrote: > also, here's a patch to Gloss which I've used locally but which may be > generally useful. > > Cheers -- Eric > > 0001-adding-primitive-support-for-uint16-uint32-and-uint6.patch > 1KViewDownload > > > > > > > > > > "Eric Schulte" writes: > > Thanks for sharing this library, I found reading your code to be very > > useful. > > > I need to be able to read and write elf files from within Clojure code, > > and Gloss initially looked like a good option. However much of the > > streaming support and frame-based conception got in the way of my > > particular needs. > > > In the end I have written a much simpler collection of functions which > > supports parsing binary files into lists of bytes, manipulating these > > lists, and then writing the lists back to binary files. This is heavily > > influenced by the code in Gloss. Seehttps://github.com/eschulte/bin-ed > > > Anyways just thought I'd share, if anyone notices anything in the code > > which doesn't make sense, or could be more easily accomplished in some > > other way please do let me know. > > > Thanks -- 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