|
; | (do (atom 42) nil) | 72.237439 | 3.16 | 100.0 |
On Thursday, September 11, 2014 11:06:44 AM UTC+2, Frantisek Sodomka wrote:
>
> Using my timings macro:
> https://gist.github.com/fsodomka/5890711
>
> I am getting that:
> - creation & derefing is 60% faster
>
Using my timings macro:
https://gist.github.com/fsodomka/5890711
I am getting that:
- creation & derefing is 60% faster
- swapping is 25% faster
- resetting is about the same
;; volatile vs. atom ;;
(report
(timings 1e7
(deref (volatile! 42))
(deref (atom 42
; |
Hello,
I posted a question about volatiles on the github commit:
https://github.com/clojure/clojure/commit/60440977823752f13a3fec3637538e9a1d68c5d4
I don't know if anybody noticed, so... why is volatile created with
function "volatile!" and not "volatile" ? Atoms, refs and agents don't have
excl
Hello,
this gist does the similar thing:
https://gist.github.com/jaked/6084411
Maybe you can find some inspiration in it.
Frantisek
On Thursday, September 5, 2013 11:23:28 PM UTC+2, Islon Scherer wrote:
>
> Hey guys,
>
> I don't know about you but when I was a beginner in Clojure (and it still
For my own needs, I wrote a macro 'timings' - see Timing expressions and
comparing results:
https://groups.google.com/d/msg/clojure/o8pOLc6uxQQ/bui7sJ-F5_wJ
Code and examples are here:
https://gist.github.com/fsodomka/5890711
Your examples on my machine with Clojure 1.5.1:
(report
(let [x 2 y [
Hi all,
If you need to compare running times of different expressions, you could
use 'timings' macro:
https://gist.github.com/fsodomka/5890711
It takes the number of runs and expressions to time. For example:
user=> (timings 1e7 (+ 1 2 3 4) (+ 1 (+ 2 (+ 3 4
[{:time 55.028223, :expr (+ 1 2 3
I am just curious, not requesting this feature :-)
How to represent negation in BNF?
http://stackoverflow.com/questions/10922352/how-to-represent-negation-in-bnf
http://pythonhosted.org/modgrammar/libref.html
modgrammar.EXCEPT(grammar, exc_grammar, **kwargs)
Match grammar, but only if it does
t;
On Monday, June 10, 2013 11:26:13 AM UTC+2, puzzler wrote:
>
> On Mon, Jun 10, 2013 at 2:13 AM, Frantisek Sodomka
>
> > wrote:
>
>>
>
> EBNF syntax for bounded repetition could be just simply A 3*5 and these
>> are equal:
>> A? is A*1
>> A+ is
EBNF syntax for bounded repetition could be just simply A 3*5 and these are
equal:
A? is A*1
A+ is A1*
A* is A0*
Frantisek
On Monday, June 10, 2013 11:04:52 AM UTC+2, Frantisek Sodomka wrote:
>
> Hello Mark,
> I have few suggestions:
>
> 1. I was going through the tutorial and
Hello Mark,
I have few suggestions:
1. I was going through the tutorial and comparing EBNF and ABNF grammars.
ABNF adds Bounded Repetition 3*5 A. Is there any chance of adding it also
to EBNF? I don't know, how the syntax would be, but it can be useful at
times.
Repetition of characters can be
Thank you for the fix, now it works without the problem.
It's fun to write grammars with Instaparse :-)
On Friday, June 7, 2013 1:29:32 AM UTC+2, puzzler wrote:
>
> On Thu, Jun 6, 2013 at 4:27 PM, Mark Engelberg
>
> > wrote:
>
>> Short answer: This is fixed in 1.2.0-SNAPSHOT.
>>
>
> To be clea
Hi all,
I am trying new parsing library Instaparse. I setup a Leiningen project,
included [instaparse "1.1.0"] as my dependency and tried to run it.
Unfortunately, I am getting this error:
Exception in thread "main" java.lang.NoClassDefFoundError:
instaparse/print$parser__GT_str (wrong name:
insta
Hello David,
thanks for your work. It is very interesting addition.
One thing that came to my mind, is a language Mercury:
http://en.wikipedia.org/wiki/Mercury_(programming_language)
http://www.mercury.csse.unimelb.edu.au/
"Mercury is a new logic/functional programming language, which combines th
PS: Read tips on:
http://clojure.org/java_interop
On Jul 15, 1:51 pm, Dragan wrote:
> Hi,
>
> I am trying to compare the performance of java loops to clojure reduce
> function. Noting special, Since I am just learning.
> Java code is something like:
>
> [code]
> long sum = 0;
> for (int i = 1;
If you make it into a function and use type hints, that should help:
(defn sum [n]
(let [n (int n)]
(loop [ret (long 0) i (int 1)]
(if (< i n)
(recur (+ ret i) (inc i))
ret
user=> (time (reduce + (range 1 100)))
"Elapsed time: 116.959837 msecs"
4950
u
s, it looks that list creation is faster than vector creation.
Frantisek
On Jul 9, 12:17 am, John Harrop wrote:
> On Wed, Jul 8, 2009 at 4:57 PM, Frantisek Sodomka wrote:
>
> > So far it seems that vectors win in Clojure:
>
> > (timings 3e5
> > (let [v (vector 1 2 3) a
So far it seems that vectors win in Clojure:
(timings 3e5
(let [v (vector 1 2 3) a (nth v 0) b (nth v 1) c (nth v 2)] (+ a b
c))
(let [lst (list 1 2 3) a (nth lst 0) b (nth lst 1) c (nth lst 2)] (+
a b c)))
=>
680.63 ms 83.6% 1.2x (let [v (vector 1 2 3) a (nth v 0) b (nth
v 1) c (nth
(first
r1) r2 (rest r1) z (first r2)] [x y z])
Frantisek
On Jul 8, 9:53 am, John Harrop wrote:
> On Wed, Jul 8, 2009 at 3:42 AM, Frantisek Sodomka wrote:
>
>
>
> > If result is a vector v, then from these 4 cases:
> > (let [v [1 2 3]]
> > (let [[a b c] v] a b c)
> &g
If result is a vector v, then from these 4 cases:
(let [v [1 2 3]]
(let [[a b c] v] a b c)
(let [a (v 0) b (v 1) c (v 2)] a b c)
(let [a (nth v 0) b (nth v 1) c (nth v 2)] a b c)
(let [x (first v) r1 (rest v) y (first r1) r2 (rest r1) z (first
r2)] x y z))
using 'nth'
(let [a (nth v 0) b
There was regression in Clojure SVN r1370. Test for 'binding' is in:
http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/test_clojure/vars.clj
I can reproduce it with r1370.
Frantisek
On Jun 16, 8:08 pm, Stuart Halloway wrote:
> This surprised me. What part of my m
Hello all!
After reading this article:
Clojure performance tips
http://gnuvince.wordpress.com/2009/05/11/clojure-performance-tips/
I wrote a macro to better compare different timings of functions and
expressions:
(defmacro time-ms [n expr]
`(let [start# (. System (nanoTime))]
(dotimes [i#
Hello Richard,
any contributions to test_clojure are very welcome!
As a general rule to contribute, you need to fill-in and mail the CA:
http://clojure.org/contributing
When Rich receives your CA and updates the clojure.org website, you
can start creating issues in clojure-contrib and attaching
, "Stephen C. Gilardi" wrote:
> Hi Frantisek!
>
> On May 25, 2009, at 7:11 AM, Frantisek Sodomka wrote:
>
> > (def a)
> > (deftest test-binding
> > (are (= _1 _2)
> > (binding [a 4] a) 4 ; regression in Clojure SVN r1370
> > ))
>
>
Hello Steve!
When I write a test for binding for this case (using deftest) and run
test_clojure, it doesn't error out. I wonder why is that?
(def a)
(deftest test-binding
(are (= _1 _2)
(binding [a 4] a) 4 ; regression in Clojure SVN r1370
))
Frantisek
PS: Rich, have you seen my
Sorry, forgot to mention: Found when testing Clojure 1.0.0.
Frantisek
--~--~-~--~~~---~--~~
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
It looks that there is a bug in int-array, long-array, float-array and
double-array when creating an array using an empty sequence.
Doc:
clojure.core/int-array
([size-or-seq] [size init-val-or-seq])
Creates an array of ints
This works:
user=> (int-array 0)
#
user=> (vec (int-array 0))
[]
user=
Hello!
Yes, you are right, "sorted-set-by" is missing. Good news is - it is
on the way :-)
See issue 76:
http://code.google.com/p/clojure/issues/detail?id=76
Frantisek
On Mar 24, 5:35 am, hjlee wrote:
> Hi, all.
> I don't know why my previous posts ignored.
> spam filtering? so i changed titl
Hello Rich & everybody!
clojure.set/union currently accepts 'nil' as a valid argument:
(union nil) => nil
(union nil nil) => nil
(union nil #{1 2}) => #{1 2}
(union #{1 2} nil) => #{1 2}
(union #{} nil) => #{}
(union nil #{}) => nil ; not consistent
Possible solution would be to ban 'nil
On Mar 19, 12:58 pm, Jason Sankey wrote:
> Also, is there somewhere I can contribute test cases for this to
> prevent a future regression?
Tests for clojure.zip can from now on go to test-clojure.clojure-zip:
http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/test_c
On Mar 19, 11:37 pm, Jason Sankey wrote:
> I pretty much have it working for the test-clojure suite now, although
> I'm sure the code could use review by a more experienced eye. I've been
> looking at adding the other two top-level suites (test-contrib and
> datalog) too, but their test clojure
On Mar 19, 11:08 pm, Stuart Sierra
wrote:
> Hi Frantisek!
>
> I can see where this is useful, and the only reason I haven't
> implemented something like it for a test-is already is that I don't
> expect it would be very commonly used outside of the very specific
> case of testing the language its
Hello Stuart & all!
As discussed in this thread:
test-is: generating and processing testing data
http://groups.google.com/group/clojure/browse_frm/thread/3e84efefd7c0bebc/3652a4a9a124cc6b
, sometimes it is necessary to test each value against each value. Example
is zeros-are-equal (as you suggest
Test-clojure is updated and ready for new tests :-)
Frantisek
On Mar 17, 5:03 am, Phil Hagelberg wrote:
> OK, so I've posted a fair amount of "smack talk" about test suites and
> how important they are--I figure it's time to help out.
>
> What are some ways in which test-clojure is lacking? Ho
On Mar 19, 12:58 pm, Jason Sankey wrote:
> Also, is there somewhere I can contribute test cases for this to
> prevent a future regression?
In order to contribute, you must fill-in and send The Contributor
Agreement (CA) to Rich Hickey:
http://clojure.org/contributing
Tests for clojure.core are
Hello Rich & all!
I have question about the reader http://clojure.org/reader
Numbers say "as per Java". I found that e.g. "2." reads Java as double
and Clojure as int.
All these read as double in Java:
2. .1 +.0 -.0 +2. -2.
Clojure either sees them as ints or errors out. I am wondering abou
On Mar 16, 7:13 pm, Mark Engelberg wrote:
>
> > On Mon, Mar 16, 2009 at 3:54 PM, Frantisek Sodomka
> > wrote:
> > > (empty (seq [1 2])) => nil
>
> > Now that there is the concept of empty sequences, maybe this should
> > actually return an empty sequenc
Hello Phil,
I see that you have your CA in already:
http://clojure.org/contributing
so you can start with creating issues and posting patches for them:
http://code.google.com/p/clojure-contrib/issues/list
Then somebody from clojure-contrib members looks at it and eventually checks
it in. (Stephen
Hello Rich & all!
I am digging into behavior of function 'empty':
user=> (doc empty)
-
clojure.core/empty
([coll])
Returns an empty collection of the same category as coll, or nil
(empty [1 2]) => []
(empty (seq [1 2])) => nil
(empty '(1 2)) => ()
(empty (seq '(1 2)))
Latest SVN r1327 works ok:
user=> (mod 9 -3)
0
user=> (map #(mod % 3) (range -10 10))
(2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0 1 2 0)
Test-clojure runs ok too.
Frantisek
On Mar 12, 10:30 am, bOR_ wrote:
> Mod seems to have broken again
>
> (mod 9 -3) gives -3
>
> (map #(mod % 3) (range -10 10))
>
There is a problem with the latest Clojure SVN version. Try running in
clojure-contrib: ant test_clojure
It generates failures and errors. There is some confusion between
"nil" and "()" by the reader/compiler it seems.
Also:
user=> (pop '(1 2 3))
java.lang.ClassCastException: clo
Hmm, interesting error. After the merge of the lazy branch was
everything ok, so it has to be a recent change.
user=> (eval (list + 1 2 3))
java.lang.ExceptionInInitializerError (NO_SOURCE_FILE:0)
user=> (eval '(+ 1 2 3))
6
user=> (list + 1 2 3)
(# 1 2 3)
user=> '(+ 1 2 3)
(+ 1 2 3)
Frantisek
I get different error (running from REPL):
(test2 (+ 1 1)) => java.lang.ExceptionInInitializerError
(NO_SOURCE_FILE:0)
(test2 10) => java.lang.ExceptionInInitializerError (NO_SOURCE_FILE:0)
I think that it has to do with 'test1' in your macro. Function 'test1'
gets compiled into a Java class and
I see only 6 + 36 = 42
Frantisek
On Feb 24, 11:25 am, Marko wrote:
> Hi, just reporting an error on the following page:http://clojure.org/dynamic
>
> 6 + 7 should really be 13, and not 42.
--~--~-~--~~~---~--~~
You received this message because you are subscribed
Frantisek
On Feb 23, 12:12 am, "Stephen C. Gilardi" wrote:
> On Feb 22, 2009, at 5:41 PM, Frantisek Sodomka wrote:
>
> > There was a functionality in build.xml to run tests from the command
> > line. When you correctly set clojure.jar path, you could just do:
>
>
There was a functionality in build.xml to run tests from the command
line. When you correctly set clojure.jar path, you could just do:
ant test_clojure
to run test-clojure tests. There is also:
ant test_contrib
which still works. "ant test_clojure" is broken by this change. (bad?
ok? don't kno
Graphs has always inspired me and seeing implementation in Clojure
will be no less inspiring.
http://www.visualcomplexity.com/vc/
http://planarity.net/
Frantisek
On 22 Ún, 16:11, Jeffrey Straszheim
wrote:
> Just as a point of fact, I don't plan to make a complete *every algorithm
> you can thi
Any thoughts on this one?
Impatient Frantisek :-)
On 21 Ún, 22:28, 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/queue without the
please post anything that is
still broken.
Thank you, Frantisek
On 22 Ún, 16:07, Jeffrey Straszheim
wrote:
> Does zero arguments return #{} ?
>
> Has intersection changed?
>
> On Sun, Feb 22, 2009 at 5:16 AM, Frantisek Sodomka wrote:
>
>
>
> > Hello! Just a quick note:
79a738cbe7f41e9
Frantisek
On 22 Ún, 02:37, Chouser wrote:
> On Sat, Feb 21, 2009 at 1:34 PM, Frantisek Sodomka wrote:
>
> > nth claims to also work on regex Matchers:
>
> > user=> (doc nth)
> > -
> > clojure.core/nth
> > ([coll index] [c
Hello! Just a quick note:
Issue 52: Make set/union accept any number of arguments
http://code.google.com/p/clojure/issues/detail?id=52
seems to be solved already by:
SVN 1276
http://code.google.com/p/clojure/source/detail?r=1276
added multi-arg clojure.set/union/difference/intersection, patch fr
+1 on that!
Graphs are common and many people are going to write similar
algorithms to yours. Also, as a library, it is going to have nice
interface (than if put together with Datalog) and will be much easier
to reuse.
Frantisek
PS: Graphs are my favorite data structure, so I am lobbying for
th
You can read:
http://clojure.org/data_structures
http://clojure.org/sequences
and:
http://en.wikibooks.org/wiki/Clojure_Programming
Frantisek
On 21 Ún, 22:24, linh wrote:
> where can i find information about clojure's data-structure class
> hierarchy? i would like to know how seq, map, list, v
Hello!
Currently, 'pop' throws an exception if the collection is empty:
clojure.core/pop
([coll])
For a list or queue, returns a new list/queue without the first
item, for a vector, returns a new vector without the last item. If
the collection is empty, throws an exception. Note - not the
nth claims to also work on regex Matchers:
user=> (doc nth)
-
clojure.core/nth
([coll index] [coll index not-found])
Returns the value at the index. get returns nil if index out of
bounds, nth throws an exception unless not-found is supplied. nth
also works for stri
For example, lazy-cons is still present in:
combinatorics.clj
lazy_xml/with_pull.clj
monads/examples.clj
Frantisek
On 21 Ún, 15:54, James Reeves wrote:
> On Feb 21, 2:36 pm, bOR_ wrote:
>
> > Note that clojure just changed the lazy branch to be the main version
> > of clojure, so right now cl
es of the exact same
> object:
>
> user> (sorted-set '(1) '(1))
> ; Exception
>
> user> (let [x '(1)] (sorted-set x x))
> #{(1)}
>
> This is almost certainly not documented behavior and should not be
> relied upon.
>
> Cheers,
> Jason
>
> On F
nces 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 wor
sorted-set works for vectors, but doesn't work for lists, maps and
sets:
user=> (sorted-set [1 4])
#{[1 4]}
user=> (sorted-set [1 4] [1 4])
#{[1 4]}
user=> (sorted-set [4 1] [1 4])
#{[1 4] [4 1]}
user=> (sorted-set '(1 4))
#{(1 4)}
user=> (sorted-set '(1 4) '(1 4))
java.lang.ClassCastException: c
On Feb 18, 8:02 pm, Rich Hickey wrote:
> On Feb 18, 12:20 pm, Frantisek Sodomka wrote:
>
> > How should I say it... It just didn't look "symmetrical" to me.
>
> > So, basically, there is a difference between functions returning
> > sequences -
ted to really understand it.
Thanks, Frantisek
On Feb 18, 5:58 pm, Chouser wrote:
> On Wed, Feb 18, 2009 at 11:46 AM, Frantisek Sodomka
> wrote:
>
> > What about 'conj'? Documentation says:
> > (conj nil item) returns (item).
>
> > Currently:
> > user=
Or maybe:
&next
??? :-
Frantisek
On Feb 18, 5:27 pm, Rich Hickey wrote:
> On Feb 18, 11:04 am, Chouser wrote:
>
> > On Wed, Feb 18, 2009 at 12:35 AM, Rob wrote:
>
> > > I'm wondering if I found a bug. I have the latest source from svn
> > > (r1291).
>
> > > user=> (bean 1)
> > > java.l
Or maybe more general question: Is there any function in Clojure which
when returning empty sequence, returns nil instead of () ???
user=> (butlast [1 2 3])
(1 2)
user=> (butlast [1])
nil
user=> (butlast [])
nil
Thanks, Frantisek
On Feb 18, 5:46 pm, Frantisek Sodomka wrote:
>
What about 'conj'? Documentation says:
(conj nil item) returns (item).
Currently:
user=> (conj nil 1)
(1)
user=> (conj () 1)
(1)
Idiom "conj nil" is used in 'reverse': (reduce conj nil coll)
Currently:
user=> (reverse [1 2])
(2 1)
user=> (reverse [1])
(1)
user=> (reverse [])
nil
It looks that n
I believe it's already done.
Frantisek
On Feb 18, 12:39 pm, Mark Volkmann wrote:
> Now that next is recommended over rest, should nthrest be renamed to nthnext?
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
--~--~-~--~~~---~--~~
You received this message bec
There is something that confuses me:
user=> (cycle [])
()
user=> (= (cycle []) ())
true
user=> (= (cycle []) nil)
true
user=> (= () nil)
false
Thanks for answering, Frantisek
On Feb 18, 3:54 am, Rich Hickey wrote:
> On Feb 17, 4:16 pm, Frantisek Sodomka wrote:
>
Usual symbol:
'abc => abc
(symbol? 'abc) => true
(symbol "abc") => abc
(symbol? (symbol "abc")) => true
Special "symbol":
'nil => nil
(symbol? 'nil) => false
(symbol "nil") => nil
(symbol? (symbol "nil")) => true
(= 'nil (symbol "nil")) => false
(= 'nil nil) => true
We can see that (symbol "nil
That was fast! ;-)
Rich, I am porting test_clojure and old 'cycle' worked as:
(cycle []) => nil
Currently:
(cycle []) => java.lang.StackOverflowError
Frantisek
On Feb 17, 8:43 pm, Rich Hickey wrote:
> I've merged the lazy branch into trunk, SVN rev 1287
>
> Please do not rush to this version
It is making more sense now.
One other interesting thing that surprised me is: "There is not a
total ordering across types."
See discussion:
http://groups.google.com/group/clojure/browse_frm/thread/710848919c68981f/51ede18b2fd7ab96?lnk=gst&q=sorted-set#51ede18b2fd7ab96
Therefore things like (so
Similar is:
user=> #{[] ()}
#{[]}
user=> #{[] [1 2]}
#{[] [1 2]}
user=> (hash-set [] ())
#{[]}
Frantisek
On Feb 15, 12:38 am, Frantisek Sodomka wrote:
> Hello!
> Function 'set' looses some of its data. It seems that there is a
> problem with comparison between
Hello!
Function 'set' looses some of its data. It seems that there is a
problem with comparison between lists and vectors:
user=> (count [nil false true 0 42 0.0 3.14 2/3 0M 1M \c "" "abc"
'sym :kw () '(1 2) [] [1 2] {} {:a 1 :b 2} #{} #{1 2}])
23
user=> (set [nil false true 0 42 0.0 3.14 2/3 0M
My antivirus doesn't like the Gift from the Stranger:
http://groups.google.com/group/clojure/files?&sort=date
Not really nice of you, Stranger...
Frantisek
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure"
owse/trunk/src/clojure/contrib/test_clojure/numbers.clj
Frantisek
On Feb 12, 1:12 pm, Timothy Pratley wrote:
> On Feb 12, 10:47 pm, Frantisek Sodomka wrote:
>
> > Also, "mod" seems too strict about numbers it accepts (only
> > integers!):
>
> *chuckle* indeed, why be
Also, "mod" seems too strict about numbers it accepts (only
integers!):
user=> (rem 1 2/3)
1/3
user=> (mod 1 2/3)
java.lang.IllegalArgumentException: mod requires two integers
(NO_SOURCE_FILE:0)
user=> (rem 4.5 2.0)
0.5
user=> (mod 4.5 2.0)
java.lang.IllegalArgumentException: mod requires two in
Cells - A dataflow extension to CLOS
http://common-lisp.net/project/cells/
Some discussions on this list (ordered by date):
(discussed in) Clojure Poll 09/2008
http://groups.google.com/group/clojure/browse_frm/thread/549696530ccbd0d/24a9c4b795f86ee6?lnk=gst&q=CELLs#24a9c4b795f86ee6
(discussed i
See neman.cells:
http://clojure.org/libraries#toc61
I believe there is at least one more implementation somewhere.
Frantisek
On 9 Ún, 17:26, Jeffrey Straszheim
wrote:
> I know I could just go read the docs, but I hope someone familiar with this
> Cells stuff could save me some time:
> 1. Doe
While reading article "Challenged by Common Lispers":
http://kazimirmajorinc.blogspot.com/2009/01/challenged-by-common-lispers.html
I found in its comments interesting definition of 'memfn':
https://www.blogger.com/comment.g?blogID=5894839&postID=8563938547112716465
This is my version in Clojure
user=> (deftest test-if (is (thrown? Exception (if
java.lang.Exception: Too few arguments to if (NO_SOURCE_FILE:35)
user=> (deftest test-div (is (thrown? ArithmeticException (/ 1 0
#'user/test-div
Yes, looks like it. Compile-time and run-time exceptions - will have
to remember that ;-)
Hello Stuart and all!
There is something strange going on with (is (thrown? ...)) form:
user=> (use 'clojure.contrib.test-is)
nil
user=> (is (= 2 2))
true
; this works
user=> (/ 1 0)
java.lang.ArithmeticException: Divide by zero (NO_SOURCE_FILE:0)
user=> (is (thrown? ArithmeticException (/ 1 0))
Streams were also intended for I/O. Is lazier addition also able to
cope with I/O sucessfully?
Can we have both - streams and lazy-seq?
My thought about streams is that if they get included, they could be
looked at as unsafe operations in Java/C# or unchecked math operations
- as long as programm
user=> (- Integer/MAX_VALUE Integer/MIN_VALUE)
java.lang.ArithmeticException: integer overflow (NO_SOURCE_FILE:0)
user=> (- Long/MAX_VALUE Long/MIN_VALUE)
java.lang.ArithmeticException: integer overflow (NO_SOURCE_FILE:0)
Is this behavior correct?
Frantisek
On Jan 10, 5:25 am, Chouser wrote:
Patch for testing sequences attached! ;-)
Frantisek
--~--~-~--~~~---~--~~
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
Thank you for explanation. I will use "is" for tests with messages.
Otherwise, I am quite happy with "are" macro. It really helps with not
repeating myself.
I created 3 new issues and added 2 patches:
http://code.google.com/p/clojure-contrib/issues/list
Issue for sequences is to inform that I am
Oops, error. Sequence passed to 'are' cannot be evaluated => use
quoted list '( or quoted vector '[ ...
(are (= _1 _2)
'(3 (+ 1 2)
0 (+ -1 1)))
Hm... Since 'are' is basically creating bunch of 'is' tests, I wonder
how to also add a description message for each test. Thinking along
the lin
Hello, I have suggestion about clojure.contrib.test-is.
It is useful and sometimes necessary to generate testing data.
Currently, data can be generated by a piece of code and passed to an
'is' function. For example, I want to test for equality of many
things, to see if each is equal to each:
(us
son_operators.html
http://www.devguru.com/Technologies/ecmascript/quickref/javascript_index.html
Frantisek
On Jan 28, 9:17 pm, Cosmin Stejerean wrote:
> On Wed, Jan 28, 2009 at 11:13 AM, Frantisek Sodomka wrote:
>
> [...]
>
> Since this is correct:
>
> > user=> (=
Hello all!
During writing tests for type predicates, I noticed that these -
possibly useful - predicates are not in clojure.core:
boolean?
character?
regex?
array?
Since this is correct:
user=> (= () [])
true
Shouldn't these be also 'true'?
user=> (= {} [])
false
user=> (= {} #{})
false
user=> (
Hello Steve,
I attached file predicates.patch for type and number predicates. Let me
know, if this is an acceptable patch (I haven't worked with them before). We
can then create an issue for Clojure-contrib if necessary.
Shawn, I keep wondering where is the best place to put tests for bug fixes.
O
I found an interesting project code_swarm (an experiment in organic
software visualization), which I would like to share:
http://vis.cs.ucdavis.edu/~ogawa/codeswarm/
See video(s):
code_swarm - Python
http://www.vimeo.com/1093745
Source:
http://code.google.com/p/codeswarm/
Enjoy, Frantisek
--~--
I have some tests ready for test_clojure. I asked Rich for SVN access
rights. There is gonna be more tests soon :-)
Frantisek
On Sun, Jan 25, 2009 at 8:55 PM, Stuart Halloway
wrote:
>
> In SVN 412 I have made the following changes to contrib:
>
> * a test_contrib.clj file which does for contrib
Word "streams" invokes association to data-flow languages. For a
while, I was following Project V:
Simple Example of the Difference Between Imperative, Functional and
Data Flow.
http://my.opera.com/Vorlath/blog/2008/01/06/simple-example-of-the-difference-between-imperative-functional-and-data-flo
Hello Rich,
Looking forward to using them! It is pleasure to see such nice
development!
Frantisek
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojure@googleg
Hello all!
I ported beatiful functional geometry:
http://www.frank-buss.de/lisp/functional.html
http://intricatevisions.com/index.cgi?page=nlcodetk
into Clojure:
http://intricatevisions.com/source/clojure/fg.clj
(link from the page http://intricatevisions.com/index.cgi?page=clojure)
When you ru
> 2. "each=" and "all-true" are gone, replaced by the new macro "are",
> which works with any predicate:
> (are =
> 2 (+ 1 1)
> 4 (+ 2 2))
>
> -Stuart Sierra
Hello and thanks for additions!
Happy to see additions and work done on tests :-)
I just wonder - how do you define "all-
Hello all!
I started writing some unit tests for Clojure. This is what I got so far:
http://intricatevisions.com/source/clojure/fs_test_clojure.clj
I am almost done with 'first' and 'rest'. I will do ffirst, frest, rfirst,
rrest, second.
Since I did 'if', I would also like to do 'and' and 'or'
Thinking about test-is little more...
Lets look at this test for minus:
(deftest test-minus
(all-true
(number? (- 1 2))
(integer? (- 1 2))
(float? (- 1.0 2))
(ratio? (- 2/3 1))
(float? (- 2/3 (/ 1.0 3
(throws IllegalArgumentException (-))
(each=
(- 1) -
Hello Stuart!
Few more ideas for you :)
each= could be extended to allow more freedom. The first parameter could
say what operation we want to perform:
each =
each not=
each <
each >
...
(each =
a b
c d)
=>
(all-true
(= a b)
(= c d))
(each not=
a b
c d)
=>
(all-true
(n
Thanks Stuart!
It will certainly make writing tests more enjoyable :-)
Inspiration for :equal-pairs/each= came from the test framework I wrote
for newLISP:
http://newlisp-on-noodles.org/wiki/index.php/Function_Testing
Tests there are written as each= with 2 exceptions:
'->' evaluates the next
In the latest SVN revision, there are both core-proxy.clj and proxy.clj
files in src\clj\clojure.
Is this intentional?
Frantisek
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this
On Thu, 13 Nov 2008 16:35:52 +0100, Dave Newton <[EMAIL PROTECTED]>
wrote:
>
> --- On Thu, 11/13/08, Frantisek Sodomka wrote:
>> [...]
>> becomes:
>>
>> (deftest t-Symbols
>>(check
>> (:equal
>>'abc (symbol "
Using this, test t-Symbols
(deftest t-Symbols
(is (= 'abc (symbol "abc")))
(is (= '*+!-_? (symbol "*+!-_?")))
(is (= 'abc:def:ghi (symbol "abc:def:ghi")))
(is (= 'abc/def (symbol "abc" "def")))
(is (= 'abc.def/ghi (symbol "abc.def" "ghi")))
(is (= 'abc/def.ghi (symbol "abc" "def
1 - 100 of 105 matches
Mail list logo