Re: rebind var for all threads
On 12 August 2011 06:36, Sean Corfield seancorfi...@gmail.com wrote: On Thu, Aug 11, 2011 at 6:48 PM, Ken Wesson kwess...@gmail.com wrote: Eh. I now can't seem to actually find any recent post mentioning both it and Android. But mentioning it in connection with Google's app store is another matter. There is no Google App Store. There is an Android Market which is where you get mobile apps for Android devices: https://market.android.com/ There is Google Apps which is their web-based email, calendar and documents for teams: http://www.google.com/apps/ Then there's Google App Engine which is their elastic cloud service supporting Python and Java web applications (with some class restrictions): http://www.google.com/enterprise/cloud/appengine/ Hope that helps clarify this thread's subject matter... Don't forget App Inventor (which is going away). -- Michael Wood esiot...@gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Example of a real-world ClojureScript web application
I was able to get Jasmine tests running in the browser. You really just have to follow the pattern in Quickstarthttps://github.com/clojure/clojurescript/wiki/Quick-Start, and good.require the needed namespaces. I imagine Google Closure's testing libhttp://closure-library.googlecode.com/svn/docs/namespace_goog_testing.html will work in the same way. I'll let you know how far I get with automated testing in a nodejs shell. Tim Washington twash...@gmail.com 416.843.9060 On Thu, Aug 11, 2011 at 2:20 AM, Filip de Waard f...@vix.io wrote: On Thu, Aug 11, 2011 at 4:03 AM, Timothy Washington twash...@gmail.comwrote: Good on you. I've been looking to find a reliable way to have Javascript unit testing run in a v8 (or any JS) shell. I've tried Jasmine and am now trying Google Closure's unit testing framework, but have so far come up short. Have you come up with anything that works? For now, i'm just having the tests run in the browser. But trying with Nodejs is the next step. I don't have it at hand, right now, because I'm not at home, but I think the Google Closure book suggests using Selenium to automatically run the tests. Alternatively, using script/repljs might work. Do you have the tests running a browser window already? If so, I'd love to have a look at how you did that, because I haven't gotten that far yet myself. I'm going to give this another shot soon, because I've learned quite a lot about ClojureScript since I last tried to get testing to work. -fmw Keep it up Tim On Tue, Aug 9, 2011 at 8:53 PM, Filip de Waard f...@vix.io wrote: I'm working on Vix, which is a document repository and content management system written in Clojure with a CouchDB backend. After the announcement on July 23 I immediately got excited about ClojureScript and the Google Closure toolkit, so I dropped the existing Backbone.js and jQuery code and rewrote all client-side functionality in ClojureScript. Despite (or maybe because of) the fact that the functionality is still very minimal I wanted to share this code as an example of ClojureScript in the wild. Be warned that: - this is not perfect, clean example code written by a ClojureScript expert (in several places I've used hacks and shortcuts to make things work), but hopefully at least a starting point for others working on similar functionality, - you should read the installation instructions carefully (e.g. there is still a hardcoded path in src/vix/db.clj at the time of this writing, which I hope to correct in the near future), - I'm actively developing this application, so things will change and new features will be added frequently, - the application isn't done yet, although it has a working prototype. I'm concentrating on adding features that will allow users to manage feeds (currently blog is the default feed), add media files like images and to manage users. I had trouble getting unit testing to work properly for the ClojureScript part of the application, so I grudgingly wrote it using a non-TDD approach. Retrofitting unit tests into the ClojureScript part is a priority. The user interface is also lacking some bells and whistles that I had previously implemented in jQuery, but still have to rewrite using Google Closure. Eventually, I want to turn Vix into a commercial SaaS offering, with a focus on performance (e.g. Amazon CloudFront support), scalability and webshop functionality. The application itself, however, will be perpetually available as open source software, because I'm committed to sharing my code. Here is the GitHub page for Vix: https://github.com/fmw/vix This is not a launch post for Vix, because we're not ready for supporting typical end-users yet, but I hope that the code will be useful to other developers in the meantime. I'm also happy to receive any feedback (positive as well as negative) and answer questions. You can reply to this post, but if you prefer to contact me privately you can also find my contact information on Github (https://github.com/ fmw). Sincerely, F.M. (Filip) de Waard / fmw P.S. I'd like to thank the ClojureScript developers. There are surprisingly few glitches considering that the project has only just been released. The language is incredibly well designed and a pleasure to use. Thanks for making client-side development more enjoyable! -- 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
Re: rebind var for all threads
On Fri, Aug 12, 2011 at 12:36 AM, Sean Corfield seancorfi...@gmail.com wrote: On Thu, Aug 11, 2011 at 6:48 PM, Ken Wesson kwess...@gmail.com wrote: Eh. I now can't seem to actually find any recent post mentioning both it and Android. But mentioning it in connection with Google's app store is another matter. There is no Google App Store. There is an Android Market which is where you get mobile apps for Android devices: https://market.android.com/ There is Google Apps which is their web-based email, calendar and documents for teams: http://www.google.com/apps/ Then there's Google App Engine which is their elastic cloud service supporting Python and Java web applications (with some class restrictions): http://www.google.com/enterprise/cloud/appengine/ Hope that helps clarify this thread's subject matter... That is odd. Google is usually much better about clearly naming things, but here they've more or less got things backwards relative to smartphone industry leader Apple. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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] Lacij v.0.4.0
Great stuff. I need something like this to visually render the internal design of synths in Overtone. Keep up the great work, Sam --- http://sam.aaron.name On 11 Aug 2011, at 14:02, Pierre Allix wrote: Hello, I'm pleased to announce the release of the version 0.4.0 of the Lacij graph visualization library. The release includes a new automatic layout called hierarchical layout. It is similar to a tree layout or family tree but works on any type of graph (tree or not). An example of this layout can be seen here http://minus.com/ll9M1g it is a PNG exported from the generated SVG. The release also extends the API and fixes a couple of bugs. The library is available on GitHub: https://github.com/pallix/lacij and Clojars: http://clojars.org/lacij Please get in touch if you want to help the Lacij project and implement additional layouts algorithms. From the README: Lacij is a graph visualization library written in Clojure. It allows the display and the dynamic modification of graphs as SVG documents that can be viewed with a Web browser or with a Swing component. Undo/ redo is supported for the dynamic modification. Automatic layout is provided for the visualization. -- 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: rebind var for all threads
Yes. The compiler probably optimized away the var lookup to an embedded constant. You'll need to use an atom, as Baldridge suggested. The Clojure compiler doesn't optimize anything away. However, in a situation like this: (defn foo [x y] ...) (def bar (partial foo 1)) The binding of `foo` is resolved when `bar` is defined, and never again thereafter. Changing the root binding of `foo` in this case would have no effect on `bar`. -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
Nasty java interop problem -- ideas?
Hi! I have the following problem. I'm using a Java lib for making GUIs. One lays out the GUI in XML, then uses a Controller (Listener type thing) to do stuff. For example, in the XML one might have onClick=doSomething(). And then reflection is used to find the method of the controller instance. But doSomething() is not a method of the interface Controller. The Controller interface only declares a few very basic methods. So, I need to pass an object to the GUI that implements Controller, but also has additional methods. With proxy, I learend recently, I can not define additional methods, outside the interface. What is the most painless way to create an object that implements a specific interace, but also has additional methods? The simplest so far seems to be to use gen-interface to create a subinterface of Controller with all the methods I need, or gen-class. But that would require AOT compilation. Can I get away without it? -- 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: Nasty java interop problem -- ideas?
The simplest so far seems to be to use gen-interface to create a subinterface of Controller with all the methods I need, or gen-class. But that would require AOT compilation. Can I get away without it? Can you use definterface to create an interface with your methods on, and then deftype or reify to implement the methods from the Controller type, and from your custom interface. -- Dave -- 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: rebind var for all threads
On Fri, Aug 12, 2011 at 10:17 AM, Stuart Sierra the.stuart.sie...@gmail.com wrote: Yes. The compiler probably optimized away the var lookup to an embedded constant. You'll need to use an atom, as Baldridge suggested. The Clojure compiler doesn't optimize anything away. However, in a situation like this: (defn foo [x y] ...) (def bar (partial foo 1)) The binding of `foo` is resolved when `bar` is defined, and never again thereafter. Changing the root binding of `foo` in this case would have no effect on `bar`. That is what I meant, and from what I've heard, in 1.3 this behavior extends to defn if the Var isn't defined with :dynamic true, that is, (defn bar [x] (foo x)) will use a baked-in value of foo rather than do a dynamic Var lookup. That's faster, but doesn't allow dynamic binding to work, and presumably not alter-var-root either. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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: Nasty java interop problem -- ideas?
Oh yes, of course. Why didn't I think of that? For some reason, implementing 2 interfaces never occurred to me. :P On Aug 12, 4:48 pm, David Powell djpow...@djpowell.net wrote: The simplest so far seems to be to use gen-interface to create a subinterface of Controller with all the methods I need, or gen-class. But that would require AOT compilation. Can I get away without it? Can you use definterface to create an interface with your methods on, and then deftype or reify to implement the methods from the Controller type, and from your custom interface. -- Dave -- 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: Stanford AI Class
Here is an interesting question to ponder... Learning involves permanent changes of behavior. In AI this is often modeled as a self-modifying program. The easiest way to see this would be a program that handles a rubics cube problem. Initially it only knows some general rules for manipulation, some measure of progress, and a goal to achieve. Each time it solves a cube it can create a new rule that moves from the starting configuration to the solution in one procedure, rather than constantly invoking new rules. This could be modeled in the data but we are assuming self modification for the moment. So we start with a lisp loop that does something like: (loop look at the current cube state for each rule, if the condition of the rule matches the cube state then apply the rule to update the cube state. ) This could be written in some form of a huge switch statement where each case matches a cube state, e.g. switch (cubestate) (GBG RRB GBB ...): rotate upper cube slice 90 degrees clockwise (GBG RRR BBY ...): rotate lower cube slice 90 degrees clockwise . (GGG GGG GGG ...): cube solved When we solve the cube we remember the sequence of rotations and add a new rule that matches the starting state followed by a sequence of rotations: switch (cubestate) (GGB RRW GYY ...): rotate upper cube slice 90 degrees clockwise rotate left cube slice 90 degrees clockwise cube solved (GBG RRB GBB ...): rotate upper cube slice 90 degrees clockwise (GBG RRR BBY ...): rotate lower cube slice 90 degrees clockwise . (GGG GGG GGG ...): cube solved; learn new rule; self-modify. Ok. So now we have an architecture for a simple program that learns by self-modification. We could get all kinds of clever by applying special recognizers to combine rotations, find subsequences, etc. but lets discuss the self-modification issue in Clojure. Hmmm. Clojure has immutable data structures. Programs are data structures. Therefore, programs are immutable. So is it possible to create a Clojure program that modifies itself? Tim Daly d...@axiom-developer.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Stanford AI Class
On Fri, Aug 12, 2011 at 12:41 PM, daly d...@axiom-developer.org wrote: Clojure has immutable data structures. Programs are data structures. Therefore, programs are immutable. So is it possible to create a Clojure program that modifies itself? Yes, if it slaps forms together and then executes (eval `(def ~sym ~form)) or (eval `(defn ~sym ~argvec ~form)) or similarly, or perhaps uses alter-var-root. (May require :dynamic true set for the involved Vars in 1.3 for functions and such to start using the new values right away -- binding definitely does. In 1.2, alter-var-root should just work. Changes occur as with atom's swap!, so the function passed to alter-var-root may potentially execute more than once.) Alternatively, you can create new functions on the fly by evaling fn forms and use atoms or refs to hold stored procedures in Clojure's other concurrency-safe mutability containers. These need to be called by derefing them, e.g. (@some-atom arg1 arg2). The functions will compile to bytecode and be eligible for JIT the same as ones not created dynamically at runtime, though the reference lookups carry a performance hit on invocation. Clojure can probably be quite a good AI research and development platform. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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
Why are some Google Closure library files not available in Clojurescript?
Hi everyone- I'm loving clojurescript and am trying to create a test app with it. This test app was going to use goog.storage, but for some reason this library doesn't appear to be available when I install clojurescript (unlike goog.dom, goog.events, etc. which work fine) You can see this library listed in the Google Closure docs: http://closure-library.googlecode.com/svn/docs/index.html For some reason, when I bootstrap clojurescript as per Rich's instructions this library is missing (i.e. I'm missing the directory ~/clojurescript/closure/library/closure/goog/storage) One guess I have as to why this is missing is that clojurescript isn't installing the latest version of the closure library, since goog.storage appears to be a more recent addition. Does anyone know if this is the reason for my issue? Is there any way I can safely update the version of the closure library? If the closure library is out of date on purpose, does anyone know when support of a more recent closure library version is planned? Thanks! Conrad Barski -- 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: Why are some Google Closure library files not available in Clojurescript?
On further inspection, the latest closure library download doesn't have this directory either, so the issue I'm having (whatever it is) is a closure issue, not related to clojurescript. Therefore, it is off- topic for this forum and I will find my answer elsewhere- Thanks! On Aug 12, 1:47 pm, Conrad drc...@gmail.com wrote: Hi everyone- I'm loving clojurescript and am trying to create a test app with it. This test app was going to use goog.storage, but for some reason this library doesn't appear to be available when I install clojurescript (unlike goog.dom, goog.events, etc. which work fine) You can see this library listed in the Google Closure docs:http://closure-library.googlecode.com/svn/docs/index.html For some reason, when I bootstrap clojurescript as per Rich's instructions this library is missing (i.e. I'm missing the directory ~/clojurescript/closure/library/closure/goog/storage) One guess I have as to why this is missing is that clojurescript isn't installing the latest version of the closure library, since goog.storage appears to be a more recent addition. Does anyone know if this is the reason for my issue? Is there any way I can safely update the version of the closure library? If the closure library is out of date on purpose, does anyone know when support of a more recent closure library version is planned? Thanks! Conrad Barski -- 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: Example of a real-world ClojureScript web application
Thanks for sharing the code with us, Filip. I have one additional question: Which parts of ClojureScript were documented well enough for you, and where was it difficult to find enough information on how to implemented certain features? Raju On Aug 10, 11:22 pm, Scott Jaderholm jaderh...@gmail.com wrote: I haven't read the code yet but I have a few questions: Do you miss backbone.js? Are you going to use it with cljs? Have you shared any code between the frontend and backend? As in run the same functions on both sides. If so, are you duplicating the code in both .clj and .cljs or doing something else? How has the debugging/error notification experience been? Scott On Tue, Aug 9, 2011 at 8:53 PM, Filip de Waard f...@vix.io wrote: I'm working on Vix, which is a document repository and content management system written in Clojure with a CouchDB backend. After the announcement on July 23 I immediately got excited about ClojureScript and the Google Closure toolkit, so I dropped the existing Backbone.js and jQuery code and rewrote all client-side functionality in ClojureScript. Despite (or maybe because of) the fact that the functionality is still very minimal I wanted to share this code as an example of ClojureScript in the wild. Be warned that: - this is not perfect, clean example code written by a ClojureScript expert (in several places I've used hacks and shortcuts to make things work), but hopefully at least a starting point for others working on similar functionality, - you should read the installation instructions carefully (e.g. there is still a hardcoded path in src/vix/db.clj at the time of this writing, which I hope to correct in the near future), - I'm actively developing this application, so things will change and new features will be added frequently, - the application isn't done yet, although it has a working prototype. I'm concentrating on adding features that will allow users to manage feeds (currently blog is the default feed), add media files like images and to manage users. I had trouble getting unit testing to work properly for the ClojureScript part of the application, so I grudgingly wrote it using a non-TDD approach. Retrofitting unit tests into the ClojureScript part is a priority. The user interface is also lacking some bells and whistles that I had previously implemented in jQuery, but still have to rewrite using Google Closure. Eventually, I want to turn Vix into a commercial SaaS offering, with a focus on performance (e.g. Amazon CloudFront support), scalability and webshop functionality. The application itself, however, will be perpetually available as open source software, because I'm committed to sharing my code. Here is the GitHub page for Vix:https://github.com/fmw/vix This is not a launch post for Vix, because we're not ready for supporting typical end-users yet, but I hope that the code will be useful to other developers in the meantime. I'm also happy to receive any feedback (positive as well as negative) and answer questions. You can reply to this post, but if you prefer to contact me privately you can also find my contact information on Github (https://github.com/ fmw). Sincerely, F.M. (Filip) de Waard / fmw P.S. I'd like to thank the ClojureScript developers. There are surprisingly few glitches considering that the project has only just been released. The language is incredibly well designed and a pleasure to use. Thanks for making client-side development more enjoyable! -- 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: at-at
Shameless plug, but tron provides the same kind of functionality: https://github.com/pyr/tron Cheers, - pyr On Wed, Aug 10, 2011 at 7:58 PM, David Nolen dnolen.li...@gmail.com wrote: On Wed, Aug 10, 2011 at 1:37 PM, Sam Aaron samaa...@gmail.com wrote: Hi, I just wanted to announce the arrival of the newly-born at-at library - freshly extracted from Overtone: https://github.com/overtone/at-at at-at is an ahead-of-time function scheduler which essentially provides a friendly wrapper around Java's ScheduledThreadPoolExecutor. Enjoy! Sam Nice! 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
trying to reach Rich Hickey
I'm trying to reach Rich Hickey to invite him to a seminar. Rich, can you please reply directly to me? Thanks. Shriram -- 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: Silly Chat: Clojure, ClojureScript and WebSockets
Whats handling the serverside websockets connections? -- 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
Indexing a nested sequence
Hello, I'm trying to find an elegant way of indexing a two-dimensional sequence with the coordinates as keys. The input is something like. ( # #...O #.#.# I.#.# #...# #) The midje test below indicates what kind of behaviour I'm looking for. I can't come up with a solution that is elegant. I'm sure there are better ways to do this, especially in such a sequence oriented language as clojure. Would someone please give me a hand here? (defn- index-maze [str-maze] (let [width (count (first str-maze)) symbols (flatten (map seq str-maze)) total-size (count symbols)] (apply conj (for [position (range total-size) :let [row(quot position width) column (mod position width) sym(nth symbols position)]] {[row column] sym} (fact makes a map with the coordinates as keys symbols as values (index-maze '(#I# #O#)) = (in-any-order { [0 0] \# [0 1] \I [0 2] \# [1 0] \# [1 1] \O [1 2] \#})) Regards Johan Martinsson -- 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
Erlang/OTP in clojure
Hi everyone, i just read this series of posts about riak core https://github.com/rzezeski/try-try-try. I liked it (because i did a lot Erlang recently) and wanted to have a similar thing in clojure. So i started, although i know i would need years to build such a system on my own, but a gen_server would be nice ;). Here is my first approach to a fsm: git repo: https://github.com/rixmann/gen_fsm clojars: [org.clojars.owl/gen_fsm 0.1-BETA] If you are interested please tell me what to do better or contribute :-). Greetings, Ole -- 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: Why are some Google Closure library files not available in Clojurescript?
In case anyone wants to know what the answer is: goog.storage was added with closure library revision 888, but the version used in clojurescript is revision 790. This is because Google hasn't released any pre-packaged versions of the closure library since March. On Aug 12, 1:47 pm, Conrad drc...@gmail.com wrote: Hi everyone- I'm loving clojurescript and am trying to create a test app with it. This test app was going to use goog.storage, but for some reason this library doesn't appear to be available when I install clojurescript (unlike goog.dom, goog.events, etc. which work fine) You can see this library listed in the Google Closure docs:http://closure-library.googlecode.com/svn/docs/index.html For some reason, when I bootstrap clojurescript as per Rich's instructions this library is missing (i.e. I'm missing the directory ~/clojurescript/closure/library/closure/goog/storage) One guess I have as to why this is missing is that clojurescript isn't installing the latest version of the closure library, since goog.storage appears to be a more recent addition. Does anyone know if this is the reason for my issue? Is there any way I can safely update the version of the closure library? If the closure library is out of date on purpose, does anyone know when support of a more recent closure library version is planned? Thanks! Conrad Barski -- 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/conj 2011 Call For Speakers Ends Soon - Aug 19th!
Call For Speakers Clojure/conj 2011 Raleigh, NC Nov 10-12th, 2011 http://clojure-conj.org This is a reminder that the Call for Speakers for the second annual Clojure/conj is ending soon - August 19th at midnight Eastern to be exact! We would still love to receive your abstracts for this conference. If you have been holding off sending in your talk ideas, now is the time to act. The current talks that have been proposed can be summarized in the following categories: * Deep dive technical talks * Real world Clojure uses * Fundamental concepts. Certainly, other categories would be welcome. Speakers will receive: * Full admission to all three days of the Clojure/conj * Up to three nights of hotel at the Raleigh Sheraton (the conference hotel) * A travel stipend * A catered speakers dinner on Thursday night. You can find more information about the Clojure/conj including the current list of speakers and more information about the call for speakers at http://clojure-conj.org. Hope to see you all in November. Thanks! Chris Redinger Clojure/core http://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
Re: Erlang/OTP in clojure
Ole, Glad you liked my posts on Riak. I took a quick glance at your code and it's amazing how much Clojure I've forgotten over the last year. I need to read my Joy of Clojure :) If you're looking for Erlang/OTP in Clojure land than I think an easier path might be to look at Erjang [1]. AFAICT, it is a fairly solid implementation of Erlang/OTP, is in active development, and has some really smart devs behind it. -Ryan [1]: https://github.com/trifork/erjang/wiki On Aug 12, 1:32 pm, Ole Rixmann rixmann@googlemail.com wrote: Hi everyone, i just read this series of posts about riak corehttps://github.com/rzezeski/try-try-try. I liked it (because i did a lot Erlang recently) and wanted to have a similar thing in clojure. So i started, although i know i would need years to build such a system on my own, but a gen_server would be nice ;). Here is my first approach to a fsm: git repo:https://github.com/rixmann/gen_fsm clojars: [org.clojars.owl/gen_fsm 0.1-BETA] If you are interested please tell me what to do better or contribute :-). Greetings, Ole -- 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
ClassCastException with contrib replace-first-str
Hi, I found a small bug in Clojure Contrib 1.2.0. To reproduce: (require '[clojure.contrib.string :as s]) (s/replace-str a b aa) ; bb as expected (s/replace-first-str a b aa) ; java.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Pattern -- 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: Indexing a nested sequence
Hello, I'm trying to find an elegant way of indexing a two-dimensional sequence with the coordinates as keys. If you know width and height you can generate the pattern of coordinates instead of calculating it: (map vector (for [y (range height) x (range width)] y) (cycle (range width))) = ([0 0] [0 1] [0 2] [1 0] [1 1] [1 2]) ; for height 2, width 3 or if you don't like 'for': (map vector (mapcat #(repeat width %) (range height)) (cycle (range width))) now combine with a one-dimensional input string: (zipmap (map vector (for [y (range height) x (range width)] y) (cycle (range width))) #I##O#) = {[1 2] \#, [1 1] \O, [1 0] \#, [0 2] \#, [0 1] \I, [0 0] \#} HTH, Jan -- 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: Indexing a nested sequence
Using the list comprehension (for) along with a helper function (index) (def y (list # #...O #.#.# I.#.# #...# #)) (defn index [s] (map #(vector %1 %2) s (range))) (defn index-maze [maze-str] (reduce conj {} (for [r (index maze-str) c (index (first r))] {[(second r) (second c)] (first c)}))) (index-maze y) The index function takes a sequence and returns a sequence of vectors with the value and the index. (index [:a :b :c]) = ([:a 0] [:b 1] [:c 2]) A similar function exists in the clojure contrib seq-utils: http://richhickey.github.com/clojure-contrib/seq-utils-api.html#clojure.contrib.seq-utils/indexed The for call then uses this index function to create the index for rows and columns. Then use reduce to create a map with all the entries. On Aug 12, 6:49 am, johanmartinsson martinsson.jo...@gmail.com wrote: Hello, I'm trying to find an elegant way of indexing a two-dimensional sequence with the coordinates as keys. The input is something like. ( # #...O #.#.# I.#.# #...# #) The midje test below indicates what kind of behaviour I'm looking for. I can't come up with a solution that is elegant. I'm sure there are better ways to do this, especially in such a sequence oriented language as clojure. Would someone please give me a hand here? (defn- index-maze [str-maze] (let [width (count (first str-maze)) symbols (flatten (map seq str-maze)) total-size (count symbols)] (apply conj (for [position (range total-size) :let [row (quot position width) column (mod position width) sym (nth symbols position)]] {[row column] sym} (fact makes a map with the coordinates as keys symbols as values (index-maze '(#I# #O#)) = (in-any-order { [0 0] \# [0 1] \I [0 2] \# [1 0] \# [1 1] \O [1 2] \#})) Regards Johan Martinsson -- 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: Erlang/OTP in clojure
Thanks, really fast feedback here :) I would like a vnode in clojure... In my opinion a lot of the erlang low-level stuff is not needed for that. The topology can be definded and shared with a gossip protocol over http or xmpp. I think i will spend some time with this, bye Ole On 12 Aug., 21:40, rzeze...@gmail.com rzeze...@gmail.com wrote: Ole, Glad you liked my posts on Riak. I took a quick glance at your code and it's amazing how much Clojure I've forgotten over the last year. I need to read my Joy of Clojure :) If you're looking for Erlang/OTP in Clojure land than I think an easier path might be to look at Erjang [1]. AFAICT, it is a fairly solid implementation of Erlang/OTP, is in active development, and has some really smart devs behind it. -Ryan [1]:https://github.com/trifork/erjang/wiki On Aug 12, 1:32 pm, Ole Rixmann rixmann@googlemail.com wrote: Hi everyone, i just read this series of posts about riak corehttps://github.com/rzezeski/try-try-try. I liked it (because i did a lot Erlang recently) and wanted to have a similar thing in clojure. So i started, although i know i would need years to build such a system on my own, but a gen_server would be nice ;). Here is my first approach to a fsm: git repo:https://github.com/rixmann/gen_fsm clojars: [org.clojars.owl/gen_fsm 0.1-BETA] If you are interested please tell me what to do better or contribute :-). Greetings, Ole -- 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: Stanford AI Class
On Fri, 2011-08-12 at 13:08 -0400, Ken Wesson wrote: On Fri, Aug 12, 2011 at 12:41 PM, daly d...@axiom-developer.org wrote: Clojure has immutable data structures. Programs are data structures. Therefore, programs are immutable. So is it possible to create a Clojure program that modifies itself? Yes, if it slaps forms together and then executes (eval `(def ~sym ~form)) or (eval `(defn ~sym ~argvec ~form)) or similarly, or perhaps uses alter-var-root. (May require :dynamic true set for the involved Vars in 1.3 for functions and such to start using the new values right away -- binding definitely does. In 1.2, alter-var-root should just work. Changes occur as with atom's swap!, so the function passed to alter-var-root may potentially execute more than once.) Consing up a new function and using eval is certainly possible but then you are essentially just working with an interpreter on the data. How does function invocation actually work in Clojure? In Common Lisp you fetch the function slot of the symbol and execute it. To modify a function you can (compile (modify-the-source fn)). This will change the function slot of the symbol so it will execute the new version of itself next time. Does anyone know the equivalent in Clojure? Would you have to invoke javac on a file and reload it? The Clojure compile function only seems to know about files, not in-memory objects. Clojure can probably be quite a good AI research and development platform. Well I'm starting to prep for the class by thinking about how to write a self-modifying function that learns in Clojure. The mixture of immutability and self-modification would imply that all of the old versions of the function still exist, essentially forming a set of more primitive versions that could be a interesting in its own right. Suppose, for instance, that you did have all of the prior versions. You could create a branching learning application. The idea is that you can have a linear path of learning and then reach back, modify an old version, and create a second branch so now you have two different paths of learning. This idea might be very useful. One of the problems that happens in learning systems is that they hill climb. They constantly try to get better. But if you think about better, it might mean that you reached a local optimum (a low peak) that cannot get better. But there might be a better optimum (a higher peak) on some other path. Branched learning could look back to a lower point, and choose a second path. If the second path ends up better than the first then you can abandon the worst path. Since Clojure has immutable data and data are programs it would seem that Clojure has a way of doing this branched learning. Clojure could certainly bring a couple interesting ideas to the AI class. Tim Daly d...@axiom-developer.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Why are some Google Closure library files not available in Clojurescript?
On Fri, Aug 12, 2011 at 2:34 PM, Conrad drc...@gmail.com wrote: In case anyone wants to know what the answer is: goog.storage was added with closure library revision 888, but the version used in clojurescript is revision 790. This is because Google hasn't released any pre-packaged versions of the closure library since March. On Aug 12, 1:47 pm, Conrad drc...@gmail.com wrote: Hi everyone- I'm loving clojurescript and am trying to create a test app with it. This test app was going to use goog.storage, but for some reason this library doesn't appear to be available when I install clojurescript (unlike goog.dom, goog.events, etc. which work fine) You can see this library listed in the Google Closure docs:http://closure-library.googlecode.com/svn/docs/index.html For some reason, when I bootstrap clojurescript as per Rich's instructions this library is missing (i.e. I'm missing the directory ~/clojurescript/closure/library/closure/goog/storage) One guess I have as to why this is missing is that clojurescript isn't installing the latest version of the closure library, since goog.storage appears to be a more recent addition. Does anyone know if this is the reason for my issue? Is there any way I can safely update the version of the closure library? If the closure library is out of date on purpose, does anyone know when support of a more recent closure library version is planned? Thanks! Conrad Barski Have you tried updating the closure library? Any problems? I ran into a similar issue when I was trying to use their Websocket code. It seems that their docs are for the head of the project. It had me very confused, especially since I was just getting started with ClojureScript. -- 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: Why are some Google Closure library files not available in Clojurescript?
When I tried that, it still didn't seem to recognize the new namespaces. My guess is that clojurescript doesn't determine closure library namespaces dynamically, but has a hardcoded list of them somewhere (but I never investigated further...) On Aug 12, 4:35 pm, Daniel Renfer d...@kronkltd.net wrote: On Fri, Aug 12, 2011 at 2:34 PM, Conrad drc...@gmail.com wrote: In case anyone wants to know what the answer is: goog.storage was added with closure library revision 888, but the version used in clojurescript is revision 790. This is because Google hasn't released any pre-packaged versions of the closure library since March. On Aug 12, 1:47 pm, Conrad drc...@gmail.com wrote: Hi everyone- I'm loving clojurescript and am trying to create a test app with it. This test app was going to use goog.storage, but for some reason this library doesn't appear to be available when I install clojurescript (unlike goog.dom, goog.events, etc. which work fine) You can see this library listed in the Google Closure docs:http://closure-library.googlecode.com/svn/docs/index.html For some reason, when I bootstrap clojurescript as per Rich's instructions this library is missing (i.e. I'm missing the directory ~/clojurescript/closure/library/closure/goog/storage) One guess I have as to why this is missing is that clojurescript isn't installing the latest version of the closure library, since goog.storage appears to be a more recent addition. Does anyone know if this is the reason for my issue? Is there any way I can safely update the version of the closure library? If the closure library is out of date on purpose, does anyone know when support of a more recent closure library version is planned? Thanks! Conrad Barski Have you tried updating the closure library? Any problems? I ran into a similar issue when I was trying to use their Websocket code. It seems that their docs are for the head of the project. It had me very confused, especially since I was just getting started with ClojureScript. -- 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
Creating global javascript objects (like Date) in Clojurescript
Sorry if this has an obvious answer, but there is still only limited documentation on clojurescript native interop on the net right now, and none of the code I've seen of runs into this use case... How do I create a javascript Date object in Clojurescript? I've tried: (Date.) (window/Date.) (.now Date) I've run out of ideas for what the correct incantation is- Can someone give me a pointer? Thanks! -Conrad Barski -- 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: Creating global javascript objects (like Date) in Clojurescript
On 12 August 2011 23:19, Conrad drc...@gmail.com wrote: Sorry if this has an obvious answer, but there is still only limited documentation on clojurescript native interop on the net right now, and none of the code I've seen of runs into this use case... How do I create a javascript Date object in Clojurescript? I've tried: (Date.) (window/Date.) (.now Date) I've run out of ideas for what the correct incantation is- Can someone give me a pointer? Thanks! After some trial and error, I found this: ClojureScript:cljs.user (new js/Date) #Sat Aug 13 2011 00:14:54 GMT+0200 (SAST) ClojureScript:cljs.user (js/Date.) #Sat Aug 13 2011 00:15:01 GMT+0200 (SAST) -- Michael Wood esiot...@gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Stanford AI Class
BTW, Is there a case when AI self-modifying program is much more elegant than AI just-data-modifying program? I just can't figure out any example when there is a lot of sense to go the self-modifying route. -- 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: Silly Chat: Clojure, ClojureScript and WebSockets
Aleph On Aug 11, 2011, at 11:49 PM, Jimmy wrote: Whats handling the serverside websockets connections? -- 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: Stanford AI Class
+1 On Friday, August 12, 2011 3:16:15 PM UTC-7, Sergey Didenko wrote: BTW, Is there a case when AI self-modifying program is much more elegant than AI just-data-modifying program? I just can't figure out any example when there is a lot of sense to go the self-modifying route. -- 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: Stanford AI Class
On Fri, Aug 12, 2011 at 4:25 PM, daly d...@axiom-developer.org wrote: Consing up a new function and using eval is certainly possible but then you are essentially just working with an interpreter on the data. How does function invocation actually work in Clojure? In Common Lisp you fetch the function slot of the symbol and execute it. To modify a function you can (compile (modify-the-source fn)). This will change the function slot of the symbol so it will execute the new version of itself next time. As I indicated in the earlier post, consing up a new function and eval'ing it actually invokes a compiler and generates a dynamic class with bytecode. It's just as eligible for JIT as a class compiled AOT and loaded the usual Java way. As for your later speculations, whether a history of earlier values is kept is entirely* up to the programmer. They can keep older versions around or not. If they stop referencing one, the GC should collect it at some point (modulo some VM options needed to make unreferenced classes collectible). * The STM, as I understand it, may keep a history of the last few values of a particular ref, if that ref keeps getting involved in transaction retries. But this history isn't accessible to user code, at least without doing implementation-dependent things that could break in future Clojure versions. If you store a lot of big things in refs, it could impact memory and GC performance though. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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: Creating global javascript objects (like Date) in Clojurescript
Ah! I didn't know about a js namespace- Thanks for figuring that out, Michael! On Aug 12, 6:15 pm, Michael Wood esiot...@gmail.com wrote: On 12 August 2011 23:19, Conrad drc...@gmail.com wrote: Sorry if this has an obvious answer, but there is still only limited documentation on clojurescript native interop on the net right now, and none of the code I've seen of runs into this use case... How do I create a javascript Date object in Clojurescript? I've tried: (Date.) (window/Date.) (.now Date) I've run out of ideas for what the correct incantation is- Can someone give me a pointer? Thanks! After some trial and error, I found this: ClojureScript:cljs.user (new js/Date) #Sat Aug 13 2011 00:14:54 GMT+0200 (SAST) ClojureScript:cljs.user (js/Date.) #Sat Aug 13 2011 00:15:01 GMT+0200 (SAST) -- Michael Wood esiot...@gmail.com -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Self-joins in ClojureQL
Update: CQL does in fact support self-joins. An example of the correct syntax is here: http://pastie.org/2356343 -- 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: Stanford AI Class
On Fri, 2011-08-12 at 16:30 -0700, pmbauer wrote: +1 On Friday, August 12, 2011 3:16:15 PM UTC-7, Sergey Didenko wrote: BTW, Is there a case when AI self-modifying program is much more elegant than AI just-data-modifying program? I just can't figure out any example when there is a lot of sense to go the self-modifying route. Clearly both are equivalent in a Turing sense. If you are 6 foot tall but modify that in data so you are 7 foot tall and always report yourself as 7 foot tall then there is no way to distinguish that from the records. Yet there is a philosophical difference between being and reporting. AI involves a lot of debate about philosophy so expect that. Learning, by one definition, involves a permanent change in behavior. This has to be reported in some way. Since programs are data in lisp this is something of a semantics debate. Is the program really changed or just reporting? Consider a more advanced kind of learning where we use genetic programs to evolve behavior. Clearly you can do this all using data but it is a bit more elegant if you can take genes (i.e. slices of code), do crossovers (i.e. merge the slices of code into other slices), and get a new mutated set of genes. These can be embedded in chromosomes which are just larger pieces of code. Real cells don't use a data scratchpad, they self-modify. The resulting self-modified lisp code has execution semantics defined by the language standard (well, CL has a standard). The data representation does not have standard semantics. Data has semantics relative to the master smart program thing you wrote. It turns out that self-modifying lisp code is both interesting and elegant as the data is itself, not some reported-thing. There is a reason lisp dominated the AI world for so long. Many centuries ago I authored a language called KROPS (see [1] below). It was a program that allowed you to represent knowledge using both subsumption (KREP-style) and rules (OPS5-style). Adding a new piece of knowledge caused it to self-modify in a way that allowed both execution semantics and data semantics. KROPS is way too complex to explain here but it was very elegant. IBM built a financial and marketing expert system in KROPS on symbolics machines. The point of all of this self-trumpet noise is that I don't believe I could have had the insight to build it in a data model. I just let it build itself to evolve a problem solution. There was no data, only program. This isn't intended to be a debate about WHY we might want a self-modifying program. It is a question of whether Clojure, as a Lisp, is sufficiently well-crafted to allow it to self-modify. It has been done in other lisps but I don't yet know how to do it in Clojure. If you only want a master smart program thing that reports data that's perfectly fine. You could write that in any language. Tim Daly d...@axiom-developer.org [Daly, Kastner, Mays Integrating rules and inheritance networks in a knowledge-based financial and marketing consultation system HICSS 1988, pp495-500] -- 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: Stanford AI Class
(defn f [x] (println hello, x)) (defn g [] (eval '(defn f [x] (println goodbye, x (defn -main [] (#'user/f world!) (g) (#'user/f cruel world.)) Close enough? :) -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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: ClassCastException with contrib replace-first-str
Looks like replace-first-str was deprecated in 1.2: {:deprecated 1.2} All future contrib work is focused on the new modular libraries with no maintenance planned on the old monolithic contrib, so I think I'd recommend not using replace-first-str and instead use this: (clojure.string/replace-first aa #a b) On Fri, Aug 12, 2011 at 11:42 AM, Marius mps@googlemail.com wrote: I found a small bug in Clojure Contrib 1.2.0. To reproduce: (require '[clojure.contrib.string :as s]) (s/replace-str a b aa) ; bb as expected (s/replace-first-str a b aa) ; java.lang.ClassCastException: java.lang.String cannot be cast to java.util.regex.Pattern -- 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: Stanford AI Class
On Fri, 2011-08-12 at 21:49 -0400, Ken Wesson wrote: (defn f [x] (println hello, x)) (defn g [] (eval '(defn f [x] (println goodbye, x (defn -main [] (#'user/f world!) (g) (#'user/f cruel world.)) Close enough? :) You get an A. --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/conj 2011 Call For Speakers Ends Soon - Aug 19th!
On Friday, August 12, 2011 2:42:04 PM UTC-4, Christopher Redinger wrote: Speakers will receive: * A catered speakers dinner on Thursday night. Correction: Wednesday night. -- 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
lein deps gets error
I do a lein new hello_world and I get a directory called hello_world. I then try lein deps. I get several lines of errors starting with #! What am I doing wrong? = Microsoft Windows [Version 6.0.6002] Copyright (c) 2006 Microsoft Corporation. All rights reserved. C:\cd cl* C:\clojure-1.2.1cd h* C:\clojure-1.2.1\helloworldlein deps C:\clojure-1.2.1\helloworld#!/bin/sh '#!' is not recognized as an internal or external command, operable program or batch file. C:\clojure-1.2.1\helloworldLEIN_VERSION=1.6.1 'LEIN_VERSION' is not recognized as an internal or external command, operable program or batch file. C:\clojure-1.2.1\helloworldexport LEIN_VERSION 'export' is not recognized as an internal or external command, operable program or batch file. C:\clojure-1.2.1\helloworldcase $LEIN_VERSION in 'case' is not recognized as an internal or external command, operable program or batch file. C:\clojure-1.2.1\helloworld*SNAPSHOT) SNAPSHOT=YES ;; '*SNAPSHOT)' is not recognized as an internal or external command, operable program or batch file. C:\clojure-1.2.1\helloworld*) SNAPSHOT=NO ;; '*)' is not recognized as an internal or external command, operable program or batch file. C:\clojure-1.2.1\helloworldesac 'esac' is not recognized as an internal or external command, operable program or batch file. C:\clojure-1.2.1\helloworld# Make sure classpath is in unix format for manipula ting, then put '#' is not recognized as an internal or external command, operable program or batch file. C:\clojure-1.2.1\helloworld# it back to windows format when we use it '#' is not recognized as an internal or external command, operable program or batch file. $OSTYPE was unexpected at this time. C:\clojure-1.2.1\helloworldif [ $OSTYPE = cygwin ] [ $CLASSPATH != ]; then C:\clojure-1.2.1\helloworld -- 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
Stream closed...
Hi, I'm trying to write a function which creates file twice as big compared to the original file by simply duplicating its content. It looks like in the for loop I can't even read the first line although I'm using with-open. Can you tell me what am I doing wrong? (defn duplicate-file-data [file-path] (with-open [reader (clojure.java.io/reader file-path) writer (clojure.java.io/writer (str file-path 2) :append true)] (for [line (line-seq reader) :let [line-count (count(line-seq reader)) curr-line 0] :when ( curr-line line-count)] ((.write writer (str line)) (.newLine writer) (inc curr-line)) ))) -- Thanks Daniel -- 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 on Javascript: Crockford javascript lectures
You might want to look at some of the information on Crockford's webpage about Javascript http://javascript.crockford.com In particular, lecture 3 in his video series is about functions, classes, objects, etc in Javascript: http://www.yuiblog.com/blog/2010/02/24/video-crockonjs-3 Tim Daly d...@axiom-developer.org -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Stream closed...
(for ...) generates a lazy sequence so it isn't realized until after the value is returned from the function. You need to wrap (for ...) with (doall ...) to realize the sequence inside (with-open ...) On Fri, Aug 12, 2011 at 4:47 PM, turcio tur...@gmail.com wrote: Hi, I'm trying to write a function which creates file twice as big compared to the original file by simply duplicating its content. It looks like in the for loop I can't even read the first line although I'm using with-open. Can you tell me what am I doing wrong? (defn duplicate-file-data [file-path] (with-open [reader (clojure.java.io/reader file-path) writer (clojure.java.io/writer (str file-path 2) :append true)] (for [line (line-seq reader) :let [line-count (count(line-seq reader)) curr-line 0] :when ( curr-line line-count)] ((.write writer (str line)) (.newLine writer) (inc curr-line)) ))) -- Thanks Daniel -- 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 -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- 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: lein deps gets error
On Fri, Aug 12, 2011 at 6:53 PM, jayvandal s...@ida.net wrote: I do a lein new hello_world and I get a directory called hello_world. I then try lein deps. I get several lines of errors starting with #! What am I doing wrong? = Microsoft Windows [Version 6.0.6002] Copyright (c) 2006 Microsoft Corporation. All rights reserved. C:\cd cl* C:\clojure-1.2.1cd h* C:\clojure-1.2.1\helloworldlein deps C:\clojure-1.2.1\helloworld#!/bin/sh '#!' is not recognized as an internal or external command, operable program or batch file. C:\clojure-1.2.1\helloworldLEIN_VERSION=1.6.1 'LEIN_VERSION' is not recognized as an internal or external command, operable program or batch file. ... Looks like you're trying to run the unix version on windows. -- Protege: What is this seething mass of parentheses?! Master: Your father's Lisp REPL. This is the language of a true hacker. Not as clumsy or random as C++; a language for a more civilized age. -- 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: Stream closed...
I think you also want to reorganize the code so you get the line-seq and then the line-count outside the for loop. And bear in mind that (inc line-count) just returns line-count + 1 - it does not update line-count which is what I'm guessing you're expecting? Or you could just use slurp and spit: (defn duplicate-file-data [file-path] (let [content (slurp file-path)] (spit (str file-path 2) (str content content On Fri, Aug 12, 2011 at 8:05 PM, Sean Corfield seancorfi...@gmail.comwrote: (for ...) generates a lazy sequence so it isn't realized until after the value is returned from the function. You need to wrap (for ...) with (doall ...) to realize the sequence inside (with-open ...) On Fri, Aug 12, 2011 at 4:47 PM, turcio tur...@gmail.com wrote: Hi, I'm trying to write a function which creates file twice as big compared to the original file by simply duplicating its content. It looks like in the for loop I can't even read the first line although I'm using with-open. Can you tell me what am I doing wrong? (defn duplicate-file-data [file-path] (with-open [reader (clojure.java.io/reader file-path) writer (clojure.java.io/writer (str file-path 2) :append true)] (for [line (line-seq reader) :let [line-count (count(line-seq reader)) curr-line 0] :when ( curr-line line-count)] ((.write writer (str line)) (.newLine writer) (inc curr-line)) ))) -- Thanks Daniel -- 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 -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- 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: match 0.1.0-SNAPSHOT
Just pushed a version of match to Clojars, would love to hear feedback! Since our earlier announcement we now have: * Guard Patterns * Or Patterns * As Patterns * Java Interop All this and we've only added about ~260 lines of code which bodes well for ease of extending the library. We're sure there are many, many bugs. Let us know what does and doesn't work for you. The project repo has updated examples and documentation: https://github.com/swannodette/match 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: Stream closed...
Even shorter: (defn duplicate-file-data [file-path] (spit file-path (slurp file-path) :append true)) Dave On Fri, Aug 12, 2011 at 11:16 PM, Sean Corfield seancorfi...@gmail.com wrote: I think you also want to reorganize the code so you get the line-seq and then the line-count outside the for loop. And bear in mind that (inc line-count) just returns line-count + 1 - it does not update line-count which is what I'm guessing you're expecting? Or you could just use slurp and spit: (defn duplicate-file-data [file-path] (let [content (slurp file-path)] (spit (str file-path 2) (str content content On Fri, Aug 12, 2011 at 8:05 PM, Sean Corfield seancorfi...@gmail.com wrote: (for ...) generates a lazy sequence so it isn't realized until after the value is returned from the function. You need to wrap (for ...) with (doall ...) to realize the sequence inside (with-open ...) On Fri, Aug 12, 2011 at 4:47 PM, turcio tur...@gmail.com wrote: Hi, I'm trying to write a function which creates file twice as big compared to the original file by simply duplicating its content. It looks like in the for loop I can't even read the first line although I'm using with-open. Can you tell me what am I doing wrong? (defn duplicate-file-data [file-path] (with-open [reader (clojure.java.io/reader file-path) writer (clojure.java.io/writer (str file-path 2) :append true)] (for [line (line-seq reader) :let [line-count (count(line-seq reader)) curr-line 0] :when ( curr-line line-count)] ((.write writer (str line)) (.newLine writer) (inc curr-line)) ))) -- Thanks Daniel -- 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 -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- 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: Stream closed...
Yeah, I got the impression the OP was trying to create a new file with double the contents of the old one - the (str file-path 2) piece - but yours is certainly a slick way to double the original file! On Fri, Aug 12, 2011 at 8:47 PM, Dave Ray dave...@gmail.com wrote: Even shorter: (defn duplicate-file-data [file-path] (spit file-path (slurp file-path) :append true)) Dave On Fri, Aug 12, 2011 at 11:16 PM, Sean Corfield seancorfi...@gmail.com wrote: I think you also want to reorganize the code so you get the line-seq and then the line-count outside the for loop. And bear in mind that (inc line-count) just returns line-count + 1 - it does not update line-count which is what I'm guessing you're expecting? Or you could just use slurp and spit: (defn duplicate-file-data [file-path] (let [content (slurp file-path)] (spit (str file-path 2) (str content content On Fri, Aug 12, 2011 at 8:05 PM, Sean Corfield seancorfi...@gmail.com wrote: (for ...) generates a lazy sequence so it isn't realized until after the value is returned from the function. You need to wrap (for ...) with (doall ...) to realize the sequence inside (with-open ...) On Fri, Aug 12, 2011 at 4:47 PM, turcio tur...@gmail.com wrote: Hi, I'm trying to write a function which creates file twice as big compared to the original file by simply duplicating its content. It looks like in the for loop I can't even read the first line although I'm using with-open. Can you tell me what am I doing wrong? (defn duplicate-file-data [file-path] (with-open [reader (clojure.java.io/reader file-path) writer (clojure.java.io/writer (str file-path 2) :append true)] (for [line (line-seq reader) :let [line-count (count(line-seq reader)) curr-line 0] :when ( curr-line line-count)] ((.write writer (str line)) (.newLine writer) (inc curr-line)) ))) -- Thanks Daniel -- 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 -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- 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 -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- 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