Clean doesn't allow mutation, so it has to do tricks like this or else
you'd never be able to write a useful program.
Clojure gives you a set of data structures that do very fast
non-destructive update. Clojure also gives you tools like atoms,
refs, and full access to Java's mutable behavior to
On Jan 7, 7:14 pm, Brian Doyle brianpdo...@gmail.com wrote:
(defn write-bytes
Writes the bytes from the in-stream to the given filename.
[#^java.io.InputStream in-stream #^String filename]
(with-open [out-stream (new FileOutputStream filename)]
(let [buffer
Thanks for your help with this problem, Bill.
The function you provided causes slime-repl-set-package to suggest the
correct namespace, which is convenient. It doesn't appear to have any
effect on my problem though.
--~--~-~--~~~---~--~~
You received this message
A few days ago, Stuart Halloway and I had an offline discussion about
some of the gotchas related to Clojure's laziness. He encouraged me
to blog about my thoughts on the matter.
On a related note, about a month ago, I posted comments about
Clojure's laziness. Rich's response was:
The
I have just added a new module for handling (finite) probability
distributions to clojure-contrib. Some examples are included as well,
but for those who want to see the examples without downloading the
clojure-contrib source code, I also uploaded them to the files
section of this group:
Hey Conrad, this is great. The only suggestion I'd make is that often
times you want a probability distribution which is updatable over
time. This happens in online learning as well as Gibbs sampling where
you always only implicitly store the posterior b/c it's changing
constantly. So in my
Clojure gives you a set of data structures that do very fast
non-destructive update. Clojure also gives you tools like atoms,
refs, and full access to Java's mutable behavior to specify update in
place if that's what you want.
Yes, I can see that one could implement this oneself
via Java.
Hi Mark,
I don't think this approach works in Clojure / Swing, but I may be
mistaken, I often am.
The issue is the event thread. In Abhishek's original and it's derivatives
the Swing event thread is used and the timer pushes events into it so key
press events and the game timer run in the same
user= (load-file clj_record/core.clj)
I got clj_record/util not in system path. Why is it so?
Emeka
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send email to
On 08.01.2009, at 11:38, aria42 wrote:
Hey Conrad, this is great. The only suggestion I'd make is that often
times you want a probability distribution which is updatable over
time. This happens in online learning as well as Gibbs sampling where
Definitely. The current module for transforming
On Jan 8, 7:26 am, Konrad Hinsen konrad.hin...@laposte.net wrote:
On 08.01.2009, at 11:22, Mark Engelberg wrote:
So my blog post has a dual purpose. First, I explain the gotcha
that Stuart and I discussed. Second, I report back to the community
about the actual experience I had in the
The point, for me, is that Mark Engelberg's construct allowed the system to
work with no mutation and I don't think you can do it with Swing implemented
the way it is (your latest version puts the mutation in an atom).
Given that, and the problems with to threads accessing the Swing layer, I
On Thu, Jan 8, 2009 at 2:01 AM, Zak Wilson zak.wil...@gmail.com wrote:
Thanks for your help with this problem, Bill.
The function you provided causes slime-repl-set-package to suggest the
correct namespace, which is convenient. It doesn't appear to have any
effect on my problem though.
The
Do people want it now?
I would vote for 1.0 ahead of streams if adding streams now will delay
1.0.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send email to
On Thu, Jan 8, 2009 at 11:05 AM, Tom Ayerst tom.aye...@gmail.com wrote:
The point, for me, is that Mark Engelberg's construct allowed the system to
work with no mutation
I don't yet see how that is possible. The detection of key presses has
to happen in the Swing thread (by getting a call to
Mark, I thought your blog post was really, really good. I have
forwarded it to a lot of people; I hope you don't mind!
As far as caching goes:
I think, regardless of the theoretical considerations of = that
caching a lot of objects is ridiculous from a performance
perspective. Access to ram
On Thu, Jan 8, 2009 at 5:55 AM, Rich Hickey richhic...@gmail.com wrote:
The
promise of the abstraction is not merely that the nth item/rest will
be equal - it is that it will be identical. I.e. a seq is persistent
and immutable.
I get that Clojure is making a promise of identity here, which
On Jan 8, 2009, at 1:06 PM, Mark Engelberg wrote:
On Thu, Jan 8, 2009 at 5:55 AM, Rich Hickey richhic...@gmail.com
wrote:
The
promise of the abstraction is not merely that the nth item/rest will
be equal - it is that it will be identical. I.e. a seq is persistent
and immutable.
I get
On Jan 8, 5:05 pm, Brian Doyle brianpdo...@gmail.com wrote:
I incorporated most of James ideas but I don't like the name pipe-stream.
Then wouldn't copy-stream be better? write-stream isn't specific
enough, IMO.
Also, I don't think there's a huge amount of gain to be had from an
Integer type
On Thu, Jan 8, 2009 at 10:20 AM, Rich Hickey richhic...@gmail.com wrote:
On Thu, Jan 8, 2009 at 5:55 AM, Rich Hickey richhic...@gmail.com
I think the real test of non-cached seqs is to swap them in for
regular seqs, rebuild Clojure and some user libs and see what breaks
and why. Then you'll
A little time with the Clojure source and a debugger has been
illuminating.
In genclass.clj:gen-interface, the line:
(let [options-map (apply hash-map options)
results in this value for options-map:
{:methods [[(quote foo) [] []]], :name mypkg.ICompileTest}
It looks like (quote foo) is
There are two issues here that I'm seeing, first is that the list and
vector have different behavior, my understanding is that they are both
sequences and one should be able to perform the same operations on
them.
Second issue is that the behavior is inconsistent, if it is not
possible to sort
Hi all!
I encountered some corner cases where overflow checking for -
doesn't work as I would expect:
user= (- Integer/MAX_VALUE Integer/MIN_VALUE)
-1
user= (- Long/MAX_VALUE Long/MIN_VALUE)
-1
The problem seems to be that negating MIN_VALUE yields MIN_VALUE
again, so it slips through the
On Jan 8, 2009, at 1:55 PM, Dmitri wrote:
There are two issues here that I'm seeing, first is that the list and
vector have different behavior, my understanding is that they are both
sequences and one should be able to perform the same operations on
them.
I don't know more about the
Hi,
Am 08.01.2009 um 19:38 schrieb Greg Harman:
It looks like (quote foo) is being taken as the literal string name,
rather than evaluating to foo. And it happens that the hex ascii in
the generated method name translates to: [](quote foo).
Seems suspiciously like a macro-time vs fn-time
Hi again,
Am 08.01.2009 um 19:38 schrieb Greg Harman:
A little time with the Clojure source and a debugger has been
illuminating.
(gen-interface
:name clojure.example.IBar
:methods [[bar [] String]])
You find this example and further information on clojure.org.
Everything is fully up to date.
The test works. Setting the ns with (ns test) works, but if I use a
more complex ns form like (ns test (:use clojure.xml)), it fails to
set the ns.
As a workaround, (in-ns test) after the ns definition seems to work.
Unless there's some reason not to, I'll just
2009/1/8 Mark Volkmann r.mark.volkm...@gmail.com
On Thu, Jan 8, 2009 at 11:05 AM, Tom Ayerst tom.aye...@gmail.com wrote:
The point, for me, is that Mark Engelberg's construct allowed the system
to
work with no mutation
I don't yet see how that is possible.
We agree then.
...
Can
2009/1/8 Tom Ayerst tom.aye...@gmail.com
2009/1/8 Mark Volkmann r.mark.volkm...@gmail.com
while cleanly painting the board; the two thread
approach flickers terribly when the snake is short.
I could be wrong, but I don't think that flicker is related to my
choice of doing the painting
Lists are not comparable (i.e., you can't do something like ( '(1 2
3) '(4 5 6))). So you can't sort a collection of lists, but you can
sort a collection of vectors (provided the vectors contain comparable
things). This is always the case; there is no inconsistency.
The reason you are
I'd vote for increased priority to reaching 1.0 also because of
workplace constraints.
Kev
On Jan 9, 4:23 am, MikeM michael.messini...@invista.com wrote:
Do people want it now?
I would vote for 1.0 ahead of streams if adding streams now will delay
1.0.
I was playing around earlier while following Mark Engelberg's blog
post, and I found that to my surprise, when I exhaust the heap
(java.lang.OutOfMemoryError), it basically fails to pop up the window
that gives me the exception (where you can normally abort or throw the
cause), and the REPL
If streams are not a breaking change, my vote is to ship 1.0 and then
add them.
Stuart
I've been holding off on integrating this as it is a fairly
substantial change (under the hood, no change at all for consumers),
introduces a new abstraction (though no impact until you use it), and
On Thu, Jan 8, 2009 at 11:57 AM, Zak Wilson zak.wil...@gmail.com wrote:
Everything is fully up to date.
The test works. Setting the ns with (ns test) works, but if I use a
more complex ns form like (ns test (:use clojure.xml)), it fails to
set the ns.
As a workaround, (in-ns test) after
I think the main issue is that sort should behave consistently.
Possibly sort could check if the elements implement Comparable before
attempting to sort them? I also don't see a reason as to why the lists
shouldn't implement Comparable.
On Jan 8, 4:17 pm, Mark Engelberg mark.engelb...@gmail.com
On Fri, Jan 9, 2009 at 7:55 AM, Tom Ayerst tom.aye...@gmail.com wrote:
2009/1/8 Mark Volkmann r.mark.volkm...@gmail.com
On Thu, Jan 8, 2009 at 11:05 AM, Tom Ayerst tom.aye...@gmail.com wrote:
The point, for me, is that Mark Engelberg's construct allowed the system
to
work with no
Hi all,
A little while ago I released clj-backtrace, a library that produces
more readable backtraces for Clojure programs. I originally conceived
of the library as just a better (.printStackTrace *e) for use at the
REPL, but I've since found some other neat uses. I'd just like to
share some
Mark McGranaghan mmcgr...@gmail.com writes:
I'd also be happy to answer any questions you have about using the
library and to hear any general comments.
This looks great! I love the way they're aligned.
Have you looked at the way Rubinius (a smalltalk-style Ruby VM) prints
backtraces? It's
Hello,
There is a difference in using (require) on a namespace if it was
compiled via (compile) or if it uses plain clj source files.
The difference appears if in the source file, you have for example top
level (println) commands.
If you (require) the namespace from compiled classes, you will
Hello,
It seems that (compile) generates .class files as expected, and also
loads the lib in the environment as well.
Is it a (apparently undocument) feature ? Or a bug ?
And also, it seems that (compile) does not load the lib from the
compiled classes, but from the source files.
I guess that,
Hi all,
I can use file-seq
(file-seq (File. .))
But how can I filter out all files ending with .clj?
Do we use re-find, re-seq etc?
thanks
sun
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post
Here's one of many ways to do this:
(filter #(.endsWith (.getName %1) .clj ) (file-seq (java.io.File. .)))
On Thu, Jan 8, 2009 at 5:48 PM, wubbie sunj...@gmail.com wrote:
Hi all,
I can use file-seq
(file-seq (File. .))
But how can I filter out all files ending with .clj?
Do we use
On Jan 9, 12:48 am, wubbie sunj...@gmail.com wrote:
I can use file-seq
(file-seq (File. .))
But how can I filter out all files ending with .clj?
Do we use re-find, re-seq etc?
You can just use filter:
(filter
#(.endsWith (str %) .clj)
(file-seq (File. .)))
- James
Hi!
(filter #(re-find #.clj$ %) … )
see http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html
(Boundary matchers)
Kind regards,
achim
On 9 Jan., 02:39, wubbie sunj...@gmail.com wrote:
thanks,
Is there anyway to specify regular expression, instead of startsWith/
endsWith?
On 9 Jan., 03:03, Achim Passen achim.pas...@gmail.com wrote:
(filter #(re-find #.clj$ %) … )
correction:
(filter #(re-find #\.clj$ %) … )
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post
I tried
(filter #(re-find #\.clj$ %) (seq (file-seq(java.io.File. .
- java.lang.ClassCastException: java.io.File cannot be cast to
java.lang.CharSequence (NO_SOURCE_FILE:0)
On Jan 8, 9:06 pm, Achim Passen achim.pas...@gmail.com wrote:
On 9 Jan., 03:03, Achim Passen achim.pas...@gmail.com
thank, it was str as usual.
On Jan 8, 9:22 pm, Brian Doyle brianpdo...@gmail.com wrote:
This works:
(filter #(re-find #\.clj$ (str %)) (file-seq(java.io.File. .)))
On Thu, Jan 8, 2009 at 7:16 PM, wubbie sunj...@gmail.com wrote:
I tried
(filter #(re-find #\.clj$ %) (seq
Phil,
Indeed, clj-backtrace was largely inspired by Rubinius' Awsome
Backtrace feature.
I've implemented and pushed to GitHub an experimental implementation
of colorized backtraces for the REPL:
In addition to the usual (pst) to pretty-print the last exception, you
can now (pst+) to
Hi Mark F,
Thanks for your responses.
1. Data: Is this really a problem that is slowing down Clojure
programs in practice? Can you provide some data to that effect? I
would suggest writing a couple of Java benchmarks - one that updates a
simple structure in place and one that only creates
I don't understand how to use it, can you post an example?
I have tried everything and have gotten it to work under circumstances
I'm not sure of. However it doesn't work now.
(ns progs.netflix.parsing
(:require (progs.netflix [pg :as pg]))
(:import (java.sql Date)))
(load-file
Oh, I mentioned this in my blog post, but perhaps it bears repating.
If cycle, repeat, and replicate were implemented behind-the-scenes
with LazySeq as opposed to LazyCons, they would still implement the
promise of identical elements for separate traversals, but would be
more efficient. Also,
On 9 jan, 07:54, lpetit laurent.pe...@gmail.com wrote:
On 9 jan, 04:03, Stuart Sierra the.stuart.sie...@gmail.com wrote:
Later on, if I call (load) (from a fresh clojure environment) from the
compiled classes, the top level (println)s are not executed, since not
compiled.
Yes, that's
On Thu, Jan 8, 2009 at 11:38 PM, Dmitri dmitri.sotni...@gmail.com wrote:
I think the main issue is that sort should behave consistently.
Possibly sort could check if the elements implement Comparable before
attempting to sort them?
I also don't see a reason as to why the lists
shouldn't
On Thu, Jan 8, 2009 at 11:20 PM, Christian Vest Hansen
karmazi...@gmail.com wrote:
Comparable implies that an Object can be reduced to a scalar value, if
only for the purpose of comparing. How do you imagine this should work
on list of arbitrary things?
Lexicographic ordering. Compare the
54 matches
Mail list logo