I recommend "The Little Schemer" and if you want to go further, "The
Seasoned Schemer".
On Jun 6, 7:12 am, Robert Campbell wrote:
> Going beyond the language-specific Programming Clojure book, what
> other books have best helped you make the (sometimes mind-bending)
> transition from OOP thinkin
Like other mentioned in the thread, Java has neither the >>> operator,
nor unsigned data types.
With that said, I think the function you are looking for is bit-shift-
right:
user> (bit-shift-right 2r1110 1)
7
I hope this helps.
Vincent.
On May 21, 9:39 pm, CuppoJava wrote:
> Hi everyone,
> I
Hello Julien,
I am in a similar situation to yours: I am writing a Clojure library
to parse Starcraft replay files, but my Clojure code is very far from
nearly equivalent Java code. Currently, on my home PC, parsing 1,050
files takes ~70 seconds with Clojure and about 12 with Java. The code
is
http://article.gmane.org/gmane.comp.version-control.git/117039
On Apr 29, 1:01 am, Dan wrote:
> On Tue, Apr 28, 2009 at 4:36 PM, Rayne wrote:
>
> > Git still sucks on windows :\
>
> On which grounds?
>
> Or as wikipedia would put it [citation needed]
--~--~-~--~~~---
For a 1.0 release, I think that having a number that we can point at
and say "this software will work with that version of the language" is
important. I think a little bit of polish wouldn't be bad either: I
saw that Scala ships with bash and batch scripts to launch scala and
scalac. I think hav
That's more likely a bug in the documentation that in the compare
function.
On Apr 11, 4:09 pm, fft1976 wrote:
> user=> (doc compare)
> -
> clojure.core/compare
> ([x y])
> Comparator. Returns 0 if x equals y, -1 if x is logically 'less
> than' y, else 1. Same as Java
I'm in favor of auto concatenating multiple string literals at
compilation, but I am strongly opposed to doing any sort of formatting
with them. If you want a new line, you stick a \n in your first
string; if you want a space, you stick it in there as well. This:
"hello"
"world"
should tra
I have no experience with gradual typing, but I'd love to try it. It
seems there are many situations where dynamic typing just makes things
easier than in a language like Haskell, however I long for their
ability to verify correctness at compile time.
Vince
On Mar 29, 10:49 am, André Thieme wr
(int (~mask-fn (. buf# (~get-fn)
>
> to be extra safe.
>
> On Tue, Mar 31, 2009 at 10:00 PM, Vincent Foley wrote:
>
> > I tried it just now; it made no difference. Nevertheless, thank you
> > for you help and time!
>
> > On Mar 31, 9:38 pm, Davi
[get-fn mask-fn]
> `(fn [#^ByteBuffer buf# len#]
> (if (= len# 1)
> (~mask-fn (. buf# (~get-fn)))
> (let [#^"[I" arr# (int-array len#)]
> (dotimes [i# len#]
> (aset-int arr# i# (int (~mask-fn (. buf# (~get-fn))
> arr#
> (aset-int
> arr__2574__auto__
> i__2575__auto__
> (mask8 (. buf__2572__auto__ (get)
> arr__2574__auto__)))
>
> This is the expansion for (make-reader get mask8), where were you attempting
> putting the int coercion to to the mask-fn?
&g
e and there and looking at what happens.
On Mar 31, 10:46 am, Christophe Grand wrote:
> Did you try to coerce the result of (~mask-fn ...) with int?
> (or use aset-int as suggested by David)
>
> On Tue, Mar 31, 2009 at 4:17 PM, Vincent Foley wrote:
>
> > No, but in my defense I di
No, but in my defense I did not know such a function existed :) I'll
give it a whirl and report back!
On Mar 31, 9:57 am, David Nolen wrote:
> Did you try using aset-int instead of aset?
>
> On Tue, Mar 31, 2009 at 8:25 AM, Vincent Foley wrote:
>
> > For those intereste
in make-reader?
Thanks,
Vincent.
On Mar 19, 8:12 pm, Vincent Foley wrote:
> Hello,
>
> For the past few days, I've been trying, unsuccessfully, to make an
> application I wrote faster. A Java program that performs, more or
> less, the same task takes 12 seconds (on my machine
Grand wrote:
> Hi Vincent!
>
> Vincent Foley a écrit :
>
> > Using the new versions of null-string and read-field-aux that you gave
> > me, in my real application, the execution time went from 160 seconds
> > to 150 seconds. As for using macros, I wrote one for the examp
s use (apply parse-buffer buf field-vector).
Thanks for the assistance,
Vincent.
On Mar 22, 4:33 pm, Vincent Foley wrote:
> How would I do that? Make a macro that expands into a map literal
> with the appropriate calls to .get, .getShort and .getInt?
>
> On Mar 22, 4:20 pm, Christ
How would I do that? Make a macro that expands into a map literal
with the appropriate calls to .get, .getShort and .getInt?
On Mar 22, 4:20 pm, Christophe Grand wrote:
> Vincent Foley a écrit :> The code is available at this
> URL:http://code.google.com/p/bwhf/
> &g
arr i (f buf)))
> (vec arr)))
>
> closing over getters (rather than rebuilding it inside the closure)
> yielded nearly as much as going "lower level".
>
> With these two changes, it's the dispatch fn that now dominates.
>
> Vincent Foley a écr
Here: http://gist.github.com/82352
I have posted memory and cpu profiling figures.
On Mar 20, 6:56 am, Christophe Grand wrote:
> Hello Vincent,
>
> Vincent Foley a écrit :
>
> > Hello,
>
> > For the past few days, I've been trying, unsuccessfully, to make an
&g
Hello,
For the past few days, I've been trying, unsuccessfully, to make an
application I wrote faster. A Java program that performs, more or
less, the same task takes 12 seconds (on my machine) to parse 1000
files; my Clojure program takes nearly 3 minutes. This more than an
order of magnitude
102% cpu 2:41.10 total
Java:
% time java -server -cp . hu.belicza.andras.bwhf.control.BinRepParser
~/prog/clojure/clj-starcraft/misc/replays/*.rep
1047
java -server -cp . hu.belicza.andras.bwhf.control.BinRepParser
12.92s user 0.31s system 110% cpu 11.923 total
On Mar 16, 9:41 pm, Vincent Fo
Personal project at work, or part of something bigger?
On Mar 16, 9:27 pm, Jeffrey Straszheim
wrote:
> Only to do a tiny little test w/ not-deployed code. But still: I am a
> professional Clojure developer now :)
> (Please don't kill my dream.)
--~--~-~--~~~---~--~--
it fixed a lot of performance issue over 5.
>
> On Mon, Mar 16, 2009 at 9:22 PM, Vincent Foley wrote:
>
> > I found that the problem is caused by the version of Sun's JVM on
> > Ubunty Hardy Heron. On my Ibex machine at home, the first two lines
> > (Object.wait and
I found that the problem is caused by the version of Sun's JVM on
Ubunty Hardy Heron. On my Ibex machine at home, the first two lines
(Object.wait and ReferenceQueue.remove) are not even there and the
costliest method if AtomicInteger.get.
Vincent.
--~--~-~--~~~---~--
I was trying to make an application go faster today when I found out
that a Java program that does pretty much the same task was 8 times
faster. I used the -Xrunhprof:cpu=times profiling flag to know where
I should look, and the results are a little puzzling:
CPU TIME (ms) BEGIN (total = 3334005
A few months, Rich mentioned Qi's type system on the IRC channel
(http://clojure-log.n01se.net/date/2008-12-11.html#10:25) and how it
could be applicable in Clojure. From what I gathered from the tweets
from Qcon, Qi was mentioned again there. Does anyone know if there
was anything more to it th
With Clojure you don't need to understand Monads. And I don't think
they're hard to understand, I think they're hard to come to grips with
because of what they are capable of.
Anyway, I hope you enjoy Clojure :)
On Mar 10, 11:30 am, zoltar wrote:
> Thanks everyone! That gives me a lot more con
Here's my feeling on it (note that I am talking about languages from
the C family, not Haskell or ML).
1. Like Jason Wolfe said, the interactive REPL means that you can
manually test a function as soon as you're done writing it, so it's
easy to get feedback and know if something breaks.
2. The w
I'm definitely interested. There is Fact that does this already as
well as ClojureCheck (http://bitbucket.org/kotarak/clojurecheck/
overview/). I think you should try to contact James and Meikel and
see if it would be a good idea to join forces. I don't mind multiple
libraries that do the same
I'm opposed to this idea. I don't think we should pander to the
masses by creating a schism between new and experienced users. New
users should be introduced to the real thing immediately and it is up
to the tutorials and community to help them overcome the fear/
puzzlement of parentheses. Like
Stuart is gonna love you guys ;)
On Feb 23, 2:59 pm, Chouser wrote:
> On Mon, Feb 23, 2009 at 2:33 PM, Stephen C. Gilardi wrote:
>
>
>
>
>
> > At that point, it seems only a small step to remove "require" entirely which
> > I think would be a long-term plus--coalescing two very similar things
>
You would not be able to distinguish between an empty collection and
pop returning a nil value.
On Feb 21, 4:28 pm, Frantisek Sodomka wrote:
> Hello!
> Currently, 'pop' throws an exception if the collection is empty:
>
> clojure.core/pop
> ([coll])
> For a list or queue, returns a new list/que
To me, the most incredible thing about Clojure is that this all
happened in about a year! Choosing to be hosted on an established
platform, though sometimes criticized by some people, was a very
effective way to get people to start writing useful programs quickly
with libraries they were used to.
I'm pretty sure that sorted-set works only with values that are
instances of a class that implements Comparable.
user=> (instance? Comparable [])
true
user=> (instance? Comparable {})
false
user=> (instance? Comparable ())
false
user=>
On Feb 20, 2:21 pm, Frantisek Sodomka wrote:
> sorted-set
Run ant
On Feb 19, 4:00 pm, samppi wrote:
> So I've downloaded the latest, lazier version of Clojure. But I'm
> having trouble; there used to be a clojure.jar file in the folder, and
> it's not there anymore. The distribution's readme.txt still says: "To
> Run java -cp clojure.jar clojure.lang.R
I've added a lcm function the clojure.contrib.math. I sent my CA form
to Rich this afternoon. Where should I submit the patch? (is it
possible to attach it using the Google groups interface?)
Vincent
--~--~-~--~~~---~--~~
You received this message because you ar
Hello Rich,
I'll play around with the lazy branch this week, and this is just a
name suggestion: what do you think of first/tail/rest where (rest s)
== (seq (tail s))? tail is already used in other functional languages
such as Haskell and OCaml to represent all-but-the-first elements, so
it woul
Sorry about the erroneous function, I think this is more likely what
you want:
(defn count-leaves [[left & right :as tree]]
(if (seq tree)
(+ (if (sequential? left)
(count-leaves left)
1)
(count-leaves right))
0))
user> (count-leaves [])
0
user> (count-leaves [
Oh duh, I didn't even implement the correct thing! Sorry :(
On Feb 15, 11:06 am, Vincent Foley wrote:
> I'm not sure if it's "Clojury", but this seems to work:
>
> (defn count-leaves [tree]
> (if (sequential? tree)
> (+ (count-leaves (first
I'm not sure if it's "Clojury", but this seems to work:
(defn count-leaves [tree]
(if (sequential? tree)
(+ (count-leaves (first tree))
(count-leaves (rest tree)))
(or tree 0)))
user> (count-leaves [1 2 3])
6
user> (count-leaves [1 [2] 3])
6
user> (count-leaves [])
0
On Feb 15,
Thanks Rich!
On Feb 13, 10:01 am, Rich Hickey wrote:
> On Feb 13, 9:06 am, Vincent Foley wrote:
>
> > Should I add this to the list of issues in the Google Code tracker?
>
> No. Those hints were suspect to begin with.
>
> .get returns a byte already, and .getShort
Should I add this to the list of issues in the Google Code tracker?
Vincent.
On Feb 12, 4:15 pm, Vincent Foley wrote:
> Hello,
>
> I was surprised today to see that my Starcraft replay program became
> slower when I updated my Clojure working copy. About a week ago,
> Chouser h
Dimiter,
The latest revision of Clojure is r1278; are you using the Google code
trunk?
Vincent
On Feb 12, 5:35 pm, "Dimiter \"malkia\" Stanev"
wrote:
> Hi guys,
>
> I'm optimizing a little benchmark called pnpoly, and I was wondering
> what is the proper way of hinting the compiler for types.
Hello,
I was surprised today to see that my Starcraft replay program became
slower when I updated my Clojure working copy. About a week ago,
Chouser helped me adding type hints to avoid reflection in my
functions. The warnings came back today.
I started going through the different revisions of
According to the GHC documentation [1]:
rem :: a -> a -> a
integer remainder, satisfying (x `quot` y)*y + (x `rem` y) == x
mod :: a -> a -> a
integer modulus, satisfying (x `div` y)*y + (x `mod` y) == x
div truncates toward negative infinity while quot (which is in
Clojure) truncates toward 0.
I don't know much about Java profiling, but I've been using java -
Xprof and java -Xrunhprof, and it's usually been enough to guide me.
On Feb 5, 10:47 pm, Sergio wrote:
> I have been trying out the YourKit profiler and I think it's great.
> However, my evaluation license is going to expire soon
Do you have slides for those of us who cannot attend?
On Feb 5, 12:33 pm, Stuart Sierra wrote:
> Hello, New York! If you're interested, I'm presenting at the New York
> Hadoop User Group [1] next Tuesday, February 10, at 6:30.
>
> I'll talk about using Clojure with Hadoop, among other things.
>
Hello everyone,
For the past few weeks, I've been having problems with my Internet
connection, losing my signal for hours sometimes and during that time,
I cannot program, because I don't have access to the Java API
documentation.
I looked on Sun's site, but I couldn't find a way to download it.
(-> person :employer :address :city) would be my pick
Vincent
On Jan 28, 4:02 pm, Mark Volkmann wrote:
> I have a map that describes a person.
> It has a key that describes their address.
> It also has a key for their employer.
> The employer has its own address.
>
> (def person {
> :name "Ma
repeat returns an infinite seq; replicate returns a finite one.
On Jan 27, 8:53 pm, Shawn Hoover wrote:
> Why do we have both repeat and replicate? I can sort of keep them straight,
> but as they only differ by arity I wonder if they can be combined... or if
> I'm missing a subtle reason for sep
ommon to want to find only one greatest/least element,
this would also quickly become an annoyance to users.
Any comments or thoughts?
Vincent.
On Jan 24, 6:57 pm, Vincent Foley wrote:
> I've worked on the library today, and imported it into a GitHub
> project:http://github.com/
It's the laziness; because the value of the call to map is never
consumed, it is never produced either, so the throw never happens.
On Jan 25, 1:05 am, Kei Suzuki wrote:
> Form3 makes me puzzled. Form1 and Form2 throw exception as expected.
> Why doesn't Form3?
>
> Form1: (do ((fn [] (throw (Exc
g addition to clojure-contrib?
Vincent.
On Jan 21, 11:09 pm, Vincent Foley wrote:
> A couple months ago, there was a discussion in this group about the
> functions max and min and making them work with data types other than
> numbers. I was toying around tonight, and I wrote the fo
when is like do with only the 'then' branch wrapped in a do:
(if foo
(do
(println "hi")
42)))
is the same as
(when foo
(println "hi")
42)
And like if without an else branch, when returns nil if its predicate
yields false.
On Jan 24, 9:33 am, wubbie wrote:
> Here is code from co
The return value of a function is the return value of its last
expression.
On Jan 23, 3:17 pm, wubbie wrote:
> Is every function supposed to return something?
> Of course, except for pure side-effects.
>
> -sun
>
> On Jan 23, 3:02 pm, Vincent Foley wrote:
>
> > T
The only two false values in Clojure are false and nil. Everything
else is logically true. If your function returns nil/false or a
result, you don't need (not (nil? (...)))
On Jan 23, 2:59 pm, BerlinBrown wrote:
> Here is some code, my question relates to '(not (nil?...':
>
> (if (not (nil? (
A couple months ago, there was a discussion in this group about the
functions max and min and making them work with data types other than
numbers. I was toying around tonight, and I wrote the following
functions.
(defn- boundary
[compare-fn f & args]
(reduce (fn [a b] (if (compare-fn (compar
(do (println eos) eos)
x))
#'user/s
user=> (seq s)
(0 1 2 3 #
4)
Vincent
On Jan 21, 7:59 pm, Rich Hickey wrote:
> On Jan 21, 7:40 pm, Vincent Foley wrote:
>
> > I have a question regarding the examples, specifically map* and
> > filter*
>
&g
I have a question regarding the examples, specifically map* and
filter*
(defn map* [f coll]
(let [iter (stream-iter coll)]
(stream
(fn [eos]
(let [x (next! iter eos)]
(if (= eos x) x (f x)))
(take 4 (map* inc (filter* even? (range 100
-> (1 3 5 7)
How is e
When you're using fn as a parameter name, you are shadowing the fn
special form. Like Mark Volkmann said, it is best that you refrain
from using special form names and core macros and functions names to
name your own things. f is the prefered notation to name a function
passed to another functio
By default Return is bound to the command newline which does not
indent. If you press the Tab key, you'll be placed at the correct
indentation spot. To make this automatic, you need to rebind Return
to newline-and-indent:
(global-set-key (kbd "C-m") 'newline-and-indent)
Hope this helps.
Vince
Well, I've gone ahead and finally bought it. Here I thought I would
have time to read a fiction novel or something :)
On Jan 13, 12:02 pm, Stuart Halloway
wrote:
> http://blog.thinkrelevance.com/2009/1/13/programming-clojure-beta-5-i...
>
> Cheers,
> Stu
--~--~-~--~~~---
As this is a commercial project, I imagine you are quite limited in
what you can tell us, but I'd love to hear about the issues you faced
during development.
On Jan 13, 10:38 am, Luc Prefontaine
wrote:
> Hi everyone,
>
> as of yesterday pm, Clojure is running in a live system in a big
> veterina
If you have a blog, you may certainly write about your experience, the
difficulties you encountered learning the language, etc. This can
provide valuable help to other new users as well as give an indication
of what the documentation should cover.
On Jan 12, 4:21 am, HB wrote:
> Hey,
> I would
I suppose then that we would also need div. Using GHCi here:
Prelude> (-3) `div` 2
-2
Prelude> (-3) `quot` 2
-1
On Dec 22, 7:04 am, "Mark Engelberg" wrote:
> Anyone know why there is no modulo or mod function in Clojure's core?
> I know there is a rem function, but that's not the same thing.
It was mentioned in the IRC channel on 30-Nov-2008 by arohner that
java.lang.Math/abs did not work for ratios and bignums. Here is a
simple patch to add an abs function into Clojure.
http://groups.google.com/group/clojure/web/abs.patch
--~--~-~--~~~---~--~~
You re
I can agree with the multiple-exceptions-in-one-catch, however I don't
think the syntax should be so liberal. It should all be (catch
[Exception+] e body).
On Nov 28, 1:19 am, "Vijay Lakshminarayanan" <[EMAIL PROTECTED]>
wrote:
> Hi
>
> I'd like to propose a change to Clojure's current try-catch
I was toying around with agents today, and I got a weird behavior:
agents hang clojure.lang.Script. Here's a simple demo script; if you
run this script, it'll print the vector and the program will be
hung.
(let [a (agent [])]
(doseq [i (range 10)]
(send-off a conj i))
(await a)
(printl
As somebody who did only a few hours of Java, but knows object
oriented programming well and had its fair share of fun with Common
Lisp, Scheme and Haskell, Clojure was quite easy to pick up. For all
pure Clojure stuff, I don't think that you need to know anything about
Java. When you work with
de", mais peut-être ces ajouts ont-
> ils déjà été faits ?
>
> Peux-tu reposter (ou m'envoyer en direct, à ta convenance) la dernière
> version en ta possession ?
>
> --
> Laurent
>
> On Nov 21, 11:19 pm, Vincent Foley <[EMAIL PROTECTED]> wrote:
>
>
Salut JF,
Merci pour tes commentaires. Je suis d'accord que l'exercice est
quelque peu futile: l'anglais est la langue officielle de
l'informatique et les traductions en français me font frémir. Je ne
crois pas qu'une personne puisse devenir un programmeur sérieux sans
être à l'aise en anglais.
Sorry about the line endings, Google groups seems to have truncated
them to a width shorter than Vim.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojure@googl
Hello everyone,
I don't know if there are French speakers lurking on this group, but
I'd really appreciate if somebody could make sure that my translation
of the Clojure rationale is accurate and typo-free.
Clojure
===
Clients et investisseurs ont des investissements substantiels dans les
p
I am writing a small Clojure tutorial which tries to explore different
facets of the language, while still producing a semi-useful program.
I posted the second part on my blog yesterday. Many thanks to Chouser
for proof-reading the document!
http://gnuvince.wordpress.com/2008/11/18/fetching-web-
+1 for projecture
Vincent
--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
They seem to work fine with me:
user=> 0xff
255
user=> (+ 0xff 45)
300
On Oct 5, 4:52 pm, "Jim Menard" <[EMAIL PROTECTED]> wrote:
> In the section on literals athttp://clojure.org/reader, it says,
> "Numbers - as per Java, plus ..."
>
> This implies to me that hex numbers like 0xff should be ac
Hello,
I was surprised to see that Clojure doesn't have an any? function. I
saw every?, not-every? and not-any? but no any?. Is there a reason
for this?
I wrote my own version, can anyone comment on it?
(defn any? [pred coll]
(loop [xs coll]
(if (nil? xs)
false
(if (pred (fi
77 matches
Mail list logo