ANN: Durable refs with ACID guarantees - Phase I
This is in reference to http://groups.google.com/group/clojure/browse_frm/thread/d6deac0c34d0ce28/5c1e11ec2bd52bde. Hi everyone! I have hacked the Clojure core to add durability to refs. The syntax to create these is (dref ), where and are strings. Then you use them just like refs. Creating a dref creates a global identity, such that subsequent dref calls to the same key and path will get the same dref. On subsequent dref calls, the will be ignored and the persisted value used. This includes in subsequent VM instances. Get it here: git://github.com/kwanalyssa/clojure.git 1. refers to BDB JE databases which get created in the "data" directory of your project. 2. BDB JE is used. I'm ignorant of IP and licensing issues. Making BDB JE core to Clojure is probably an issue. 3. Currently only a subset of Clojure primitives types is supported. No BigDecimal or Ratio yet. See the comprehensive list (and serialization mappings) at the bottom of src/jvm/clojure/lang/ DRef.java. BDB JE TupleBindings are used. Submissions welcome, especially for the persistent data structures. 4. How do we approach the problem of storing objects with lexical environments? 5. Unit tests welcome! I didn't do TDD since the work is in Java and there's no Java-level tests in the project. Please add your own in test/clojure/test_clojure/drefs.clj. I'm new to concurrency, so tests along those lines would be awesome! 6. The ACID part is not really guaranteed!!! STM is currently one- phase-commit. I inserted two-phase-commits to the data stores in the middle of the one-phase-commit. There's the remote possibility that STM in-memory changes fail AFTER writing to disk. It's REALLY remote, but it is possible. STM would have to be made 2PC to make this airtight. That's way beyond my current grasp of both concurrency and Clojure implementation. 7. I was aiming for an API where is optional. However, I didn't want to stray from the ref API, which has variable arity. Suggestions on how to reconcile the two are welcome! 8. To maintain global identity, I use a static cache, which requires non-hard references to avoid OOM issues. This is my first time doing this, so please check my code to make sure that I'm doing it right. I'm using SoftReferences, though WeakReferences may be better for real- life usage patterns. Let me know! Please dig in! Feedback appreciated! Alyssa Kwan -- 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: building new contrib against a specific clojure jar
OK, it appears one more line of change allows clojure-contrib latest as of today to build with clojure 1.3.0-master-SNAPSHOT. See inline below for slightly modified instructions that worked for me on both OS X and Ubuntu Linux. On Sep 22, 2010, at 6:16 PM, Andy Fingerhut wrote: So I'm trying to start from a Mac OS X 10.5.8 system with java and mvn installed, but not Clojure, and with no Maven repo (i.e. ~/.m2 does not exist yet), and trying to build the latest Clojure and contrib from the git repos using something as close to the recommended instructions that comes in those repos as I can find, plus what I've learned from this thread. I've gotten the latest Clojure to build and install in ~/.m2, but when I try to use that clojure-1.3.0-master-SNAPSHOT.jar to build contrib, it fails. Here are the steps I took to build Clojure: % git clone http://github.com/clojure/clojure.git % cd clojure [ downloaded maven-ant-tasks-2.1.1.jar and saved it here: /Users/ Shared/sw/maven-ant-tasks-2.1.1.jar ] % ant -lib /Users/Shared/sw/maven-ant-tasks-2.1.1.jar ci-build Verified that I now have an ~/.m2 directory tree, and it contains this file, among others: ~/.m2/repository/org/clojure/clojure/1.3.0-master-SNAPSHOT/ clojure-1.3.0-master-SNAPSHOT.jar Now try to use that to build contrib using these commands: % cd .. % git clone http://github.com/clojure/clojure-contrib.git % cd clojure-contrib Now do this with the attached patch file: % patch -p1 < clojure-contrib-patch.txt % mvn install After that, I had clojure, contrib, and a bunch of other dependencies in my Maven repo in ~/.m2 I'm guessing that the "patch" step above will soon be unnecessary when the contrib maintainers decide how best to improve it. I'm just going for the quick and dirty fix here. Andy diff --git a/modules/accumulators/src/main/clojure/clojure/contrib/accumulators.clj b/modules/accumulators/src/main/clojure/clojure/contrib/accumulators.clj index 55073e3..12bb7c6 100644 --- a/modules/accumulators/src/main/clojure/clojure/contrib/accumulators.clj +++ b/modules/accumulators/src/main/clojure/clojure/contrib/accumulators.clj @@ -24,6 +24,7 @@ accumulators."} clojure.contrib.accumulators (:refer-clojure :exclude (deftype)) + (:use [clojure.set :only (union)]) (:use [clojure.contrib.types :only (deftype)]) (:use [clojure.contrib.def :only (defvar defvar- defmacro-)]) (:require [clojure.contrib.generic.arithmetic :as ga])) diff --git a/modules/condition/pom.xml b/modules/condition/pom.xml index 0a2d9e5..751f48f 100644 --- a/modules/condition/pom.xml +++ b/modules/condition/pom.xml @@ -13,7 +13,7 @@ org.clojure clojure - 1.2.0 + 1.3.0-master-SNAPSHOT org.clojure.contrib diff --git a/modules/fnmap/pom.xml b/modules/fnmap/pom.xml index d6b13ff..908f4fc 100644 --- a/modules/fnmap/pom.xml +++ b/modules/fnmap/pom.xml @@ -13,7 +13,7 @@ org.clojure clojure - 1.2.0 + 1.3.0-master-SNAPSHOT diff --git a/modules/jmx/pom.xml b/modules/jmx/pom.xml index ef49604..8e7233b 100644 --- a/modules/jmx/pom.xml +++ b/modules/jmx/pom.xml @@ -13,7 +13,7 @@ org.clojure clojure - 1.2.0 + 1.3.0-master-SNAPSHOT org.clojure.contrib diff --git a/modules/parent/pom.xml b/modules/parent/pom.xml index 6965302..1903aa2 100644 --- a/modules/parent/pom.xml +++ b/modules/parent/pom.xml @@ -3,7 +3,7 @@ http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";> 4.0.0 -1.2.0 +1.3.0-master-SNAPSHOT UTF-8 org.clojure.contrib diff --git a/modules/repl-ln/pom.xml b/modules/repl-ln/pom.xml index 143de26..a823f36 100644 --- a/modules/repl-ln/pom.xml +++ b/modules/repl-ln/pom.xml @@ -13,7 +13,7 @@ org.clojure clojure - 1.2.0 + 1.3.0-master-SNAPSHOT org.clojure.contrib -- 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: CLR questions
Is this still a problem if you compile everything ahead of time? I noticed that if I make a jar with leiningen my clj files are included in the jar but I assumed that it was just part of some dogma that I should share my source code. Also, I asked a similar question where I was concerned about the things Timothy mentioned. The one answer I got was pretty much that if the Xbox version of .Net had everything Clojure needed the Xbox just wouldn't run clojure very well. Just like with Dalvik, the Compact .Net handles GC poorly. http://groups.google.com/group/clojure/browse_thread/thread/699d722f2632d3ce On Sep 22, 1:32 pm, Timothy Baldridge wrote: > First of all, MonoDevelop should be able to load the .sln > > As far as XNA...last I heard XNA did not have any support for emit, > and as such is incapable of running any sort of jit code. Basically > all .NET code has to be ahead-of-time compiled to run a XBOX via XNA. > It's the same limitation that IronPython has > (http://ironpython.codeplex.com/wikipage?title=FAQ). > > Timothy > > > > On Wed, Sep 22, 2010 at 3:06 PM, tsuraan wrote: > > I have two (apparently unrelated) questions about ClojureCLR. > > > First, does Clojure 1.2 build under mono? The clojure-clr tree only > > appears to have a .sln file; is there some sane way to convert that to > > a Makefile or a shell script that can be used under *nix? > > > Secondly, has anybody tried deploying a clojure-based app under XNA > > (the XBox API)? I've seen some basic howtos for F#-based XNA > > development; I'd be interested in hearing about anybody's experience > > doing this with Clojure. > > > Thanks for any input. > > > -- > > 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 > > -- > “One of the main causes of the fall of the Roman Empire was > that–lacking zero–they had no way to indicate successful termination > of their C programs.” > (Robert Firth) -- 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 meetup group listing
Hi Andrew, feel free to add the Cambridge (UK) Clojurians group: http://www.meetup.com/Cambridge-Clojurians/ Our next meeting is in a lovely pub called the Punter on Monday the 4th of October from 7.30 onwards. Sam --- http://sam.aaron.name On 20 Sep 2010, at 4.33 pm, Andrew Gwozdziewycz wrote: > Hey All, > > I know there are certainly a few groups out there (organized via > Meetup.com or otherwise) which I see things posted about from time to > time on the list. I'd like to propose that we make an effort to list > these groups on Meetup Everywhere (http://www.meetup.com/everywhere), > which is a free platform useful for finding a nearby meetup about a > given topic. Please note, this is not meant to overtake your existing > organization method. Everywhere is designed to be agnostic in regards > to organization platform. > > If enough groups start listing there, it might make sense to then post > a link on the Clojure site to help people find their local user group: > >http://www.meetup.com/Clojure > > I can make changes to the page as necessary. > > Cheers, > > Andrew > > -- > http://www.apgwoz.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: building new contrib against a specific clojure jar
OK, one more quick hack I've found -- again, a hack, not a long term solution. If you want to create a Leiningen project that uses the latest clojure and contrib, read on. I couldn't figure out what to use in project.clj unless I renamed this file first. % mv ~/.m2/repository/org/clojure/contrib/complete/1.3.1-SNAPSHOT/ complete-1.3.1-SNAPSHOT-bin.jar ~/.m2/repository/org/clojure/contrib/ complete/1.3.1-SNAPSHOT/complete-1.3.1-SNAPSHOT.jar % lein new myproj % cd myproj Now edit project.clj file so its :dependencies look like the one below. :dependencies [[org.clojure/clojure "1.3.0-master-SNAPSHOT"] [org.clojure.contrib/complete "1.3.1-SNAPSHOT"]]) Out of curiosity, I tried adding swank-clojure 1.2.1 in :dev- dependencies, but I got a run time exception when trying 'lein swank'. Not too surprising. 'lein repl' will have to do for now. Andy On Sep 22, 2010, at 9:10 PM, Andy Fingerhut wrote: OK, it appears one more line of change allows clojure-contrib latest as of today to build with clojure 1.3.0-master-SNAPSHOT. See inline below for slightly modified instructions that worked for me on both OS X and Ubuntu Linux. On Sep 22, 2010, at 6:16 PM, Andy Fingerhut wrote: So I'm trying to start from a Mac OS X 10.5.8 system with java and mvn installed, but not Clojure, and with no Maven repo (i.e. ~/.m2 does not exist yet), and trying to build the latest Clojure and contrib from the git repos using something as close to the recommended instructions that comes in those repos as I can find, plus what I've learned from this thread. I've gotten the latest Clojure to build and install in ~/.m2, but when I try to use that clojure-1.3.0-master-SNAPSHOT.jar to build contrib, it fails. Here are the steps I took to build Clojure: % git clone http://github.com/clojure/clojure.git % cd clojure [ downloaded maven-ant-tasks-2.1.1.jar and saved it here: /Users/ Shared/sw/maven-ant-tasks-2.1.1.jar ] % ant -lib /Users/Shared/sw/maven-ant-tasks-2.1.1.jar ci-build Verified that I now have an ~/.m2 directory tree, and it contains this file, among others: ~/.m2/repository/org/clojure/clojure/1.3.0-master-SNAPSHOT/ clojure-1.3.0-master-SNAPSHOT.jar Now try to use that to build contrib using these commands: % cd .. % git clone http://github.com/clojure/clojure-contrib.git % cd clojure-contrib Now do this with the attached patch file: % patch -p1 < clojure-contrib-patch.txt % mvn install After that, I had clojure, contrib, and a bunch of other dependencies in my Maven repo in ~/.m2 I'm guessing that the "patch" step above will soon be unnecessary when the contrib maintainers decide how best to improve it. I'm just going for the quick and dirty fix here. Andy -- 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: Durable refs with ACID guarantees - Phase I
Cool! I'm getting back to Clojure after an extended absence. Just today I was pondering the design of a solution to a similar problem, though I suspect our requirements diverge on several points. My tentative conclusion was that it could be done entirely in Clojure and without modifying existing code. Maybe you can poke holes in my fledging plan since you've obviously been thinking about this sort of problem longer than me: There's a new pref reference type. It consists of a key and an atom containing nil for unloaded objects and an STM reference for loaded objects. When a pref is dereferenced, it checks its atom. If nil, it first loads the object from disk into a fresh STM reference (which has a metadata field pointing back to the pref) and mutates the atom so it points to it. In either case it finishes by dereferencing the STM reference. When a pref is mutated, it first goes through the same motions as for dereferencing. Then it simply forwards the mutation to the underlying STM reference. Watchers are installed on STM references backed by prefs. Thus we are notified when something is mutated. There is a pref-specific transaction boundary form called atomic, analogous to dosync. The watchers are used to determine which prefs were mutated during the transaction so as to flag them dirty for write-back or write-through caching; this is why we need the pref back reference in the metadata. Anyway, even assuming this all works, it will obviously be less computationally efficient than extending LockingTransaction.java with special support. -Per On Thu, Sep 23, 2010 at 10:21 AM, Alyssa Kwan wrote: > This is in reference to > http://groups.google.com/group/clojure/browse_frm/thread/d6deac0c34d0ce28/5c1e11ec2bd52bde. > > Hi everyone! > > I have hacked the Clojure core to add durability to refs. The syntax > to create these is (dref ), where and > are strings. Then you use them just like refs. Creating a dref > creates a global identity, such that subsequent dref calls to the same > key and path will get the same dref. On subsequent dref calls, the > will be ignored and the persisted value used. This includes in > subsequent VM instances. > > Get it here: git://github.com/kwanalyssa/clojure.git > > 1. refers to BDB JE databases which get created in the "data" > directory of your project. > 2. BDB JE is used. I'm ignorant of IP and licensing issues. Making > BDB JE core to Clojure is probably an issue. > 3. Currently only a subset of Clojure primitives types is supported. > No BigDecimal or Ratio yet. See the comprehensive list (and > serialization mappings) at the bottom of src/jvm/clojure/lang/ > DRef.java. BDB JE TupleBindings are used. Submissions welcome, > especially for the persistent data structures. > 4. How do we approach the problem of storing objects with lexical > environments? > 5. Unit tests welcome! I didn't do TDD since the work is in Java and > there's no Java-level tests in the project. Please add your own in > test/clojure/test_clojure/drefs.clj. I'm new to concurrency, so tests > along those lines would be awesome! > 6. The ACID part is not really guaranteed!!! STM is currently one- > phase-commit. I inserted two-phase-commits to the data stores in the > middle of the one-phase-commit. There's the remote possibility that > STM in-memory changes fail AFTER writing to disk. It's REALLY remote, > but it is possible. STM would have to be made 2PC to make this > airtight. That's way beyond my current grasp of both concurrency and > Clojure implementation. > 7. I was aiming for an API where is optional. However, I > didn't want to stray from the ref API, which has variable arity. > Suggestions on how to reconcile the two are welcome! > 8. To maintain global identity, I use a static cache, which requires > non-hard references to avoid OOM issues. This is my first time doing > this, so please check my code to make sure that I'm doing it right. > I'm using SoftReferences, though WeakReferences may be better for real- > life usage patterns. Let me know! > > Please dig in! Feedback appreciated! > Alyssa Kwan > > -- > 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: CLR questions
> Is this still a problem if you compile everything ahead of time? I > noticed that if I make a jar with leiningen my clj files are included > in the jar but I assumed that it was just part of some dogma that I > should share my source code. Actually I think it's a bit worse than that. LISP treats all code as data and all data as code. Basically, in LISP you can take any list and attempt to execute it. So even if you completely AOT compile the code you're going to have to rip out any JIT functions to get it to properly transfer to the Xbox. > > Also, I asked a similar question where I was concerned about the > things Timothy mentioned. The one answer I got was pretty much that > if the Xbox version of .Net had everything Clojure needed the Xbox > just wouldn't run clojure very well. Just like with Dalvik, the > Compact .Net handles GC poorly. > The biggest issue is that Clojure, IronPython, etc. are based on the Microsoft DLR. This DLR makes heavy, heavy use of on-the-fly code generation. As far as I know the 360 does not implement a full-blown JIT (the bytecodes are translated to machine code on the development PC then the resulting binary is shipped to the Xbox). Therefore the DLR will not run on the Xbox and languages that require it will either. That link you supplied doesn't state that "Xbox 360 has all you need to run Clojure" but simply states that in addition to any other issues you may have, Clojure would kill the GC. Now what could happen is this: Someone could take the AST classes in Clojure-CLR and convert them from code generation routines to interpreted routines. Interpreted Clojure would run on the Xbox, there just isn't an interpreter written yet. Timothy -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- 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 meetup group listing
CodeBuilders is a small programming club in Gainesville, Florida, that meets about twice per week to work on programming projects (mostly in Clojure). The other two members are very new to programming, but learning fast as we build a Tic Tac Toe game together. http://github.com/algarete13/tic-tac-toe/ http://groups.google.com/group/codebuilders The club is a lot more active than the mailing list would suggest, because most of our planning is face-to-face or via text messages. On Mon, Sep 20, 2010 at 11:33 AM, Andrew Gwozdziewycz wrote: > Hey All, > > I know there are certainly a few groups out there (organized via > Meetup.com or otherwise) which I see things posted about from time to > time on the list. I'd like to propose that we make an effort to list > these groups on Meetup Everywhere (http://www.meetup.com/everywhere), > which is a free platform useful for finding a nearby meetup about a > given topic. Please note, this is not meant to overtake your existing > organization method. Everywhere is designed to be agnostic in regards > to organization platform. > > If enough groups start listing there, it might make sense to then post > a link on the Clojure site to help people find their local user group: > > http://www.meetup.com/Clojure > > I can make changes to the page as necessary. > > Cheers, > > Andrew > > -- > http://www.apgwoz.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: Durable refs with ACID guarantees - Phase I
It's probably possible to do it completely in Clojure, but you have to subclass Atom. There's no need for any transaction boundary; you just have to make sure that compareAndSet does a durable swap. My plan was to get durable refs done and then extend the other mutable identities, including atom. I'd love to work with you on it! On Sep 23, 8:27 am, Per Vognsen wrote: > Cool! > > I'm getting back to Clojure after an extended absence. Just today I > was pondering the design of a solution to a similar problem, though I > suspect our requirements diverge on several points. My tentative > conclusion was that it could be done entirely in Clojure and without > modifying existing code. Maybe you can poke holes in my fledging plan > since you've obviously been thinking about this sort of problem longer > than me: > > There's a new pref reference type. It consists of a key and an atom > containing nil for unloaded objects and an STM reference for loaded > objects. > > When a pref is dereferenced, it checks its atom. If nil, it first > loads the object from disk into a fresh STM reference (which has a > metadata field pointing back to the pref) and mutates the atom so it > points to it. In either case it finishes by dereferencing the STM > reference. > > When a pref is mutated, it first goes through the same motions as for > dereferencing. Then it simply forwards the mutation to the underlying > STM reference. > > Watchers are installed on STM references backed by prefs. Thus we are > notified when something is mutated. > > There is a pref-specific transaction boundary form called atomic, > analogous to dosync. The watchers are used to determine which prefs > were mutated during the transaction so as to flag them dirty for > write-back or write-through caching; this is why we need the pref back > reference in the metadata. > > Anyway, even assuming this all works, it will obviously be less > computationally efficient than extending LockingTransaction.java with > special support. > > -Per > > > > On Thu, Sep 23, 2010 at 10:21 AM, Alyssa Kwan wrote: > > This is in reference > > tohttp://groups.google.com/group/clojure/browse_frm/thread/d6deac0c34d0 > > > Hi everyone! > > > I have hacked the Clojure core to add durability to refs. The syntax > > to create these is (dref ), where and > > are strings. Then you use them just like refs. Creating a dref > > creates a global identity, such that subsequent dref calls to the same > > key and path will get the same dref. On subsequent dref calls, the > > will be ignored and the persisted value used. This includes in > > subsequent VM instances. > > > Get it here: git://github.com/kwanalyssa/clojure.git > > > 1. refers to BDB JE databases which get created in the "data" > > directory of your project. > > 2. BDB JE is used. I'm ignorant of IP and licensing issues. Making > > BDB JE core to Clojure is probably an issue. > > 3. Currently only a subset of Clojure primitives types is supported. > > No BigDecimal or Ratio yet. See the comprehensive list (and > > serialization mappings) at the bottom of src/jvm/clojure/lang/ > > DRef.java. BDB JE TupleBindings are used. Submissions welcome, > > especially for the persistent data structures. > > 4. How do we approach the problem of storing objects with lexical > > environments? > > 5. Unit tests welcome! I didn't do TDD since the work is in Java and > > there's no Java-level tests in the project. Please add your own in > > test/clojure/test_clojure/drefs.clj. I'm new to concurrency, so tests > > along those lines would be awesome! > > 6. The ACID part is not really guaranteed!!! STM is currently one- > > phase-commit. I inserted two-phase-commits to the data stores in the > > middle of the one-phase-commit. There's the remote possibility that > > STM in-memory changes fail AFTER writing to disk. It's REALLY remote, > > but it is possible. STM would have to be made 2PC to make this > > airtight. That's way beyond my current grasp of both concurrency and > > Clojure implementation. > > 7. I was aiming for an API where is optional. However, I > > didn't want to stray from the ref API, which has variable arity. > > Suggestions on how to reconcile the two are welcome! > > 8. To maintain global identity, I use a static cache, which requires > > non-hard references to avoid OOM issues. This is my first time doing > > this, so please check my code to make sure that I'm doing it right. > > I'm using SoftReferences, though WeakReferences may be better for real- > > life usage patterns. Let me know! > > > Please dig in! Feedback appreciated! > > Alyssa Kwan > > > -- > > 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...@googlegrou
Re: CLR questions
On xbox, you can't alter running code in memory, which means JIT basically doesn't work. So imagine you are running java code on JVM in interpreted mode, it's too slow for any serious game. This is a common issue in most game consoles. -- 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: CLR questions
> First of all, MonoDevelop should be able to load the .sln Ok, I'll have a look at that. I currently know nothing of .NET or mono, so it's all news to me :) > As far as XNA...last I heard XNA did not have any support for emit, > and as such is incapable of running any sort of jit code. Basically > all .NET code has to be ahead-of-time compiled to run a XBOX via XNA. > It's the same limitation that IronPython has > (http://ironpython.codeplex.com/wikipage?title=FAQ). Ok, so for XBox stuff, ScalaCLR or F# would probably be more practical. That's unfortunate, but I'm not way too surprised. Thanks for the info! -- 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: CLR questions
>> As far as XNA...last I heard XNA did not have any support for emit, >> and as such is incapable of running any sort of jit code. Basically >> all .NET code has to be ahead-of-time compiled to run a XBOX via XNA. >> It's the same limitation that IronPython has >> (http://ironpython.codeplex.com/wikipage?title=FAQ). > > Ok, so for XBox stuff, ScalaCLR or F# would probably be more > practical. That's unfortunate, but I'm not way too surprised. Thanks > for the info! And, as a lovely self-reply, replace that last "practical" with "possible". I think that's more accurate. -- 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 1.3 Alpha 1
Clojure 1.3 Alpha 1 is now available at http://clojure.org/downloads == Changes == * enhanced primitive support (http://dev.clojure.org/display/doc/Enhanced+Primitive+Support) * better exception reporting * ancillary namespaces no longer auto-load on startup: clojure.set, clojure.xml, clojure.zip == Why Alpha Now? == 1.3 is the first release of Clojure that will include a series of alpha builds. We are adding these builds to support maven and leiningen users, who want a specific artifact that they can target (as opposed to building from master or "moving-target" snapshots). If you are the kind of person who used to track master by building from source, but no longer do so because you are using maven or leiningen, alpha releases are for you. For maven/leiningen users, your settings to get the beta from build.clojure.org/releases are: :dependencies [[org.clojure/clojure "1.3.0-alpha1"] Thanks! Stu Stuart Halloway Clojure/core team at Relevance http://clojure.com http://thinkrelevance.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: CLR questions
"So imagine you are running java code on JVM in interpreted mode, it's too slow for any serious game." Meh...that's not exactly true. Many games (Warhammer 40k, Supreme Commander, WoW, etc.) use stock LUA, and some (Civ IV) use Python. Both of these are not JIT languages. Actually I would assume LIPS like languages would actually run better than most in an interpreted VM due to the simplicity of the VM. In fact picoLISP released some benchmarks back in 2006 were they showed that interpreted picoLisp was actually faster than compiled Common LISP [1]. So while having a highly advanced JIT like the JVM provides, I'm not sure it's exactly a requirement for an acceptable Clojure variant. Timothy Baldridge [1] http://www.software-lab.de/radical.pdf On Thu, Sep 23, 2010 at 9:27 AM, Wilson MacGyver wrote: > On xbox, you can't alter running code in memory, which means JIT basically > doesn't work. So imagine you are running java code on JVM in interpreted mode, > it's too slow for any serious game. > > This is a common issue in most game consoles. > > -- > 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 -- “One of the main causes of the fall of the Roman Empire was that–lacking zero–they had no way to indicate successful termination of their C programs.” (Robert Firth) -- 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 meetup group listing
On Thu, Sep 23, 2010 at 8:47 AM, Eric Lavigne wrote: > CodeBuilders is a small programming club in Gainesville, Florida, that > meets about twice per week to work on programming projects (mostly in > Clojure). The other two members are very new to programming, but > learning fast as we build a Tic Tac Toe game together. > > http://github.com/algarete13/tic-tac-toe/ > > http://groups.google.com/group/codebuilders > > The club is a lot more active than the mailing list would suggest, > because most of our planning is face-to-face or via text messages. > This sounds awesome! I like the idea of small groups forming to collectively learn a new skill. The fact that it's programming is just a bonus. On Mon, Sep 20, 2010 at 11:33 AM, Andrew Gwozdziewycz > wrote: > > Hey All, > > > > I know there are certainly a few groups out there (organized via > > Meetup.com or otherwise) which I see things posted about from time to > > time on the list. I'd like to propose that we make an effort to list > > these groups on Meetup Everywhere (http://www.meetup.com/everywhere), > > which is a free platform useful for finding a nearby meetup about a > > given topic. Please note, this is not meant to overtake your existing > > organization method. Everywhere is designed to be agnostic in regards > > to organization platform. > > > > If enough groups start listing there, it might make sense to then post > > a link on the Clojure site to help people find their local user group: > > > >http://www.meetup.com/Clojure > > > > I can make changes to the page as necessary. > > > > Cheers, > > > > Andrew > > > > -- > > http://www.apgwoz.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 > -- http://www.apgwoz.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: CLR questions
(str "if " "Xbox 360 has all you need to run Clojure"), I was just trying to emphasize that even if you could emit code you still had other problems. On Sep 23, 5:45 am, Timothy Baldridge wrote: > > Is this still a problem if you compile everything ahead of time? I > > noticed that if I make a jar with leiningen my clj files are included > > in the jar but I assumed that it was just part of some dogma that I > > should share my source code. > > Actually I think it's a bit worse than that. LISP treats all code as > data and all data as code. Basically, in LISP you can take any list > and attempt to execute it. So even if you completely AOT compile the > code you're going to have to rip out any JIT functions to get it to > properly transfer to the Xbox. > > > > > Also, I asked a similar question where I was concerned about the > > things Timothy mentioned. The one answer I got was pretty much that > > if the Xbox version of .Net had everything Clojure needed the Xbox > > just wouldn't run clojure very well. Just like with Dalvik, the > > Compact .Net handles GC poorly. > > The biggest issue is that Clojure, IronPython, etc. are based on the > Microsoft DLR. This DLR makes heavy, heavy use of on-the-fly code > generation. As far as I know the 360 does not implement a full-blown > JIT (the bytecodes are translated to machine code on the development > PC then the resulting binary is shipped to the Xbox). Therefore the > DLR will not run on the Xbox and languages that require it will > either. That link you supplied doesn't state that "Xbox 360 has all > you need to run Clojure" but simply states that in addition to any > other issues you may have, Clojure would kill the GC. > > Now what could happen is this: Someone could take the AST classes in > Clojure-CLR and convert them from code generation routines to > interpreted routines. Interpreted Clojure would run on the Xbox, there > just isn't an interpreter written yet. > > Timothy > > -- > “One of the main causes of the fall of the Roman Empire was > that–lacking zero–they had no way to indicate successful termination > of their C programs.” > (Robert Firth) -- 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: CLR questions
Not quite. Lua isn't a good example because it's a register based runtime designed to be very small footprint. Also most of the games you listed are PC. Civ 4 uses python but it targets PC too. Consoles have very different and strict set of rules. We tried this last year, while we could get a bunch of CLR languages to do basic things, they were failure from practical use POV. Yes it's possible to use embedded lisp as a scripting DSL on console, GOAL on playstation is such an example. But again, it was designed from ground up to do this. If that's what you want to do, you'd have better luck starting with ecl(embedded common lisp). We've gotten that to work on iPhone even. On Sep 23, 2010, at 10:36 AM, Timothy Baldridge wrote: > "So imagine you are running java code on JVM in interpreted mode, > it's too slow for any serious game." > > Meh...that's not exactly true. Many games (Warhammer 40k, Supreme > Commander, WoW, etc.) use stock LUA, and some (Civ IV) use Python. > Both of these are not JIT languages. Actually I would assume LIPS like > languages would actually run better than most in an interpreted VM due > to the simplicity of the VM. In fact picoLISP released some benchmarks > back in 2006 were they showed that interpreted picoLisp was actually > faster than compiled Common LISP [1]. > > So while having a highly advanced JIT like the JVM provides, I'm not > sure it's exactly a requirement for an acceptable Clojure variant. > > Timothy Baldridge > > [1] http://www.software-lab.de/radical.pdf > > > > On Thu, Sep 23, 2010 at 9:27 AM, Wilson MacGyver wrote: >> On xbox, you can't alter running code in memory, which means JIT basically >> doesn't work. So imagine you are running java code on JVM in interpreted >> mode, >> it's too slow for any serious game. >> >> This is a common issue in most game consoles. >> >> -- >> 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 > > > > -- > “One of the main causes of the fall of the Roman Empire was > that–lacking zero–they had no way to indicate successful termination > of their C programs.” > (Robert Firth) > > -- > 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 1.3 Alpha 1
Will alpha releases be once-a-month, once-a-quarter, or now-seems- good? Is there a theoretical schedule for 1.3? Are people thinking of it as a year or something less than a year away? On Sep 23, 12:23 pm, Stuart Halloway wrote: > Clojure 1.3 Alpha 1 is now available at > > http://clojure.org/downloads > > == Changes == > > * enhanced primitive support > (http://dev.clojure.org/display/doc/Enhanced+Primitive+Support) > * better exception reporting > * ancillary namespaces no longer auto-load on startup: > clojure.set, clojure.xml, clojure.zip > > == Why Alpha Now? == > > 1.3 is the first release of Clojure that will include a series of > alpha builds. We are adding these builds to support maven and > leiningen users, who want a specific artifact that they can target (as > opposed to building from master or "moving-target" snapshots). > > If you are the kind of person who used to track master by building > from source, but no longer do so because you are using maven or > leiningen, alpha releases are for you. > > For maven/leiningen users, your settings to get the beta from > build.clojure.org/releases are: > > :dependencies [[org.clojure/clojure "1.3.0-alpha1"] > > Thanks! > Stu > > Stuart Halloway > Clojure/core team at Relevancehttp://clojure.comhttp://thinkrelevance.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: clojure-contrib master now in submodules
On Sep 22, 2:03 pm, Stuart Sierra wrote: > On Sep 22, 12:35 pm, Justin Kramer wrote: > > > Here's the magic incantation I've been using: > > > [org.clojure.contrib/complete "1.3.1-SNAPSHOT" :classifier "bin"] > > > I don't know how official or future-proof that is. > > It's wrong, technically, but appears to work for now. > > I think this may be a problem with Leiningen not understanding "pom" > packages. If somebody can confirm that, we can try to fix it. > > -S No, plain Maven has the same problem. If I add bin to this pom it works, without it fails: http://gist.github.com/594252 --Brian -- 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 for VS2010
Some background: I've been spending some of my free time providing by basic Clojure support in VS 2010. To be honest, I'm a bit of a Clojure newbie, so I figured something that would require me to build a lexer and parser for the language and delve into the clojure source would be a great way to learn while creating something other people might find valuable. For adoption, having first-class support in VS for clojure- clr would be huge. I've built syntax highlighting, brace matching, and some basic formatting helpers. I'm working on the REPL window and project/build system next. My hope is to get it to the point where a user can download the plugin, create a new project, get some basic boilerplate, build, execute and debug all from within Visual Studio. People who are using emacs won't be abandoning it, but I hope it'll help people with a .Net background get going quickly. I'm looking for input about what features I should focus on and just general comments on the worthiness of the project. I figure I'm bound to make mistakes by approaching this from a C/C++/C# programmer's perspective, and this might preclude that. Thanks. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new 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
Something hanging onto the head?
I have a very simple test case in clojure 1.2: (def * 1* (count (range 0 1))) I have a loop running in another thread that periodically causes a full gc and then prints the amount of used memory every 2 seconds. Evaluating the above form, I get: Used memory: 0.079951296 G Used memory: 0.32577516 G Used memory: 0.847947752 G Used memory: 1.377162736 G Used memory: 1.878349032 G Used memory: 2.202150656 G Used memory: 2.686696656 G Used memory: 3.14701836 G ... Seems like something is holding onto the front of the sequence. However, if I use the following instead: (def *1* (#(count (range 0 1 The problem goes away: Used memory: 0.07999508 G Used memory: 0.0799572 G Used memory: 0.07999796 G Used memory: 0.079997392 G Used memory: 0.111486904 G Used memory: 0.079995512 G Used memory: 0.11590836 G Used memory: 0.080138968 G Used memory: 0.080005136 G Used memory: 0.079963912 G Used memory: 0.07996396 G Used memory: 0.079964008 G Any ideas? -- 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
Error message that could be more helpful
I have a project that consists of playhaven.downloader.run and playhaven.downloader.core. Run is defined like this (for brevity's sake, I've left out a lot of the code; let me know if I missed something important): ;; run.clj (ns playhaven.downloader.run (:use playhaven.downloader.core clojure.contrib.command-line) (:gen-class)) (defn -main ... ) My first attempt at core.clj was this: ;; core.clj - bad! (ns playhaven.downloader.core (:require clj-http.client :as client)) ...but it really should have been this: ;; core.clj - good! (ns playhaven.downloader.core (:require [clj-http.client :as client])) This is obviously a dumb newbie error (I left out a pair of brackets if you missed it). However, the error message I got wasn't much help: Exception in thread "main" java.lang.ExceptionInInitializerError (NO_SOURCE_FILE:1) at clojure.lang.Compiler.eval(Compiler.java:5440) at clojure.lang.Compiler.eval(Compiler.java:5415) at clojure.lang.Compiler.eval(Compiler.java:5391) at clojure.core$eval.invoke(core.clj:2382) at clojure.main$eval_opt.invoke(main.clj:235) at clojure.main$initialize.invoke(main.clj:254) at clojure.main$null_opt.invoke(main.clj:279) at clojure.main$main.doInvoke(main.clj:354) at clojure.lang.RestFn.invoke(RestFn.java:422) at clojure.lang.Var.invoke(Var.java:369) at clojure.lang.AFn.applyToHelper(AFn.java:165) at clojure.lang.Var.applyTo(Var.java:482) at clojure.main.main(main.java:37) Caused by: java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at clojure.lang.RT.loadClassForName(RT.java:1578) at clojure.lang.RT.load(RT.java:399) at clojure.lang.RT.load(RT.java:381) at clojure.core$load$fn__4511.invoke(core.clj:4905) at clojure.core$load.doInvoke(core.clj:4904) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.core$load_one.invoke(core.clj:4729) at clojure.core$compile$fn__4516.invoke(core.clj:4916) at clojure.core$compile.invoke(core.clj:4915) at user$eval7.invoke(NO_SOURCE_FILE:1) at clojure.lang.Compiler.eval(Compiler.java:5424) ... 12 more Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Symbol (core.clj:1) at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:2911) at clojure.lang.Compiler.compile1(Compiler.java:5933) at clojure.lang.Compiler.compile1(Compiler.java:5923) at clojure.lang.Compiler.compile(Compiler.java:5992) at clojure.lang.RT.compile(RT.java:368) at clojure.lang.RT.load(RT.java:407) at clojure.lang.RT.load(RT.java:381) at clojure.core$load$fn__4511.invoke(core.clj:4905) at clojure.core$load.doInvoke(core.clj:4904) at clojure.lang.RestFn.invoke(RestFn.java:409) at clojure.core$load_one.invoke(core.clj:4729) at clojure.core$load_lib.doInvoke(core.clj:4766) at clojure.lang.RestFn.applyTo(RestFn.java:143) at clojure.core$apply.invoke(core.clj:542) at clojure.core$load_libs.doInvoke(core.clj:4800) at clojure.lang.RestFn.applyTo(RestFn.java:138) at clojure.core$apply.invoke(core.clj:544) at clojure.core$use.doInvoke(core.clj:4880) at clojure.lang.RestFn.invoke(RestFn.java:422) at playhaven.downloader.run$loading__4410__auto__.invoke(run.clj:1) at playhaven.downloader.run__init.load(Unknown Source) at playhaven.downloader.run__init.(Unknown Source) ... 25 more Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Symbol at clojure.core$alias.invoke(core.clj:3306) at clojure.core$load_lib.doInvoke(core.clj:4774) at clojure.lang.RestFn.applyTo(RestFn.java:143) at clojure.core$apply.invoke(core.clj:542) at clojure.core$load_libs.doInvoke(core.clj:4800) at clojure.lang.RestFn.applyTo(RestFn.java:138) at clojure.core$apply.invoke(core.clj:542) at clojure.core$require.doInvoke(core.clj:4869) at clojure.lang.RestFn.invoke(RestFn.java:437) at playhaven.downloader.core$loading__4410__auto__.invoke(core.clj:1) at clojure.lang.AFn.applyToHelper(AFn.java:159) at clojure.lang.AFn.applyTo(AFn.java:151) at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:2906) ... 46 more It would be awesome if this error message at least said something like "syntax error in core.clj". I was going to report this to the ticket tracker, but couldn't figure out where to do that. Could someone point me in the right direction? -- 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 moderat
Re: Error message that could be more helpful
Also, one thing I just thought about: I got this error when running lein jar. Is it possible this is a leiningen problem rather than a clojure problem? -- 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
Fixing subject. On Sep 23, 1:25 pm, Jeff Palmucci wrote: > I have a very simple test case in clojure 1.2: > > (def * 1* (count (range 0 1))) > > I have a loop running in another thread that periodically causes a full gc > and then prints the amount of used memory every 2 seconds. Evaluating the > above form, I get: > > Used memory: 0.079951296 G > Used memory: 0.32577516 G > Used memory: 0.847947752 G > Used memory: 1.377162736 G > Used memory: 1.878349032 G > Used memory: 2.202150656 G > Used memory: 2.686696656 G > Used memory: 3.14701836 G > > ... > > Seems like something is holding onto the front of the sequence. > > However, if I use the following instead: > > (def *1* (#(count (range 0 1 > > The problem goes away: > > Used memory: 0.07999508 G > Used memory: 0.0799572 G > Used memory: 0.07999796 G > Used memory: 0.079997392 G > Used memory: 0.111486904 G > Used memory: 0.079995512 G > Used memory: 0.11590836 G > Used memory: 0.080138968 G > Used memory: 0.080005136 G > Used memory: 0.079963912 G > Used memory: 0.07996396 G > Used memory: 0.079964008 G > > Any ideas? -- 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 for VS2010
On Thu, Sep 23, 2010 at 4:20 PM, Will Kennedy wrote: > Some background: I've been spending some of my free time providing by > basic Clojure support in VS 2010. To be honest, I'm a bit of a Clojure > newbie, so I figured something that would require me to build a lexer > and parser for the language and delve into the clojure source would be > a great way to learn while creating something other people might find > valuable. For adoption, having first-class support in VS for clojure- > clr would be huge. > > I've built syntax highlighting, brace matching, and some basic > formatting helpers. I'm working on the REPL window and project/build > system next. My hope is to get it to the point where a user can > download the plugin, create a new project, get some basic boilerplate, > build, execute and debug all from within Visual Studio. People who are > using emacs won't be abandoning it, but I hope it'll help people with > a .Net background get going quickly. > > I'm looking for input about what features I should focus on and just > general comments on the worthiness of the project. I figure I'm bound > to make mistakes by approaching this from a C/C++/C# programmer's > perspective, and this might preclude that. > > Thanks. > Hi Will, This is absolutely worthy. It's VS or die in the .NET world. Syntax highlighting, indentation, the REPL (including sending expressions from the editor), and the project system are most important. After that, I think some combination of integrating the editor with the REPL's doc function, .NET intellisense, and Clojure intellisense. There's some effort going on to potentially unify the REPL servers used by the IDEs, so keep an eye on that, as well. Shawn -- 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: building new contrib against a specific clojure jar
On Thu, Sep 23, 2010 at 1:40 AM, Andy Fingerhut wrote: > OK, one more quick hack I've found -- again, a hack, not a long term > solution. If you want to create a Leiningen project that uses the latest > clojure and contrib, read on. I couldn't figure out what to use in > project.clj unless I renamed this file first. ... > :dependencies [[org.clojure/clojure "1.3.0-master-SNAPSHOT"] > [org.clojure.contrib/complete "1.3.1-SNAPSHOT"]]) According to another thread, the following works (but is "technically wrong"): :dependencies [[org.clojure/clojure "1.3.0-master-SNAPSHOT"] [org.clojure.contrib/complete "1.3.1-SNAPSHOT" :classifier "bin"]]) -- 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: Clojure 1.3 Alpha 1
On Thu, Sep 23, 2010 at 10:23 AM, Stuart Halloway wrote: > Clojure 1.3 Alpha 1 is now available at Thank you! > For maven/leiningen users, your settings to get the beta from > build.clojure.org/releases are: > :dependencies [[org.clojure/clojure "1.3.0-alpha1"] Are there plans to also make alpha builds of Clojure Contrib available that are built against the equivalent Clojure Alpha? -- 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: Little LISPer and Ten Commandments
I concur - that book is amazing. Steve Yegge mentions he worked through the whole book in Scheme and then Common LISP. http://steve-yegge.blogspot.com/2006/06/shiny-and-new-emacs-22.html (and he mentioned recently he was taking a look at Clojure.) It looks like there is a blog or two online that work through it. There also appear to be some guys on twitter talking about it. My favourite bit is how you build the scheme evaluator at the end. JG On Sep 23, 6:10 am, David Sletten wrote: > That book is amazing. Enjoy working through it, it will stretch your mind. > > However, keep in mind that their emphasis is on getting a feel for how > recursion works. Real world Clojure code (any Lisp really) de-emphasizes > recursion to some extent. Particularly with regard to list (sequence) > processing (the name Lisp comes from "List processing" after all), Clojure > has a powerful library of functions that handle much of what the book > implements recursively. For example, if you would like to apply a function f > to each element in a list you could write code similar to the book: > (defn my-map [f l] > (cond (empty? l) '() > :else (cons (f (first l)) (my-map f (rest l ) > > (my-map inc '(1 2 3 4 5)) => (2 3 4 5 6) > > Here we apply the "First Commandment"--is the list l empty? If so, return an > empty list. Otherwise, apply the function to the first element of the list > and recursively process the rest of the list. > > We could accomplish the same thing more succinctly in Clojure like this: > (map inc '(1 2 3 4 5)) => (2 3 4 5 6) > > Clojure has a built-in 'map' function which iterates over each element in a > sequence, not merely lists: > (map dec [2 4 6 8]) => (1 3 5 7) > (map #(Character/toUpperCase %) "Is this not pung?") => (\I \S \space \T \H > \I \S \space \N \O \T \space \P \U \N \G \?) > > Furthermore, the book is pretty much using a dialect of Lisp called Scheme, > and the semantics are a little different from Clojure. For instance, Clojure > does not have the concept of 'atom'. > > It may actually be easier to work through the book in a Scheme environment (I > used Common Lisp though). But what you learn there will help you later with > Clojure. > > In fact, if you are brave here is some of the material from chapter 9 dealing > with the Y-Combinator implemented in Clojure. It's pretty > weird:http://groups.google.com/group/clojure/browse_thread/thread/c9bd4e79e... > > Have all good days, > David Sletten > > On Sep 21, 2010, at 6:38 PM, ax2groin wrote: > > > > > Newbie here, to both LISP and Clojure. A friend has lent me a copy of > > "The Little LISPer" and I've started working through it, using some > > web resources to translate it into clojure. > > > My questions: How relevant are the ten commandments? What modification > > need to be made ... either to the commandments or to your code in > > clojure? > > > I ask because the first commandment (always ask null?) hasn't > > translated directly into any single statement for me. I can achieve > > the same with (or) to navigate the difference between nil and () in > > clojure, but sure that difference is in there for a reason. > > > Any other input on the other commandments or using the book in > > general? > > > Thanx > > > -- > > 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
Building from source - error in contrib/accumulators?
As of yesterday, I built Clojure and Contrib from source successfully and was able to run some Clojure programs. That was on my laptop. Today I tried to do the same thing on my desktop and I'm hitting a failure in mvn install during the test for monads.clj (if I'm reading the output of Maven correctly). My workflow to build from source is: * cd clojure * git pull * ant -lib /path/to/maven-ant-tasks-2.1.1.jar ci-build * mvn install * cp clojure-1.3.0-SNAPSHOT.jar ~/.m2/repository/org/clojure/clojure/1.3.0-SNAPSHOT/clojure-1.3.0-SNAPSHOT.jar (I still seem to need to do this - slim and sources JAR files are installed and look good but the main JAR is still empty otherwise) * cd ../clojure-contrib * git pull * edit modules/parent/pom.xml and set clojure.version to 1.3.0-SNAPSHOT * edit any other pom.xml that refer to 1.2.0 (there are explicit dependencies on Clojure versions due to AOT considerations according to the notes in four files) * mvn compile * mvn install FWIW, when this worked on my laptop, I had this in Leiningen and was able to run programs fine: :dependencies [[org.clojure/clojure "1.3.0-SNAPSHOT"] [org.clojure.contrib/complete "1.3.1-SNAPSHOT" :classifier "bin"]] That all worked on my laptop. Below is the error I get on my desktop. clojure.set not found? I fixed it by adding the following to accumulators.clj: (:use [clojure.set :only (union)]) Is this just a bug in accumulators.clj or something weird in my environment? Thanx, Sean [INFO] [INFO] Building Unnamed - org.clojure.contrib:monads:jar:1.3.1-SNAPSHOT [INFO]task-segment: [install] [INFO] [INFO] [resources:resources {execution: default-resources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] skip non existing resourceDirectory /Developer/workspace/clojure-contrib/modules/monads/src/examples/clojure [INFO] [compiler:compile {execution: default-compile}] [INFO] No sources to compile [INFO] [clojure:compile {execution: compile-clojure}] [INFO] [resources:testResources {execution: default-testResources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [compiler:testCompile {execution: default-testCompile}] [INFO] No sources to compile [INFO] [surefire:test {execution: default-test}] [INFO] Surefire report directory: /Developer/workspace/clojure-contrib/modules/monads/target/surefire-reports --- T E S T S --- There are no tests to run. Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [clojure:test {execution: test-clojure}] Exception in thread "main" java.lang.ClassNotFoundException: clojure.set, compiling:(accumulators.clj:121) at clojure.lang.Compiler.analyze(Compiler.java:5777) at clojure.lang.Compiler.analyze(Compiler.java:5723) at clojure.lang.Compiler$StaticInvokeExpr.parse(Compiler.java:3093) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3317) at clojure.lang.Compiler.analyzeSeq(Compiler.java:5945) at clojure.lang.Compiler.analyze(Compiler.java:5762) at clojure.lang.Compiler.analyze(Compiler.java:5723) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3331) at clojure.lang.Compiler.analyzeSeq(Compiler.java:5945) at clojure.lang.Compiler.analyze(Compiler.java:5762) at clojure.lang.Compiler.analyze(Compiler.java:5723) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5131) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4639) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3449) at clojure.lang.Compiler.analyzeSeq(Compiler.java:5941) at clojure.lang.Compiler.analyze(Compiler.java:5762) at clojure.lang.Compiler.analyzeSeq(Compiler.java:5931) at clojure.lang.Compiler.analyze(Compiler.java:5762) at clojure.lang.Compiler.analyze(Compiler.java:5723) at clojure.lang.Compiler$HostExpr$Parser.parse(Compiler.java:847) at clojure.lang.Compiler.analyzeSeq(Compiler.java:5943) at clojure.lang.Compiler.analyze(Compiler.java:5762) at clojure.lang.Compiler.analyze(Compiler.java:5723) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5131) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4639) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3449) at clojure.lang.Compiler.analyzeSeq(Compiler.java:5941) at clojure.lang.Compiler.analyze(Compiler.java:5762) at clojure.lang.Compiler.eval(Compiler.java:5995) at clojure.lang.Compiler.load(Compiler.java:6431) at clojure.lang.RT.loadResourceScript(RT.java:340) at clojure.lang.RT.loadResourceScript(RT.java:331) at clojure.lan
Re: Building from source - error in contrib/accumulators?
Yep, I got the same thing yesterday. See my message in the thread "Re: building new contrib against a specific clojure jar" from last night for a patch that corrects this, and causes 1.3.0-master-SNAPSHOT version of clojure to be used for compilation everywhere in contrib instead of 1.2.0 version of Clojure. Andy On Sep 23, 2010, at 4:52 PM, Sean Corfield wrote: As of yesterday, I built Clojure and Contrib from source successfully and was able to run some Clojure programs. That was on my laptop. Today I tried to do the same thing on my desktop and I'm hitting a failure in mvn install during the test for monads.clj (if I'm reading the output of Maven correctly). My workflow to build from source is: * cd clojure * git pull * ant -lib /path/to/maven-ant-tasks-2.1.1.jar ci-build * mvn install * cp clojure-1.3.0-SNAPSHOT.jar ~/.m2/repository/org/clojure/clojure/1.3.0-SNAPSHOT/clojure-1.3.0- SNAPSHOT.jar (I still seem to need to do this - slim and sources JAR files are installed and look good but the main JAR is still empty otherwise) * cd ../clojure-contrib * git pull * edit modules/parent/pom.xml and set clojure.version to 1.3.0- SNAPSHOT * edit any other pom.xml that refer to 1.2.0 (there are explicit dependencies on Clojure versions due to AOT considerations according to the notes in four files) * mvn compile * mvn install FWIW, when this worked on my laptop, I had this in Leiningen and was able to run programs fine: :dependencies [[org.clojure/clojure "1.3.0-SNAPSHOT"] [org.clojure.contrib/complete "1.3.1-SNAPSHOT" :classifier "bin"]] That all worked on my laptop. Below is the error I get on my desktop. clojure.set not found? I fixed it by adding the following to accumulators.clj: (:use [clojure.set :only (union)]) Is this just a bug in accumulators.clj or something weird in my environment? Thanx, Sean [INFO] [INFO] Building Unnamed - org.clojure.contrib:monads:jar:1.3.1- SNAPSHOT [INFO]task-segment: [install] [INFO] [INFO] [resources:resources {execution: default-resources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] skip non existing resourceDirectory /Developer/workspace/clojure-contrib/modules/monads/src/examples/ clojure [INFO] [compiler:compile {execution: default-compile}] [INFO] No sources to compile [INFO] [clojure:compile {execution: compile-clojure}] [INFO] [resources:testResources {execution: default-testResources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [compiler:testCompile {execution: default-testCompile}] [INFO] No sources to compile [INFO] [surefire:test {execution: default-test}] [INFO] Surefire report directory: /Developer/workspace/clojure-contrib/modules/monads/target/surefire- reports --- T E S T S --- There are no tests to run. Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [clojure:test {execution: test-clojure}] Exception in thread "main" java.lang.ClassNotFoundException: clojure.set, compiling:(accumulators.clj:121) at clojure.lang.Compiler.analyze(Compiler.java:5777) at clojure.lang.Compiler.analyze(Compiler.java:5723) at clojure.lang.Compiler$StaticInvokeExpr.parse(Compiler.java:3093) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3317) at clojure.lang.Compiler.analyzeSeq(Compiler.java:5945) at clojure.lang.Compiler.analyze(Compiler.java:5762) at clojure.lang.Compiler.analyze(Compiler.java:5723) at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3331) at clojure.lang.Compiler.analyzeSeq(Compiler.java:5945) at clojure.lang.Compiler.analyze(Compiler.java:5762) at clojure.lang.Compiler.analyze(Compiler.java:5723) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5131) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4639) at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3449) at clojure.lang.Compiler.analyzeSeq(Compiler.java:5941) at clojure.lang.Compiler.analyze(Compiler.java:5762) at clojure.lang.Compiler.analyzeSeq(Compiler.java:5931) at clojure.lang.Compiler.analyze(Compiler.java:5762) at clojure.lang.Compiler.analyze(Compiler.java:5723) at clojure.lang.Compiler$HostExpr$Parser.parse(Compiler.java:847) at clojure.lang.Compiler.analyzeSeq(Compiler.java:5943) at clojure.lang.Compiler.analyze(Compiler.java:5762) at clojure.lang.Compiler.analyze(Compiler.java:5723) at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:5131) at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4639) at clojure.lang.Compiler$FnExpr.parse(Compi
Re: Building from source - error in contrib/accumulators?
Thanx. I saw your message but didn't look at the patch in detail. I notice you have 1.3.0-master-SNAPSHOT but when I built Clojure and mvn install'd it, it created 1.3.0-SNAPSHOT instead...? On Thu, Sep 23, 2010 at 5:21 PM, Andy Fingerhut wrote: > Yep, I got the same thing yesterday. > > See my message in the thread "Re: building new contrib against a specific > clojure jar" from last night for a patch that corrects this, and causes > 1.3.0-master-SNAPSHOT version of clojure to be used for compilation > everywhere in contrib instead of 1.2.0 version of Clojure. > > Andy -- 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: Building from source - error in contrib/accumulators?
BTW, to feed changes back to the core/contrib team, what's the preferred approach? i.e., is the information on these pages up-to-date: http://clojure.org/contributing http://clojure.org/patches On Thu, Sep 23, 2010 at 5:34 PM, Sean Corfield wrote: > Thanx. I saw your message but didn't look at the patch in detail. > > I notice you have 1.3.0-master-SNAPSHOT but when I built Clojure and > mvn install'd it, it created 1.3.0-SNAPSHOT instead...? > > On Thu, Sep 23, 2010 at 5:21 PM, Andy Fingerhut > wrote: >> Yep, I got the same thing yesterday. >> >> See my message in the thread "Re: building new contrib against a specific >> clojure jar" from last night for a patch that corrects this, and causes >> 1.3.0-master-SNAPSHOT version of clojure to be used for compilation >> everywhere in contrib instead of 1.2.0 version of Clojure. >> >> Andy -- 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: Durable refs with ACID guarantees - Phase I
What is the performance penalty? On Sep 23, 5:21 am, Alyssa Kwan wrote: > This is in reference > tohttp://groups.google.com/group/clojure/browse_frm/thread/d6deac0c34d0 > > Hi everyone! > > I have hacked the Clojure core to add durability to refs. The syntax > to create these is (dref ), where and > are strings. Then you use them just like refs. Creating a dref > creates a global identity, such that subsequent dref calls to the same > key and path will get the same dref. On subsequent dref calls, the > will be ignored and the persisted value used. This includes in > subsequent VM instances. > > Get it here: git://github.com/kwanalyssa/clojure.git > > 1. refers to BDB JE databases which get created in the "data" > directory of your project. > 2. BDB JE is used. I'm ignorant of IP and licensing issues. Making > BDB JE core to Clojure is probably an issue. > 3. Currently only a subset of Clojure primitives types is supported. > No BigDecimal or Ratio yet. See the comprehensive list (and > serialization mappings) at the bottom of src/jvm/clojure/lang/ > DRef.java. BDB JE TupleBindings are used. Submissions welcome, > especially for the persistent data structures. > 4. How do we approach the problem of storing objects with lexical > environments? > 5. Unit tests welcome! I didn't do TDD since the work is in Java and > there's no Java-level tests in the project. Please add your own in > test/clojure/test_clojure/drefs.clj. I'm new to concurrency, so tests > along those lines would be awesome! > 6. The ACID part is not really guaranteed!!! STM is currently one- > phase-commit. I inserted two-phase-commits to the data stores in the > middle of the one-phase-commit. There's the remote possibility that > STM in-memory changes fail AFTER writing to disk. It's REALLY remote, > but it is possible. STM would have to be made 2PC to make this > airtight. That's way beyond my current grasp of both concurrency and > Clojure implementation. > 7. I was aiming for an API where is optional. However, I > didn't want to stray from the ref API, which has variable arity. > Suggestions on how to reconcile the two are welcome! > 8. To maintain global identity, I use a static cache, which requires > non-hard references to avoid OOM issues. This is my first time doing > this, so please check my code to make sure that I'm doing it right. > I'm using SoftReferences, though WeakReferences may be better for real- > life usage patterns. Let me know! > > Please dig in! Feedback appreciated! > Alyssa Kwan -- 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: Genetic Algorithm Example
On Sep 19, 2010, at 9:41 AM, Goran Jovic wrote: > Anyway, being a Clojure newbie myself, I had a huge benefit from > freely available code examples, so I decided to share my own project > with other folks who are learning Clojure. > > It's hosted on: > http://code.google.com/p/genetic-my-number/ > > So, enjoy... and, of course, I always welcome ideas, suggestions, > (constructive) criticism or any other comments. Perhaps you'd be interested in a related but slightly different approach to solving a related but slightly different problem. The problem is the one posed by the numeric card game Krypto ( http://en.wikipedia.org/wiki/Krypto_(game) ), and the solution uses not a standard genetic algorithm but rather a genetic programming system (Clojush, a Clojure implementation of Push/PushGP). Using this to solve Krypto, which is quite simple, is a bit like using a sledgehammer to kill a fly, but it made a cute little exercise so I included it as one of the examples in the latest version of the Clojush system: http://github.com/lspector/Clojush BTW I mentioned the Clojush project here previously but I've recently made a number of significant improvements based on comments I received. It's much more idiomatic Clojure code now, although I'm sure it still bears traces of its history in Common Lisp and Scheme. Also, just for kicks I recently wrote Clojure code to solve Krypto instances directly, since it's pretty easy. I'll paste in the code below. People will yell that I shouldn't use eval or non-recur recursive calls, but I think they're fine in this (toy) case. -Lee ;; kryptosolve.clj ;; Clojure code for solving instances of the game of Krypto. ;; See http://en.wikipedia.org/wiki/Krypto_(game) ;; Lee Spector, lspec...@hampshire.edu, 2010 (ns kryptosolve (:use clojure.contrib.combinatorics)) (defn safe-eval "Returns the result of evaluating e, or :error if it throws an exception." [e] (try (eval e) (catch java.lang.Exception _ :error))) (defn all-splits "Returns a sequence of all ways of splitting values into 2 subsequences." [values] (map #(split-at (inc %) values) (range (dec (count values) (defn expressions "Returns a sequence of all of the arithmetic expressions that can be formed with the provided values in the given order." [values] (if (< (count values) 2) values (mapcat (fn [[left-values right-values]] (mapcat (fn [[left-expression right-expression]] (map #(list % left-expression right-expression) '(+ - * /))) (cartesian-product (expressions left-values) (expressions right-values (all-splits values (defn solve-krypto "Returns a solution expression if one can be found for the given values and target." [values target] (first (filter #(= (safe-eval %) target) (mapcat expressions (lex-permutations values) (solve-krypto [1 2 3 4 5] 25) -- 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: textmate-clojure, SLIME for TextMate (sorta)
First off Acknowledgements: Aria Haghighi, did much of the heavy lifting on this project! Stephen Roller, created the first version of the bundle in 2008 Mark McGranaghan, expanded Stephen Roller's version Justin Balthrop & Lance Bradley, core developers of Cake http://github.com/ninjudd/cake - if they weren't constantly adding features just for this project, this would have never gotten off the ground Allan Odgaard, for being the creator of TextMate and listening to my Bundle dev noob questions A screencast: http://blip.tv/file/4160578 The project repo: http://github.com/swannodette/textmate-clojure The Google Group: http://groups.google.com/group/textmate-clojure The project is written almost entirely in Clojure so you have no excuse to not contribute if you like TextMate :D Lots of bugs to fix. Two things I'd love to see: 1. Integration with nREPL via WebSockets to get a REPL right in TextMate 2. Integration with Mycroft to get an inspector right in TextMate 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: ANN: Durable refs with ACID guarantees - Phase I
On Thu, Sep 23, 2010 at 8:16 PM, Alyssa Kwan wrote: > There's no need for any transaction boundary; you just > have to make sure that compareAndSet does a durable swap. I had the chance to read your code today. You have a transaction boundary in DRef.set() which is called by LockingTransaction.run() at commit time. My point was that if you weren't intrusively modifying LockingTransaction.java you would need to take care of that somewhere else, the most obvious place being a dosync wrapper form. All you would need is a seq of 'vals' returned on a commited run(). That would also be useful for application-side transaction logging, etc. -Per -- 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: Durable refs with ACID guarantees - Phase I
I haven't benchmarked... I don't have much experience with benchmarking. Assistance would be greatly appreciated! On Sep 23, 9:09 pm, Dragan Djuric wrote: > What is the performance penalty? > > On Sep 23, 5:21 am, Alyssa Kwan wrote: > > > > > This is in reference > > tohttp://groups.google.com/group/clojure/browse_frm/thread/d6deac0c34d0 > > > Hi everyone! > > > I have hacked the Clojure core to add durability to refs. The syntax > > to create these is (dref ), where and > > are strings. Then you use them just like refs. Creating a dref > > creates a global identity, such that subsequent dref calls to the same > > key and path will get the same dref. On subsequent dref calls, the > > will be ignored and the persisted value used. This includes in > > subsequent VM instances. > > > Get it here: git://github.com/kwanalyssa/clojure.git > > > 1. refers to BDB JE databases which get created in the "data" > > directory of your project. > > 2. BDB JE is used. I'm ignorant of IP and licensing issues. Making > > BDB JE core to Clojure is probably an issue. > > 3. Currently only a subset of Clojure primitives types is supported. > > No BigDecimal or Ratio yet. See the comprehensive list (and > > serialization mappings) at the bottom of src/jvm/clojure/lang/ > > DRef.java. BDB JE TupleBindings are used. Submissions welcome, > > especially for the persistent data structures. > > 4. How do we approach the problem of storing objects with lexical > > environments? > > 5. Unit tests welcome! I didn't do TDD since the work is in Java and > > there's no Java-level tests in the project. Please add your own in > > test/clojure/test_clojure/drefs.clj. I'm new to concurrency, so tests > > along those lines would be awesome! > > 6. The ACID part is not really guaranteed!!! STM is currently one- > > phase-commit. I inserted two-phase-commits to the data stores in the > > middle of the one-phase-commit. There's the remote possibility that > > STM in-memory changes fail AFTER writing to disk. It's REALLY remote, > > but it is possible. STM would have to be made 2PC to make this > > airtight. That's way beyond my current grasp of both concurrency and > > Clojure implementation. > > 7. I was aiming for an API where is optional. However, I > > didn't want to stray from the ref API, which has variable arity. > > Suggestions on how to reconcile the two are welcome! > > 8. To maintain global identity, I use a static cache, which requires > > non-hard references to avoid OOM issues. This is my first time doing > > this, so please check my code to make sure that I'm doing it right. > > I'm using SoftReferences, though WeakReferences may be better for real- > > life usage patterns. Let me know! > > > Please dig in! Feedback appreciated! > > Alyssa Kwan -- 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
Is ClojureCLR converging toward a release?
It was mentioned about six weeks ago that ClojureCLR was mostly 1.2 compatible with a few outstanding issues and a couple dozen failing tests. What is the status now? Is there still an intention of an official binary release with 1.2 level functionality, or has that target been dropped? Thanks, 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
Re: ANN: Durable refs with ACID guarantees - Phase I
Ah. I thought we were discussing prefs, or datoms (durable atoms), as I would call them. Because datoms are only synchronous but not coordinated, there's no transaction boundary. (More accurately, the swap! is the transaction boundary, much like auto-commit.) dosync has no effect on datoms. drefs, being coordinated, do require a transaction boundary. However, I don't think it's possible without modifying LockingTransaction. It's bad enough that the current implementation has 2PC against ACID resources wrapped inside of a 1PC STM transaction. To place the durable write outside of the 1PC would be much less safe. dosync enforces a global transaction order. If writes were outside LockingTransaction.run(), the order could (and probably would) be different between in-memory resources and durable resources. For ultimate safety, we need to be even more intrusive and add a prepare phase to the STM. On Sep 23, 11:05 pm, Per Vognsen wrote: > On Thu, Sep 23, 2010 at 8:16 PM, Alyssa Kwan wrote: > > There's no need for any transaction boundary; you just > > have to make sure that compareAndSet does a durable swap. > > I had the chance to read your code today. You have a transaction > boundary in DRef.set() which is called by LockingTransaction.run() at > commit time. My point was that if you weren't intrusively modifying > LockingTransaction.java you would need to take care of that somewhere > else, the most obvious place being a dosync wrapper form. All you > would need is a seq of 'vals' returned on a commited run(). That would > also be useful for application-side transaction logging, etc. > > -Per -- 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: Durable refs with ACID guarantees - Phase I
This probably comes back to divergent requirements. Strict durability is much too expensive for what I need to do. For me the more important thing is that whatever authoritative data lives on disk is consistent with the application transaction boundaries. This means that I need to tag persistent refs as dirty or increment a version number when an STM transaction commits, so that when they are evicted from cache or a consistent snapshot is written to disk, I know what to write out. Another simplifying requirement is that I don't have to worry about different database domains for persistent refs. The application is organized around a single database that serves as a persistent store for application domain data. -Per On Fri, Sep 24, 2010 at 10:40 AM, Alyssa Kwan wrote: > Ah. I thought we were discussing prefs, or datoms (durable atoms), as > I would call them. Because datoms are only synchronous but not > coordinated, there's no transaction boundary. (More accurately, the > swap! is the transaction boundary, much like auto-commit.) dosync has > no effect on datoms. > > drefs, being coordinated, do require a transaction boundary. However, > I don't think it's possible without modifying LockingTransaction. > It's bad enough that the current implementation has 2PC against ACID > resources wrapped inside of a 1PC STM transaction. To place the > durable write outside of the 1PC would be much less safe. dosync > enforces a global transaction order. If writes were outside > LockingTransaction.run(), the order could (and probably would) be > different between in-memory resources and durable resources. For > ultimate safety, we need to be even more intrusive and add a prepare > phase to the STM. > > On Sep 23, 11:05 pm, Per Vognsen wrote: >> On Thu, Sep 23, 2010 at 8:16 PM, Alyssa Kwan wrote: >> > There's no need for any transaction boundary; you just >> > have to make sure that compareAndSet does a durable swap. >> >> I had the chance to read your code today. You have a transaction >> boundary in DRef.set() which is called by LockingTransaction.run() at >> commit time. My point was that if you weren't intrusively modifying >> LockingTransaction.java you would need to take care of that somewhere >> else, the most obvious place being a dosync wrapper form. All you >> would need is a seq of 'vals' returned on a commited run(). That would >> also be useful for application-side transaction logging, etc. >> >> -Per > > -- > 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: textmate-clojure, SLIME for TextMate (sorta)
Awesome! Great job on this, I was hoping the TM Clojure bundle would get some much needed loving. :-) Quick question: how does this bundle get clojure.jar and clojure-contrib.jar (and any additional dependencies), and is there a way to tell it to use a specific clojure[-contrib].jar file(s)? Thanks, Greg On Sep 23, 2010, at 7:39 PM, David Nolen wrote: > First off Acknowledgements: > > Aria Haghighi, did much of the heavy lifting on this project! > Stephen Roller, created the first version of the bundle in 2008 > Mark McGranaghan, expanded Stephen Roller's version > Justin Balthrop & Lance Bradley, core developers of Cake > http://github.com/ninjudd/cake - if they weren't constantly adding features > just for this project, this would have never gotten off the ground > Allan Odgaard, for being the creator of TextMate and listening to my Bundle > dev noob questions > > A screencast: http://blip.tv/file/4160578 > The project repo: http://github.com/swannodette/textmate-clojure > The Google Group: http://groups.google.com/group/textmate-clojure > > The project is written almost entirely in Clojure so you have no excuse to > not contribute if you like TextMate :D > > Lots of bugs to fix. Two things I'd love to see: > > 1. Integration with nREPL via WebSockets to get a REPL right in TextMate > 2. Integration with Mycroft to get an inspector right in TextMate > > 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: ANN: textmate-clojure, SLIME for TextMate (sorta)
On Thu, Sep 23, 2010 at 11:55 PM, Greg wrote: > Awesome! Great job on this, I was hoping the TM Clojure bundle would get > some much needed loving. :-) > > Quick question: how does this bundle get clojure.jar and > clojure-contrib.jar (and any additional dependencies), and is there a way to > tell it to use a specific clojure[-contrib].jar file(s)? > > Thanks, > Greg > Same way you do with lein. Just set that in your project.clj and run 'cake deps', or even 'lein deps' if you like. 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
Byte Literals
Is there a way to create a vector of byte literals eg. [64 69 72] as bytes? -- 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: Byte Literals
I'm not quite sure what you're asking. Clojure doesn't have byte literals, but you can use the function 'byte' to coerce an int literal: (map class [2 3 4]) => (java.lang.Integer java.lang.Integer java.lang.Integer) (map class (map byte [2 3 4])) => (java.lang.Byte java.lang.Byte java.lang.Byte) Or you can create a Java byte[] array: (def a (make-array Byte/TYPE 3)) But you still have to coerce: (aset a 0 (byte 2)) => 2 (aset a 0 2) => java.lang.IllegalArgumentException: argument type mismatch (NO_SOURCE_FILE:0) Have all good days, David Sletten On Sep 24, 2010, at 12:31 AM, HiHeelHottie wrote: > > Is there a way to create a vector of byte literals eg. [64 69 72] as > bytes? > > -- > 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
Building from source - great improvements today! Thank you!
I just pulled the latest clojure and contrib and was able to build them with one little glitch which I suspect is due to something I did wrong... Building Clojure seems to install 1.3.0-SNAPSHOT but by default Contrib seems to expect 1.3.0-master-SNAPSHOT ? A little bit of experimentation and I realized I could specify the versions in the Maven install for Contrib (and I had to specify the clojure.contrib.version): * mvn -Dclojure.contrib.version=1.3.0 -Dclojure.version=1.3.0-SNAPSHOT -e install Is the expectation that we specify both versions for the Maven install? If so, that's fine - I just want to know so I can build this off the latest version any time... I like the idea of running the bleeding edge to build my software (I'm notorious for putting applications into production on pre-release software stacks... :) Thanx to Stuart and Stuart who committed today's changes! :) -- 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: ANN: textmate-clojure, SLIME for TextMate (sorta)
Thanks! What about single files though? (i.e. no project.clj) On Sep 23, 2010, at 9:22 PM, David Nolen wrote: > On Thu, Sep 23, 2010 at 11:55 PM, Greg wrote: > Awesome! Great job on this, I was hoping the TM Clojure bundle would get some > much needed loving. :-) > > Quick question: how does this bundle get clojure.jar and clojure-contrib.jar > (and any additional dependencies), and is there a way to tell it to use a > specific clojure[-contrib].jar file(s)? > > Thanks, > Greg > > Same way you do with lein. Just set that in your project.clj and run 'cake > deps', or even 'lein deps' if you like. > > 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: ANN: textmate-clojure, SLIME for TextMate (sorta)
On Fri, Sep 24, 2010 at 1:06 AM, Greg wrote: > Thanks! What about single files though? (i.e. no project.clj) > > cake has a global project.clj - ~/.cake/project.clj. Change this and single files will get access to those dependencies. David > On Sep 23, 2010, at 9:22 PM, David Nolen wrote: > > On Thu, Sep 23, 2010 at 11:55 PM, Greg wrote: > >> Awesome! Great job on this, I was hoping the TM Clojure bundle would get >> some much needed loving. :-) >> >> Quick question: how does this bundle get clojure.jar and >> clojure-contrib.jar (and any additional dependencies), and is there a way to >> tell it to use a specific clojure[-contrib].jar file(s)? >> >> Thanks, >> Greg >> > > Same way you do with lein. Just set that in your project.clj and run 'cake > deps', or even 'lein deps' if you like. > > 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 > -- 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: Byte Literals
There's also 'bytes', 'byte-array' and 'into-array': (byte-array (map byte [1 2 3])) (into-array Byte/TYPE (map byte [1 2 3])) // raek -- 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