If you don't want the overhead introduced by an atom or (maybe, I'm
not sure) by local vars, you can just instanciate a mutable object.
The simplest being just an array of Objects with just one element.
This can be achieved without java interop by using make-array , aset,
aget ...
A lasst res
Yea, for me, being on JVM is one of clojure's biggest selling point.
I don't know that I would've learn and use clojure were it not on the
JVM.
On Thu, Jul 9, 2009 at 4:24 PM, John Harrop wrote:
> On Thu, Jul 9, 2009 at 11:10 AM, tmountain wrote:
>>
>> I just finished watching the Bay Area Cloju
I'm running Clojure 1.0.
Could someone please check and see whether this is still a bug in the
most current version?
(use 'clojure.contrib.duck-streams)
(defstruct t :a)
(def x (struct-map t :a 1))
(def s (binding [*print-dup* true] (with-out-str (pr x
(read-string s)
ERROR: java.lang.Runti
On Thu, Jul 9, 2009 at 7:56 PM, Conrad wrote:
>
> I'm trying to optimize an inner loop and need a variable that mutates
> to make this work. It does NOT need to be a thread-safe variable.
> What's the best way to create a "plain ol' mutating variable" in
> Clojure? I know I can always use an Atom,
Yes, I agree using loop/recur is preferable for many reasons when
possible.
On Jul 9, 8:37 pm, Daniel Lyons wrote:
> On Jul 9, 2009, at 5:56 PM, Conrad wrote:
>
>
>
> > Hi everyone:
>
> > I'm trying to optimize an inner loop and need a variable that mutates
> > to make this work. It does NOT nee
On Thu, Jul 9, 2009 at 11:10 AM, tmountain wrote:
>
> I just finished watching the Bay Area Clojure Meetup video, and Rich
> spent a few minutes talking about the possibility of Clojure in
> Clojure. The prospect of having Clojure self-hosted is incredibly
> cool, but it brought a few questions t
On Jul 9, 2009, at 5:56 PM, Conrad wrote:
>
> Hi everyone:
>
> I'm trying to optimize an inner loop and need a variable that mutates
> to make this work. It does NOT need to be a thread-safe variable.
> What's the best way to create a "plain ol' mutating variable" in
> Clojure? I know I can alwa
I suspect the answer will be that I should use atoms (despite the fact
that it isn't completely low level) since I see RH uses those in his
memoization example, which is pretty much the epitemy of optimizing
with a mutating local variable. :-)
On Jul 9, 7:56 pm, Conrad wrote:
> Hi everyone:
>
>
Hi everyone:
I'm trying to optimize an inner loop and need a variable that mutates
to make this work. It does NOT need to be a thread-safe variable.
What's the best way to create a "plain ol' mutating variable" in
Clojure? I know I can always use an Atom, but I was wondering if
there's a more low
http://users.csc.calpoly.edu/~clements/scheme-workshop-2009/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new memb
Hi
I just release a new version of AnotherClojureBox!!
What's new
- Code completion
- Inline help while you are writing clojure form (function arguments,
etc).
- Help form Clojure website pressing F1 over a form.
- Form documentation (where available) in the Outout Window pressing
Ctrl+1 over a f
Hi Tom,
2009/7/2 Tom Faulhaber :
>
>
>
>> Are you suggesting that "clojure reader parsed code" could be first
>> translated back to String and reinjected to the "source code reader" ?
>> Indeed that could simplify final implementation. I don't know what the
>> impact on performance would be, thou
hi,
i see it has been discussed before, and that there are lots of
options. :-) to restrict it a bit, what is the current practice for
getting ML style pattern matching syntax in Clojure?
many thanks.
--~--~-~--~~~---~--~~
You received this message because you ar
That was easy!
user=> (defmacro metafn [meta args & body]
`(proxy [clojure.lang.AFn] [~meta] (invoke ~args ~...@body)))
#'user/metafn
user=> (metafn {:foo :bar} [a b c] (println a) (+ a b c))
#
user=> (*1 1 2 3)
1
6
user=> (meta (metafn {:foo :bar} [a b c] (println a) (+ a b c)))
{:foo :bar
> Actually, it does.
Ah, that explains the UnsupportedOperationException :)
> user=> (instance? clojure.lang.IMeta (fn []))
> true
>
> What it doesn't support is changing the metadata after
> creation:
>
> user=> (with-meta (fn []) {:foo "bar"})
> java.lang.UnsupportedOperationException (NO_SOUR
On Thu, Jul 9, 2009 at 4:19 PM, Richard Newman wrote:
>
> Is there any particular reason why Fn doesn't implement IMeta?
Actually, it does.
user=> (instance? clojure.lang.IMeta (fn []))
true
What it doesn't support is changing the metadata after
creation:
user=> (with-meta (fn []) {:foo "bar"}
That pages says the scopes system is already designed. To you have
any preliminary design docs posted somewhere?
On Jul 9, 2:59 pm, Stuart Sierra wrote:
> On Jul 9, 6:10 am, Mike wrote:
>
> > Is there a pattern out there in Clojure for handling laziness at the
> > same time as handling resourc
> If you want to be able to query a function for its source code later
> on, that's tougher. You'll need to make a macro that wraps defn and
> assigns a copy of the body form to a metadata tag on the function's
> name.
I'm resurrecting this thread because I'm actually hitting this problem
On Jul 9, 6:10 am, Mike wrote:
> Is there a pattern out there in Clojure for handling laziness at the
> same time as handling resource lifecycle (with-open, etc.)?
Not yet, but it is planned, in something called "scopes."
http://clojure.org/todo
-SS
--~--~-~--~~~--
By the by, I believe Squeak Smalltalk has a 'compiler' written in
Squeak that it uses to generate C code which is then used to bootstrap
the rest of the language.
On Jul 9, 9:33 am, tmountain wrote:
> > To be safe one often retains a
> > stub compiler for some subset of the language written in a
On Thu, Jul 9, 2009 at 16:43, eyeris wrote:
>
> I ran the code you pasted here. It didn't throw an IOException for me.
> I am running 1.0.
I suspect that You're Doing it Wrong.
You'll see the exception only if you actually try to evaluate the lazy
sequence returned by byte-seq.
(import [java.io
On Thu, Jul 9, 2009 at 7:31 AM, Patrik Fredriksson wrote:
>
> My shot at a Clojure implementation, with inspiration from a previous
> post in this group on a similar problem:
>
> (ns step3.pnehm.clojure-orderer
> (:gen-class
> :name step3.pnehm.ClojureOrderer
> :implements [pnehm.Orderer]
>
Name: Jazz
URL: http://kotka.de/projects/clojure/jazz.html
Author: Meikel Brandmeyer
Categories: GUI
License: MIT
Dependencies: c.c.def, c.c.except, c.c.swing-utils, JGoodies Forms
Description:
Jazz eases the creation of GUI forms by virtue of the JGoodies
Forms library. One specifies the desired
> To be safe one often retains a
> stub compiler for some subset of the language written in another
> language, and then implements the rest of the language in the stub
> version.
This makes a lot of sense. So basically, a subset of Clojure could be
ported to whatever language you'd want to targe
On Jul 9, 2009, at 10:07 AM, Paul Mooser wrote:
>
> Since clojure is a compiled language, and is going to just end up
> generating java bytecodes, I wouldn't expect it to be particularly
> slower if it was written in itself. Maybe that's naive ?
It's not naive. This is called self-hosting and
Since clojure is a compiled language, and is going to just end up
generating java bytecodes, I wouldn't expect it to be particularly
slower if it was written in itself. Maybe that's naive ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed t
Excellent. This will be a lifesaver—thanks a lot.
On Jul 9, 8:21 am, Chouser wrote:
> On Jul 8, 11:53 pm, samppi wrote:
>
> > In clojure.contrib.def, I'd love to have a defmemo macro that acts
> > just like defn, only with memoize. I'm planning to change a lot of
> > functions to use memoize, a
On Jul 8, 11:53 pm, samppi wrote:
> In clojure.contrib.def, I'd love to have a defmemo macro that acts
> just like defn, only with memoize. I'm planning to change a lot of
> functions to use memoize, and I'm not looking forward to changing
> nice, clean defns with docstrings to (def {:doc docstri
Name: com.konato.ode
URL: http://www.konato.com/2009/07/08/com-konato-ode/
Author: Stephane Rousseau
Categories: Scientific computing, Simulation, ODE
License: EPL
Dependencies: clojure.contrib.test-is for unit testing
Description: This is an ordinary differentials equation
Okay, since you DO call the Clojure code from Java, I like what you
did very much.
If you're running "edge" Clojure, and not 1.0, I'd recommend writing
the tests in Clojure next, using the clojure.test namespace.
Sean
On Jul 9, 10:16 am, Patrik Fredriksson wrote:
> The idea is to gradually, ov
I just finished watching the Bay Area Clojure Meetup video, and Rich
spent a few minutes talking about the possibility of Clojure in
Clojure. The prospect of having Clojure self-hosted is incredibly
cool, but it brought a few questions to mind. For one, Rich mentions
that it would potentially open
Jonathan showed destructuring/indexing very nicely. Here are some
timings for vector/list creation:
(let [lst '(1 2 3)]
(timings 1e7
(list 1 2 3)
(cons 1 (cons 2 (cons 3 (
(conj (conj (conj () 3) 2) 1)
(vector 1 2 3)
(vec lst)
(conj (conj (conj [] 1) 2) 3)))
6590.
The idea is to gradually, over a few steps, move from a Java
implementation to a pure Clojure implementation. A this step the
Clojure implementation is called by the Java JUnit-test (see complete
test below). In the last step, the Java-references will be removed
from the Clojure implementation and
Rich, could this be a minor omission?
public class AReference implements IReference {
}
is not declared 'public abstract class' like ARef, AFn,
APersistentMap, and the others...
Cheers,
Jon
--~--~-~--~~~---~--~~
You received this message because you are subscribe
This is very cool. I will definitely be keeping a copy on my laptop as
a quick reference. Thanks for putting it together.
Travis
On Jul 8, 5:04 am, Steve Tayon wrote:
> Hello everyone,
>
> while looking around for a modern lisp, I discovered Clojure and was
> instantly infected by the new possi
I ran the code you pasted here. It didn't throw an IOException for me.
I am running 1.0.
On Jul 9, 5:10 am, Mike wrote:
> I wanted to grab bytes out of a stream, and didn't see an analogue to
> reader from duck-streams, so I made my own:
>
> (defn byte-seq
> "Returns the bytes from stream as
Hi Mike,
On Thu, Jul 9, 2009 at 12:10 PM, Mike wrote:
>
> I wanted to grab bytes out of a stream, and didn't see an analogue to
> reader from duck-streams, so I made my own:
>
> (defn byte-seq
> "Returns the bytes from stream as a lazy sequence of ints.
> stream must implement java.io.InputStre
One question on design intent before feedback. Is your intent to have
this Clojure code called by Java code later?
On Jul 9, 7:31 am, Patrik Fredriksson wrote:
> Hi!
>
> I started to look closer at Clojure after Rich Hickey's presentation
> at QCon London in March, this is my first post. I spe
On Thu, Jul 9, 2009 at 12:10, Mike wrote:
>
> I wanted to grab bytes out of a stream, and didn't see an analogue to
> reader from duck-streams, so I made my own:
>
> (defn byte-seq
> "Returns the bytes from stream as a lazy sequence of ints.
> stream must implement java.io.InputStream."
> [#^ja
I wanted to grab bytes out of a stream, and didn't see an analogue to
reader from duck-streams, so I made my own:
(defn byte-seq
"Returns the bytes from stream as a lazy sequence of ints.
stream must implement java.io.InputStream."
[#^java.io.InputStream stream]
(lazy-seq
(let [b (. s
No, same thing. If you go to clojure.wikispaces.com it redirects to
clojure.org, which is hosted at wikispaces.com.
On Wed, Jul 8, 2009 at 5:15 PM, Raoul Duke wrote:
>
> > It looks like anyone with Organizer rights on Clojure's wikispaces wiki
> > should be able to export an HTML or WikiText ba
Hi!
I started to look closer at Clojure after Rich Hickey's presentation
at QCon London in March, this is my first post. I spend my days
programming Java, but my journey as developer did actually start with
an ML programming course many years ago. It has been great fun to
re-discover the function
On Thu, Jul 9, 2009 at 1:56 AM, Mani wrote:
>
> Thanks Shawn, Robert.
> From Robert's post, I am bit confused here. I also read that .emacs is
> in %appdata% folder (vista), but all I see is .emacs.d folder (which I
> guess is for the emacs server). I tried creating one "C-x C-f
> ~/.emacs" - unde
On Jul 8, 12:47 pm, Meikel Brandmeyer wrote:
> Hi,
>
> I'd like to second the suggestion of Richard and Daniel (in
> the other thread): use a file.
>
> It solves almost all problems with immediate effect.
>
> Here is my workflow for your example. I added some
> annotations. (as a note: I use VimC
44 matches
Mail list logo