Re: Why does this overflow? (a try at the sieve of Eratosthenes)

2013-09-05 Thread kawas
range 2 (inc n))) (recur (inc i) n (conj preds #(and (> % i) (zero? (rem % i))) (last (siev2 2 5 [])) 4 Clojure is always fun to play and I have not even try reducers yet :) - kawas Le jeudi 5 septembre 2013 09:01:01 UTC+2, Cedric Greevey a écrit : > > Deeply nested lazy seq g

Re: problem with edn

2013-08-23 Thread kawas
- Nippy <https://github.com/ptaoussanis/nippy> I have no experience with them, just sharing Regards Kawas Le jeudi 22 août 2013 21:09:41 UTC+2, Jim foo.bar a écrit : > > all I'm trying to do is to provide a uniform mechanism to save/load > game-states across my 2D board-game

Re: problem with edn

2013-08-23 Thread kawas
ain. If I keep technical details in meta data (ex: locks) I see no need to serialize it to share it over the wire. Kind regards Kawas Le vendredi 23 août 2013 09:51:47 UTC+2, Meikel Brandmeyer (kotarak) a écrit : > > Hi, > > Am Donnerstag, 22. August 2013 17:46:42 UTC+2 schrieb kawas: >

Re: problem with edn

2013-08-23 Thread kawas
te to reload it fast without too much reprocessing. Don't get me wrong, I'am not against any use of edn, in any situation. If it solves you're problems, than you're good to go. Regards Kawas > > RPC stuff is hard to work with and couples both ends a lot. Edn is much >

Re: problem with edn

2013-08-22 Thread kawas
Jim, This is indeed a hack and not a best practice, maybe you're not using the right tool for your problem... - If you want to exchange data (think values), you should not be in need of keeping types and meta data when you exchange data in json, for example, you're not providing object class

Re: problem with edn

2013-08-21 Thread kawas
der user=> (edn/read-string {:readers {'treemap #(merge (sorted-map) %)}} (binding [*print-dup* false] (str "#treemap " (pr-str (sorted-map :z 5 :a 1) {:a 1, :z 5} ;; this is a sorted map Seems like it should be possible to easily provide default printers and read

Re: problem with edn

2013-08-21 Thread kawas
dn/read-string {:readers {'user.Foo #(apply ->Foo %)}} "#user.Foo[1, 2, 3]") #user.Foo{:a 1, :b 2, :c 3} Nice Le mercredi 21 août 2013 22:33:00 UTC+2, kawas a écrit : > > By the way *print-dup* is the problem, maybe you should not use it :) > > Spot the difference

Re: problem with edn

2013-08-21 Thread kawas
By the way *print-dup* is the problem, maybe you should not use it :) Spot the difference : user=> (binding [*print-dup* true] (prn (->Foo 1 2 3))) #user.Foo[1, 2, 3] user=> (binding [*print-dup* false] (prn (->Foo 1 2 3))) #user.Foo{:a 1, :b 2, :c 3} cheers Le mercredi 21 août 2013 19:

Re: problem with edn

2013-08-21 Thread kawas
Hi, Maybe you should provide a custom reader for your record. See answer on this question http://stackoverflow.com/questions/17991565/clojure-defrecord-serialization-classnotfoundexception regards, Le mercredi 21 août 2013 19:55:59 UTC+2, Jim foo.bar a écrit : > > Hi everyone, > > I am trying

Re: When arithmetic on a computer bite back

2012-06-01 Thread kawas
constructors but I may have made a mistake about which value is the correct one... Bye, Laurent On 1 juin, 19:21, Tassilo Horn wrote: > kawas writes: > > Hi Laurent, > > > (defn prime-factors [n] > >   (loop [f 2 n n res []] > >     (cond > >       (<=

When arithmetic on a computer bite back

2012-06-01 Thread kawas
Hi, Can someone explain to me the behavior of this function when applied to different kind of numbers. (defn prime-factors [n] (loop [f 2 n n res []] (cond (<= n 1) res (zero? (rem n f)) (recur f (quot n f) (conj res f)) :else (recur (inc f) n res Problem 1 (solved):

Re: about lazy-seq

2011-07-02 Thread kawas
                     (slice 0 (dec high) (rest coll)) > > On Jul 1, 4:29 pm, kawas wrote: > > > > > > > > > Hi, > > > As a clojure beginner I'm practicing my understanding of the language > > but at some point the use of lazy-seq get blurry.

about lazy-seq

2011-07-01 Thread kawas
it seems like I'm hanging onto my head. Is lazy-seq creating some kind of closure with my collection in it ? How about lazy-seq, tail call and closure clearing ? regards, -- kawas -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post t