Lambda Jam schedule posted (Chicago, July 8-10)

2013-04-19 Thread Alex Miller
Hello! 

The full Lambda Jam Chicago (http://lambdajam.com/schedule) schedule is now 
available! In addition to our keynote speakers (Joe Armstrong, Gerald 
Sussman, and David Nolen), every morning there will be three session 
tracks. All this:

Clojure
- The Joy of Flying Robots with Clojure - Carin Meier
- Monads and Macros - Chris Houser and Jonathan Claggett
- Functional composition - Chris Ford
- Lisp and Cancer - Ola Bini
- Data, Visibility, and Abstraction - Stuart Sierra

Scala 
- Functional Async Without the Pain - Jim Powers
- Journey to the Heart of the For-Yield - Kelsey Innis
- Enabling Microservice Architectures with Scala - Kevin Scaldeferri
- Functional I/O in Scala - Nilanjan Raychaudhuri

Erlang
- Distributed Programming with Riak Core and Pipe - John Daily
- Finite State Machines - Why the fear? - Mahesh Paolini-Subramanya
- Addressing Network Congestion in Riak Clusters - Steve Vinoski
- Let it Crash: Erlang Fault Tolerance - Tristan Sloughter
- QuickCheck: A Silver Bullet for testing? - Joseph Wayne Norton

F#
- Functional Mobile Applications in F# - Adam Granicz
- Functional Linear Data Structures in F# - Jack Fox
- Clarity of Intent: Three Features of F# Which Lead to Better Code - 
Paulmichael Blasucci

Haskell
- Domain Specific Languages and Towers of Abstraction in Haskell - Gershom 
Bazerman
- Simile-Free Monad Recipes - Aditya Siram

Others
- Functional Reactive Programming in the Netflix API - Ben Christensen
- Protocols, Functors and Type Classes - Creighton Kirkendall
- Living in a Post-Functional World - Daniel Spiewak
- Copious Data, the "Killer App" for Functional Programming - Dean Wampler
- Semantics, clarity, and notation: the benefits of expressions over 
statements - Tracy Harms
- Living in Big Data with Vector Functional Programming - Dave Thomas
- Functional Coffeescript for Web UIs - Richard Feldman
- Redex: Program Your Semantics - Robby Findler

If that's not enough, every afternoon we roll up our sleeves with your 
choice from 5 workshops each day ($50/each) or an open jam. 

Monday workshops
- Try F# from Zero to Data Science - Rachel Reese
- The Art of Several Interpreters, Quickly - Dan Friedman, Jason Hemann
- Hands-on Intro to Haskell - Bartosz Milewski
- Top-down TDD in Clojure - Brian Marick
- The Seductions of Scala - Dean Wampler

Tuesday workshops
- F# on the Web - Ryan Riley and Daniel Mohl
- Program Transformations - William Byrd, Nada Amin
- Uses Lenses, Folds and Traversals - Edward Kmett
- Functional Web Development with Clojure - Clinton N. Driesbach
- Building Applications in Erlang - Garrett Smith

Wednesday workshops
- Installed to Productive in Julia - Leah Hanson
- Macros! - Drew Colthorp
- Compilers from Scratch - Daniel Feltey
- Functional Web Applications with Webmachine - Sean Cribbs, Chris 
Meiklejohn
- Introduction to Summingbird - Sam Ritchie

Registration for Lambda Jam Chicago is now open.  Tickets are $400 for 
regular admission and $50 per workshop. Register now!
http://regonline.com/lambdajam2013

Alex Miller

-- 
-- 
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 How To Make Your Open Source Project Awesome (or: Not Suck)

2013-04-19 Thread juan.facorro
Good stuff and I really enjoyed reading it too.

Thanks,

J

On Saturday, April 20, 2013 1:11:59 AM UTC-3, Michael Klishin wrote:
>
>
> 2013/4/20 u1204 >
>
>> There is a HUGE gulf between the user documentation and maintaining
>> the code. Just like there is a huge difference between using a car
>> and maintaining a car.
>>
>
> There are two things to consider:
>
>  * Your audience is other developers.
>  * Most projects are relatively small and straightforward compared to the 
> Clojure compiler.
>
> My point was "at least try to find a new maintainer". Don't let it rot.
>
> There is a blog post in the community that I'm referring to between the 
> lines.
> It won't be hard to figure out which one. The idea is, "don't do that". 
> Don't turn
> your project into abandonware if you no longer want to maintain it well.
>
> Projects such as ring, clj-time, clj-http have found new
> maintainers and those people do a great job with them.
> -- 
> 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
--- 
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] Pedestal docs are now open-source

2013-04-19 Thread Michael Klishin
2013/4/20 Ryan Neufeld 

> Find more details on making contributions in our contribution guidelines
> here: https://github.com/pedestal/docs/blob/master/CONTRIBUTING.md
>
> Happy Hacking,
> Ryan @ Relevance
>

Ryan,

I'd like to thank everyone at Relevance for making this happen.
The "we accept minor corrections without CA on file" policy is great.
-- 
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
--- 
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 How To Make Your Open Source Project Awesome (or: Not Suck)

2013-04-19 Thread Michael Klishin
2013/4/20 u1204 

> There is a HUGE gulf between the user documentation and maintaining
> the code. Just like there is a huge difference between using a car
> and maintaining a car.
>

There are two things to consider:

 * Your audience is other developers.
 * Most projects are relatively small and straightforward compared to the
Clojure compiler.

My point was "at least try to find a new maintainer". Don't let it rot.

There is a blog post in the community that I'm referring to between the
lines.
It won't be hard to figure out which one. The idea is, "don't do that".
Don't turn
your project into abandonware if you no longer want to maintain it well.

Projects such as ring, clj-time, clj-http have found new
maintainers and those people do a great job with them.
-- 
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
--- 
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 How To Make Your Open Source Project Awesome (or: Not Suck)

2013-04-19 Thread Dave Della Costa
Good points.  I've tried to follow many of these with code I've written,
but there are still some things I could stand to do better.

Thanks for writing this, it can serve as a checklist for my own projects
from now on!

Cheers,
DD

(2013/04/20 7:09), Michael Klishin wrote:
> Month after month there are more and more people who announce their open
> source
> Clojure projects. This is great and we can't get enough of this.
> 
> What is not great is how easy it often is to get started with some of
> the projects.
> Some of the most basic "maintainer best practices" are completely
> ignored, even though
> it often takes 3 minutes to fix some annoyances.
> 
> So I wrote a little ranty blog post about what you can do to make your
> project awesome
> (or at least not suck). This also sums up what we've been trying to
> practice with
> ClojureWerkz.
> 
> I hope it will help the Clojure community to be better library
> maintainers. Here it is:
> http://blog.clojurewerkz.org/blog/2013/04/20/how-to-make-your-open-source-project-really-awesome/
> 
> Now you have no excuse to not make your library totally awesome.
> -- 
> 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
> ---
> 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.
>  
>  

-- 
-- 
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: Time series with Clojure

2013-04-19 Thread Mikera
Hi Fernando,

Would just like to point out for those not yet aware that there is a group 
of people interested in bringing proper multi-dimensional matrix 
capabilities to Clojure in the core.mtarix project. Somewhat inspired by 
NumPy, but with a distinctively Clojure flavour. See the discussion group 
here:
https://groups.google.com/forum/?fromgroups#!forum/numerical-clojure

Incanter pre-dates this initiative, and as such has it's own way of dealing 
with matrices (which is fine, but not as comprehensive a solution). In the 
medium term, I hope it is possible to integrate the two, i.e. Incanter will 
use core.matrix as the underlying matrix library. Then we won't have this 
disconnect, and Incanter will benefit from all of the advanced features in 
core.matrix.

To some extent you can already use core.matrix quite well with Incanter: 
core.matrix already supports treating arbitrary Clojure sequences and 
persistent vectors as matrices / vectors.

I'll try and quickly comment on your thoughts from a core.matrix 
perspective.

On Saturday, 20 April 2013 00:49:08 UTC+8, Fernando Saldanha wrote:
>
> I am new to the Clojure world. After years of developing finance 
> applications in R, I am trying to convert a relatively big R/Finance 
> project into Clojure/Incanter. Some things are going very smoothly. I can 
> see how the number of LOC is drastically reduced and the code is clean and 
> concise.
>
> However, in the core area of dealing with financial time series I am 
> having difficulties. Here are some thoughts:
>
> 1) In R one works with matrices and data frames, analogous to Incanter's 
> matrices and datasets. In R you can do calculations with both types, in 
> Incanter only with matrices, but not with datasets. Both data frames and 
> datasets allow for heterogeneous data, both matrices do not.
>

core.matrix allows for matrices with heterogeneous data, so you can use 
them as general purpose datasets. It also supportes specialised matrices 
with pure numbers (e.g. the pure double matrices in vectorz-clj).
 

>
> 2) In R a matrix can have both column and row names, in Incanter it can 
> have neither.
>

It might be smart to use metadata for row and column names in a standard 
way.
 

>
> 3) From 1) and 2) it seems to me that in Incanter every time you want to 
> do calculations you lose the naming of your data. This gives me a feeling 
> of insecurity as I have to think about the ordering of the rows (which is 
> usually not a problem) and of the columns (which is a big problem).
>
> 4) Finance people work primarily with time series. They tend to work with 
> data frames or matrices in which each column is a time series. The R data 
> frame structure fits nicely with this since a data frame is a list of its 
> columns (loosely speaking). Although I don't know what is going on in the 
> innards of Incanter, it seems to be focused on rows. I wonder if that has a 
> performance penalty when one is working with columns. One could think of 
> representing time series as rows in datasets, but that would lead to a loss 
> of naming, as datasets don't have row names. Or one could work with columns 
> in datasets and rows in matrices, which would require systematically 
> transposing the data, which is expensive.
>
> 5) I understand that working with Clojure one loses the possibility of 
> writing code like 
>
> A[i, j] = something 
>
> where A is a matrix. Here i and j may be numbers or vectors. Actually in R 
> a new matrix A is created when executes a command like this, so it is not 
> the performance that is the issue. It is rather the convenience. Would it 
> be possible to have a function in Clojure/Incanter that when called in the 
> following way
>
> (def B (foo A i j z))
>
> would create a matrix B with the same dimensions and entries as A except 
> that the subset of rows and columns defined by i and j would be replaced by 
> z? (Here i and j could be vectors like [3 5 12] or just ints like 4)
>

core.matrix provides the mset function to set individual array elements 
e.g. (mset A i j z).
Some implementations also support mutable arrays with (mset! A i j z) - use 
at your own non-concurrency-safe risk.

Haven't yet put in an API function for setting entire submatrices at once, 
but can see the value in that: will look at adding this into the next 
iteration.
 

>
> 6) To complement the functionality in 5) one would like to be able to 
> apply a function to the columns or rows or a matrix, *with the parameters 
> varying with the column*. Sometimes in R the functionality is already 
> embedded in the function. For example, the function pmin (parallel min), So 
> , if I have a matrix
>
> mat
>  [,1] [,2] [,3]
> [1,]147
> [2,]258
> [3,]369
>
> I can call pmin and get the following:
>
> pmin(mat, c(3, 4, 5))
>  [,1] [,2] [,3]
> [1,]133
> [2,]244
> [3,]355
>
> (This uses R's "recycling," which is not how Incanter deals w

Re: can congomongo connect to mongos?

2013-04-19 Thread Zhi Yang
yes, it  works for single instance, and for mongos, if I query use 
fetch-one it works, just do not work for fetch

On Saturday, April 20, 2013 2:54:43 AM UTC+8, Sean Corfield wrote:
>
> Does the exact same code work connecting directly to a single instance 
> or a to a replica set (instead of mongos shard server)? 
>
> On Fri, Apr 19, 2013 at 7:17 AM, Zhi Yang > 
> wrote: 
> > I use 
> > (defn get-conn [] 
> >   (let [conn (make-connection (:database db-config) 
> >   :host (:host db-config) 
> >   :port (:port db-config) 
> >   (mongo-options :auto-connect-retry true))] 
> > (auth conn) 
> > conn)) 
> > try to connect to mongos, but 
> > 
> > (with-mongo conn 
> > (apply fetch (concat '(:collection) args 
> > 
> > always has exception, any one know why? 
> > 
> > java.lang.NullPointerException 
> > 
> > at com.mongodb.DBCursor._check(DBCursor.java:365) 
> > at com.mongodb.DBCursor._hasNext(DBCursor.java:459) 
> > at com.mongodb.DBCursor.hasNext(DBCursor.java:484) 
> > at clojure.lang.IteratorSeq.create(IteratorSeq.java:27) 
> > at clojure.lang.RT.seqFrom(RT.java:495) 
> > at clojure.lang.RT.seq(RT.java:486) 
> > at clojure.core$seq.invoke(core.clj:133) 
> > at clojure.core$map$fn__4215.invoke(core.clj:2479) 
> > at clojure.lang.LazySeq.sval(LazySeq.java:42) 
> > at clojure.lang.LazySeq.seq(LazySeq.java:60) 
> > 
> > -- 
> > -- 
> > 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. 
> > 
> > 
>
>
>
> -- 
> 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.




Re: ANN How To Make Your Open Source Project Awesome (or: Not Suck)

2013-04-19 Thread u1204
TL:DR 

Write ideas for humans around your code or it will die.
Explain, don't document.



Excellent blog post. However, you write

  Passing It Over
At some point you may become disinterested in maintaining your
project. Maybe you've moved on to a new job or no longer use
your own project. Announce it on the mailing list, ask someone to
take over your project. Sooner or later, someone will help. ...

No, no, they won't. Why? Because, as you state earlier:

Claim that people who are not willing to read the code to figure
out even the most basic things are stupid and should flip burgers
instead.

There is a HUGE gulf between the user documentation and maintaining
the code. Just like there is a huge difference between using a car
and maintaining a car.

I have been trying to reverse-engineer the code the Clojure code base.
It uses red-black trees overlaid with a special immutable bit of
design. It uses a lot of optimizations, some of which assume a 32-bit
implementation. All without a comment anywhere. This is excellent code.

It is also unmaintainable. 




(aside: the word "you" below is not aimed at the Michael, it is generic.
 I am following Michael's usage and style from his blog post.)



 /me drags out his street-worn soapbox. A crowd of two gathers.

Nobody, nobody, and I say again, NOBODY is going to pick up your
project. Why? Because they are going to look at your code pile and
cringe. There are thousands of good projects in Sourceforge. 
Dead ones all. You too are writing dead code.

You have written layer upon layer upon layer of "improvements". You have
added partially worked out "features".  You have removed the front-end
code but left the old code there because it is backward compatible with
version 0.0.0.1.2 which was never released.

Just to add to the confusion, you have ported your code to a dozen
platforms so you now have compiler switches, annotations, pragmas,
special Makefile stanzas, and library dependencies that will fail at the
next upgrade. You wrote autoconf macro scripts nobody understands.

You have install scripts for linux, an installer for Windows, and one
for the MAC. However, the linux script uses tools and directories that
only exist on your machine. The Windows installer is for Windows NT,
not Windows 8. The MAC installer doesn't check dependencies so it
installs but fails to run.

You need slime and leiningen but EVERYBODY has moved to smegle and
buildme. Leiningen is now 7 versions ahead of your version with
plugins that conflict with yours so your code no longer installs.

But not a word of explanation on any of it.

Your project is unmaintainable. 




 /me stacks another soapbox, with guitar for a ballad. The crowd thins.

Consider GNU Common Lisp, GCL. 
It was originally called Austin Kyoto Common Lisp, AKCL. 
It was written by Bill Schelter. 

Bill was a FANTASTIC open source developer. He sat at my desk writing
AKCL. He found a bug in emacs, fetched a copy, fixed it, and uploaed
a patched version. In 1985. He was hardcore. He wrote amazing code
and never wrote comments, like all the greats. 
AKCL eventually became GCL.

Bill is now dead. GCL was picked up by Camm Macquire. Camm is
another of those precious-few heavy hackers and GCL was the basis
of several huge projects. But Common Lisp has a real standard.
Does your project? Have a hundred people written a standard for you?

What is not explained is the crufty way that AKCL is built.  It is
built on top of Kyoto Common Lisp.  The Kyoto Common Lisp (KCL) license
says that you can't modify the code. It must be distributed unmodified. 
So Bill wrote a "delta" program and everything he wrote was in delta 
files off the original, unmodified KCL sources.

Thus, to maintain AKCL source code you have to use patch files.
Bill wrote valid patch files by hand. Diff -Naur valid files without diff.
Hardcore enough for you? Can you read directories full of patch files?

Oh, yeah, and since he was muttering to himself (aka programming)
he didn't even explain why the code needed to be written as patches.
The only reason I know is that I helped write pieces of AKCL and he
sat in my office.

Bill was an amazing programmer. But I now know he did it wrong.



 /me stacks a bar of soap on top of the pile, steps up and ...

SCREAMS. 

Maintaining and modifying source code is hard. 
Porting it to multiple new platforms may require rewrites. 
Maintaining library compatibility may require refactoring. 
Upgrading installers may require code reorganizations. 
Contributing it to debian may require restructuring.

It is all trivial and obvious to you. You wrote it. But finding and
fixing the fencepost bug in a red-black immutable tree implementation
borders on the impossible. You need to know that bit 31 overflows in a
strange way only on Alpha2 processors, causing a interrupt that is not
handled by the JVM. What does bit 31 mean? Why did the bug depend on it?

Your project exceeds 25,

Can I build gen-class methods and implementations from one function call?

2013-04-19 Thread tieTYT
Some background, I'd like to write a Clojure Jersey generator.  Here's some 
examples of Jersey: 
http://jersey.java.net/nonav/documentation/latest/jax-rs.html#d4e188  To me 
it seems like it's like compojure but more verbose.  Since Jersey needs a 
class and methods with specific annotations on it, I figured I'd use 
gen-class.

As an api, I'd pretty much want it to be compojure's API. As an example:

(GET "/user/:id" [id] (str "Hello user " id ""))

This would generate a Jersey class that looks like this:

@Produces(MediaType.TEXT_HTML)
public class JerseyResource {

@GET
@Path("user/{id}")
public String user(@PathParam("id") Integer id) {

}
} 

And in clojure, this would be some code that looks like this:

(ns clj-jersey-resource
  (:import (javax.ws.rs Path PathParam Produces GET))
  (:import (javax.ws.rs.core MediaType)))

(defn -user
  [this id]
  ...)

(gen-class
  :name ^{Path {:value "v2"}
  Produces {:value ["application/json"]}}
  myclass.CljJerseyResource
  :methods [[^{GET {}} user [Integer] String]])

I'm stuck because gen-class takes a list for :methods and I can't figure 
out how to make my one api call (ie: GET) generate both the signature of 
the method inside the gen-class and the implementation of the function 
outside of gen-class simultaneously.  Even more confusing, if GET is called 
twice, I want this to define two separate methods in the same gen-class. 
 How can I implement this?

-- 
-- 
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 replacements in string using a map

2013-04-19 Thread Andy Fingerhut
I fired up a Clojure 1.5.1 REPL, did (require '[clojure.string :as s])
first, then copied and pasted those two function definitions, and did not
get the errors you are seeing.  I don't have a good guess why you are
getting those errors.  Did you do the require first?  What version of
Clojure are you using?

Andy


On Fri, Apr 19, 2013 at 5:17 PM, Mond Ray  wrote:

> Old thread but what the heck... it doesn't work in my REPL
>
> user=> (defn key-pattern
>   #_=> "Create a regex Pattern of the form '|', the key
> names
>   #_=> will be quoted in case they contain special regex characters"
>   #_=> [m]
>   #_=> (->> (keys m)
>   #_=> (map #(java.util.regex.Pattern/quote (name %)))
>   #_=> (s/join "|")
>   #_=> java.util.regex.Pattern/compile))
> #'user/key-pattern
> user=>
>
> user=> (defn replace-map [text m]
>   #_=> (s/replace text
>   #_=>(key-pattern m)
>   #_=>(fn [field-name]
>   #_=>   (java.util.regex.Matcher/quoteReplacement (str (get m
>   #_=> (keyword field-name)))
> #'user/replace-map
> user=> (replace-map "/path/:p0/b/:p1" {:p0 "1" :p1 "2"})
> ClassCastException java.lang.String cannot be cast to clojure.lang.IFn
>  user/key-pattern/fn--408 (NO_SOURCE_FILE:6)
>
> user=> (key-pattern {:a 1})
> ClassCastException java.lang.String cannot be cast to clojure.lang.IFn
>  user/key-pattern/fn--408 (NO_SOURCE_FILE:6)
>
> Am I doing something wrong or is there a typo in your code?
>
>
>
> On Tuesday, 15 March 2011 16:35:04 UTC+1, Aaron Cohen wrote:
>
>> On Mon, Mar 14, 2011 at 2:17 PM, Daniel Solano Gomez
>>  wrote:
>> > On Mon Mar 14 13:02 2011, shuaybi2 shuaybi2 wrote:
>> >> I have a string such as:
>> >>
>> >> "select * from account where acctId = _ACCT-ID_ and acctTyp =
>> _ACCT-TYP_"
>>
>> There are several clojure libraries that exist to improve the ease and
>> safety of doing something like this. Amongst them are
>> clojure.contrib.sql and ClojureQL, which take different approaches.
>> They all should be sufficient to guard against SQL injection and
>> should probably be the first place you look.
>>
>> For the more general question you were asking about how to generically
>> replace a map of matches-to-replacements though, Daniel did a good job
>> showing how to use a reduce over the map. That method will call
>> "replaceAll" once per entry in the map, which is probably fine if you
>> don't have many substitutions.
>>
>> Another way to do it is using clojure.string.replace, which has an
>> often-overlooked third overload which matches with a regex and
>> replaces with a "mapping function."
>>
>> Starting with a simple example:
>> user=>(require '[clojure.string :as s])
>> nil
>> user=>(s/replace "a b a" #"a|b" {"a" "1" "b" "2"})
>> "1 2 1"
>>
>> In the example, the map was being used as a "replacement function".
>>
>> ---
>> If you're willing to change your map to use strings as keys and
>> values, then the previous example is good enough.
>>
>> Otherwise, because you're wanting to use keywords as your keys, and
>> arbitratry values for your values, we'll need to use a slightly more
>> sophisticated replacement function.
>>
>> (defn key-pattern
>> "Create a regex Pattern of the form '|', the key names
>> will be quoted in case they contain special regex characters"
>> [m]
>> (->> (keys m)
>> (map #(java.util.regex.Pattern/**quote (name %)))
>> (s/join "|")
>> java.util.regex.Pattern/**compile))
>>
>> (defn replace-map [text m]
>> (s/replace text
>>(key-pattern m)
>>(fn [field-name]
>>   (java.util.regex.Matcher/**quoteReplacement (str (get m
>> (keyword field-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/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,

Re: Multiple replacements in string using a map

2013-04-19 Thread Sean Corfield
I just tried the code in a fresh REPL with Clojure 1.5.1 and it works,
so I tried it with Clojure 1.4.0 and it works. Well, assuming you do
this first: (require '[clojure.string :as s])

What version of Clojure are you using? Are you doing the require? Do
you have something else defined as `s`?

Sean

On Fri, Apr 19, 2013 at 5:17 PM, Mond Ray  wrote:
> Old thread but what the heck... it doesn't work in my REPL
>
> user=> (defn key-pattern
>   #_=> "Create a regex Pattern of the form '|', the key
> names
>   #_=> will be quoted in case they contain special regex characters"
>   #_=> [m]
>   #_=> (->> (keys m)
>   #_=> (map #(java.util.regex.Pattern/quote (name %)))
>   #_=> (s/join "|")
>   #_=> java.util.regex.Pattern/compile))
> #'user/key-pattern
> user=>
>
> user=> (defn replace-map [text m]
>   #_=> (s/replace text
>   #_=>(key-pattern m)
>   #_=>(fn [field-name]
>   #_=>   (java.util.regex.Matcher/quoteReplacement (str (get m
>   #_=> (keyword field-name)))
> #'user/replace-map
> user=> (replace-map "/path/:p0/b/:p1" {:p0 "1" :p1 "2"})
> ClassCastException java.lang.String cannot be cast to clojure.lang.IFn
> user/key-pattern/fn--408 (NO_SOURCE_FILE:6)
>
> user=> (key-pattern {:a 1})
> ClassCastException java.lang.String cannot be cast to clojure.lang.IFn
> user/key-pattern/fn--408 (NO_SOURCE_FILE:6)
>
> Am I doing something wrong or is there a typo in your code?
>
>
>
> On Tuesday, 15 March 2011 16:35:04 UTC+1, Aaron Cohen wrote:
>>
>> On Mon, Mar 14, 2011 at 2:17 PM, Daniel Solano Gomez
>>  wrote:
>> > On Mon Mar 14 13:02 2011, shuaybi2 shuaybi2 wrote:
>> >> I have a string such as:
>> >>
>> >> "select * from account where acctId = _ACCT-ID_ and acctTyp =
>> >> _ACCT-TYP_"
>>
>> There are several clojure libraries that exist to improve the ease and
>> safety of doing something like this. Amongst them are
>> clojure.contrib.sql and ClojureQL, which take different approaches.
>> They all should be sufficient to guard against SQL injection and
>> should probably be the first place you look.
>>
>> For the more general question you were asking about how to generically
>> replace a map of matches-to-replacements though, Daniel did a good job
>> showing how to use a reduce over the map. That method will call
>> "replaceAll" once per entry in the map, which is probably fine if you
>> don't have many substitutions.
>>
>> Another way to do it is using clojure.string.replace, which has an
>> often-overlooked third overload which matches with a regex and
>> replaces with a "mapping function."
>>
>> Starting with a simple example:
>> user=>(require '[clojure.string :as s])
>> nil
>> user=>(s/replace "a b a" #"a|b" {"a" "1" "b" "2"})
>> "1 2 1"
>>
>> In the example, the map was being used as a "replacement function".
>>
>> ---
>> If you're willing to change your map to use strings as keys and
>> values, then the previous example is good enough.
>>
>> Otherwise, because you're wanting to use keywords as your keys, and
>> arbitratry values for your values, we'll need to use a slightly more
>> sophisticated replacement function.
>>
>> (defn key-pattern
>> "Create a regex Pattern of the form '|', the key names
>> will be quoted in case they contain special regex characters"
>> [m]
>> (->> (keys m)
>> (map #(java.util.regex.Pattern/quote (name %)))
>> (s/join "|")
>> java.util.regex.Pattern/compile))
>>
>> (defn replace-map [text m]
>> (s/replace text
>>(key-pattern m)
>>(fn [field-name]
>>   (java.util.regex.Matcher/quoteReplacement (str (get m
>> (keyword field-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/groups/opt_out.
>
>



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

[ANN] Pedestal docs are now open-source

2013-04-19 Thread Ryan Neufeld
Hello everyone,

I'm pleased to announce that the Pedestal documentation is now open-source 
and open for contributions at http://github.com/pedestal/docs.

Find more details on making contributions in our contribution guidelines 
here: https://github.com/pedestal/docs/blob/master/CONTRIBUTING.md

Happy Hacking,
Ryan @ Relevance

-- 
-- 
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 replacements in string using a map

2013-04-19 Thread Mond Ray
Old thread but what the heck... it doesn't work in my REPL

user=> (defn key-pattern
  #_=> "Create a regex Pattern of the form '|', the key 
names
  #_=> will be quoted in case they contain special regex characters"
  #_=> [m]
  #_=> (->> (keys m)
  #_=> (map #(java.util.regex.Pattern/quote (name %)))
  #_=> (s/join "|")
  #_=> java.util.regex.Pattern/compile))
#'user/key-pattern
user=> 

user=> (defn replace-map [text m]
  #_=> (s/replace text
  #_=>(key-pattern m)
  #_=>(fn [field-name]
  #_=>   (java.util.regex.Matcher/quoteReplacement (str (get m
  #_=> (keyword field-name)))
#'user/replace-map
user=> (replace-map "/path/:p0/b/:p1" {:p0 "1" :p1 "2"})
ClassCastException java.lang.String cannot be cast to clojure.lang.IFn 
 user/key-pattern/fn--408 (NO_SOURCE_FILE:6)

user=> (key-pattern {:a 1})
ClassCastException java.lang.String cannot be cast to clojure.lang.IFn 
 user/key-pattern/fn--408 (NO_SOURCE_FILE:6)

Am I doing something wrong or is there a typo in your code?



On Tuesday, 15 March 2011 16:35:04 UTC+1, Aaron Cohen wrote:
>
> On Mon, Mar 14, 2011 at 2:17 PM, Daniel Solano Gomez
> > wrote:
> > On Mon Mar 14 13:02 2011, shuaybi2 shuaybi2 wrote:
> >> I have a string such as:
> >>
> >> "select * from account where acctId = _ACCT-ID_ and acctTyp = 
> _ACCT-TYP_"
>
> There are several clojure libraries that exist to improve the ease and
> safety of doing something like this. Amongst them are
> clojure.contrib.sql and ClojureQL, which take different approaches.
> They all should be sufficient to guard against SQL injection and
> should probably be the first place you look.
>
> For the more general question you were asking about how to generically
> replace a map of matches-to-replacements though, Daniel did a good job
> showing how to use a reduce over the map. That method will call
> "replaceAll" once per entry in the map, which is probably fine if you
> don't have many substitutions.
>
> Another way to do it is using clojure.string.replace, which has an
> often-overlooked third overload which matches with a regex and
> replaces with a "mapping function."
>
> Starting with a simple example:
> user=>(require '[clojure.string :as s])
> nil
> user=>(s/replace "a b a" #"a|b" {"a" "1" "b" "2"})
> "1 2 1"
>
> In the example, the map was being used as a "replacement function".
>
> ---
> If you're willing to change your map to use strings as keys and
> values, then the previous example is good enough.
>
> Otherwise, because you're wanting to use keywords as your keys, and
> arbitratry values for your values, we'll need to use a slightly more
> sophisticated replacement function.
>
> (defn key-pattern
> "Create a regex Pattern of the form '|', the key names
> will be quoted in case they contain special regex characters"
> [m]
> (->> (keys m)
> (map #(java.util.regex.Pattern/quote (name %)))
> (s/join "|")
> java.util.regex.Pattern/compile))
>
> (defn replace-map [text m]
> (s/replace text
>(key-pattern m)
>(fn [field-name]
>   (java.util.regex.Matcher/quoteReplacement (str (get m
> (keyword field-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/groups/opt_out.




Re: Time series with Clojure

2013-04-19 Thread Fernando Saldanha
Somebody kindly called my attention to incanter.zoo that deals with many of 
the issues I mentioned in my previous post.



On Friday, April 19, 2013 1:49:08 PM UTC-3, Fernando Saldanha wrote:
>
> I am new to the Clojure world. After years of developing finance 
> applications in R, I am trying to convert a relatively big R/Finance 
> project into Clojure/Incanter. Some things are going very smoothly. I can 
> see how the number of LOC is drastically reduced and the code is clean and 
> concise.
>
> However, in the core area of dealing with financial time series I am 
> having difficulties. Here are some thoughts:
>
> 1) In R one works with matrices and data frames, analogous to Incanter's 
> matrices and datasets. In R you can do calculations with both types, in 
> Incanter only with matrices, but not with datasets. Both data frames and 
> datasets allow for heterogeneous data, both matrices do not.
>
> 2) In R a matrix can have both column and row names, in Incanter it can 
> have neither.
>
> 3) From 1) and 2) it seems to me that in Incanter every time you want to 
> do calculations you lose the naming of your data. This gives me a feeling 
> of insecurity as I have to think about the ordering of the rows (which is 
> usually not a problem) and of the columns (which is a big problem).
>
> 4) Finance people work primarily with time series. They tend to work with 
> data frames or matrices in which each column is a time series. The R data 
> frame structure fits nicely with this since a data frame is a list of its 
> columns (loosely speaking). Although I don't know what is going on in the 
> innards of Incanter, it seems to be focused on rows. I wonder if that has a 
> performance penalty when one is working with columns. One could think of 
> representing time series as rows in datasets, but that would lead to a loss 
> of naming, as datasets don't have row names. Or one could work with columns 
> in datasets and rows in matrices, which would require systematically 
> transposing the data, which is expensive.
>
> 5) I understand that working with Clojure one loses the possibility of 
> writing code like 
>
> A[i, j] = something 
>
> where A is a matrix. Here i and j may be numbers or vectors. Actually in R 
> a new matrix A is created when executes a command like this, so it is not 
> the performance that is the issue. It is rather the convenience. Would it 
> be possible to have a function in Clojure/Incanter that when called in the 
> following way
>
> (def B (foo A i j z))
>
> would create a matrix B with the same dimensions and entries as A except 
> that the subset of rows and columns defined by i and j would be replaced by 
> z? (Here i and j could be vectors like [3 5 12] or just ints like 4)
>
> 6) To complement the functionality in 5) one would like to be able to 
> apply a function to the columns or rows or a matrix, *with the parameters 
> varying with the column*. Sometimes in R the functionality is already 
> embedded in the function. For example, the function pmin (parallel min), So 
> , if I have a matrix
>
> mat
>  [,1] [,2] [,3]
> [1,]147
> [2,]258
> [3,]369
>
> I can call pmin and get the following:
>
> pmin(mat, c(3, 4, 5))
>  [,1] [,2] [,3]
> [1,]133
> [2,]244
> [3,]355
>
> (This uses R's "recycling," which is not how Incanter deals with vectors 
> of different lengths)
>
> If a function does not have that functionality, one can write
>
> t(apply(mat, 1, function(x, z) {x + z}, c(0, 1, 2)))
>
>  [,1] [,2] [,3]
> [1,]159
> [2,]26   10
> [3,]37   11
>
> In any case, just the ability to apply a function to a give or all the 
> columns or rows of a matrix would be a big help. 
>
> I wrote the functions
>
> (defn matrix-map-col
>   "Applies a function on each element of a column of a matrix."
>   [A foo j] (matrix-map foo ($ :all j A)))
>
> (defn matrix-maps-cols
>   "Applies a sequence of functions to the elements of the columns of a 
> matrix.
>The return value is a matrix with the same dimensions as the argument 
> matrix."
>   [A foos xs]
>   (trans (matrix (map #(matrix-map-col A %1 %2) foos xs
>
> which would be part of the solution. One would still have to add the 
> ability to vary the parameters and return a matrix. Given my short 
> experience with Clojure I wonder if they could be made faster/better and 
> what would be the best way to implement the remaining functionality.
>
> 7) I wrote in R a class that extends R's matrices. It associates a Date 
> object to each row and provides many other capabilities. When I extract 
> data from an object I can see the date range and the series I am dealing 
> with, which is crucial for checking calculations. I understand Clojure is 
> not OO. How could I have similar capabilities. What kind of construct in 
> Clojure could I use? I thought about a map with the following keys:
>
> :date - a Java date vector or just a vec

Re: ANN How To Make Your Open Source Project Awesome (or: Not Suck)

2013-04-19 Thread Raoul Duke
hooray! right on! testify, brother!!!

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




ANN How To Make Your Open Source Project Awesome (or: Not Suck)

2013-04-19 Thread Michael Klishin
Month after month there are more and more people who announce their open
source
Clojure projects. This is great and we can't get enough of this.

What is not great is how easy it often is to get started with some of the
projects.
Some of the most basic "maintainer best practices" are completely ignored,
even though
it often takes 3 minutes to fix some annoyances.

So I wrote a little ranty blog post about what you can do to make your
project awesome
(or at least not suck). This also sums up what we've been trying to
practice with
ClojureWerkz.

I hope it will help the Clojure community to be better library maintainers.
Here it is:
http://blog.clojurewerkz.org/blog/2013/04/20/how-to-make-your-open-source-project-really-awesome/

Now you have no excuse to not make your library totally awesome.
-- 
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
--- 
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.




ANN Welle 1.5.0 is released

2013-04-19 Thread Michael Klishin
Welle [1] is an expressive Clojure client for Riak with batteries included.

1.5 is a 100% backwards compatible release that includes support for
retriers, conflict resolvers and a few minor improvements.

Release notes:
http://blog.clojurewerkz.org/blog/2013/04/19/welle-1-dot-5-0-is-released/

Documentation site will be updated for 1.5 later today.

1. http://clojureriak.info
-- 
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
--- 
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: Interop for primitive types

2013-04-19 Thread Softaddicts

I agree with you that matching exactly the java method signatures
would be less confusing. I was advocating this to be as transparent
as possible with interop. I was in minority :)

Reviewing what I said, case 1b is a bit more complex, the compiler cannot
decide between the two methods case (byte and thread signatures).
We are not talking about primitive number types here, byte is as alien to
the Thread object as a fish is to roller blades.

As for 1a, it looks like interop is attempting also to demote to a byte if a 
method 
can possibly match. I find this odd. From the top of my head, only integers and 
longs
where to be folded into this single case, it seems that bytes and shorts are 
also
concerned.

As for case 2, objects like Long and Integer are unboxed when searching for a
signature. If the signature has int or long (the primitive types) it will match.
Should be the same for Short and Byte classes. This mimics Java.

I suspect interop to search signatures based on the size of the value from
the smallest (byte) to the biggest (long).
The int signature is found first in your test because the value fits in an int.
Just curious, define also a byte signature for the same method in that class.
I feel it would match with a value less than 255.

My two cents, be specific when calling a Java method and cast the operators
to avoid ambiguity. I am concerned by the exception that may
occur if you feed a value in excess of what the primitive type supports
in your method. The runtime may or may not find a matching method
depending on the value being fed in the call. This would have to be tested.

Implement the widest numeric (long) every where if you have control
on the source code or create a wrapper in clojure to normalize the interactions
with the Java lib and avoid these pitfalls.

I knew this would bite someone one day, sorry that you were the one.

Can't test any of the above, no Clojure and Java on my iPad :)

Luc


> The problem is that the current behavior is not consistent with what
> you describe. Sometimes it fails, but sometimes it works when it
> should fail.
> 
> And there's no documentation or guidelines about the current behavior
> at all, so it's all very confusing.
> 
> My opinion is that interop is essentially ugly, so it should look
> ugly. The problem stems from the compiler attempting to not making it
> look ugly. I think it would be far better by requiring every type to
> exactly match the signature. Then there's no complex rules to
> remember.
> 
> On Apr 19, 3:13 am, Softaddicts  wrote:
> > 1) Your signature has to match your java method,
> > (Foo/bar (byte 1)) will work.
> >
> > 2) There's been a long thread about this. People wanted ints and longs
> >  have a similar behavior and match whatever signature is available when 
> > doing
> >  interop.
> >  When passing (Long. 1), interop tries to match two primitive types, int
> >  and long in Java method signatures. It cannot to choose on your behalf 
> > between
> >  two signatures  that match your args, and it warns you consequently.
> >  Using an explicit cast (int ...) or (long ...) would solve the issue 
> > and direct
> >  to the proper method.
> >
> > I did not like this idea of collapsing ints and longs when searching for an 
> > interop
> > signature but at least there is a trap to tell you that you have a 
> > signature "clash".
> >
> > This behavior has not been extended to bytes and shorts which are rarely 
> > used
> > interchangeably with ints and longs.
> >
> > Beware, the above applies to primitive types in method signatures.
> > (Long. 1) is an object so there should be no possible confusion between the 
> > Long and
> > Integer classes used in a Java method signature. They would not be 
> > considered
> > equivalent candidates.
> >
> > All of the above come from the top of my head but I think it's accurate.
> >
> > Luc P.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > 1)
> >
> > > public class Foo {
> > >   public static String bar(byte b) {
> > > return "byte";
> > >   }
> > > }
> >
> > > user=> (Foo/bar 1)
> > > "byte"
> >
> > > public class Foo {
> > >   public static String bar(byte b) {
> > > return "byte";
> > >   }
> >
> > >   public static String bar(Thread thread) {
> > > return "thread";
> > >   }
> > > }
> >
> > > user=> (Foo/bar 1)
> > > IllegalArgumentException No matching method found: bar
> > > clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:80)
> >
> > > Is this a bug or a feature?
> >
> > > 2)
> >
> > > public class Foo {
> > >   public static String bar(int i) {
> > > return "int";
> > >   }
> >
> > >   public static String bar(long l) {
> > > return "long";
> > >   }
> > > }
> >
> > > user=> (Foo/bar 1)
> > > "long"
> >
> > > user=> (Foo/bar (Long. 1))
> > > CompilerException java.lang.IllegalArgumentException: More than one
> > > matching method found: bar, compiling:(NO_SOURCE_PATH:3:1)
> >
> > > user=> (Foo/bar (Integer. 1))  ; Shouldn't th

Re: can congomongo connect to mongos?

2013-04-19 Thread Sean Corfield
Does the exact same code work connecting directly to a single instance
or a to a replica set (instead of mongos shard server)?

On Fri, Apr 19, 2013 at 7:17 AM, Zhi Yang  wrote:
> I use
> (defn get-conn []
>   (let [conn (make-connection (:database db-config)
>   :host (:host db-config)
>   :port (:port db-config)
>   (mongo-options :auto-connect-retry true))]
> (auth conn)
> conn))
> try to connect to mongos, but
>
> (with-mongo conn
> (apply fetch (concat '(:collection) args
>
> always has exception, any one know why?
>
> java.lang.NullPointerException
>
> at com.mongodb.DBCursor._check(DBCursor.java:365)
> at com.mongodb.DBCursor._hasNext(DBCursor.java:459)
> at com.mongodb.DBCursor.hasNext(DBCursor.java:484)
> at clojure.lang.IteratorSeq.create(IteratorSeq.java:27)
> at clojure.lang.RT.seqFrom(RT.java:495)
> at clojure.lang.RT.seq(RT.java:486)
> at clojure.core$seq.invoke(core.clj:133)
> at clojure.core$map$fn__4215.invoke(core.clj:2479)
> at clojure.lang.LazySeq.sval(LazySeq.java:42)
> at clojure.lang.LazySeq.seq(LazySeq.java:60)
>
> --
> --
> 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.
>
>



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




Re: [ANN] java.jdbc 0.3.0-alpha1

2013-04-19 Thread Sean Corfield
On Fri, Apr 19, 2013 at 4:33 AM, mynomoto  wrote:
> I also like the new api design. You can just jdbc/execute! and jdbc/query
> everything. Or almost. I was trying:

Thanx.

> (jdbc/execute!
>   ["INSERT INTO fruits (name, color, flavor) VALUES (?, ?, ?)" ["apple"
> "red" "sweet"] ["pear" "yellow" "sweet"]])
>
> But that doesn't work. Should it? I know that jdbc/insert! works but it's
> not the same.

No, I would not expect that to work because execute! expects a vector
whose first element is a SQL string and whose remaining elements are
the individual parameters for that single operation. insert!
specifically runs multiple operations. It might be an interesting
enhancement to allow that form tho'...

One of the things that is not currently supported by the new API which
I'm still looking at is the multi-row insert (returning counts instead
of keys) that is possible with the original API.
--
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.




Re: Interop for primitive types

2013-04-19 Thread Alice
The problem is that the current behavior is not consistent with what
you describe. Sometimes it fails, but sometimes it works when it
should fail.

And there's no documentation or guidelines about the current behavior
at all, so it's all very confusing.

My opinion is that interop is essentially ugly, so it should look
ugly. The problem stems from the compiler attempting to not making it
look ugly. I think it would be far better by requiring every type to
exactly match the signature. Then there's no complex rules to
remember.

On Apr 19, 3:13 am, Softaddicts  wrote:
> 1) Your signature has to match your java method,
>     (Foo/bar (byte 1)) will work.
>
> 2) There's been a long thread about this. People wanted ints and longs to
>      have a similar behavior and match whatever signature is available when 
> doing
>      interop.
>      When passing (Long. 1), interop tries to match two primitive types, int
>      and long in Java method signatures. It cannot to choose on your behalf 
> between
>      two signatures  that match your args, and it warns you consequently.
>      Using an explicit cast (int ...) or (long ...) would solve the issue and 
> direct
>      to the proper method.
>
> I did not like this idea of collapsing ints and longs when searching for an 
> interop
> signature but at least there is a trap to tell you that you have a signature 
> "clash".
>
> This behavior has not been extended to bytes and shorts which are rarely used
> interchangeably with ints and longs.
>
> Beware, the above applies to primitive types in method signatures.
> (Long. 1) is an object so there should be no possible confusion between the 
> Long and
> Integer classes used in a Java method signature. They would not be considered
> equivalent candidates.
>
> All of the above come from the top of my head but I think it's accurate.
>
> Luc P.
>
>
>
>
>
>
>
>
>
> > 1)
>
> > public class Foo {
> >   public static String bar(byte b) {
> >     return "byte";
> >   }
> > }
>
> > user=> (Foo/bar 1)
> > "byte"
>
> > public class Foo {
> >   public static String bar(byte b) {
> >     return "byte";
> >   }
>
> >   public static String bar(Thread thread) {
> >     return "thread";
> >   }
> > }
>
> > user=> (Foo/bar 1)
> > IllegalArgumentException No matching method found: bar
> > clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:80)
>
> > Is this a bug or a feature?
>
> > 2)
>
> > public class Foo {
> >   public static String bar(int i) {
> >     return "int";
> >   }
>
> >   public static String bar(long l) {
> >     return "long";
> >   }
> > }
>
> > user=> (Foo/bar 1)
> > "long"
>
> > user=> (Foo/bar (Long. 1))
> > CompilerException java.lang.IllegalArgumentException: More than one
> > matching method found: bar, compiling:(NO_SOURCE_PATH:3:1)
>
> > user=> (Foo/bar (Integer. 1))  ; Shouldn't this also fail?
> > "int"
>
> > user=> (def x (Long. 1))       ; same as (def x 1)
> > #'user/x
>
> > user=> (Foo/bar x)             ; a bug?
> > "int"
>
> > --
> > --
> > 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, visithttps://groups.google.com/groups/opt_out.
>
> --
> Softaddicts sent by ibisMail from my ipad!

-- 
-- 
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: Setting content type in a resouce response

2013-04-19 Thread Josh Kamau
Hi David ;

Thanks for your attempt to answer my question despite lack of information.
I was accessing my clojure application via apache virtual host. Any html
file served as a resource ends up with content type being "text/plain" .
Without apache everything works fine.  I ended up doing something like
 {:body (io/InputStream. (io/resource "public/index.html")) :headers
{...content type...} to make it work

Josh


On Fri, Apr 19, 2013 at 4:58 AM, David Della Costa wrote:

> Hi Josh, you should post Ring-related questions here:
>
> https://groups.google.com/forum/?fromgroups#!forum/ring-clojure
>
> To answer your question, it's hard to say without seeing your code.  In
> fact, I'm having a hard time reproducing the problem without explicitly
> telling ring to serve an HTML file as text/plain--it's showing up as
> text/html without me explicitly setting it.
>
> Also, did you mean ring.util.response (
> http://ring-clojure.github.io/ring/ring.util.response.html) rather than
> ring.util.resource (which doesn't exist as far as I know)?
>
> For a very vanilla example which explicitly sets Content-Type, take a look
> at this.  Let's say we had a plain file-response (note again that this is
> giving me text/html, but anyways...):
>
>
> (defn handler [request]
>  (resource-response "index.html" {:root "public"}))
>
> If we wanted to explicitly set it as text/html, we could wrap it using the
> content-type function:
>
> (defn handler [request]
>   (->
>(resource-response "index.html" {:root "public"})
>(content-type "text/html")))
>
> Of course, this is the most basic method--there are smarter ways to do it.
>  Check out the Ring wiki for more, especially the section on creating
> responses (https://github.com/ring-clojure/ring/wiki/Creating-responses),
> static resources (
> https://github.com/ring-clojure/ring/wiki/Static-Resources) and Content
> Types (https://github.com/ring-clojure/ring/wiki/Content-Types).
>
> And again, I would suggest using the Ring list for these questions.
>
> Hope this helps!
>
> Best,
> Dave
>
> 2013/4/19 Josh Kamau 
>
>> Hi there ;
>>
>> Please help. How do i set the ContentType header in a
>> (ring.util.resouce/resource-response ) ?
>>
>> I am serving html file and its being served as plain text.
>>
>> Josh
>>
>> --
>> --
>> 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.
>>
>>
>>
>
>  --
> --
> 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.
>
>
>

-- 
-- 
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: For bubble-sort, why this tail-recursive version is even slower than the linear-recursive one?

2013-04-19 Thread Ben Wolfson
I don't know about the speed, but I suspect the stack overflow results from
many nested calls to concat, which will by itself result in stack overflows.


On Fri, Apr 19, 2013 at 9:57 AM, Miles Wen  wrote:

> Hi all,
> I wrote a bubble-sort program in clojure:
>
> (defn bubble-sort
>   [col]
>   (letfn [(outter-loop
> [cc i]
> (if (< i 1)
>   cc
>   (letfn [(inner-loop
> [c j]
> (if (> j (- i 2))
>   c
>   (let [_1st (first c)
> _2nd (second c)
> others (rest (rest c))]
> (if (> _1st _2nd)
>   (cons _2nd (inner-loop (cons _1st others)
> (inc j)))
>   (cons _1st (inner-loop (cons _2nd others)
> (inc j)))]
> (recur (inner-loop cc 0) (dec i)]
> (outter-loop col (count col
>
> It works quite well, it could sort 1000 elements in no time.
>
> and I also rewrite it to a tail-recursive version:
>
> (defn bubble-sort-tail
>   [col]
>   ((fn
>  [cc i]
>  (if (< i 1)
>cc
>(let [inner-loop (fn
>   [c j rst]
>   (if (> j (- i 2))
> (concat rst c)
> (let [_1st (first c)
>   _2nd (second c)
>   others (rest (rest c))]
>   (if (> _1st _2nd)
> (recur (cons _1st others) (inc j) (concat
> rst [_2nd]))
> (recur (cons _2nd others) (inc j) (concat
> rst [_1st]))]
>  (recur (inner-loop cc 0 []) (dec i)
> col (count col)))
>
> But this tail-recursive version is very very slow, much slower than the
> former one. And it also stack-overflows when the input is fairly large... I
> don't understand why.
>
> I also printed out a stack trace when it's running slowly, using 'jstack'
> command, and the strange stack trace is here:
>
> "nREPL-worker-0" daemon prio=10 tid=0x01dc1000 nid=0x7b1b runnable
> [0x7f77de15a000]
>java.lang.Thread.State: RUNNABLE
> at clojure.lang.RT.seqFrom(RT.java:482)
> at clojure.lang.RT.seq(RT.java:477)
>  at clojure.core$seq.invoke(core.clj:133)
> at clojure.core$concat$fn__3941.invoke(core.clj:678)
> at clojure.lang.LazySeq.sval(LazySeq.java:42)
>  - eliminated <0xf5deac28> (a clojure.lang.LazySeq)
> at clojure.lang.LazySeq.seq(LazySeq.java:60)
>  - locked <0xf5deac28> (a clojure.lang.LazySeq)
> at clojure.lang.RT.seq(RT.java:475)
> at clojure.core$seq.invoke(core.clj:133)
>  at clojure.core$concat$fn__3941.invoke(core.clj:678)
> at clojure.lang.LazySeq.sval(LazySeq.java:42)
> - eliminated <0xf5deac80> (a clojure.lang.LazySeq)
>  at clojure.lang.LazySeq.seq(LazySeq.java:60)
> - locked <0xf5deac80> (a clojure.lang.LazySeq)
>  at clojure.lang.RT.seq(RT.java:475)
> at clojure.core$seq.invoke(core.clj:133)
> at clojure.core$concat$fn__3941.invoke(core.clj:678)
>  at clojure.lang.LazySeq.sval(LazySeq.java:42)
> - eliminated <0xf5deacd8> (a clojure.lang.LazySeq)
>  at clojure.lang.LazySeq.seq(LazySeq.java:60)
> - locked <0xf5deacd8> (a clojure.lang.LazySeq)
>  at clojure.lang.RT.seq(RT.java:475)
> at clojure.core$seq.invoke(core.clj:133)
> at clojure.core$concat$fn__3941.invoke(core.clj:678)
>  ..
> ..
> ..
> many many more stack frames ignored
> ..
> ..
> ..
> at clojure.core$concat$fn__3941.invoke(core.clj:678)
>  at clojure.lang.LazySeq.sval(LazySeq.java:42)
> - eliminated <0xf5def0e8> (a clojure.lang.LazySeq)
>  at clojure.lang.LazySeq.seq(LazySeq.java:60)
> - locked <0xf5def0e8> (a clojure.lang.LazySeq)
>  at clojure.lang.RT.seq(RT.java:475)
> at clojure.core$seq.invoke(core.clj:133)
> at clojure.core$concat$fn__3941.invoke(core.clj:678)
>  at clojure.lang.LazySeq.sval(LazySeq.java:42)
> - eliminated <0xf5def140> (a clojure.lang.LazySeq)
>  at clojure.lang.LazySeq.seq(LazySeq.java:60)
> - locked <0xf5def140> (a clojure.lang.LazySeq)
>  at clojure.lang.RT.seq(RT.java:475)
> at clojure.core$seq.invoke(core.clj:133)
> at clojure.core$concat$fn__3941.invoke(core.clj:678)
>  at clojure.lang.LazySeq.sval(LazySeq.java:42)
> - eliminated <0xf5def198> (a clojure.lang.LazySeq)
>  at clojure.lang.LazySeq.seq(LazySeq.java:60)
> - locked <0xf5def198> (a clojure.lang.LazySeq)
>  at clojure.lang.RT.seq(RT.java:475)
> at clojure.core$seq.invoke(core.clj:133)
> at clojure.core$concat$fn__3941.invoke(core.clj:678)
>  at clojure.lang.LazySeq.sval(LazySeq.java:42)
> - eliminated <0xf5def1f0> (a clojure.lang.LazySeq)
>  at clojure.lang.LazySeq.seq(LazySeq.java:60)
> - locked <0xf5def1f0> (a clojure.lang.LazySeq)
>  at clojure.lang.RT.seq(RT.java:475)
> at

For bubble-sort, why this tail-recursive version is even slower than the linear-recursive one?

2013-04-19 Thread Miles Wen
Hi all,
I wrote a bubble-sort program in clojure:

(defn bubble-sort
  [col]
  (letfn [(outter-loop
[cc i]
(if (< i 1)
  cc
  (letfn [(inner-loop
[c j]
(if (> j (- i 2))
  c
  (let [_1st (first c)
_2nd (second c)
others (rest (rest c))]
(if (> _1st _2nd)
  (cons _2nd (inner-loop (cons _1st others)
(inc j)))
  (cons _1st (inner-loop (cons _2nd others)
(inc j)))]
(recur (inner-loop cc 0) (dec i)]
(outter-loop col (count col

It works quite well, it could sort 1000 elements in no time.

and I also rewrite it to a tail-recursive version:

(defn bubble-sort-tail
  [col]
  ((fn
 [cc i]
 (if (< i 1)
   cc
   (let [inner-loop (fn
  [c j rst]
  (if (> j (- i 2))
(concat rst c)
(let [_1st (first c)
  _2nd (second c)
  others (rest (rest c))]
  (if (> _1st _2nd)
(recur (cons _1st others) (inc j) (concat
rst [_2nd]))
(recur (cons _2nd others) (inc j) (concat
rst [_1st]))]
 (recur (inner-loop cc 0 []) (dec i)
col (count col)))

But this tail-recursive version is very very slow, much slower than the
former one. And it also stack-overflows when the input is fairly large... I
don't understand why.

I also printed out a stack trace when it's running slowly, using 'jstack'
command, and the strange stack trace is here:

"nREPL-worker-0" daemon prio=10 tid=0x01dc1000 nid=0x7b1b runnable
[0x7f77de15a000]
   java.lang.Thread.State: RUNNABLE
at clojure.lang.RT.seqFrom(RT.java:482)
at clojure.lang.RT.seq(RT.java:477)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$concat$fn__3941.invoke(core.clj:678)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
- eliminated <0xf5deac28> (a clojure.lang.LazySeq)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
- locked <0xf5deac28> (a clojure.lang.LazySeq)
at clojure.lang.RT.seq(RT.java:475)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$concat$fn__3941.invoke(core.clj:678)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
- eliminated <0xf5deac80> (a clojure.lang.LazySeq)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
- locked <0xf5deac80> (a clojure.lang.LazySeq)
at clojure.lang.RT.seq(RT.java:475)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$concat$fn__3941.invoke(core.clj:678)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
- eliminated <0xf5deacd8> (a clojure.lang.LazySeq)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
- locked <0xf5deacd8> (a clojure.lang.LazySeq)
at clojure.lang.RT.seq(RT.java:475)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$concat$fn__3941.invoke(core.clj:678)
..
..
..
many many more stack frames ignored
..
..
..
at clojure.core$concat$fn__3941.invoke(core.clj:678)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
- eliminated <0xf5def0e8> (a clojure.lang.LazySeq)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
- locked <0xf5def0e8> (a clojure.lang.LazySeq)
at clojure.lang.RT.seq(RT.java:475)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$concat$fn__3941.invoke(core.clj:678)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
- eliminated <0xf5def140> (a clojure.lang.LazySeq)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
- locked <0xf5def140> (a clojure.lang.LazySeq)
at clojure.lang.RT.seq(RT.java:475)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$concat$fn__3941.invoke(core.clj:678)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
- eliminated <0xf5def198> (a clojure.lang.LazySeq)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
- locked <0xf5def198> (a clojure.lang.LazySeq)
at clojure.lang.RT.seq(RT.java:475)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$concat$fn__3941.invoke(core.clj:678)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
- eliminated <0xf5def1f0> (a clojure.lang.LazySeq)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
- locked <0xf5def1f0> (a clojure.lang.LazySeq)
at clojure.lang.RT.seq(RT.java:475)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$concat$fn__3941.invoke(core.clj:678)

It seems that the tail-recursive version also resulted in a very deep
recursion.
I think my program is nothing wrong in the algorithm itself. But why would
this happen? Any ideas?

Thanks!

-- 
Regards.
Yue . Wen

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegro

Re: Test strategy

2013-04-19 Thread Chris Ford
I'm a little unclear as to what your specific challenge is. I understand
you're trying to test fns that take a map produced by the JSON parser, and
extract specific fields.

Would it be sufficient to just create literal maps to fake the output of
the JSON parser, use those as inputs to your extraction fns, and then just
compare the output to what you expected? If the issue is that the
extraction isn't done by top-level fns, and thus is hard to test, perhaps
you could just make them top-level fns?

Cheers,

Chris


On 19 April 2013 15:14, Jonathon McKitrick  wrote:

> As a relatively new Clojure user, I have a relatively simple app which
> parses a complex JSON structure into a database.
>
> I have test code which verifies all the basic database functions, but I'm
> not sure how best to exercise all the parsing code.  The JSON parser is
> built-in, and most of my code is navigating each structure, picking out
> fields of interest to build the objects for the database.
>
> What would be a good strategy for tests that would exercise this
> intermediate layer of the app, between the JSON and the database, where the
> heart of the app logic actually lies?
>
> --
> --
> 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.
>
>
>

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




Time series with Clojure

2013-04-19 Thread Fernando Saldanha
I am new to the Clojure world. After years of developing finance 
applications in R, I am trying to convert a relatively big R/Finance 
project into Clojure/Incanter. Some things are going very smoothly. I can 
see how the number of LOC is drastically reduced and the code is clean and 
concise.

However, in the core area of dealing with financial time series I am having 
difficulties. Here are some thoughts:

1) In R one works with matrices and data frames, analogous to Incanter's 
matrices and datasets. In R you can do calculations with both types, in 
Incanter only with matrices, but not with datasets. Both data frames and 
datasets allow for heterogeneous data, both matrices do not.

2) In R a matrix can have both column and row names, in Incanter it can 
have neither.

3) From 1) and 2) it seems to me that in Incanter every time you want to do 
calculations you lose the naming of your data. This gives me a feeling of 
insecurity as I have to think about the ordering of the rows (which is 
usually not a problem) and of the columns (which is a big problem).

4) Finance people work primarily with time series. They tend to work with 
data frames or matrices in which each column is a time series. The R data 
frame structure fits nicely with this since a data frame is a list of its 
columns (loosely speaking). Although I don't know what is going on in the 
innards of Incanter, it seems to be focused on rows. I wonder if that has a 
performance penalty when one is working with columns. One could think of 
representing time series as rows in datasets, but that would lead to a loss 
of naming, as datasets don't have row names. Or one could work with columns 
in datasets and rows in matrices, which would require systematically 
transposing the data, which is expensive.

5) I understand that working with Clojure one loses the possibility of 
writing code like 

A[i, j] = something 

where A is a matrix. Here i and j may be numbers or vectors. Actually in R 
a new matrix A is created when executes a command like this, so it is not 
the performance that is the issue. It is rather the convenience. Would it 
be possible to have a function in Clojure/Incanter that when called in the 
following way

(def B (foo A i j z))

would create a matrix B with the same dimensions and entries as A except 
that the subset of rows and columns defined by i and j would be replaced by 
z? (Here i and j could be vectors like [3 5 12] or just ints like 4)

6) To complement the functionality in 5) one would like to be able to apply 
a function to the columns or rows or a matrix, *with the parameters varying 
with the column*. Sometimes in R the functionality is already embedded in 
the function. For example, the function pmin (parallel min), So , if I have 
a matrix

mat
 [,1] [,2] [,3]
[1,]147
[2,]258
[3,]369

I can call pmin and get the following:

pmin(mat, c(3, 4, 5))
 [,1] [,2] [,3]
[1,]133
[2,]244
[3,]355

(This uses R's "recycling," which is not how Incanter deals with vectors of 
different lengths)

If a function does not have that functionality, one can write

t(apply(mat, 1, function(x, z) {x + z}, c(0, 1, 2)))

 [,1] [,2] [,3]
[1,]159
[2,]26   10
[3,]37   11

In any case, just the ability to apply a function to a give or all the 
columns or rows of a matrix would be a big help. 

I wrote the functions

(defn matrix-map-col
  "Applies a function on each element of a column of a matrix."
  [A foo j] (matrix-map foo ($ :all j A)))

(defn matrix-maps-cols
  "Applies a sequence of functions to the elements of the columns of a 
matrix.
   The return value is a matrix with the same dimensions as the argument 
matrix."
  [A foos xs]
  (trans (matrix (map #(matrix-map-col A %1 %2) foos xs

which would be part of the solution. One would still have to add the 
ability to vary the parameters and return a matrix. Given my short 
experience with Clojure I wonder if they could be made faster/better and 
what would be the best way to implement the remaining functionality.

7) I wrote in R a class that extends R's matrices. It associates a Date 
object to each row and provides many other capabilities. When I extract 
data from an object I can see the date range and the series I am dealing 
with, which is crucial for checking calculations. I understand Clojure is 
not OO. How could I have similar capabilities. What kind of construct in 
Clojure could I use? I thought about a map with the following keys:

:date - a Java date vector or just a vector of strings of the form 
"20130415"

:data - One of the following two alternatives

a) A vector of maps, each one of which would have as a key the column name 
(a string) and as value a time series

b) An Incanter dataset

Each alternative has advantages and disadvantages. Has anyone thought about 
these issues?  Any comments would be very welcome.

These are my thoughts for now. I will a

can congomongo connect to mongos?

2013-04-19 Thread Zhi Yang
I use 
(defn get-conn []
  (let [conn (make-connection (:database db-config)
  :host (:host db-config)
  :port (:port db-config)
  (mongo-options :auto-connect-retry true))]
(auth conn)
conn))
try to connect to mongos, but 

(with-mongo conn
(apply fetch (concat '(:collection) args

always has exception, any one know why?

java.lang.NullPointerException

at com.mongodb.DBCursor._check(DBCursor.java:365)
at com.mongodb.DBCursor._hasNext(DBCursor.java:459)
at com.mongodb.DBCursor.hasNext(DBCursor.java:484)
at clojure.lang.IteratorSeq.create(IteratorSeq.java:27)
at clojure.lang.RT.seqFrom(RT.java:495)
at clojure.lang.RT.seq(RT.java:486)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$map$fn__4215.invoke(core.clj:2479)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)

-- 
-- 
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] lein-html5-docs 2.0.0

2013-04-19 Thread John Gabriele

On Friday, April 19, 2013 3:16:58 AM UTC-4, Tassilo Horn wrote:
>
>
> > I think the final output would look better if you assumed the 
> > docstrings themselves were markdown-formatted and rendered them as 
> > html. (That is, only have the items under "Arglists" in a preformatted 
> > block --- everything else would be html.) 
>
> Hm, that sounds like a good idea.  Is there some clojure lib that takes 
> a markdown-formatted string and returns plain HTML5 code? 
>
>
Well, there's , which I think is 
actively maintained, though I've not used it.

I think it would be great if I could tell lein-html5-docs: "treat 
docstrings as markdown, render them as html, and shell out to Pandoc [^1] 
to do it". 

[^1]: Pandoc supports some niceties I've gotten pretty used to, like 
tables, definition lists, deeply-nested lists, and LaTeX math.

---John

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




Test strategy

2013-04-19 Thread Jonathon McKitrick
As a relatively new Clojure user, I have a relatively simple app which 
parses a complex JSON structure into a database.

I have test code which verifies all the basic database functions, but I'm 
not sure how best to exercise all the parsing code.  The JSON parser is 
built-in, and most of my code is navigating each structure, picking out 
fields of interest to build the objects for the database.

What would be a good strategy for tests that would exercise this 
intermediate layer of the app, between the JSON and the database, where the 
heart of the app logic actually lies?

-- 
-- 
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: Arrays and indexes

2013-04-19 Thread John D. Hume
Both `for` and `doseq` support the same vector form preceding a body. `for`
returns a lazy sequence and is often appropriate for a purely functional
body. `doseq` is not lazy and returns nil, so it is only appropriate when
you want to run the body for side effects.

Take a look at http://clojure.github.io/clojure/clojure.core-api.html and
play around in the repl to get a clearer idea of how that works. Maybe
start with an expression like this:
(let [nested [[1 2 3] [4 5 6]]]
  (for [row nested
number row]
(str number " from row " row)))
If you change `for` to `doseq`, you may also want to change `str` to
`println`.

Alan's example uses `map-indexed` to get numeric indices. Note that `cols`
holds a row from `rows` and is then passed to the second `map-indexed`
call, so his example is like a nested for-loop in a C-like language, except
that it is lazy and returns a sequence of results of calling `display` with
each item from your nested vector along with its coordinates. For this
example to make sense, `display` should return a value that will be used to
put something on screen. If `display` just does the screen-putting, and its
return value is insignificant, then `doseq` would make sense.

Hope this helps.
-hume.
On Apr 19, 2013 4:27 AM,  wrote:

> How does that work: you appear to be iterating over two, unconnected,
> vectors.
>
> And yes that's an example of the second option but doesn't explain if or
> why that's the best approach- which was the question ;)
>
> On Thursday, 18 April 2013 19:48:40 UTC+1, Alan Malloy wrote:
>>
>> (for [[y cols] (map-indexed vector rows)
>>   [x cell] (map-indexed vector cols)]
>>   (display cell y x))
>>
>> ?
>>
>> On Thursday, April 18, 2013 3:14:19 AM UTC-7, edw...@kenworthy.infowrote:
>>>
>>> So, I want a 2 dimensional array.
>>>
>>> I think the best way to implement this is a vector of vectors.
>>>
>>> Now I want to display that array drawing each element relative to its
>>> position in the array.
>>>
>>> Is the best way to use doseq and manually maintain the indices? Or is it
>>> to use nested for-loops manually iterating of the vector-of-vectors?
>>>
>>  --
> --
> 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.
>
>
>

-- 
-- 
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] java.jdbc 0.3.0-alpha1

2013-04-19 Thread mynomoto
I also like the new api design. You can just jdbc/execute! and jdbc/query 
everything. Or almost. I was trying:

(jdbc/execute!
  ["INSERT INTO fruits (name, color, flavor) VALUES (?, ?, ?)" ["apple" 
"red" "sweet"] ["pear" "yellow" "sweet"]])

But that doesn't work. Should it? I know that jdbc/insert! works but it's 
not the same.


On Tuesday, April 9, 2013 7:41:10 PM UTC-3, Sean Corfield wrote:
>
> On Tue, Apr 9, 2013 at 1:49 PM, r0man 
> > 
> wrote: 
> > first off, I like the new API design. 
>
> Thanx. 
>
> > 1.) Despite the asymmetry I'm also thinking that passing entities 
> > and identifiers functions via the "db" argument is quite 
> > convienient. Otherwise I always have to wrestle with those extra 
> > parameters and pass them through my underlying SQL generation 
> > functions. Which I have to to with the db anyway (maybe one level 
> > less). 
>
> Could you elaborate on your use case, in the context of the new API? 
> I'm trying to imagine what "my underlying SQL generation functions" 
> look like and how they relate to / have access to the db-spec. 
>
> The identifiers and entities macros allow you to wrap a block of code 
> containing the new API and/or the DSL and have the functions injected 
> automatically: 
>
> (entities (quoted \') 
>   ... 
>   (insert! my-db :foo {:name "Bar" :level 123}) 
>   ... 
>   (identifiers as-is 
> ... 
> (query my-db (select :name :foo (where {:level 123}) 
>
> That is equivalent to the (much longer): 
>
>   ... 
>   (insert! my-db :foo {:name "Bar" :level 123} :entities (quoted \')) 
>   ... 
>   (query my-db (select :name :foo (where {:level 123} :entities 
> (quoted \')) :entities (quoted \')) :identifiers as-is) 
>
> ;; assuming I got my parens right! 
>
> Given that SQL generation happens _before_ the db-spec is even 
> referenced - and happens in a separately evaluated form - I'm not 
> seeing how having :entities inside the db-spec helps here. 
>
> > 2.) The default naming strategy for columns coming from the 
> > database is at the moment "lower-case". Wouldn't it be more 
> > idiomatic to lower case and replace "_" with "-". 
>
> Yes, but I didn't want to break backward compatibility (with the 
> default behavior of 0.2.x and earlier) since I expect people to 
> migrate easily and that seems like a gratuitous change, because it 
> would ripple thru all of the library's client code. I'm certainly 
> happy to provide a convenience function in the DSL, along with as-is, 
> lower-case, and (quoted x) to provide lower-case-and-hyphens in the 
> entity to Clojure direction (i.e., an identifiers function) and an 
> as-is-with-underscore in the opposite direction... with better 
> names... suggestions? 
>
> I believe the defaults in java.jdbc have always been (effectively): 
> * :identifiers lower-case 
> * :entities as-is 
>
> I don't want to make migration from 0.2.x to 0.3.0 difficult for folks 
> with large code bases (like me, for example!). 
>
> > 3.) Would it make sense to define some connection spec, into 
> > which the current specs get translated to? Something like the 
> > Ring SPEC for connections. I'm often interested in the name of 
> > the database, the credentials of the hostname the database is 
> > running on, etc. Something like this? 
>
> An interesting idea... 
>
> As it stands, the API functions all accept anything that 
> get-connection can turn into a database connection, and from a 
> connection you can get the catalog and quite a bit of metadata (via 
> .getCatalog and .getMetaData method calls). Some of the things you can 
> pass to get-connection don't directly contain the information you're 
> looking for (e.g., pass in a JNDI name / environment or a DataSource 
> object with username / password - not to be confused with the 
> user/password property used in some of the other "connectable" 
> things). 
>
> Feel free to add notes or comments here: 
> http://dev.clojure.org/display/design/java.jdbc 
> Also request enhancements here: 
> http://dev.clojure.org/jira/browse/JDBC (although some discussion 
> about things would be welcome first) 
>
> I have created a mailing list specific to clojure.java.jdbc in case 
> folks want to get into deep discussions and don't want to clog up this 
> main Clojure mailing list (since I understand the user base for 
> java.jdbc is relatively small compared to the overall Clojure 
> community): https://groups.google.com/d/forum/clojure-java-jdbc 
> -- 
> 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
cloj

Re: Arrays and indexes

2013-04-19 Thread https://github.com/jmaandrade/orchestration

Hi,

How about this?

> (map-indexed (fn [i x] (vector x)) (for [x (range 10)] "HELLO WORLD"))

(["HELLO WORLD"] ["HELLO WORLD"] ["HELLO WORLD"] ["HELLO WORLD"] ["HELLO 
WORLD"] ["HELLO WORLD"] ["HELLO WORLD"] ["HELLO WORLD"] ["HELLO WORLD"] 
["HELLO WORLD"])


Quinta-feira, 18 de Abril de 2013 11:14:19 UTC+1, edw...@kenworthy.info 
escreveu:
>
> So, I want a 2 dimensional array.
>
> I think the best way to implement this is a vector of vectors.
>
> Now I want to display that array drawing each element relative to its 
> position in the array.
>
> Is the best way to use doseq and manually maintain the indices? Or is it 
> to use nested for-loops manually iterating of the vector-of-vectors?
>

-- 
-- 
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: Arrays and indexes

2013-04-19 Thread edward
How does that work: you appear to be iterating over two, unconnected, 
vectors.

And yes that's an example of the second option but doesn't explain if or 
why that's the best approach- which was the question ;)

On Thursday, 18 April 2013 19:48:40 UTC+1, Alan Malloy wrote:
>
> (for [[y cols] (map-indexed vector rows)
>   [x cell] (map-indexed vector cols)]
>   (display cell y x))
>
> ?
>
> On Thursday, April 18, 2013 3:14:19 AM UTC-7, edw...@kenworthy.info wrote:
>>
>> So, I want a 2 dimensional array.
>>
>> I think the best way to implement this is a vector of vectors.
>>
>> Now I want to display that array drawing each element relative to its 
>> position in the array.
>>
>> Is the best way to use doseq and manually maintain the indices? Or is it 
>> to use nested for-loops manually iterating of the vector-of-vectors?
>>
>

-- 
-- 
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] lein-html5-docs 2.0.0

2013-04-19 Thread Tassilo Horn
John Gabriele  writes:

Hi John,

>> That's how docs generated with the plugin look like: 
>>
>>   http://userpages.uni-koblenz.de/~horn/funnyqt-docs/ 
>>
>>
> Nice, Tassilo!

Thanks. :-)

> Incidentally, it looks like most of the doc strings there are
> pretty-much markdown-formatted.

Well, at least I enclose var and parameter names in `...` in my
docstrings.

> I think the final output would look better if you assumed the
> docstrings themselves were markdown-formatted and rendered them as
> html. (That is, only have the items under "Arglists" in a preformatted
> block --- everything else would be html.)

Hm, that sounds like a good idea.  Is there some clojure lib that takes
a markdown-formatted string and returns plain HTML5 code?

Hey, and of course, pull requests are welcome.

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