Atoms, reference to itself cause StackOverflowError

2015-08-07 Thread Simone Mosciatti
Hi all,

I noticed this behaviour that I was not expecting:

simo@simo:~$ lein repl
nREPL server started on port 42010 on host 127.0.0.1 - 
nrepl://127.0.0.1:42010
REPL-y 0.3.5, nREPL 0.2.6
Clojure 1.6.0
OpenJDK 64-Bit Server VM 1.7.0_79-b14
Docs: (doc function-name-here)
  (find-doc part-of-name-here)
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user= (def a (atom {}))
#'user/a
user= (swap! a assoc :self a)

StackOverflowError   java.util.regex.Pattern$GroupHead.match 
(Pattern.java:4556)
user= (swap! a assoc :test :ok)

StackOverflowError   java.lang.Character.codePointAt (Character.java:4668)
user= a

StackOverflowError   java.util.regex.Pattern$Curly.match0 
(Pattern.java:4148)
user= (def b (atom {}))
#'user/b
user= (swap! b assoc :test :ok)
{:test :ok}

It is something expected or I should open a bug report ?

Greets

Simone

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Atoms, reference to itself cause StackOverflowError

2015-08-07 Thread Simone Mosciatti
Thank you :)

Extremely clear !

On Friday, August 7, 2015 at 3:48:14 PM UTC+2, Stuart Sierra wrote:

 Hi Simone,

 The stack overflow here is caused by the REPL trying to print a circular 
 reference. `swap!` always returns the new value of the Atom, and the REPL 
 tries to print it.

 If you don't print the Atom, this self-reference can still work:

 user= (def a (atom {}))
 #'user/a
 user= (do (swap! a assoc :self a) nil)
 nil
 user= (= a (:self @a))
 true

 –S


 On Friday, August 7, 2015 at 9:42:05 AM UTC-4, Simone Mosciatti wrote:

 Hi all,

 I noticed this behaviour that I was not expecting:

 simo@simo:~$ lein repl
 nREPL server started on port 42010 on host 127.0.0.1 - nrepl://
 127.0.0.1:42010
 REPL-y 0.3.5, nREPL 0.2.6
 Clojure 1.6.0
 OpenJDK 64-Bit Server VM 1.7.0_79-b14
 Docs: (doc function-name-here)
   (find-doc part-of-name-here)
   Source: (source function-name-here)
  Javadoc: (javadoc java-object-or-class-here)
 Exit: Control+D or (exit) or (quit)
  Results: Stored in vars *1, *2, *3, an exception in *e

 user= (def a (atom {}))
 #'user/a
 user= (swap! a assoc :self a)

 StackOverflowError   java.util.regex.Pattern$GroupHead.match 
 (Pattern.java:4556)
 user= (swap! a assoc :test :ok)

 StackOverflowError   java.lang.Character.codePointAt (Character.java:4668)
 user= a

 StackOverflowError   java.util.regex.Pattern$Curly.match0 
 (Pattern.java:4148)
 user= (def b (atom {}))
 #'user/b
 user= (swap! b assoc :test :ok)
 {:test :ok}

 It is something expected or I should open a bug report ?

 Greets

 Simone



-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Obtain name of interface from java file, regex + slurp doesn't works

2013-11-27 Thread Simone Mosciatti
Hi all,

I am trying to parse some java source file that contain the definition of 
an interface, what I need is to get the name of the interface, what methods 
it defines and what other interfaces it extend.

I used a regex (there is any clever way other than analyze the source ?) 
that works pretty good, however it doesn't works all the time.

If I copy and paste the source test from the file to the repl it works 
without any problem, however if I slurp the file it works only on some 
files, not on every file.

What can be the problem ?

(defn is-interface? [str]
  (re-matches #(.|\n)* interface (\w+) (.|\n|\{)* str))

is the regex I am using.

This: 
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ISeq.java
is a source that does NOT work.

This other: 
https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/ILookup.java
is a source that DOES work.


 

-- 
-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [ANN] Clojure Cheatsheet for Emacs

2013-08-09 Thread Simone Mosciatti
Thank you so much...

Actually was kinda funny, I typed something like clojure cheatsheet 
offline and your github link was one of the first, and I was very 
surprised... Wow, it is possible that I didn't know of it ? 
Well now I understand why I didn't know of it yet, it is only few hours old 
;)

On Friday, August 9, 2013 10:30:46 PM UTC+2, Kris Jenkins wrote:

 Hi,

 I find the Clojure Cheatsheet http://clojure.org/cheatsheet really 
 useful, but since I often need at those times I don't have wifi, I've 
 packaged it up into an Emacs plugin:


 https://raw.github.com/krisajenkins/clojure-cheatsheet/master/screenshot1.png
 In the hope that someone else finds it useful too, the project's here on 
 Github https://github.com/krisajenkins/clojure-cheatsheet, along with 
 installation instructions. Any feedback is welcomed. :-)

 Cheers,
 Kris


-- 
-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Tortoise-hare algorithm

2013-06-29 Thread Simone Mosciatti
It is very interesting, just a friendly suggestion, if you share code, and 
need some help, make sure people can get immediately what is going on.
(READ: comment the code)

On Saturday, June 29, 2013 1:34:57 PM UTC+2, Zhemin Lin wrote:

 Hi.
 One of my colleagues gave a share about the cycle detecting tortoise-hare 
 algorithm 
 (wikihttp://en.wikipedia.org/wiki/Cycle_detection#Tortoise_and_hare
 ).
 I translated the script on Wiki from Python to Clojure.
 It worked, but not elegant.  I'd like to make it more functional, more 
 tasty.
 Any suggestions to help it evolve?

 I uploaded my (messy) code here: 
 https://github.com/miaoski/clojure-tortoise-hare
 Thanks a lot! :)



-- 
-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: unusual question: how do you get morale?(or moral support)

2013-05-12 Thread Simone Mosciatti
I code only for myself, and honestly coding is what I like to do.

I remember these days being in a very bad mood and all I wanted to do was 
to sit and code.

I believe that what motivate myself is my own EGO, code for me is only 
about solving problem, and more problem I solve better my ego is.

Anyway I am still a student and I don't have (m)any [I like that XP] 
financial issues.

I am weird, but friends usually don't help me when I have an hard time, 
neither does my family (no that they wouldn't like to help me, they try 
most of the time but they simply don't work), time helps.
For problems that I can not solve because they are not ups to me, I just 
don't think about, so I keep myself as busy as possible, until I don't feel 
great again.
For problems that I can solve, well those are just other forms of coding, 
so I just fix that for my ego.

:-)

Someone else want to share ? 

On Sunday, May 12, 2013 9:34:22 PM UTC+2, atkaaz wrote:

 Hi. I've been meaning to ask (all of)you, how do you get moral support? 
 How do you put yourself into that mood so that you're happy/willing to 
 program? What motivates you to do it? Is it the people you surround 
 yourself with or the financial support? Are they enough to subconsciously 
 motivate you? What if you had no friends/contacts but you had time?

  Unusual question for this ML, I know, so I won't expect (m)any answers. 
 Thanks.


-- 
-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [ANN] bleach 0.0.11

2013-05-05 Thread Simone Mosciatti
It is probably me being stupid, but WHY ?

On Sunday, May 5, 2013 8:11:05 AM UTC+2, David Lowe wrote:

 It's much, much simpler than any compiler! It just translates arbitrary 
 clojure code to and from all-whitespace strings :)

 Thanks,
 David


 On Sat, May 4, 2013 at 11:26 AM, Gary Verhaegen 
 gary.ve...@gmail.comjavascript:
  wrote:

 Without looking at more than the Readme on github, I guess it's kind
 of like a compiler to whitespace. You know, the whitespace programming
 language :
 http://en.wikipedia.org/wiki/Whitespace_(programming_language)

 like implemented as a user defined type with the #bleach/ed type.

 On 4 May 2013 19:51, AtKaaZ atk...@gmail.com javascript: wrote:
  could you post a sample code how it looks before and after?
 
 
  On Thu, May 2, 2013 at 7:36 AM, David Lowe 
  j.davi...@gmail.comjavascript: 
 wrote:
 
  bleach: whitens unsightly code!
 
  When you bleach your code, it continues to work as before, only now it
  looks like:
 
  (use 'bleach.core) #bleach/ed 
 
 
 
 
  
 
  Find it here: https://github.com/dlowe/bleach
 
  Enjoy :)
  David Lowe
 
  --
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clo...@googlegroups.comjavascript:
  Note that posts from new members are moderated - please be patient with
  your first post.
  To unsubscribe from this group, send email to
  clojure+u...@googlegroups.com javascript:
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google 
 Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send 
 an
  email to clojure+u...@googlegroups.com javascript:.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
 
  --
  --
  You received this message because you are subscribed to the Google
  Groups Clojure group.
  To post to this group, send email to clo...@googlegroups.comjavascript:
  Note that posts from new members are moderated - please be patient with 
 your
  first post.
  To unsubscribe from this group, send email to
  clojure+u...@googlegroups.com javascript:
  For more options, visit this group at
  http://groups.google.com/group/clojure?hl=en
  ---
  You received this message because you are subscribed to the Google 
 Groups
  Clojure group.
  To unsubscribe from this group and stop receiving emails from it, send 
 an
  email to clojure+u...@googlegroups.com javascript:.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 

 --
 --
 You received this message because you are subscribed to the Google
 Groups Clojure group.
 To post to this group, send email to clo...@googlegroups.comjavascript:
 Note that posts from new members are moderated - please be patient with 
 your first post.
 To unsubscribe from this group, send email to
 clojure+u...@googlegroups.com javascript:
 For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en
 ---
 You received this message because you are subscribed to the Google Groups 
 Clojure group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to clojure+u...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.





-- 
-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
Clojure group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Delay with atom

2013-01-10 Thread Simone Mosciatti
Thanks Dave, I come out with that too...

I put the wrong question honestly, but why the atom is not working I wonder 
?

On Thursday, January 10, 2013 2:43:27 AM UTC+1, Dave Sann wrote:

 Create the atom in a let, in the function - so it's new and isolated

 better still - use an accumulator in the loop, not an atom.

 take, map an others are lazy. you may need to (doall ...)

 Dave


 On Thursday, 10 January 2013 08:22:57 UTC+11, Simone Mosciatti wrote:

 Hi everybody,

 I was implementing a skip list, just for fun.

 I implemented the list and just to be sure that it were working I wanted 
 to count how many steps it compute to find a value.
 SkipList -- http://en.wikipedia.org/wiki/Skip_list

 To do so I was using a atom, and the code looks like this:

 (def c (atom 0))

  

 (defn search-n-count [s n]
   (letfn [(search-fn [s n]
 (reset! c 0)  ;; I restart to count 
 (loop [s s]
   (swap! c inc)  ;; add a passage to the counter
   (when (seq s)  
 (let [v (first s)]
   (cond
( v n) false
(== v n) n
( v n) (recur (rest s)))]
 [(take 1 (drop-while #(or (false? %1) (nil? %1)) (map search-fn s 
 (repeat n @c]))  ;;the take and everything looks horrible, but I didn't 
 find anything better, any ideas ?

  
 However the value that I get simply doesn't makes any sense, sometimes it 
 looks like I get a value that could refer to the previous computation...

 Where is the problem ?

 If you don't get the code I can comment better the code, just let me 
 know...

 Here the whole code and some example: https://gist.github.com/4497077

 Thanks for any help :-)

 Simone



-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Delay with atom

2013-01-09 Thread Simone Mosciatti
Hi everybody,

I was implementing a skip list, just for fun.

I implemented the list and just to be sure that it were working I wanted to 
count how many steps it compute to find a value.
SkipList -- http://en.wikipedia.org/wiki/Skip_list

To do so I was using a atom, and the code looks like this:

(def c (atom 0))

 

 (defn search-n-count [s n]
   (letfn [(search-fn [s n]
 (reset! c 0)  ;; I restart to count 
 (loop [s s]
   (swap! c inc)  ;; add a passage to the counter
   (when (seq s)  
 (let [v (first s)]
   (cond
( v n) false
(== v n) n
( v n) (recur (rest s)))]
 [(take 1 (drop-while #(or (false? %1) (nil? %1)) (map search-fn s 
 (repeat n @c]))  ;;the take and everything looks horrible, but I didn't 
 find anything better, any ideas ?

 
However the value that I get simply doesn't makes any sense, sometimes it 
looks like I get a value that could refer to the previous computation...

Where is the problem ?

If you don't get the code I can comment better the code, just let me know...

Here the whole code and some example: https://gist.github.com/4497077

Thanks for any help :-)

Simone

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure Conj Videos

2013-01-04 Thread Simone Mosciatti
It could be a good idea to post the video and the slides also in some 
different platform (YouTube/Vimeo for the video and something else for the 
slides google doc, dropbox) just to avoid what happened with blip.tv...

It may be a even better idea to get all the video material and put all 
together somewhere, maybe in the main site of clojure...

We start to have a lot of videos and organize them it start to be a good 
idea.

On Friday, January 4, 2013 4:45:06 AM UTC+1, Alex Miller wrote:

 The full Strange Loop video schedule is here: 
 https://thestrangeloop.com/news/strange-loop-2012-video-schedule

 Re Clojure talks, 

 Already released related in some way to Clojure and ClojureScript:
 - Nathan Marz on big data - 
 http://www.infoq.com/presentations/Complexity-Big-Data
 - Jim Weirich on Y Combinator - 
 http://www.infoq.com/presentations/Y-Combinator
 - Chris Granger on Light Table - 
 http://www.infoq.com/presentations/Learn-Tools
 - David Nolen on ClojureScript - 
 http://www.infoq.com/presentations/ClojureScript-Optimizations
 - Amit Rathore on Clojure+Datomic+Storm - 
 http://www.infoq.com/presentations/Zolodeck
 - Bodil Stokke on Catnip IDE and ClojureScript - 
 http://www.infoq.com/presentations/Catnip

 Still to be released:
 - Jason Wolfe's talk on the Prismatic Graph library is coming out week of 
 Jan 28th
 - Kevin Lynagh's talk on his ClojureScript visualization lib is week of 
 Feb 11th
 - Rich Hickey's talk is scheduled for week of Mar 18th but same one has 
 already been released on InfoQ so not sure if they'll re-release it
 - Stuart Sierra's talk on functional design patterns is week of Apr 1st

 Sorry if I missed any.

 Alex

 On Thursday, January 3, 2013 2:43:39 AM UTC-6, kinleyd wrote:

 I've been waiting forever for the recent Strange Loop Clojure talks to be 
 made available as well. So far I've only seen two, Amit Rathore's Clojure 
 + Datomic + Stomr = Zolodeck and David Nolen's ClojureScript - Better 
 semantics at low, low prices on InfoQ. Any one have any idea when the 
 others will be made available? 

 On Thursday, January 3, 2013 2:26:18 PM UTC+6, CA wrote:

 Let the party begin :-)

 On Thursday, January 3, 2013 2:02:41 AM UTC+1, Lynn Grogan wrote:

 Confreaks is just completing the final edits on the videos and we 
 should be releasing them soon (in a week or so?). 
 Of course, it will probably be a staggered release just to drive 
 everyone crazy ;) 

 Lynn Grogan
 Relevance

 On Wednesday, January 2, 2013 7:12:03 PM UTC-5, Sean Corfield wrote:

 On Wed, Jan 2, 2013 at 3:42 PM, Mark Derricutt ma...@talios.com 
 wrote: 
  
  +1 - I'm sure I've even seen any BLOGS on this years Conj let alone 
 videos. 

 http://corfield.org/blog/post.cfm/clojure-conj-2012 
 -- 
 Sean A Corfield -- (904) 302-SEAN 
 An Architect's View -- http://corfield.org/ 
 World Singles, LLC. -- http://worldsingles.com/ 

 Perfection is the enemy of the good. 
 -- Gustave Flaubert, French realist novelist (1821-1880) 



-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Merry Christmas Everybody

2012-12-24 Thread Simone Mosciatti
I just wanted to say

Merry Christmas to this wonderful community that during this first (half) 
year learning clojure is really helping me.

Thanks to everybody and best wishes for the holidays

Simone Mosciatti

PS: Here in Italy is just 0.11 AM of the 25th of December aka Christmas...

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: what is the simplest user auth system possible?

2012-10-28 Thread Simone Mosciatti
I never really get Persona (means person in Italian that doesn't really 
make a lot of sense, but whatever) what if I share my pc with my brother ?
Maybe i miss something...

If you are using mongodb I am using https://github.com/xavi/noir-auth-app that 
is using congomongo and since i am using monger i port it in 
https://github.com/siscia/noir-auth-app ...

It manage maybe too much for your need, email authentication, resend email, 
change password and other fancy stuff, but the code is really clean and 
full of comments, really good code imo... 

If you have time you could port it to work with korma... it is not a lot of 
work at all...

On Sunday, October 28, 2012 8:07:02 PM UTC+1, larry google groups wrote:

 What happens if the Persona project closes down?


 On Friday, October 26, 2012 7:06:48 AM UTC-4, Dave Sann wrote:

 For authorisation, I really like mozilla persona (previously browserid) 
 which I discovered from refheap. javascript lib plus an http request from 
 the server to validate. really simple.

 https://login.persona.org/

 Dave



 On Friday, 26 October 2012 01:35:53 UTC+11, Stephen Compall wrote:

 On Oct 25, 2012 9:04 AM, larry google groups lawrenc...@gmail.com 
 wrote:
  For my next step, I need to come up with a user system. My needs are 
 minimal: I only need to know when someone is logged in, and I need to 
 associate them with some user id (the id will simply be the id from a user 
 table kept in MySql). 
 
  I am curious what is the absolutely easiest way to do this?

 The easiest auth system to write is the one that's already written.

 https://github.com/cemerick/friend

 --
 Stephen Compall
 If anyone in the MSA is online, you should watch this flythrough. 



-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ANN Monger 1.3.0 is released

2012-10-24 Thread Simone Mosciatti
If I upgrade right now I can remove clojure.data.json from my dependencies 
and still use monger.joda-time without any problem ?
Or I have to put chesire in the dependency ?

On Wednesday, October 24, 2012 10:58:21 AM UTC+2, Michael Klishin wrote:

 Monger (http://clojuremongodb.info) is an idiomatic Clojure MongoDB 
 driver for a more civilized age.

 `1.3.0` is a minor *100% backwards-compatible* release that includes an 
 important bug fix in the updated MongoDB Java driver.
 We recommend all users to upgrade to it as soon as possible.


 ## Changes in 1.3.0

 ### monger.core/disconnect!

 `monger.core/disconnect!` is a new function that closes the default 
 database connection.


 ### Ragtime 0.3.0

 Ragtime dependency has been updated to 0.3.0.


 ### MongoDB Java Driver Update

 MongoDB Java driver dependency has been updated to 2.9.2 [1]. This
 includes *an important bug fix*: JAVA-660 [2].


 ### Cheshire Support

 `monger.json` and `monger.joda-time` will now use Cheshire [3] if it is 
 available.
 clojure.data.json is no longer a hard dependency (but `0.1.x` versions are 
 still supported if available).

 Recently released `clojure.data.json` version `0.2.0` completely breaks 
 public API and is not supported
 in this release.


 ### ClojureWerkz Support 0.7.0

 ClojureWerkz Support library is upgraded to `0.7`.


 ## Change Log

 We recommend all users to upgrade to 1.3.0 [5] as soon as possible.

 Full Monger change log [6] is available on GitHub.


 1. 
 https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10006version=11891
 2. https://jira.mongodb.org/browse/JAVA-660
 3. https://github.com/dakrone/cheshire
 4. https://github.com/clojure/data.json
 5. https://clojars.org/com.novemberain/monger/versions/1.3.0
 6. https://github.com/michaelklishin/monger/blob/master/ChangeLog.md

 -- 
 MK



-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] Immutant 0.5.0 released

2012-10-16 Thread Simone Mosciatti
It looks great, well done...

waiting for the 1.0...

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure web framework

2012-09-30 Thread Simone Mosciatti
Immutant ( http://immutant.org/ ) IMO is moving in a great direction, if I 
have understand is wrapping several libraries in just one enviroment...

And red hat is behind it I just find out, that usually means great doc...

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure web framework

2012-09-29 Thread Simone Mosciatti


On Saturday, September 29, 2012 1:48:10 PM UTC+2, Anthony Grimes wrote:

I do not have access to the website in order to update it


Somebody (Chris Granger ???) has the access, if you are actually 
maintaining it you should have the access too... 
 

 Chris has things he wanted to see done first, *things I don't intend to do
 *, so it's mostly waiting on that.

 
Like what ? Do you refer to the road map ? Just example and tutorial ?
If there is something more would be cool to know... Maybe somebody has 
already wrote something, or he could work on it...
 

 I agree that documentation is the answer and not another monolithic 
 framework.

 
 Documentation is always an issue, few times ago I propose to organize a 
fund raiser to improve OUR project, the project of OUR community, stuff we 
should be proud of, and the improve of the doc was one of the biggest 
issue... However nobody supported me.
 

 It isn't hard to use Compojure and other web development libraries.


You can really use noir with just the few example in the website, although 
I had some previous (few) knowledge of web developing (django)

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: ANN Quartzite 1.0 (final)

2012-09-17 Thread Simone Mosciatti
OMG I was waiting for that,
thank you guys so much, really...

Just a little note: fantastic would be add documentation for durable 
scheduler...

On Monday, September 17, 2012 10:53:57 PM UTC+2, Michael Klishin wrote:

 Quartzite [1] is a Clojure DSL on top of the Quartz scheduler. It has a 
 few convenience features
 in addition, but primarily tries to make core Quartz features as easy to 
 use as possible without heavy use of Java interop in your apps.

 Here's a list of what you get out of the box:

  * Ability to define jobs, triggers and schedules using a DSL
  * Scheduling, unscheduling, pausing and resuming jobs and triggers.
  * Querying scheduler for information, convenient predicate functions
  * Ability to register listeners for scheduler events
  * Access to durable scheduler data stores (JDBC databases out of the box, 
 other stores via plugins)
  * Solid documentation (my favorite feature)


 New in 1.0 final:

  * Documentation updates
  * Stateful jobs support
  * Clojure 1.4 by default
  * Better names for functions that remove triggers

 Full change log is available on GitHub [4].

 Quartzite targets Clojure 1.3+, tested against 3 Clojure versions x 3 JDKs 
 on travis-ci.org, and is released under the Eclipse Public License.

 Learn more in the Getting Started guide [2] and the rest of the docs [1].

 The source is available on GitHub [3]. We also use GitHub to track issues.


 1. http://clojurequartz.info
 2. http://clojurequartz.info/articles/getting_started.html
 3. http://github.com/michaelklishin/quartzite
 4. 
 https://github.com/michaelklishin/quartzite/blob/1.0.x-stable/ChangeLog.md
 -- 
 MK

 http://github.com/michaelklishin
 http://twitter.com/michaelklishin



-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Fund raiser for our projects

2012-09-07 Thread Simone Mosciatti
Ok, I guess nobody is really interested in something like that...
Never mind...

On Wednesday, September 5, 2012 6:37:40 PM UTC+2, Simone Mosciatti wrote:

 Hi everybody,

 I get a little idea now that we are heading to Christmas.

 Would be nice to organize a little fund raiser to support our projects.

 We have a lot of great project, but first of all good documentation is not 
 the norm.
 Then there are a lot of spot where we can improve-- I am thinking about 
 web authentication, friends is great but the same author suggest to add 
 security and a bunch of other type of authentication, but obviously there 
 is more.

 I am making a personal project and I am find some sort of lack in any 
 library I am using, however I don't have neither the time nor the knowledge 
 to really improve the situation.

 Maybe the author of the library would have at least the knowledge so if we 
 can raise some money to buy his/her time would be really nice, wouldn't ?

 Finally we should also involve the company that are using clojure ( 
 http://dev.clojure.org/display/community/Clojure+Success+Stories more 
 http://www.quora.com/Whos-using-Clojure-in-production ) to raise bigger 
 money.

 I thought about and I have some idea how decide what project would get the 
 -hypotetical- money.

 Anyway before to even think about how organize everything I want to know 
 what the community think about that.

 It is possible ? It can be dangerous ? We shouldn't do that ? 

 Thanks for the attention.

 Greets

 Simone Mosciatti


-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Fund raiser for our projects

2012-09-05 Thread Simone Mosciatti
Hi everybody,

I get a little idea now that we are heading to Christmas.

Would be nice to organize a little fund raiser to support our projects.

We have a lot of great project, but first of all good documentation is not 
the norm.
Then there are a lot of spot where we can improve-- I am thinking about web 
authentication, friends is great but the same author suggest to add 
security and a bunch of other type of authentication, but obviously there 
is more.

I am making a personal project and I am find some sort of lack in any 
library I am using, however I don't have neither the time nor the knowledge 
to really improve the situation.

Maybe the author of the library would have at least the knowledge so if we 
can raise some money to buy his/her time would be really nice, wouldn't ?

Finally we should also involve the company that are using clojure ( 
http://dev.clojure.org/display/community/Clojure+Success+Stories more 
http://www.quora.com/Whos-using-Clojure-in-production ) to raise bigger 
money.

I thought about and I have some idea how decide what project would get the 
-hypotetical- money.

Anyway before to even think about how organize everything I want to know 
what the community think about that.

It is possible ? It can be dangerous ? We shouldn't do that ? 

Thanks for the attention.

Greets

Simone Mosciatti

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Fund raiser for our projects

2012-09-05 Thread Simone Mosciatti
I would say raise money to help people improve their project (documentation 
is a very important part that).

With a little of our effort and a big jump thank to some company we would 
improve a lot of projects.

It will help everybody...

The developers that finally get something from their open source project
The community and the company that can now use better library ...

I don't know, it is just an idea, if nobody see any point, too bad...

On Wednesday, September 5, 2012 6:58:30 PM UTC+2, Jim foo.bar wrote:

 I'll be  honest with you... I 'm not sure I understand at all what you 
 mean! raise money for people to document their open-source projects 
 better? 

 forgive me but I missed your point... :-) 

 Jim 


 On 05/09/12 17:37, Simone Mosciatti wrote: 
  Hi everybody, 
  
  I get a little idea now that we are heading to Christmas. 
  
  Would be nice to organize a little fund raiser to support our projects. 
  
  We have a lot of great project, but first of all good documentation is 
  not the norm. 
  Then there are a lot of spot where we can improve-- I am thinking 
  about web authentication, friends is great but the same author suggest 
  to add security and a bunch of other type of authentication, but 
  obviously there is more. 
  
  I am making a personal project and I am find some sort of lack in any 
  library I am using, however I don't have neither the time nor the 
  knowledge to really improve the situation. 
  
  Maybe the author of the library would have at least the knowledge so 
  if we can raise some money to buy his/her time would be really nice, 
  wouldn't ? 
  
  Finally we should also involve the company that are using clojure ( 
  http://dev.clojure.org/display/community/Clojure+Success+Stories more 
  http://www.quora.com/Whos-using-Clojure-in-production ) to raise 
  bigger money. 
  
  I thought about and I have some idea how decide what project would get 
  the -hypotetical- money. 
  
  Anyway before to even think about how organize everything I want to 
  know what the community think about that. 
  
  It is possible ? It can be dangerous ? We shouldn't do that ? 
  
  Thanks for the attention. 
  
  Greets 
  
  Simone Mosciatti 
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.comjavascript: 
  Note that posts from new members are moderated - please be patient 
  with your first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/clojure?hl=en 



-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Fund raiser for our projects

2012-09-05 Thread Simone Mosciatti
My point is that by the time that I am able to write a nice/useful article 
about any library a maintaners of the lib would be able to write 10 
articles way better.

Then still there if I write one article, you write another and @whoever 
write the next we will have 3 different articles in 3 different blogs, 
honestly I am sure that 3 articles doesn't worth 3 page of real 
documentation (and because in your article you cannot assume that your 
readers know what you are talking about, but you can do so in the second 
page of a wiki, and because probably the maintaners of the lib would write 
it better)

Finally you cannot assume that the creators of a library will be always 
there to help us, they may change career, they may don't have time anymore 
for some stuff, they may move in Buthan, however you can be about sure that 
a wiki page will still.

And again, I am not talking only about add documentation but also improve 
what we have now, and why not?, start something new.

I don't know if there is anybody that think that it is a good idea...

On Wednesday, September 5, 2012 8:35:04 PM UTC+2, Paul deGrandis wrote:

 We keep bringing up the same social problem: We have brilliant people 
 contributing quality code, with a lack of documentation, polish, and to 
 some degree community management/engagement.

 The solution is simple: help out by writing or improving documentation, 
 building demo apps, writing tutorials, and sharing success stories.
 All of the creators and maintainers of these projects LOVE being engaged 
 by those interested in the project.  They will take the time to help you 
 adopt their stuff and patch up libraries to solve your specific problems 
 (time-allowing).

 I think a general fund/fundraiser is a bad idea, but I'm all for a Clojure 
 Ecosystem bounty page/site.  If companies or individuals want to put 
 monetary support behind a feature/bug-fix/tutorial, I think we should let 
 them.  This approach has worked well for Mozilla, Apache, and others.  We 
 would just have to be mindful that the bounties are for the ecosystem and 
 not for Clojure-proper development.

 Don't be scared to reach out and approach the authors of the libraries 
 you're using.  I've had much success directly contracting 
 creators/maintainers of open source projects.

 Regards,
 Paul

 On Wednesday, September 5, 2012 10:19:04 AM UTC-7, Jim foo.bar wrote:

  aaa ok that makes things clearer...thank you I get your point now! i 
 can't say it doesn't make sense but i would say it's rather ambitious. :-) 


 Jim


 On 05/09/12 18:15, Simone Mosciatti wrote:
  
 I would say raise money to help people improve their project 
 (documentation is a very important part that). 

  With a little of our effort and a big jump thank to some company we 
 would improve a lot of projects.

  It will help everybody...

  The developers that finally get something from their open source project
 The community and the company that can now use better library ...

 I don't know, it is just an idea, if nobody see any point, too bad...

 On Wednesday, September 5, 2012 6:58:30 PM UTC+2, Jim foo.bar wrote: 

 I'll be  honest with you... I 'm not sure I understand at all what you 
 mean! raise money for people to document their open-source projects 
 better? 

 forgive me but I missed your point... :-) 

 Jim 


 On 05/09/12 17:37, Simone Mosciatti wrote: 
  Hi everybody, 
  
  I get a little idea now that we are heading to Christmas. 
  
  Would be nice to organize a little fund raiser to support our 
 projects. 
  
  We have a lot of great project, but first of all good documentation is 
  not the norm. 
  Then there are a lot of spot where we can improve-- I am thinking 
  about web authentication, friends is great but the same author suggest 
  to add security and a bunch of other type of authentication, but 
  obviously there is more. 
  
  I am making a personal project and I am find some sort of lack in any 
  library I am using, however I don't have neither the time nor the 
  knowledge to really improve the situation. 
  
  Maybe the author of the library would have at least the knowledge so 
  if we can raise some money to buy his/her time would be really nice, 
  wouldn't ? 
  
  Finally we should also involve the company that are using clojure ( 
  http://dev.clojure.org/display/community/Clojure+Success+Stories more 
  http://www.quora.com/Whos-using-Clojure-in-production ) to raise 
  bigger money. 
  
  I thought about and I have some idea how decide what project would get 
  the -hypotetical- money. 
  
  Anyway before to even think about how organize everything I want to 
  know what the community think about that. 
  
  It is possible ? It can be dangerous ? We shouldn't do that ? 
  
  Thanks for the attention. 
  
  Greets 
  
  Simone Mosciatti 
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.com

Re: webnoir on openshift (Paas by RedHat), little guide

2012-09-03 Thread Simone Mosciatti
Yes, I know it is an issue, but I didn't really find any other PaaS (free 
to start) without such problem...

On Monday, September 3, 2012 3:21:02 AM UTC+2, raould wrote:

 now if only they had a webinar that explained the utterly horrendous 
 leagaleze nightmare tolsoty-length terms and conditions. 

 On Fri, Aug 31, 2012 at 2:49 PM, John Holland 
 jbho...@gmail.comjavascript: 
 wrote: 
  This is awesome! 
  
  On Friday, August 31, 2012 4:31:38 PM UTC-4, Simone Mosciatti wrote: 
  
  A little guide to use webnoir on openshift 
  
  http://sisciatech.tumblr.com/post/29614188595/webnoir-in-openshift 
  
  English is not my first language, if you find any mistake please let me 
  know. 
  
  I hope it will be useful to somebody. 
  
  Simone 
  
  -- 
  You received this message because you are subscribed to the Google 
  Groups Clojure group. 
  To post to this group, send email to clo...@googlegroups.comjavascript: 
  Note that posts from new members are moderated - please be patient with 
 your 
  first post. 
  To unsubscribe from this group, send email to 
  clojure+u...@googlegroups.com javascript: 
  For more options, visit this group at 
  http://groups.google.com/group/clojure?hl=en 


-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

webnoir on openshift (Paas by RedHat), little guide

2012-08-31 Thread Simone Mosciatti
A little guide to use webnoir on openshift 

http://sisciatech.tumblr.com/post/29614188595/webnoir-in-openshift

English is not my first language, if you find any mistake please let me 
know.

I hope it will be useful to somebody.

Simone

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: core.match invert match

2012-07-24 Thread Simone Mosciatti
Thanks, it was what i thought...

Any other suggestion is still welcome :-)

On Tuesday, July 24, 2012 12:50:47 AM UTC+2, David Nolen wrote:

 On Mon, Jul 23, 2012 at 6:42 PM, Simone Mosciatti mweb@gmail.com 
 wrote: 
  Hi everybody, 
  I was looking if it is possible to invert the match macro, an example 
 worth 
  more than 1000 words. 
  
  (def x (match [a b] 
 [true true] 0.5 
 [false true] 0.6 
 [true false] 0.4 
 [false false] 0.8)) 
  
  (max x) 
  = [false false] 
  (filter odd? x) 
  = [true true] 
  
  It is possible ? 
  
  I am definitely not an expert but it looks like a core.logic task, 
 doesn't ? 

 If you want to go in both directions yes - core.logic is more suitable. 

 David 


-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

core.match invert match

2012-07-23 Thread Simone Mosciatti
Hi everybody,
I was looking if it is possible to invert the match macro, an example worth 
more than 1000 words.

(def x (match [a b]
   [true true] 0.5
   [false true] 0.6
   [true false] 0.4
   [false false] 0.8))

(max x)
= [false false]
(filter odd? x)
= [true true]

It is possible ?

I am definitely not an expert but it looks like a core.logic task, doesn't ?

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

DAG (Direct Acyclic Graph) and Bayesian Network help

2012-07-14 Thread Simone Mosciatti
Hi guys,
I'm trying to develop a Bayesian Network just for fun XD

My first problem is to understand how represent the graph necessary a DAG.

I come out with something : https://gist.github.com/3111539 
(Very very first stage I just finish to write this code)

But I have some question to how represent properly the DAG.

I need to map every child of every node, or I just need to know the 
(non-)descendants of every node ? Why ?

Do you have any useful link that I can use ? 

Thank you guys anyway.

PS: This is still me 
http://stackoverflow.com/questions/11482474/clojure-dag-bayesian-network#comment15165499_11482474

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: DAG (Direct Acyclic Graph) and Bayesian Network help

2012-07-14 Thread Simone Mosciatti
Yes, I already saw that... But without code doesn't help so much...

On Saturday, July 14, 2012 7:24:41 PM UTC+2, Walter van der Laan wrote:

 Chas Emerick did a presentation on this: 
 http://blip.tv/clojure/chas-emerick-modeling-the-world-probabilistically-using-bayesian-networks-in-clojure-5961126

 But AFAIK the raposo library has not been published yet.

 On Saturday, July 14, 2012 4:20:17 PM UTC+2, Simone Mosciatti wrote:

 Hi guys,
 I'm trying to develop a Bayesian Network just for fun XD

 My first problem is to understand how represent the graph necessary a DAG.

 I come out with something : https://gist.github.com/3111539 
 (Very very first stage I just finish to write this code)

 But I have some question to how represent properly the DAG.

 I need to map every child of every node, or I just need to know the 
 (non-)descendants of every node ? Why ?

 Do you have any useful link that I can use ? 

 Thank you guys anyway.

 PS: This is still me 
 http://stackoverflow.com/questions/11482474/clojure-dag-bayesian-network#comment15165499_11482474



-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] clojure-echonest-api

2012-05-25 Thread Simone Mosciatti
Yes, you right.
Definitely both atom and dynamic is too much, the idea is to set once for 
the whole section at the very start, given anyway the possibility to change 
it by bindig when it is necessary...

I guess that i should use only dynamic... but i got some problem changing 
the var...
I should look better at the doc...

Il giorno venerdì 25 maggio 2012 01:49:41 UTC-5, Ulises ha scritto:

  I am unsure about the atom of api-key, in theory i won't need to change 
 my 
  api-key, but idk... You can get a lot of api-key gratis which are a 
 little 
  limited or just one payed api-key that can do everything... 

 My point was that once you've declared api-key {:dynamic true} (which 
 by the way is not necessary if you define your api key as an atom) you 
 can then either bind it to a different value in a particular thread 
 with (binding ...) or in a particular context with (with-redef ...)[1] 

 This approach works fine when you regularly change your api key 
 depending on the context, however I'm not entirely sure how things 
 would work if you want to set your api-key once for an entire session. 

 U 

 [1] http://clojure.org/vars 


-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] clojure-echonest-api

2012-05-24 Thread Simone Mosciatti
Yep, i changed it in futures...

I am unsure about the atom of api-key, in theory i won't need to change my 
api-key, but idk... You can get a lot of api-key gratis which are a little 
limited or just one payed api-key that can do everything...

Il giorno giovedì 24 maggio 2012 00:56:25 UTC-5, Ulises ha scritto:

  Looking the code again I believe that I should use a future and not an 
  agent... 
  I am right ??? 

 I would think so. AFAIK, the advice has always been if you need to do 
 some computation on another thread don't (ab)use agents, use futures. 

 Additionally, you have[1]: 

 (def #^{:dynamic true} *api-key* (atom N6E4NIOVYMTHNDM8J)) 

 unless you're planning on setting the key to different values in 
 different threads (unlikely?) you don't need to use an atom there. 

 All I've said above could be completely wrong so be warned :) 

 U 

 [1] 
 https://github.com/siscia/echonest-clojure-api/blob/master/src/echonest_api/with-doc-core.clj#L16
  


-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [ANN] clojure-echonest-api

2012-05-23 Thread Simone Mosciatti
Looking the code again I believe that I should use a future and not an 
agent...
I am right ???

Il giorno martedì 22 maggio 2012 16:10:58 UTC-5, Simone Mosciatti ha 
scritto:

 Hi everybody,

 I have release a library to query the echonest[1][2] API.
 This is my very first job so I'm looking for feedback, especially about 
 how to manage some basic configuration[3] and how introduce asynchronously 
 agent[4]...

 I am very happy to have finished this job...

 Please contact me for every question or just to say that i did everything 
 wrong...

 Simone Mosciatti

 [1] http://the.echonest.com/
 [2] http://developer.echonest.com/ 
 [3] Lines 16 and 18 
 https://github.com/siscia/echonest-clojure-api/blob/master/src/echonest_api/with-doc-core.clj#L16
 [4] Line 7 
 https://github.com/siscia/echonest-clojure-api/blob/master/src/echonest_api/with-doc-core.clj#L7


Il giorno martedì 22 maggio 2012 16:10:58 UTC-5, Simone Mosciatti ha 
scritto:

 Hi everybody,

 I have release a library to query the echonest[1][2] API.
 This is my very first job so I'm looking for feedback, especially about 
 how to manage some basic configuration[3] and how introduce asynchronously 
 agent[4]...

 I am very happy to have finished this job...

 Please contact me for every question or just to say that i did everything 
 wrong...

 Simone Mosciatti

 [1] http://the.echonest.com/
 [2] http://developer.echonest.com/ 
 [3] Lines 16 and 18 
 https://github.com/siscia/echonest-clojure-api/blob/master/src/echonest_api/with-doc-core.clj#L16
 [4] Line 7 
 https://github.com/siscia/echonest-clojure-api/blob/master/src/echonest_api/with-doc-core.clj#L7


-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

[ANN] clojure-echonest-api

2012-05-22 Thread Simone Mosciatti
Hi everybody,

I have release a library to query the echonest[1][2] API.
This is my very first job so I'm looking for feedback, especially about how 
to manage some basic configuration[3] and how introduce asynchronously 
agent[4]...

I am very happy to have finished this job...

Please contact me for every question or just to say that i did everything 
wrong...

Simone Mosciatti

[1] http://the.echonest.com/
[2] http://developer.echonest.com/ 
[3] Lines 16 and 18 
https://github.com/siscia/echonest-clojure-api/blob/master/src/echonest_api/with-doc-core.clj#L16
[4] Line 7 
https://github.com/siscia/echonest-clojure-api/blob/master/src/echonest_api/with-doc-core.clj#L7

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Streaming song

2012-04-14 Thread Simone Mosciatti
Hi everybody,

I was looking for streaming a song between my server and my laptop, 
the only problem is that I have no ideas at all, never do something like 
that.

I have a little idea of what aleph is and how it work (very little idea) so 
i was thinking to use that lib and stream byte by byte using the TCP or UDP 
(which one ?) protocol, but then i have no idea how play the song on my 
laptop...

I guess that there is already something, probably in java, that would made 
everything simpler, but i didn't find...

So im looking for every idea, suggestion, link, documentation, everything 
that would be useful (also theorical information/paper).

Thanks everybody

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Congomongo or monger ???

2012-04-09 Thread Simone Mosciatti
Sorry, was my bad...
I was using clojure 1.2.1...

Il giorno venerdì 6 aprile 2012 13:04:35 UTC-5, Michael Klishin ha scritto:

 Simone Mosciatti:

  (Do you need more info ???)

 Simone,

 Please post full exception instead of just Error. If you can put 
 together a small sample
 project on github, even better.

 By the way, Monger has its own mailing list, feel free to post it there:
 https://groups.google.com/forum/#!forum/clojure-monger

 MK



-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Congomongo or monger ???

2012-04-06 Thread Simone Mosciatti
Ok, my bad i was using clojure 1.2... im sorry

Il giorno venerdì 6 aprile 2012 03:11:07 UTC-5, jaju ha scritto:

 On Fri, Apr 6, 2012 at 5:10 AM, Simone Mosciatti mweb@gmail.comwrote:

 Ok, honestly from the readme of github i like better monger,
 but when i try to run it into the shell swank it doesn't work...

 It is a new problem ?
 .(use 'monger.collection)
 ;= Error


 *This* is what you will need to investigate and fix. The library is not 
 in path and has not been imported, most likely.
  

 .(:use 'monger.collection) 

 ;= nil ;; I guess ok


 Not ok for pulling in a library! :) 

 -- 
 jaju


-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Congomongo or monger ???

2012-04-05 Thread Simone Mosciatti
Ok, honestly from the readme of github i like better monger,
but when i try to run it into the shell swank it doesn't work...

It is a new problem ?
.(use 'monger.collection)
;= Error
.(:use 'monger.collection)
;= nil ;; I guess ok
. (insert ,,)
;= Error non var named insert (or something like that)
Is ok this behavior, or is some problem ?
(Do you need more info ???)

Il giorno mercoledì 4 aprile 2012 16:50:52 UTC-5, Michael Klishin ha 
scritto:

 Marcus Lindner:

  But it might be intersting to see the opinions from more experienced 
 people ;).

 Monger [1] has several things Congomongo does not (or did not last time I 
 looked at it):

 * No integration of clj-time (transparent Joda Time types serialization)
 * No integration with clojure.data.json
 * No query DSL à la Korma
 * No recommended way of validating your data

 Which means more choices to make and boilerplate code to write on your 
 part. For basic usage they are probably very similar.

 CongoMongo still supports Clojure 1.2 while Monger was created from the 
 ground up for 1.3 and its dependencies such as Validateur [2] also require 
 Clojure 1.3. So if you have reasons to use 1.2, CongoMongo is a safe bet.

 Full disclosure: I am the author of Monger.

 1. https://github.com/michaelklishin/monger
 2. https://github.com/michaelklishin/validateur

 MK




-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Congomongo or monger ???

2012-04-04 Thread Simone Mosciatti
I don't like try to compare two different work, but when two programs have 
the same task, i never know...

What would you suggest, congomongo or monger (or other) ? Why ? Thoughts ???

My operation would be very easy, write more than read, and update values, 
maybe in a future use of map/reduction...

I will work a lot with json...

Thank you

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: [OT] Any other italian Clojure users?

2012-03-23 Thread Simone Mosciatti
im italian but now im living in USA...
I will come back in july...
Im from Siena

Il giorno giovedì 22 marzo 2012 04:21:02 UTC-5, Marco Dalla Stella ha 
scritto:

 Hi,

 I just want to know if there are any other italian Clojure users in
 the ml, maybe for open an Italian Clojure User Group and organize some
 meetings...

 Thanks,
 -- 
 Marco Dalla Stella
 web: http://thediracsea.org
 twitter: http://twitter.com/kra1iz3c


Il giorno giovedì 22 marzo 2012 04:21:02 UTC-5, Marco Dalla Stella ha 
scritto:

 Hi,

 I just want to know if there are any other italian Clojure users in
 the ml, maybe for open an Italian Clojure User Group and organize some
 meetings...

 Thanks,
 -- 
 Marco Dalla Stella
 web: http://thediracsea.org
 twitter: http://twitter.com/kra1iz3c


Il giorno giovedì 22 marzo 2012 04:21:02 UTC-5, Marco Dalla Stella ha 
scritto:

 Hi,

 I just want to know if there are any other italian Clojure users in
 the ml, maybe for open an Italian Clojure User Group and organize some
 meetings...

 Thanks,
 -- 
 Marco Dalla Stella
 web: http://thediracsea.org
 twitter: http://twitter.com/kra1iz3c


Il giorno giovedì 22 marzo 2012 04:21:02 UTC-5, Marco Dalla Stella ha 
scritto:

 Hi,

 I just want to know if there are any other italian Clojure users in
 the ml, maybe for open an Italian Clojure User Group and organize some
 meetings...

 Thanks,
 -- 
 Marco Dalla Stella
 web: http://thediracsea.org
 twitter: http://twitter.com/kra1iz3c


Il giorno giovedì 22 marzo 2012 04:21:02 UTC-5, Marco Dalla Stella ha 
scritto:

 Hi,

 I just want to know if there are any other italian Clojure users in
 the ml, maybe for open an Italian Clojure User Group and organize some
 meetings...

 Thanks,
 -- 
 Marco Dalla Stella
 web: http://thediracsea.org
 twitter: http://twitter.com/kra1iz3c



-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Google Summer of Code 2012 - any mentors?

2012-02-13 Thread Simone Mosciatti
More students
+1

On Feb 9, 9:54 am, Baishampayan Ghose b.gh...@gmail.com wrote:
 Alexander,

 A discussion is currently ongoing in the Clojure Dev mailing list.

 We are still waiting for someone from Clojure/core to chime in.

 Regards,
 BG

 On Thu, Feb 9, 2012 at 8:53 PM, Alexander Yakushev









 yakushev.a...@gmail.com wrote:
  Hello,

  I am wondering if there is there anybody willing to take part in this
  year's GSoC as a mentor? I would be happy to contribute this summer's
  time to hacking Clojure and there are probably more students that
  would.

  Best regards,
  Alexander

  --
  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 members are moderated - please be patient with 
  your first post.
  To unsubscribe from this group, send email to
  clojure+unsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/clojure?hl=en

 --
 Baishampayan Ghose
 b.ghose at gmail.com

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Print only by clojure code

2012-02-10 Thread Simone Mosciatti
Hi Tassilo,

i tried your macro and its work perfectly, thank you.

On 9 Feb, 01:57, Tassilo Horn tass...@member.fsf.org wrote:
 Cedric Greevey cgree...@gmail.com writes:

 Hi Cedric,

  Just in case the java lib in fact uses System.out/err directly, one
  can redirect standard out and error to something else.

  (with-open [w (clojure.java.io/writer /dev/null)]
   (binding [*out* w, *err* w]
     (.noisyJavaCall1 1 2 3)
     (.noisyJavaCall2 3 2 1)))

  Of course, /dev/null is somewhat platform specific.

  Will that work? I was under the impession that binding *out* and *err*
  had no effect on System/out or System/err.

 No, it won't work.  I tested it briefly in a slime repl and forgot the
 fact that java sysouts aren't printed in there anyway.  So using your
 setOut/Err() advice, here's a java quitening macro that actually works:

 --8---cut here---start-8---
 (defmacro without-java-output [ body]
   `(with-open [w# (java.io.PrintStream. /dev/null)]
      (let [oo# System/out, oe# System/err]
        (System/setOut w#)
        (System/setErr w#)
        (try
          ~@body
          (finally
           (System/setOut oo#)
           (System/setErr oe#))

 (without-java-output
  (.println System/out Hello out)
  (.println System/err Hello err))
 --8---cut here---end---8---

 Bye,
 Tassilo

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Print only by clojure code

2012-02-10 Thread Simone Mosciatti
Hi Tassilo,

i tried your macro and its work perfectly, thank you.

On 9 Feb, 01:57, Tassilo Horn tass...@member.fsf.org wrote:
 Cedric Greevey cgree...@gmail.com writes:

 Hi Cedric,

  Just in case the java lib in fact uses System.out/err directly, one
  can redirect standard out and error to something else.

  (with-open [w (clojure.java.io/writer /dev/null)]
   (binding [*out* w, *err* w]
     (.noisyJavaCall1 1 2 3)
     (.noisyJavaCall2 3 2 1)))

  Of course, /dev/null is somewhat platform specific.

  Will that work? I was under the impession that binding *out* and *err*
  had no effect on System/out or System/err.

 No, it won't work.  I tested it briefly in a slime repl and forgot the
 fact that java sysouts aren't printed in there anyway.  So using your
 setOut/Err() advice, here's a java quitening macro that actually works:

 --8---cut here---start-8---
 (defmacro without-java-output [ body]
   `(with-open [w# (java.io.PrintStream. /dev/null)]
      (let [oo# System/out, oe# System/err]
        (System/setOut w#)
        (System/setErr w#)
        (try
          ~@body
          (finally
           (System/setOut oo#)
           (System/setErr oe#))

 (without-java-output
  (.println System/out Hello out)
  (.println System/err Hello err))
 --8---cut here---end---8---

 Bye,
 Tassilo

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Print only by clojure code

2012-02-08 Thread Simone Mosciatti
Hi guys,

I have developed a very very little application in clojure that use an
external lib in java that i prefer do not touch.

The problem is that this lib for some weird reason (debug i guess)
print at video a bunch of information useless for me, there is any way
to avoid this problem, i mean can i just print what the clojure code
actually print and not what also the lib in java print ?

I'm sorry for my English...

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Lazy-seq of a binary file

2011-12-14 Thread Simone Mosciatti
Ok thank you so much, i got it.

Thanks again ;-)

Simone

On Dec 14, 3:22 am, Cedric Greevey cgree...@gmail.com wrote:
 On Wed, Dec 14, 2011 at 12:04 AM, Simone Mosciatti mweb@gmail.com wrote:
  Thank you so much, just one last thing, why you use a char-array ?

 Reader returns chars.

  If I want use a byte-array, and no map all the whole sequence ?

 Use an InputStream rather than a reader if you're reading binary files
 (or text files as binary). If you're not consuming the whole sequence,
 again, have the part of the code that consumes some and then stops
 also create the stream and be responsible for closing it, passing it
 to the lazy sequence maker; use with-open, and if that part of the
 code still emits a sequence (e.g. (take some-number (remove icky?
 (..., rather than a single object (extracted, reduced, or
 whatever), wrap that sequence in (doall ...) inside the with-open so
 all the needed stream I/O actually is performed before the stream gets
 closed.

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Lazy-seq of a binary file

2011-12-13 Thread Simone Mosciatti
No, I'm sure to not use all the sequence, so I will follow your second
advice, but...

Cause of my non-perfect english I've not really understand the last
part.
 Who is the caller ?
 You suggest something like this:

(let [fl (clojure.java.io/reader path/filename)
  rd (lazy-reader fl)]
(do-my-operation-with-lazy-reader)
(.close fl))

???

Or what ?

On Dec 13, 1:20 am, Cedric Greevey cgree...@gmail.com wrote:
 You also probably want more efficiency. Try something closer to:

 (defn lazy-reader [filename]
   (let [rd (fn [rdr]
              (let [buf (char-array 4096)
                    n (.read rdr buf 0 4096)]
                (condp == n
                  -1 (.close rdr)
                  0 (recur rdr)
                  (take n buf
         lr (fn lr [rdr]
              (lazy-seq
                (if-let [b (rd rdr)]
                  (concat b (lr rdr)]
     (lr (clojure.java.io/reader filename

 which should buffer the reads and terminate when the stream is
 consumed (untested).  I'm not sure how to additionally make the seq
 chunked.

 I avoided with-open to avoid the stream closing before the lazy seq is
 consumed. Instead, it closes only when the lazy seq is fully consumed,
 or when it's been discarded and the GC runs the stream's finalizer
 after discovering that it's become unreachable. The latter could take
 a while (and isn't guaranteed to happen short of the JVM exiting) so
 there's a risk of running out of file handles using this a lot without
 fully consuming the lazy seqs. If that could be an issue, I'd suggest
 modifying it to take a reader rather than a filename, and making the
 caller responsible for instantiating the reader, passing it in,
 (partially) consuming the sequence, and closing the reader if the
 sequence may not have been fully consumed.

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Lazy-seq of a binary file

2011-12-13 Thread Simone Mosciatti
Ok, now by now i think to have understand...

To do right, I should build a macro similar to let where I pass the
filename and after execute the body close the stream, right ?

On Dec 13, 9:42 pm, Cedric Greevey cgree...@gmail.com wrote:
 On Tue, Dec 13, 2011 at 10:14 PM, Simone Mosciatti mweb@gmail.com wrote:
  No, I'm sure to not use all the sequence, so I will follow your second
  advice, but...

  Cause of my non-perfect english I've not really understand the last
  part.
   Who is the caller ?
   You suggest something like this:

  (let [fl (clojure.java.io/reader path/filename)
       rd (lazy-reader fl)]
  (do-my-operation-with-lazy-reader)
  (.close fl))

  ???

 Pretty much, yes. The lazy-reader function will of course not call
 clojure.java.io/reader on its argument, instead just passing it
 directly to its internal function lr. And if
 (do-my-operation-with-lazy-reader) returns a lazy sequence that's
 backed by the lazy-reader sequence, then either it needs to be doall'd
 before (.close fl) or the responsibility for creating and closing the
 reader needs to be pushed up to *its* user. Generally, if dealing with
 data that might not fit in main memory you'd need to push the reader's
 lifetime management up to the level where you're not just wrapping the
 seq but reducing over it, searching it for an item (with something
 like (first (filter ...)) or (first (remove ...)) or (last ...) or
 (some ...)), or picking a limited sample (e.g. (take
 some-finite-number (filter foo (some-wrapped-lazy-reader-seq rdr.

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Lazy-seq of a binary file

2011-12-13 Thread Simone Mosciatti
Where by now:
(defn lazy-reader [fl]
 (assert ...)
 (lazy-seq
 (cons (.read fl) (lazy-reader fl

The first one ?

This means that I haven't understand nothing, right?
(I'm so sorry for this stupid question... :embarassed: )

On Dec 13, 10:23 pm, Cedric Greevey cgree...@gmail.com wrote:
 On Tue, Dec 13, 2011 at 11:12 PM, Simone Mosciatti mweb@gmail.com wrote:
  Ok, now by now i think to have understand...

  To do right, I should build a macro similar to let where I pass the
  filename and after execute the body close the stream, right ?

 Easier to just use the pre-existing one: with-open.

 Something like:

 (with-open [rdr (clojure.java.io/reader foo)]
   (reduce something (filter whatever (transmogrify (lazy-reader rdr)

 will auto-close rdr after the reduction is done, and evaluate to the
 result of the reduction.

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Lazy-seq of a binary file

2011-12-13 Thread Simone Mosciatti
Thank you so much, just one last thing, why you use a char-array ?
If I want use a byte-array, and no map all the whole sequence ?

On Dec 13, 10:39 pm, Cedric Greevey cgree...@gmail.com wrote:
 On Tue, Dec 13, 2011 at 11:33 PM, Simone Mosciatti mweb@gmail.com wrote:
  Where by now:
  (defn lazy-reader [fl]
      (assert ...)
      (lazy-seq
          (cons (.read fl) (lazy-reader fl

  The first one ?

 Er, buffering of the I/O is probably preferable, but that would
 probably work OK in many cases. Just removing the
 (clojure.java.io/reader ...) wrapping the argument in the code I wrote
 will make it take the reader directly as its argument.

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Lazy-seq of a binary file

2011-12-12 Thread Simone Mosciatti
If I do just something like that:

(def fl (clojure.java.io/reader /path/to/file))

(defn lazy-reader [fl]
(lazy-seq
(cons (.read fl) (lazy-reader fl

Can work ? (0.03696 ms for 500 char)
Possible problem ?

On Dec 11, 9:49 pm, Stephen Compall stephen.comp...@gmail.com wrote:
 On Sat, 2011-12-10 at 23:13 -0800, Simone Mosciatti wrote:
  Anyway, i'm looking for read a file byte by byte, perfect would be get
  a lazy-seq of every byte in the file, it's looks, for me, very weird
  that there isn't a built-in or some easy way to do that

 The tradeoffs aren't universal enough to justify one true way to do
 that.  You might be willing to pay the overhead of one LazySeq,
 function, lock, and Byte per byte, but many can't afford it.

  To be honest, I need to read N byte at time (where I know N before to
  read) so I can built anytime a bite-array and put in the necessary
  byte which (def stream (new java.io.FileInputStream filename))
  (def vettore (byte-array N))
  (.read stream vettore)

  But i really don't like this way, the (.read ) is horrible, I guess...

 It's not Clojure style to replace absolutely everything you might do
 with Java interop with a standard Clojure-style library.  Else, there
 would be no motivation to make interop so easy.

 It is Clojure style, though, to use those Clojure libraries that do
 exist, when appropriate.  In this case, see `reader' in the
 clojure.java.io module included with the standard library, as a
 replacement for your `new' call.

 As for the reading part itself, I suggest careful usage of `iterate' and
 `take-while' (or `lazy-seq' and `cons') from the standard library, with
 appropriate .read calls.  Byte-by-byte reading can be accomplished by
 writing a single iterate, a single take-while, and a single .read call.

 --
 Stephen Compall
 ^aCollection allSatisfy: [:each|aCondition]: less is better

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Lazy-seq of a binary file

2011-12-12 Thread Simone Mosciatti
I thought to just put it into a take...

(take number-of-byte-necessary (lazy-reader (clojure.java.io/reader
path/to/file)))

On Dec 12, 12:34 pm, Stephen Compall stephen.comp...@gmail.com
wrote:
 On Mon, 2011-12-12 at 10:21 -0800, Simone Mosciatti wrote:
  (defn lazy-reader [fl]
      (lazy-seq
          (cons (.read fl) (lazy-reader fl

  Can work ? (0.03696 ms for 500 char)
  Possible problem ?

 You need a termination case; your lazy-reader currently always yields an
 infinite sequence.

 --
 Stephen Compall
 ^aCollection allSatisfy: [:each|aCondition]: less is better

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Lazy-seq of a binary file

2011-12-12 Thread Simone Mosciatti
Ok, I found a possible problem, if i try to put all together, so write
something like this:

(defn lazy-reader [filename]
  (with-open [fl (clojure.java.io/reader filename)]
(loop [bite (.read fl)]
(lazy-seq
 (cons (bite) (recur (.read fl)))

Obviously doesn't work...
Any suggest of how fix that ?
Error: CompilerException java.lang.UnsupportedOperationException: Can
only recur from tail position, compiling:(NO_SOURCE_PATH:42)

On Dec 12, 12:42 pm, Simone Mosciatti mweb@gmail.com wrote:
 I thought to just put it into a take...

 (take number-of-byte-necessary (lazy-reader (clojure.java.io/reader
 path/to/file)))

 On Dec 12, 12:34 pm, Stephen Compall stephen.comp...@gmail.com
 wrote:







  On Mon, 2011-12-12 at 10:21 -0800, Simone Mosciatti wrote:
   (defn lazy-reader [fl]
       (lazy-seq
           (cons (.read fl) (lazy-reader fl

   Can work ? (0.03696 ms for 500 char)
   Possible problem ?

  You need a termination case; your lazy-reader currently always yields an
  infinite sequence.

  --
  Stephen Compall
  ^aCollection allSatisfy: [:each|aCondition]: less is better

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Lazy-seq of a binary file

2011-12-11 Thread Simone Mosciatti
Hi Guys,

I'm pretty new of clojure so sorry for the maybe stupid question...

Anyway, i'm looking for read a file byte by byte, perfect would be get
a lazy-seq of every byte in the file, it's looks, for me, very weird
that there isn't a built-in or some easy way to do that, but I haven't
find nothing, it's possible that I haven't search enough ?

To be honest, I need to read N byte at time (where I know N before to
read) so I can built anytime a bite-array and put in the necessary
byte which (def stream (new java.io.FileInputStream filename))
(def vettore (byte-array N))
(.read stream vettore)

But i really don't like this way, the (.read ) is horrible, I guess...

Any suggest ?

-- 
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 members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en