Write/reading java maps and lists using fressian/transit

2014-08-07 Thread Islon Scherer
Hi,

I have a program I wrote who needs to serialize java HashMaps and 
ArrayLists to and from disk but AFAIK (and after some simple tests) it 
seems fressian writes those maps/lists correctly but read them back as 
clojure maps and lists (persistent).
Is there a way to tell fressian (could be transit too) to read them back as 
java maps/lists?
Just for some context, it's a huge amount of data and it should be 
serialized in binary format/non-human readable way for performance and 
space considerations. All the data is composed of simple types (maps, 
lists, strings, numbers, keywords only. No complex objects)
I'm thinking about maybe just using some java serialization library if 
fressian/transit doesn't support that.

Thanks in advance.

-- 
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: Write/reading java maps and lists using fressian/transit

2014-08-07 Thread Islon Scherer
Ok, I got it. Instead of using transit-clj I can user the java library 
directly. The reader automatically returns ArrayList and HashMap. Great!

On Thursday, August 7, 2014 8:11:50 PM UTC+2, Thomas Heller wrote:

 Both Transit and fressian take a Handler map as arguments to the 
 reader/writer functions/constructors. So its pretty straightforward to 
 replace the default handlers with handlers that do what you want. 

 I have no example handy but it should be documented in both libraries. 
 Transit has something called mapBuilder, not sure about fressian.

 HTH,
 /thomas

 On Thursday, August 7, 2014 2:48:20 PM UTC+2, Islon Scherer wrote:

 Hi,

 I have a program I wrote who needs to serialize java HashMaps and 
 ArrayLists to and from disk but AFAIK (and after some simple tests) it 
 seems fressian writes those maps/lists correctly but read them back as 
 clojure maps and lists (persistent).
 Is there a way to tell fressian (could be transit too) to read them back 
 as java maps/lists?
 Just for some context, it's a huge amount of data and it should be 
 serialized in binary format/non-human readable way for performance and 
 space considerations. All the data is composed of simple types (maps, 
 lists, strings, numbers, keywords only. No complex objects)
 I'm thinking about maybe just using some java serialization library if 
 fressian/transit doesn't support that.

 Thanks in advance.



-- 
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: Is Korma still a good current choice for DB backend?

2014-07-23 Thread Islon Scherer
Sean, that was exactly what we did when we changed to yesql. With separated 
queries our Postgres specialist could optimize each query separately, and 
for the if nesting we used cond or core.match. Even with all the 
boilerplate of maintaining separated queries it was still much better than 
Korma limited DSL. How much better yesql was compared to raw 
clojure.java.jdbc was an open question though.

On Wednesday, July 23, 2014 4:35:14 AM UTC+2, Sean Corfield wrote:

 I'm curious as to how folks using Yesql deal with conditional queries - 
 which is something we seem to run into a lot.

 For example, we have some business logic that might optionally be passed a 
 date range and maybe some other qualifier so our query would be:

 (str SELECT ... main query stuff WHERE basic conditions
 (when date-range (str  AND dateUpdated = ? AND dateUpdated  ?))
 (when qualifier  AND someColumn = ?))

 and then some conditions to build the parameters:

 (cond- basic-params
 date-range (concat date-range)
 qualifier (concat [qualifier]))

 It seems like with Yesql we'd have to have four different query functions 
 and then code like this:

 (if date-range
 (if qualifier
 (query-with-date-range-and-qualifier db basic params (first date-range) 
 (second date-range) qualifier)
 (query-with-date-range db basic params (first date-range) (second 
 date-range)))
 (if qualifier
 (query-with-qualifier db basic params qualifier)
 (query-basic db basic params)))

 Sean

 On Jul 22, 2014, at 6:08 AM, Timothy Baldridge tbald...@gmail.com 
 javascript: wrote:

 Also, read the rationale behint yesql: 
 https://github.com/krisajenkins/yesql IMO, it hits the nail on the head. 
 ORMs are both crappy object systems and crappy DB DSLs. With a library like 
 yesql you write your queries in pure SQL and get pure data back. Now you 
 can fully leverage both SQL and Clojure. 




-- 
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: Meta-eX - The Music of Code

2014-04-14 Thread Islon Scherer
Overtone is amazing, I'm planning on doing some experiments with it as soon 
as I finish the supercollider book and improve my music theory skills.

On Friday, April 11, 2014 4:44:22 PM UTC+2, Sam Aaron wrote:


 On 10 Apr 2014, at 03:18, Earl Jenkins ejenk...@gmail.com javascript: 
 wrote: 

  Good stuff, all the hard work you've done in the field of live coding, 
 yet no mention of Meta-ex nor clojure in the Computer Music Journal which 
 has a whole issue dedicated to this subject  ;( 

 To be honest, Overtone was never targeted at academics. It was built for 
 Clojure hackers to be able to use their programming skills to realise their 
 musical ideas. As such, it's gained a lot of traction with progressional 
 programmers. 

 I'm continuously amazed with what people are doing with Overtone - 
 stretching it in incredible ways. However, I feel that the best is still 
 yet to come. Now is a fantastic time to get involved... 

 Sam 

 --- 
 http://sam.aaron.name

-- 
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: Latest web framework for clojure

2014-02-28 Thread Islon Scherer
If you are learning go with a simple approach (compojure + http-kit + 
hiccup for example). If you already know clojure I recommend going with 
some library that provide everything as data, specially the routes, as the 
function composition approach of compojure only gets you so far (been 
there).

On Friday, February 28, 2014 12:05:08 PM UTC+1, xavi wrote:

 I would recommend this combination of libraries:

 - Compojure
 - lib-noir
 - Enlive and Enfocus, for server-side and client-side templating 
 respectively (I've also used Hiccup, but I prefer Enlive/Enfocus because 
 with these, templates are pure HTML; I prefer them even for solo projects, 
 but I would especially recommend them if the HTML/CSS is going to be 
 written by people that don't necessarily know anything about 
 Clojure/ClojureScript).
 - CongoMongo, if you're using MongoDB as a database (there's also Monger, 
 but I don't have any experience with it)

 Some time ago I open-sourced a base web, with a complete authentication 
 system, that used these libraries. Maybe you'll find it useful
 https://github.com/xavi/noir-auth-app

 Cheers,
 Xavi

 On Thursday, February 27, 2014 2:57:07 AM UTC+1, Moritz Ulrich wrote:

 Om is well-suited to handle the UI-part for you. It doesn't do any 
 server communication or forces you into any particular programming 
 style or project layout. 

 On Thu, Feb 27, 2014 at 2:35 AM, Mark Engelberg 
 mark.en...@gmail.com wrote: 
  As far as I can tell, neither luminus nor caribou are well-suited to 
  building, for example, interactive web apps like this web-based chat 
 room 
  which serves as the Hello World for the Opa web framework: 
  https://github.com/MLstate/opalang/wiki/Hello%2C-chat 
  
  Is this the kind of thing that Pedestal and Hoplon are meant for?  Or 
 Om? 
  
  -- 
  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 
  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 
  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. 
  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: Do web apps need Clojure?

2013-11-14 Thread Islon Scherer
For me it's about 1 thing: Data.

A web application is about taking data from the user, transform it and 
store it on the database and take data from the database, transform it and 
show it to the user.
Clojure is the best language I used to work with data, it just gives you a 
composable set of tools and then get out of your way, and there's always 
macros for the more complex use cases.
We have a web application that serves edn data to our clojurescript 
frontend, our webdevelopers created a new site for mobile in backbone.js 
that used json, I had just to create a function (ring middleware) that 
transformed my edn data to json based on the accept header.

My 2¢

On Thursday, November 14, 2013 9:11:04 AM UTC+1, Bastien Guerry wrote:

 Marcus Blankenship mar...@creoagency.com javascript: writes: 

  Brian, that’s really interesting.  I think we’re seeing something 
  similar, and are going to look at Pedestal and Caribou as options for 
  a project we’re working on.  Are their others we should consider? 

 Perhaps you should consider starting from scratch, in parallel. 

 Maybe that's because I'm a beginner in both the language and in web 
 development, but so far I've found it's the best way to understand the 
 choices behind framaworks.  Otherwise I would confuse web development 
 with those choices, and I feel the richness of the Clojure ecosystem 
 is precisely to open your mind about web development. 

 2 cents, 

 -- 
  Bastien 


-- 
-- 
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: wally: a alternative way to discover functions

2013-09-09 Thread Islon Scherer
Florian: I filter out all functions that end with ! but I can't know for 
sure which functions have side effects.

On Sunday, September 8, 2013 7:24:48 AM UTC+2, Florian Over wrote:

 Hi,
 you could check for io! to find forms with side-effect, but i think it is 
 seldom used.
 Florian

 http://clojuredocs.org/clojure_core/clojure.core/io!


 2013/9/8 Maximilien Rzepka maximili...@gmail.com javascript:

 Found many times apropos useful...
 user (apropos partition)
 (partition-by partition-all partition)

 But wally approach is really cool.
 Thanks for sharing 
 @maxrzepka

 Le jeudi 5 septembre 2013 23:23:28 UTC+2, Islon Scherer a écrit :

 Hey guys,

 I don't know about you but when I was a beginner in Clojure (and it 
 still happens every now and then) I had a hard time finding functions using 
 `doc` or `find-doc`,
 normally because I didn't remember the name of the function or because 
 my only clue was a generic name so find-doc would return too much results. 
 But one
 thing I knew: what to expect of the function, I knew the inputs and the 
 outputs. That's why I decided to create wally, because sometimes you don't
 know the name of the function you want but you know how it should behave.

 With wally you can tell the inputs and the output and it'll search for 
 functions that match those inputs/outputs.

 Ex:

 user= (find-by-sample {1 1, 2 3, 3 1, 4 2} [1 2 3 4 4 2 
 2])-clojure.core/frequencies([coll])
   Returns a map from distinct items in coll to the number of times
   they appear.


 user= (find-by-sample '((1 2 3) (4 5)) (partial  3) [1 2 3 4 5])
 -
 clojure.core/partition-by
 ([f coll])
   Applies f to each value in coll, splitting it each time f returns
a new value.  Returns a lazy seq of partitions.


  
 https://github.com/**stackoverflow/wallyhttps://github.com/stackoverflow/wally

  -- 
 -- 
 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: wally: a alternative way to discover functions

2013-09-07 Thread Islon Scherer


 I wonder if it would be possible to improve it using the core.typed 
 library and doing some kind of static analysis similar to Haskell's Hoogle 
 to filter out candidates.

The problem is most Clojure functions don't use core.type nor are type 
annotated.
It would be nice if pure functions had some metadata like :pure true. =) 

On Saturday, September 7, 2013 1:53:08 AM UTC+2, Chris-tina Whyte wrote:

 Interesting!

 Though it executes every function in order to find the matches, which is a 
 little bit dangerous as Clojure doesn't enforce purity :( 

 I wonder if it would be possible to improve it using the core.typed 
 library and doing some kind of static analysis similar to Haskell's Hoogle 
 to filter out candidates.

 On Thursday, September 5, 2013 6:23:28 PM UTC-3, Islon Scherer wrote:

 Hey guys,

 I don't know about you but when I was a beginner in Clojure (and it still 
 happens every now and then) I had a hard time finding functions using `doc` 
 or `find-doc`,
 normally because I didn't remember the name of the function or because my 
 only clue was a generic name so find-doc would return too much results. But 
 one
 thing I knew: what to expect of the function, I knew the inputs and the 
 outputs. That's why I decided to create wally, because sometimes you don't
 know the name of the function you want but you know how it should behave.

 With wally you can tell the inputs and the output and it'll search for 
 functions that match those inputs/outputs.

 Ex:

 user= (find-by-sample {1 1, 2 3, 3 1, 4 2} [1 2 3 4 4 2 
 2])-clojure.core/frequencies([coll])
   Returns a map from distinct items in coll to the number of times
   they appear.


 user= (find-by-sample '((1 2 3) (4 5)) (partial  3) [1 2 3 4 5])
 -
 clojure.core/partition-by
 ([f coll])
   Applies f to each value in coll, splitting it each time f returns
a new value.  Returns a lazy seq of partitions.


  https://github.com/stackoverflow/wally



-- 
-- 
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: wally: a alternative way to discover functions

2013-09-06 Thread Islon Scherer
Mayank: thanks!

Shaun: I thought about approximations too but that's enough complexity to 
be another library by itself.
If there's such a library that I can feed two values and it returns how 
similar they are with some percentage I would gladly integrate it with 
wally.

Of course wally only works for referential transparent/pure functions but 
that's the majority of Clojure functions anyway =)

On Friday, September 6, 2013 6:44:43 AM UTC+2, Shaun Gilchrist wrote:

 Very cool! I wonder how hard it would be to have it suggest compositions 
 if it can not find a direct match? 


 On Thu, Sep 5, 2013 at 10:34 PM, Mayank Jain fires...@gmail.comjavascript:
  wrote:

 Looks pretty interesting. Thanks for sharing


 On Fri, Sep 6, 2013 at 2:53 AM, Islon Scherer 
 islons...@gmail.comjavascript:
  wrote:

 Hey guys,

 I don't know about you but when I was a beginner in Clojure (and it 
 still happens every now and then) I had a hard time finding functions using 
 `doc` or `find-doc`,
 normally because I didn't remember the name of the function or because 
 my only clue was a generic name so find-doc would return too much results. 
 But one
 thing I knew: what to expect of the function, I knew the inputs and the 
 outputs. That's why I decided to create wally, because sometimes you don't
 know the name of the function you want but you know how it should behave.

 With wally you can tell the inputs and the output and it'll search for 
 functions that match those inputs/outputs.

 Ex:

 user= (find-by-sample {1 1, 2 3, 3 1, 4 2} [1 2 3 4 4 2 
 2])-clojure.core/frequencies([coll])
   Returns a map from distinct items in coll to the number of times
   they appear.


 user= (find-by-sample '((1 2 3) (4 5)) (partial  3) [1 2 3 4 5])
 -
 clojure.core/partition-by
 ([f coll])
   Applies f to each value in coll, splitting it each time f returns
a new value.  Returns a lazy seq of partitions.


  https://github.com/stackoverflow/wally
  
 -- 
 -- 
 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.




 -- 
 Regards,
 Mayank. 

 -- 
 -- 
 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: wally: a alternative way to discover functions

2013-09-06 Thread Islon Scherer
Thanks for the gist, nice solution but it's not viable for real world code 
without some heavy filtering. If I execute it on my current project it 
starts a server, sends a bunch of emails and hangs forever =)

On Friday, September 6, 2013 2:12:29 PM UTC+2, Frantisek Sodomka wrote:

 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 
 happens every now and then) I had a hard time finding functions using `doc` 
 or `find-doc`,
 normally because I didn't remember the name of the function or because my 
 only clue was a generic name so find-doc would return too much results. But 
 one
 thing I knew: what to expect of the function, I knew the inputs and the 
 outputs. That's why I decided to create wally, because sometimes you don't
 know the name of the function you want but you know how it should behave.

 With wally you can tell the inputs and the output and it'll search for 
 functions that match those inputs/outputs.

 Ex:

 user= (find-by-sample {1 1, 2 3, 3 1, 4 2} [1 2 3 4 4 2 
 2])-clojure.core/frequencies([coll])
   Returns a map from distinct items in coll to the number of times
   they appear.


 user= (find-by-sample '((1 2 3) (4 5)) (partial  3) [1 2 3 4 5])
 -
 clojure.core/partition-by
 ([f coll])
   Applies f to each value in coll, splitting it each time f returns
a new value.  Returns a lazy seq of partitions.


  https://github.com/stackoverflow/wally



-- 
-- 
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.


wally: a alternative way to discover functions

2013-09-05 Thread Islon Scherer
Hey guys,

I don't know about you but when I was a beginner in Clojure (and it still 
happens every now and then) I had a hard time finding functions using `doc` 
or `find-doc`,
normally because I didn't remember the name of the function or because my 
only clue was a generic name so find-doc would return too much results. But 
one
thing I knew: what to expect of the function, I knew the inputs and the 
outputs. That's why I decided to create wally, because sometimes you don't
know the name of the function you want but you know how it should behave.

With wally you can tell the inputs and the output and it'll search for 
functions that match those inputs/outputs.

Ex:

user= (find-by-sample {1 1, 2 3, 3 1, 4 2} [1 2 3 4 4 2 
2])-clojure.core/frequencies([coll])
   Returns a map from distinct items in coll to the number of times
   they appear.


user= (find-by-sample '((1 2 3) (4 5)) (partial  3) [1 2 3 4 5])
 -
 clojure.core/partition-by
 ([f coll])
   Applies f to each value in coll, splitting it each time f returns
a new value.  Returns a lazy seq of partitions.


 https://github.com/stackoverflow/wally

-- 
-- 
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: Multiple REPLs in Emacs? (was: test run startup time

2013-07-12 Thread Islon Scherer
Here at doo we have a shortcut C-c X where X is a number to change 
between nrepls.

The code is in https://github.com/maxweber/emacs.d/blob/master/my/nrepl.el

Note that the nrepl ports are hardcoded but it's good enough for us.

Hope this helps.

--
Islon

On Thursday, July 11, 2013 11:53:31 PM UTC+2, Sean Corfield wrote:

 On Wed, Jul 10, 2013 at 10:53 AM, Jay Fields 
 j...@jayfields.comjavascript: 
 wrote: 
  I work in emacs with 2 repls running - 1 for running my app and 1 for 
  running my tests. 

 What is the magic to get this working and how does Emacs / nrepl.el 
 know which REPL to send commands to? 

 I've often wanted multiple active REPLs (usually for working with 
 multiple projects) but have never figured out how to get it working... 
 -- 
 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
--- 
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.




Functions that return seqs

2013-07-02 Thread Islon Scherer
One things that always bugged me about clojure is that most functions that 
work on collections return seqs and not the original data structure type:

(= [2 4 6] (- [2 [4]] flatten (conj 6)))
= false

Every time I transform collections I need to be aware of this.
My questions is: is there a philosophical reason for that or it was 
implement this way because it's easier? Why conj is different?
Doesn't it break the principle of least surprise?

Thanks,
Islon

-- 
-- 
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: Functions that return seqs

2013-07-02 Thread Islon Scherer
Thanks for all the answers.
Agreed that sequences are a great abstraction (100 functions in 1 data 
structure instead of 10 to 10) and, as David said, there's value in having 
the return type to be predictable.
I think a 'generics collection functions' library would be nice for those 
edge cases you want those functions to be generic.

I guess the philosophical reason is that 'concrete types don't 
 really matter'... 

Well, maybe most of the time, but there's cases where the concrete type 
semantics matters a lot, specially with sets but sometimes with vectors 
too, right now i'm using into or just calling vec|set or reducers library 
but maybe I'll try to implement this generics library I just talk about as 
it's really easy to do that in clojure =)

Islon

-- 
-- 
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: Lambda: A lniux distro for clojurists

2012-05-26 Thread Islon Scherer
Why not create a shell script?

On May 26, 9:32 am, Denis Labaye denis.lab...@gmail.com wrote:
 Hi,

 This is a very interesting idea. It would have been of great use when I
 did a Clojure workshop with complete beginners, with all kinds of OSes
 (Windows, OSX, ...).

 I took the Completely packaged VirtualBox image approach, but it is
 still a big mess: Not everyone have VirtualBox installed (or the right
 version). And not every flavors of the main editors where correctly
 configured for Clojure (Emacs, vi).

 Being able to just boot on a live CD, and have a working Clojure
 environment would have been great. Also great for distribution: Just
 burn it on a lot of cheap Cd's, and much more down loadable: A Virtual
 Box image takes about 2gig, a live CD is 700meg.

 Cheers,

 Denis

 On Thu, May 24, 2012 at 10:11 PM, banseljaj ali.sajid.im...@gmail.comwrote:







  Hello Guys,

  I am quite new to clojure, and I am a fan. It's a great thing. One thing
  that seems missing, however, is a single unified way of setting up the
  clojure environment. Which seemed pretty daunting to me at first.

  So I have decided to create a Linux Distro specifically for Clojure
  development.

  I have been bouncing this idea in #clojure and it got a good response. So
  now I have started the complete development effort.

  My plan so far is as follows.

  Mission Statement for the Distro

  The distro should be able to:

     - Connect to internet.
     - Be able to convert itself into An VM/Iso/LiveCD etc
     - Have all IDEs for Clojure installed and preconfigured.
        - Eclipse
        - Vim
        - Emacs
        - Netbeans
     - Have a ready to play connection to clojure forums and channels
     - Have at-least one book on clojure programming on board
     - Have following clojure specific features
        - It should have leiningen installed and configured
        - It should have a local repo of all current clojure plugins
        - It should have a local cloud on which you can deploy web apps
        easily
        - it should have REPLlabs on baord and configured
     - Have Clojure specific branding

  The packages that are needed absolutely:

     - OpenJDK 1.7.0
     - Leiningen
     - Clojure
     - Eclipse
     - Vim
     - Emacs 24
     - Netbeans
     - Emacs Starter kit
     - CCW plugin for eclipse
     - Firefox/Chrome
     - A local webserver
     - Postgresql
     - LXDE/XFCE
     - Gwibber/Other Social network Client
     - xchat
     - irssi
     - git
     - Regular packages for system functioning.

  I am still open to ideas. I intend to roll it as a complete distro, so I
  will love any and all input.

  For now, the specific things I need input for are:

     - Who/How to create the art for branding.
     - Any packages that are missing from the above listing.
     - Any suggestions for the overall functioning.

  I will soon have an actual website set up.

  It is my intention to create a fully functional, independent Development
  environment for Functional programmers by release 2. Right now, I am
  working on release 0.0.1.

  Looking forward to all input.

  regards.

  banseljaj

   --
  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 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: Sum on a list of maps

2011-10-14 Thread Islon Scherer
The best i could think was:

 (defn calc-types [coll]
  (let [types (map (fn [m] {:type (get m Type) :value (Double/parseDouble 
(get m Value))}) coll)  ; convert keys to keywords and values to doubles
it1 (sort-by :type types) ; sort by type
a (atom (:type (first it1)))
it2 (partition-by (fn [m] (if (not= (:type m) @a) (do (reset! a 
(:type m)) true) false)) it1)] ; partition by type
(map (fn [l] {:type (:type (first l)), :value (reduce + (map :value 
l))}) it2))) ; map reduce

Hope it helps.
P.S: Try to use keywords and numbers instead of strings, the function will 
be simpler

-- 
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: Learning clojure - comments on my function?

2011-09-29 Thread Islon Scherer
You probably want something like

(defn split-zero [ls]
(filter #(not= (first %) 0) (partition-by zero? ls)))

-- 
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: suggestion for clojure development

2011-09-28 Thread Islon Scherer
I agree with Nicolas, clojure should, at this point, focus on improving the 
language instead of maintain compatibility, and as most features of other 
languages can be implemented as macros I think clojure is ahead of the 
competition.

-- 
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: lein repl newbie question

2011-09-23 Thread Islon Scherer
Have you tried control+d?

-- 
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: Re: lein repl newbie question

2011-09-23 Thread Islon Scherer
control+d exits clojure repl

-- 
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: advantage of dynamic typing

2011-09-20 Thread Islon Scherer
Scala is a OO language with FP support, clojure is a functional language 
with OO support, they are very different.
It's normal for someone with a OO background to think that every method 
receives a object of some kind and it's good to know it's type in advance, 
and if you want polymorphism you create a subclass or implement an interface 
but in clojure functions are polymorphic not classes.
Let's take the function first as an example, if you give a String to first 
you'll get the first char, if you give a vector or list you'll get the first 
element, if you give a java array you'll get the element at index 0.
In scala each collection class has a overriden first method so you can have 
a static and pre-defined return type, in clojure the first function is 
itself polymorphic so it doesn't make sense to say that the return type of 
first is Object because it depends on the parameter.
You can code clojure's first function in scala but the parameter and return 
type would be Object, and you would have to typecast it anyway. (Maybe with 
scala's extremely fancy type system you can create a generic first function 
a la clojure but the type signature would make my eyes hurt :)
With doc, source (the functions) and the repl, a static typing system 
would'n be that useful

-- 
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: Top secret clojure project names

2011-09-01 Thread Islon Scherer
I have a big clojure project at work but it's not a secret. It
superseded a old java project, the clojure one is 50 times smaller, 10
times faster and bug free. They had no choice but to accept the new
one =)

On Sep 1, 6:54 pm, Sean Corfield seancorfi...@gmail.com wrote:
 On Thu, Sep 1, 2011 at 2:31 PM, JAX jayunit...@gmail.com wrote:
  Hi guys: I assume some of you have secret Clojure projects at work, that 
  your bosses don't know about.

 LOL! That would be hard for me - every commit and every ticket update
 / comment is emailed to the whole project team which includes
 management :)

 It does pose an interesting question tho': how many folks are using
 skunkwork projects to introduce Clojure vs opening getting buy in up
 front?
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View --http://corfield.org/
 World Singles, LLC. --http://worldsingles.com/
 Railo Technologies, Inc. --http://www.getrailo.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


Re: learning clojure library

2011-08-03 Thread Islon Scherer
You can use (ns-publics 'your.namespace) to see every public intern mapping 
in this namespace.

Islon

-- 
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: Code structure/design problems

2011-07-28 Thread Islon Scherer
Hi Oskar, I've been a game programmer for more than 5 years going from 
simple card games to 3D MMORPGs.
Even though you can make a simple game in a functional way it would be a big 
challenge to do the same with a moderately complex game.
Games are all about state, your character if full of state, the enemies have 
state, the world, the AI, the physics, etc.
If you're creating a complex game the language you chose is the least of 
your concerns, the graphics engine, physics engine, AI engine is what really 
matters.
I'm not saying you can't create a game in clojure(I already did) and if your 
main objective is to learn clojure go ahead, but don't be afraid to model 
stateful entities.
However, if you're thinking about making a complex/commercial game I 
strongly advise you use a game engine, there are good free game engines out 
there and it will make your game 2 or 3 orders of magnitude faster to 
finish.

Islon

-- 
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: Need Help Parsing Clojure Strings

2011-07-25 Thread Islon Scherer
Do you want something like:
(vec (.split some-string \\|))

(vec (.split AT|1 Kenilworth Rd||Soapville|ZA|99901-7505|Option value=A == 
Normal street matchOption value=T == ZIP+4 corrected|013|C065| \\|))
= [AT 1 Kenilworth Rd  Soapville ZA 99901-7505 Option value=A 
== Normal street matchOption value=T == ZIP+4 corrected 013 C065]

-- 
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

JSON library for clojure 1.3

2011-07-22 Thread Islon Scherer
Is there a clojure json library that works in clojure 1.3?
I tried danlarkin/clojure-json but it gives me error: 
java.lang.IllegalArgumentException: Unable to resolve classname: 
IPersistentMap, compiling:(org/danlarkin/json/encoder.clj:144)

-- 
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: JSON library for clojure 1.3

2011-07-22 Thread Islon Scherer
Thanks Sean, org.clojure/data.json worked like a charm.

-- 
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: JSON library for clojure 1.3

2011-07-22 Thread Islon Scherer
I'll take a look, but I only need basic json encoding/decoding right now.

Islon

-- 
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: Being able to use blank?

2011-07-21 Thread Islon Scherer
I think it's just a sintax problem.

(ns test-csv
  ...
  (:require [clojure.string :as str]))

-- 
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: How to Return Vector of Vectors

2011-07-21 Thread Islon Scherer
Simple: conj doesn't mutate the vector, it returns a new vector.
Clojure is a (mostly) immutable language, you're trying to solve the
problem in a imperative way, you should solve it in a functional way.

On Jul 21, 7:48 pm, octopusgrabbus octopusgrab...@gmail.com wrote:
 (def accumail-url-keys [CA, STREET, STREET2, CITY, STATE,
 ZIP, YR, BILL_NO, BILL_TYPE])

 (defn ret-params
     Generates all q-parameters and returns them in a vector of
 vectors.
     [all-csv-rows]
     (let [param-vec [[]] ]
         (doseq [one-full-csv-row all-csv-rows]
             (let [accumail-csv-row one-full-csv-row
                   q-param (zipmap accumail-url-keys accumail-csv-row)
                   accu-q-param (first (rest (split-at 3 q-param)))
                   billing-param (first (split-at 3 q-param))]
                 (conj param-vec accu-q-param billing-param)))
          param-vec))

 I combine some internal data with each vector returned from clojure-
 csv's parse-csv. I want to return all that in a new vector of vectors,
 but param-vec is empty. What am I doing wrong?

 tnx
 cmn

-- 
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: Fixing Java Apache Class error

2011-07-20 Thread Islon Scherer
Mark is right, you should use lein (or cake) repl instead of trying to run 
clojure on command line.

-- 
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: Anyone on Google+ yet?

2011-07-14 Thread Islon Scherer
http://gplus.to/islonscherer

On Jul 14, 8:55 pm, Sean Corfield seancorfi...@gmail.com wrote:
 On Thu, Jul 14, 2011 at 4:00 PM, ianp ian.phill...@gmail.com wrote:
  Looks like G+ is pretty popular with the Clojure crowd :-)

 I've been using it for a while and I don't see the point. With
 Facebook for *friends* and Twitter for tech talk (and LinkedIn for
 professional networking), what purpose does G+ have?

 I just found it annoying. I recently turned off all email
 notifications and deleted everyone from my circles and disabled most
 of the features and now, apart from the occasional annoying red
 notification icon in Gmail, I can completely ignore it.

 Is it just a case of ooh, shiny! Google released a new toy! or is
 there actually some tangible useful benefit to a developer being on
 G+?
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View --http://corfield.org/
 World Singles, LLC. --http://worldsingles.com/
 Railo Technologies, Inc. --http://www.getrailo.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


Re: Clojure for large programs

2011-07-04 Thread Islon Scherer
I think  the issue with large programs is not the language but
software engineering.
A large program should be well designed and architected, and this is a
problem (I think) many
people in clojure and functional programming in general have. Clojure
is a very high level and concise language so I'll grow my program as I
type.
I'm not proposing UML or any specific tool or technique, but analysis
and design are a important part of a large software.
It's easier to understand your problem if you look at your high level
documentation/diagrams than look at code. Of course some problems and
refactor
will happen no matter how well you designed, but you'll understand
better what you did and what you should do.

Islon

On Jul 4, 9:40 am, James Keats james.w.ke...@gmail.com wrote:
 On Jul 4, 1:26 pm, James Keats james.w.ke...@gmail.com wrote:

  On Jul 4, 5:45 am, Christian Schuhegger
  A good
  book to get you started would SEMANTIC WEB for the WORKING ONTOLOGIST,
  of which a second edition has recently come out. :-)

 Sorry about the unintentional to get you started figure of speech; I
 note you said you already had rdf/owl in your kit. It's not out of
 underestimating your knowledge (though it might be out of my sense of
 being mildly overwhelmed by the still remaining reading list I already
 have of semantic web books, Springer just keeps dropping them like
 rain. :-)

-- 
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


date-clj clojure date/time library

2011-06-29 Thread Islon Scherer
Hello people.
I've created date-clj, a date/time library for clojure.
I know there's clj-time already but I was thinking about something
less javaish and more like date.js.

Some examples:

(date :day 25 :month :november :year 2000)
- #Date Sat Nov 25 00:00:00 BRST 2000

(- (today) (set-date :month :december :year 1900))
- #Date Sat Dec 29 16:44:33 BRST 1900

(from-now 1 :year 5 :days)
- #Date Wed Jul 04 16:44:33 BRST 2012

(back 1 :month 200 :minutes)
- #Date Sun May 29 13:26:33 BRST 2011

(following :friday)
- #Date Fri Jul 01 16:47:17 BRST 2011

(- (today) (is? :friday 13))
- false

(- (back 3 :days) (was? :sunday))
- true

(- (april) sundays first)
- #Date Sun Apr 03 00:00:00 BRST 2011

(- (following :month) fridays last)
- #Date Fri Jul 29 00:00:00 BRST 2011

(monday)
- #Date Mon Jun 27 00:00:00 BRST 2011

(binding [*locale* (Locale/GERMAN)] (names :week-days))
- (Sontag Montag Dienstag Mittwoch Donnerstag Freitag
Samstag)


The project page is: http://github.com/stackoverflow/date-clj

Critics and ideas are welcome =)
Regards,
Islon

-- 
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: date-clj clojure date/time library

2011-06-29 Thread Islon Scherer
Thanks for the critic Laurent.
set-date is not destructive, it creates a new date and returns it, the
original is unaltered,
but I agree that the documentation and the function name may be
deceiving, I'll think about a better name and change the docs.

Islon

On Jun 29, 5:29 pm, Laurent PETIT laurent.pe...@gmail.com wrote:
 Or to be more constructive:

 maybe set-date al should be renamed set-date! ...

 ... the more clojurish a library will look like, the more
 expectations people will have on it (principle of least surprise) even
 before verifying their assumptions are true (e.g. a pure clojure
 library = works with immutable -if not persistent- datastructures)

 My 0.02€,

 --
 Laurent

 2011/6/29 Islon Scherer islonsche...@gmail.com:







  Hello people.
  I've created date-clj, a date/time library for clojure.
  I know there's clj-time already but I was thinking about something
  less javaish and more like date.js.

  Some examples:

  (date :day 25 :month :november :year 2000)
  - #Date Sat Nov 25 00:00:00 BRST 2000

  (- (today) (set-date :month :december :year 1900))
  - #Date Sat Dec 29 16:44:33 BRST 1900

  (from-now 1 :year 5 :days)
  - #Date Wed Jul 04 16:44:33 BRST 2012

  (back 1 :month 200 :minutes)
  - #Date Sun May 29 13:26:33 BRST 2011

  (following :friday)
  - #Date Fri Jul 01 16:47:17 BRST 2011

  (- (today) (is? :friday 13))
  - false

  (- (back 3 :days) (was? :sunday))
  - true

  (- (april) sundays first)
  - #Date Sun Apr 03 00:00:00 BRST 2011

  (- (following :month) fridays last)
  - #Date Fri Jul 29 00:00:00 BRST 2011

  (monday)
  - #Date Mon Jun 27 00:00:00 BRST 2011

  (binding [*locale* (Locale/GERMAN)] (names :week-days))
  - (Sontag Montag Dienstag Mittwoch Donnerstag Freitag
  Samstag)

  The project page is:http://github.com/stackoverflow/date-clj

  Critics and ideas are welcome =)
  Regards,
  Islon

  --
  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 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 ideas repository / todo list

2011-05-15 Thread Islon Scherer
Good ideas, I'm thinking about implementing it as my first clojure web
project.

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


Clojure ideas repository / todo list

2011-05-14 Thread Islon Scherer
Is there anyplace people post ideas of libraries/frameworks/functions
that would be nice to be implemented in clojure?
Sometimes I want to help the community but I don't know what to do (an
idea), what's already done (yeah, I know one can search github or ask
here but you can't be 100% sure it's not already implemented). Maybe a
wiki or something like that would do the job.

Thanks in advance,
Islon

-- 
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: Learning Idiomatic Clojure

2011-05-12 Thread Islon Scherer
Read the joy of clojure, it's an amazing book that will teach you the
way of clojure.

Islon

-- 
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


problem running tests in leiningen

2011-05-06 Thread Islon Scherer
I have a lein project and I'm trying to run my tests with lein test.
The first problem I had was a class not found error in one of my
records
so I put aot: [namespace.name] in project.clj.
It's required that I put all namespaces that contain defrecords/
deftypes in the aot list?

After that I tried to run the tests again and got a different error:
Exception in thread main java.lang.ClassNotFoundException:
clojure.pprint
Inside lein swank this code runs and compiles with no problems, do
lein
execute tests with a different clojure(and/or contrib) version?

This is my project.clj

(defproject mediaretriever 1.0.0-SNAPSHOT
  :description ...
  :dependencies [[org.clojure/clojure 1.2.1]
 [org.clojure/clojure-contrib 1.2.0]
 [enlive 1.0.0]
 [clj-http 0.1.3]
 [clj-time 0.3.0]]
  :dev-dependencies [[swank-clojure 1.3.0]]
  :aot [mediaretriever.media])

Any help is appreciated.
Regards
Islon

-- 
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: Search for a node querying on attrs

2011-05-06 Thread Islon Scherer
This is what I did:

(let [nodes (html/html-resource (StringReader. body))
   meta-extractor (fn [m attr] (first (filter #(= (-
% :attrs :name) attr) m)))
   metas (html/select nodes [:meta])
   title (- (meta-extractor metas title) :attrs :content)
   desc (- (meta-extractor metas description) :attrs :content)
   date-raw (- (meta-extractor metas date) :attrs :content)
   keywords-raw (- (meta-extractor metas
keywords) :attrs :content)
   keywords (string/split keywords-raw #, )]

Hope it helps.

On May 5, 5:18 am, Alfredo alfredo.dinap...@gmail.com wrote:
 Ty very much :)
 Alfredo

 On May 5, 10:05 am, Thorsten Wilms t...@freenet.de wrote:







  On 05/04/2011 06:23 PM, Alfredo wrote:

   meta name=keywords content=clojure, is, good /

   I want to extract only the content part.

  I recently had related issues, so:

  (def metas
     (en/html-snippet
       meta http-equiv=\Content-Type\ content=\text/html;
          charset=UTF-8\ /
        meta name=\keywords\ content=\clojure, is, good\ /))

  (en/select metas [[:meta (en/attr= :name keywords)]])

  (- (en/select metas [[:meta (en/attr= :name keywords)]])
       first :attrs :content)

  --
  Thorsten Wilms

  thorwil's design for free software:http://thorwil.wordpress.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: problem running tests in leiningen

2011-05-06 Thread Islon Scherer
Thanks Stuart, the tests are working now.

On May 6, 12:16 pm, Stuart Halloway stuart.hallo...@gmail.com wrote:
  I have a lein project and I'm trying to run my tests with lein test.
  The first problem I had was a class not found error in one of my
  records
  so I put aot: [namespace.name] in project.clj.
  It's required that I put all namespaces that contain defrecords/
  deftypes in the aot list?

 This should not be a requirement. However, you might need to require the 
 namespace containing the class before using the class.

  After that I tried to run the tests again and got a different error:
  Exception in thread main java.lang.ClassNotFoundException:
  clojure.pprint
  Inside lein swank this code runs and compiles with no problems, do
  lein
  execute tests with a different clojure(and/or contrib) version?

 The standard Clojure repl uses some utility fns from non-core namespaces. 
 Specifically:

      ;; from main.clj
      (use '[clojure.repl :only (source apropos dir pst doc find-doc)])
      (use '[clojure.java.javadoc :only (javadoc)])
      (use '[clojure.pprint :only (pp pprint)])

 When you run code outside the REPL, you will need to use these specifically 
 if you need them.

 Hope this helps.

 Stu

 Stuart Halloway
 Clojure/corehttp://clojure.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: record serialization

2010-11-24 Thread Islon Scherer
Thanks for the answers!
Some guy told me on irc that you can implement interfaces right in the
record definition like
(defrecord R [a b] SomeInterface (methods...))

Regards.
Islon

On Nov 24, 4:25 am, Shantanu Kumar kumar.shant...@gmail.com wrote:
 Shantanu Kumar wrote:
  Islon Scherer wrote:
   Yes, java serialization is what I want but I don't know how to do a
   record implement the Serializable interface.

  The following two steps may help:

  (defrecord Foo [a b])
  (extend java.io.Serializable Foo)

 Oops! that was a bit too fast. Records already implement Serializable.

 Regards,
 Shantanu

-- 
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


record serialization

2010-11-23 Thread Islon Scherer
Hi people, I want to serialize records to further deserializing, is
there a way to do that?
(pr-str myrecord) doesn't seen to work.
I was thinking about something like (to-map record) and (from-map
RecordClass record) to serialize and deserialize.
Any sugestions?

Islon

-- 
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: record serialization

2010-11-23 Thread Islon Scherer
Yes, java serialization is what I want but I don't know how to do a
record implement the Serializable interface.

On Nov 23, 2:46 pm, Shantanu Kumar kumar.shant...@gmail.com wrote:
 Not sure about your exact requirement, but can Java serialization
 help? You may need to extend the Serializable interface to the
 records.http://java.sun.com/developer/technicalArticles/Programming/serializa...

 Regards,
 Shantanu

 On Nov 23, 5:50 pm, Islon Scherer islonsche...@gmail.com wrote:







  Hi people, I want to serialize records to further deserializing, is
  there a way to do that?
  (pr-str myrecord) doesn't seen to work.
  I was thinking about something like (to-map record) and (from-map
  RecordClass record) to serialize and deserialize.
  Any sugestions?

  Islon

-- 
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


clojure compiler

2010-08-05 Thread Islon Scherer
Ok, this question is not about clojure itself, just a doubt I have.
Clojure uses the ASM library to compile code to jvm bytecode.
Let's suppose I created the foo.clj and bar.clj source files.
The ns foo in foo.clj depends on the functions of bar in bar.clj.
How the compiler manages file dependencies?

Islon

-- 
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: ClojureDocs.org

2010-07-16 Thread Islon Scherer
Hi.

Does clojuredocs expose any external API (json, xml... rest,
webservices, etc) so I can access the docs from my code?

Islon

On Jul 13, 11:40 pm, j-g-faustus johannes.fries...@gmail.com wrote:
 On Jul 13, 8:37 pm, Paul Moore p.f.mo...@gmail.com wrote:

  Can I suggest omitting the Table of contents sidebar when printing?
  I've not tried printing the document to see how it looks, but removing
  the sidebar would be an essential starting point...

 Why would anyone want to print it?

 I occasionally print longer texts like specifications, but for
 reference material like Javadoc,ClojureDocs, the Ruby cheat sheet and
 this page, I think HTML is a far superior format due to links and
 browser search.
 And 40+ loose single sheets is a rather cumbersome package unless you
 have access to a book binder.

 But if at least two people feel that they would really like to print
 it out, I can skip the TOC on print.

 (Making it look _nice_ on paper is a whole different ballgame, then
 I'd have to look into pagination and page layouts, perhaps by
 converting to DocBook or LaTex. That's outside the scope of what I
 intended to do.)

 On Jul 13, 10:04 pm, Meikel Brandmeyer m...@kotka.de wrote:

  Some comments after quickly skimming through:
  ...
  PS: I'm apologise if some this seems to be nit-picking.

 Not at all, I'm still learning the language and happy to get the
 details clarified.

 The second form of condp and the #_ were omitted simply because I
 didn't know about them, thanks for the heads-up.

 For quoted lists, I take your point.
 For the sequence operations examples it was somewhat deliberate, in
 that a sequence is a very different datatype from a vector but pretty
 much the same as a list.
 I had a bug in some code that conj'ed elements onto a vector, but for
 some reason it would switch direction in the middle and start adding
 elements at the opposite end. It took me a while to figure out that it
 was because concat'ing two vectors doesn't return a vector.
 So I wanted to emphasize that using a sequence op on anything other
 than a list is also a conversion from one datatype to another.
 But I'll take another look, there may be better ways.

 Thanks for your comments, much appreciated. I'll include them with the
 next update.

 Sincerely,
 jf

-- 
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 date library

2010-05-24 Thread Islon Scherer
Thanks for the link.
I wasn't aware of this library.

Islon

On May 24, 3:10 pm, David Nolen dnolen.li...@gmail.com wrote:
 On Mon, May 24, 2010 at 1:53 PM, islon islonsche...@gmail.com wrote:
  I missed a date/time API in clojure so I made one myself.
  Is it possible to put it in clojure.contrib?
  Sugestions, critics and improvements are welcome.

  -http://www.copypastecode.com/29707/

  Islon

 Have you looked at clj-time?http://github.com/clj-sys/clj-time

 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 
 athttp://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