Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread Richard Newman

I don't expect anyone to actually read, rather I was hoping some folks
who know Clojure might just glance at it to get the rhythm of the
math. It's the pattern, not the detail that matters. How should what
is essentially a monster algebra equation be codified in Clojure?


I looked at your PDF.

You express the equations as functions. Turning your equation notation  
into function notation -- I'll use Haskell's as an example:


OpportunityCost = Rent - Sell

becomes

opportunityCost r s = r - s

or in Clojure:

(defn opportunity-cost [r s]
  (- r s))

Note that the implicit arguments in your equational notation become  
explicit arguments in the functional version.


How do I compute r and s? Why, with functions of course! Let's take  
Sell as an example.


	Sell = HouseSaleProfit0(1 +  
RealMonthlyOpportunityCost)^MonthsInBusiness


which becomes

(defn sell [hsp-zero rmoc mib]
  (* hsp-zero
 (exp (+ 1 rmoc) mib))); Assuming exp defined.


Now, assuming that we have Rent, HSP0, RMOC, and MIB calculated (which  
follows the same pattern), we compute our OpportunityCost:


(defn -main []
  ;; TODO: extract user arguments.
  ;; ...
  (let [hsp-zero (...)   ; More calculation.
rmoc (...)
mib (...)]
(println "Opportunity Cost: "
 (opportunity-cost rent (sell hsp-zero rmoc mib


To turn this into your final code, you need only:

* Keep walking through your formulae until you've expressed everything  
as functions;
* Grab the nineteen or so "leaf" values you need from the user, and  
plug them into your calls.


When you have intermediate values, bind them with let, as I show above.

Note that:

* Each of the functions stands alone, defined in terms of its  
arguments, and follows naturally from your equations
* You can compute any intermediate stage, and print them out, log  
them, whatever

* There are no global values or bindings
* You can name each intermediate value using let; your main function  
can essentially be a sequential set of intermediate calculations, just  
like your PDF.


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: "hot swapping" + swing + repl?

2010-02-17 Thread Meikel Brandmeyer
Hi,

On Feb 18, 1:49 am, Raoul Duke  wrote:

> any pointers to learn up on how to get a nice environment for doing
> swing app development w/out having to kill and restart the whole world
> when i make changes to app logic? (yes i'm googling, but i'm still
> confused/clueless just yet.)

I used VimClojure to run a nailgun server in the application. I
changed a function, send them to the running application via nailgun,
tested the change, edit, send, test, edit, send, test, ... Works very
well. I use the same technique at the moment with a web server.

You can do the same with SLIME on Emacs, I presume.

One gotcha however are higher order functions. Let's say you have
something like:

(defn make-callback [some things] (fn [evt] (do-stuff evt some
things)))

(... (.setCallback aWidget (make-callback thing other-thing)) ...)

Then this approach works not so well, because reloading make-callback
doesn't help. aWidget still has the old function in place. Then you
also have rebuild aWidget.

But in general it's a fast way of development.

Sincerely
Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread Yaron
Absolutely. I typed up an example in Scala.

class RentOrSell(val Months_To_Find_Tenant: Int, val Months_In_Lease:
Int, val Lease_Cycles: Int, val Months_To_Sell: Int) {
  val months_in_business: Int = ((Months_To_Find_Tenant +
Months_In_Lease) * Lease_Cycles) + Months_To_Sell
}

When I create a class instance I pass in the user defined variables (I
only used 4 in this example). Those values are then bound as invariant
values and used to create months_in_business which is itself an
invariant value (e.g. bound at class creation time and then
immutable).

This is the effect I was expecting. That I could define both the user
supplied values and the derived values as immutable values. Instead I
had to create thunks for the derived values for the reasons previously
described.

But again I'm completely open to the idea that I'm just going about
this all wrong. I have spent more years of my life than I care to
remember writing OO code so I have no doubt I'm relying on instincts
that just don't apply here.

Ideally I'd love to figure out how to properly write a program that
implements http://www.goland.org/sellorrent.pdf in Clojure rather than
beat Clojure into looking like what I'm used to from my OO days. Put
another way, I speak Clojure with a really thick OO accent and I'd
like to learn better how to speak it like a native. :)

   Yaron

On Feb 17, 11:53 am, Laurent PETIT  wrote:
> Hello,
>
> 2010/2/17Yaron:
>
>
>
> > I actually started off doing exactly what you suggested. The original
> > version of my program used a map for the arguments and then used
> > explicit arguments when the number of arguments fell to a reasonable
> > level.
>
> > For example, I started off with:
>
> > (defn months_in_business
> >        "The total number of months we will be in the business of renting out
> > our home"
> >        [Months_To_Find_Tenant Months_In_Lease Lease_Cycles Months_To_Sell]
> >        (-> (+ Months_To_Find_Tenant Months_In_Lease) (* Lease_Cycles) (+
> > Months_To_Sell)))
>
> > Which got called as (months_in_business Months_To_Find_Tenant
> > Months_In_Lease Lease_Cycles Months_To_Sell)
>
> > But this was a lot of typing every time I wanted to call the function.
> > So I changed it to:
>
> > (defn months_in_business
> >        "The total number of months we will be in the business of renting out
> > our home"
> >        [:keys [Months_To_Find_Tenant Months_In_Lease Lease_Cycles
> > Months_To_Sell]]
> >        (-> (+ Months_To_Find_Tenant Months_In_Lease) (* Lease_Cycles) (+
> > Months_To_Sell)))
>
> > Which got called as (months_in_business bag_o_args)
>
> > This at least meant less typing when calling the function but defining
> > the function still required a bunch of typing.
>
> > So eventually I just went to:
>
> > (defn months_in_business
> >        "The total number of months we will be in the business of renting out
> > our home"
> >        []
> >        (-> (+ *Months_To_Find_Tenant* *Months_In_Lease*) (* *Lease_Cycles*)
> > (+ *Months_To_Sell*)))
>
> > Which was called as: (months_in_business)
>
> > At least there wasn't much typing involved but now I had a bunch of
> > thunks running around. Which is what brought me to the group in the
> > first place.
>
> > It seems to me that there is a design principal here somewhere that
> > says something like "One shouldn't have to pass static values around
> > as arguments to functions". But because there is nothing like an
> > object context in Clojure this ended up meaning that derived values
> > like months_in_business have to be thunks. Which I though was
> > inelegant.
>
> > If, on the other hand, I was implementing this in an object oriented
> > language I would just say:
>
> > class foo
> >  var A
> >  var B
> >  foo (bag_o_args)
> >  {
> >    A = (bag_o_args A)
> >    B = A+1
> >  }
>
> I would like to try to help, but I first need to understand your
> (pseudo?) OO langage above.
> Could you detail it a little bit more ?
>
>
>
> > And I would be done. No heaps of typing. No thunks. Just what looks to
> > me like a nice simple solution.
>
> > But I recognize that I'm just running home to mommy because my
> > background is OO. That's why I came to the group in the first place.
> > Since I know I'm blinded by my OO past I wanted to see if there was an
> > approach to the problem in Clojure that was as easy and straight
> > forward as what I would have done in an OO language.
>
> > That having been said, defining a bunch of thunks isn't the worst
> > thing in the world. But it is unfortunate from both a design and
> > performance perspective.
>
> >    Yaron
>
> > On Feb 16, 11:07 pm, Richard Newman  wrote:
> >> > It seems however that the consensus of the group based on what I've
> >> > said so far is to pass around state in a structmap.
>
> >> Not necessarily a struct-map. Just a map.
>
> >> > This is nice in
> >> > that it makes each function completely self contained (e.g. no
> >> > external references). It's unfortunate in that it now means that e

Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread Richard Newman

I'm just trying to figure out what the right pattern is
because the fact that I'm forced to make the derived values into
thunks feels really wrong but I honestly don't know what's right in
the context of Clojure.


I don't think you're using the term "thunk" correctly.

A thunk is (usually) a no-argument function, typically used for things  
like delayed evaluation, and typically capturing some environment. E.g.,


(defn hello [thunk]
  (println "Hello, " (thunk)))

(defn make-name-thunk [name]
  (fn [] name))

(let [n (make-name-thunk "Jim")]
  (println "Calling hello...")
  (hello n))

You are not making your derived values into thunks by this definition.  
Your derived values are just that: values, computed by functions.  
Compute them when you need them by invoking the appropriate functions  
with the appropriate arguments.


Can you explain what you mean by "thunk"?

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread Yaron
That's actually quite a nifty use of the fact that code/data is the
same in Clojure. But how do I test things out? In other words, how do
I make sure that the expression defining a# is correct? Especially
when any test has to itself be in the context of all the variables?

But more to the point I think there is a difference between possible
and desirable. You're giving me what I asked for, e.g. a way to
achieve my goal of not having the derived values be thunks. But I
can't help but think that I'm just approaching the whole problem in
the wrong way in Clojure. That's why I posted 
http://www.goland.org/sellorrent.pdf.

I don't expect anyone to actually read, rather I was hoping some folks
who know Clojure might just glance at it to get the rhythm of the
math. It's the pattern, not the detail that matters. How should what
is essentially a monster algebra equation be codified in Clojure?

On Feb 17, 10:48 am, Tom Faulhaber  wrote:
> You can combine let and binding like this to make this slightly more
> elegant:
>
> (let [a# 'expr involving *A* *B* and *C*''
>       b# 'expr involving *A* *B* and *C*''
>       c# 'expr involving *A* *B* and *C*'']
>   (binding [*A* a#
>                *B* b#
>                *C* c#]
>      ...))
>
> Note the x# form which does an implicit gensym for you so you get
> unique names.
>
> This at least reduces it from n levels to two levels. It would be
> pretty easy to build a parallel-binding macro that did this for you.
>
> hth,
>
> Tom
>
> On Feb 17, 10:09 am,Yaron wrote:
>
> > I did but it requires two levels of macro and that made me nervous.
> > The problem is derived values. When defining a binding, near as I can
> > tell, the values in the binding cannot see other values in the
> > binding. In other words:
>
> > (def *A* 10)
> > (binding [*A* 3 B (+ foo 1)] B)
>
> > Returns 11, not 4.
>
> > So to use the macro I have to:
>
> > (def *A* bogus_value)
> > (def B bogus_value)
>
> > (defmacro in-environment [env & body]
> >   `(binding [*A* :A ..]
> >     (binding [B (+ *A* 1)...]
> >     �...@body))
>
> > I think this would actually work. But it requires a bunch of
> > accounting (all the bogus global defs) and introduces some worrisome
> > ordering issues. For example, let's say I have a value C whose
> > definition is (def C (+ B 1)). I can't define it using the previous
> > macro. Because, again, bindings can't see each other. So now I'd have
> > to write a macro that dynamically created a whole set of nested
> > bindings. Which seems like a lot of work.
>
> > In other words:
>
> > (binding [*A* :A...]
> >   (binding [B (+ *A* 1)...]
> >    (binding [C (+ *B* 1)...]
> >      etc.
>
> > And I can't use let (which does allow for internal visibility) because
> > then other functions I call will bind to the global value not the let
> > value.
>
> >    Yaron

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread Yaron
The reason for typing so much is maintainability. I'll have to come
back to this code again and again over a period of years and there's
no chance in heck I'll remember anything I did before. So I've learned
that using clearer variable names, even with a little extra typing, is
a price worth paying.

On Feb 17, 10:46 am, David Nolen  wrote:
> (defn months_in_business
>        "The total number of months we will be in the business of renting out
> our home"
>        [:keys [Months_To_Find_Tenant Months_In_Lease Lease_Cycles
> Months_To_Sell]]
>        (-> (+ Months_To_Find_Tenant Months_In_Lease) (* Lease_Cycles) (+
> Months_To_Sell)))
>
> ->
>
> I have no idea why you want to type this much:
>
> (defn months-in-business
>   [:keys [mtft mil lc mts]
>   (-> (+ mtft mil) (* lc) (+ mts))
>
> But how do we know what these abbreviations mean while we develop our
> application? Write a couple of helper functions:
>
> (defn map-to-humane-repr [m]
>      (let [ok (keys m)
>            vs (vals m)]
>        (zipmap (map mappings ok) vs)))
>
> (def *dummy*
>      {:mtft 1,
>       :mil 24,
>       :lc 5,
>       :mts 12})
>
> (map-to-humane-repr *dummy*) ->
>
> {"Months to Sell" 12,
>  "Lease Cycles" 5,
>  "Months In Lease" 24,
>  "Months To Find Tenant" 1}

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread Yaron
I think I see what you're saying. But honestly my goal isn't to
replicate the OO experience. My goal is to replicate how easy OO made
this specific scenario. In other words I want to use Clojure properly
and trying to paste an OO framework on Clojure has got to be a major
anti-pattern. I'm just trying to figure out what the right pattern is
because the fact that I'm forced to make the derived values into
thunks feels really wrong but I honestly don't know what's right in
the context of Clojure.

On Feb 17, 10:39 am, CuppoJava  wrote:
> HiYaron,
>
> You've slightly misunderstood my suggestion. I hope this will shed
> some reasoning on it:
>
> In OO, what you are effectively doing is this:
>
> The Object represents the "environment" under which you do your
> calculations.
> The "environment" object is created by your constructor.
> Once this "environment" has been created, you can use it to do
> calculations using "foo.tax_deductible_expenses(1)".
>
> My example is meant to capture this style of programming. (Whether
> this style is appropriate is up to you to decide.)
>
> The "environment" is represented by a map.
> You can write a function that creates an "environment" just like how
> you can write a constructor to create an environment object in Java.
>   eg.  new-environment( ... )
> Once this environment has been created, you may use it to do
> calculations using
>   "(in-environment foo
>      (tax-deductible-expenses 1))"
>
> The in-environment macro is not meant to contain any logic. It is
> solely meant to save you some typing.
>
> Hope that's more clear.
>   -Patrick

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: "hot swapping" + swing + repl?

2010-02-17 Thread Sean Devlin
Netbeans has a good swing gui building tool.  Good for prototyping &
understanding the feel of your app.  Not sure how well it plays w/
Clojure, though.

On Feb 17, 7:49 pm, Raoul Duke  wrote:
> hi,
>
> any pointers to learn up on how to get a nice environment for doing
> swing app development w/out having to kill and restart the whole world
> when i make changes to app logic? (yes i'm googling, but i'm still
> confused/clueless just yet.)
>
> many thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: "hot swapping" + swing + repl?

2010-02-17 Thread John Cromartie
I know this isn't a direct answer to your question, but may I suggest
SWT (unless you already have some investment in Swing or have a
particular technical reason to use it) instead? In my experience SWT
is more lightweight and responsive, especially in the repl.

As for "hot swapping" of logic... that's easy. When you create GUI
objects, use clojure.core/proxy and refer to defn'ed functions. They
will be updated when you reload the namespaces. Reloading is achieved
by passing the :reload keyword as a directive to require/use, like
(use 'foo.bar :reload).

-John

On Feb 17, 7:49 pm, Raoul Duke  wrote:
> hi,
>
> any pointers to learn up on how to get a nice environment for doing
> swing app development w/out having to kill and restart the whole world
> when i make changes to app logic? (yes i'm googling, but i'm still
> confused/clueless just yet.)
>
> many thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Integers can't be Objects?

2010-02-17 Thread John Cromartie
This also means that the source code for clojure.core/format is a good
study on how to make use of Java vararg methods:

  (defn format
"Formats a string using java.lang.String.format, see
java.util.Formatter for format
string syntax"
{:tag String}
[fmt & args]
(String/format fmt (to-array args)))


On Feb 17, 12:41 pm, Kevin Downey  wrote:
> the [ in front means an array. the String.format takes java varargs,
> which the compiler de-sugars as an array. easier to use clojure's own
> format function. which calls String's format method in the end, but
> you don't have to create the array manually.
>
>
>
>
>
> On Wed, Feb 17, 2010 at 9:21 AM, Phil  wrote:
> > Sorry for the newbie question, but this seems a strange error
> > message.  Either it is saying that a java.lang.Integer cannot be cast
> > to an Object, or it is saying that it can't be cast to a particular
> > object.  Some enlightenment would be appreciated.
>
> > user=> (. String format "%d" 28)
> > java.lang.ClassCastException: java.lang.Integer cannot be cast to
> > [Ljava.lang.Object; (NO_SOURCE_FILE:0)
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with 
> > your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en
>
> --
> And what is good, Phaedrus,
> And what is not good—
> Need we ask anyone to tell us these things?

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


jmx with auth

2010-02-17 Thread Drz
I am just starting to play around with clojure.  I was trying to use
the clojure.contrib.jmx library to connect to remote java vms that
require auth (-Dcom.sun.management.jmxremote.password.file=blah -
Dcom.sun.management.jmxremote.access.file=blah).  Looking at the java
docs, I need to add "jmx.remote.credentials" into the environment map
with the value of ["username" "password"].  I tested this out by
creating a with-connection macro in my own namespace and changing the
{} to {"jmx.remote.credentials" (into-array ["username"
"password"])}.  That worked just fine for testing, but is not a long
term solution.  Does anyone have a suggestion as to how I could get
this kind of functionality integrated into jmx library?  I tried to
contact Stuart Halloway via github with no luck.  If getting this into
the library isn't an option, does anyone have any suggestions on an
elegant way to add this without essentially duplicating with-
connection macro?

  Drz

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clojure-contrib on Windows

2010-02-17 Thread kkw
Hi Ram,

If you all you want is the latest .jar file, and don't feel the
need to compile, consider bypassing the compilation and grab the
latest successfully compiled .jar from build.clojure.org. This is what
I now do.

Kev

On Feb 17, 9:51 am, Ram  wrote:
> I'm having an issue compiling clojure-contrib on Windows.
>
> I downloaded the code from the git repository and when I run Maven,
> after compilation it runs through the test suite fails in test-io:
>
> FAIL in (test-as-url) (run-test5405918110152723544.clj:47)
> expected: (= (URL. "file:/foo") (as-url (File. "/foo")))
>   actual: (not (= # #))
>
> I'm guessing someone expected UNIX style filenames in this test case
> and not Windows filenames, but that is besides the issue. The issue is
> that the jars aren't actually generating themselves. Am I missing
> something? If I am, its probably something really dumb.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread Michał Marczyk
I must say that I find Richard's suggestions to be very reasonable,
but I'd like to add my own take... This is meant as a step-by-step
account of my thinking process, so it starts out with a statement of
the basics. Skim & skip if you prefer.

The problem to be solved is basically a huge calculation. When written
out -- for the purpose of defining the problem -- in the usual
mathematical notation, it turns out to depend on multiple free
variables (inflation rate, interest on the mortgage etc.); then
there's a bunch of named parameters / dependent variables whose values
are derived from those free variables.

So, the natural thing to do is what you do in that .pdf you posted:
you break it down into a bunch of equations defining the dependent
variables in the above in terms of the free variables and / or
previously defined dependent variables plus one inequality of the
form, say, rent-profit <= sale-profit, whose truth or falsity is to be
established.

Now, an imperative programme to calculate whether rent-profit does or
does not exceed sale-profit would proceed as follows:

free-variable-1 = some-value-1
free-variable-2 = some-value-2
...
dependent-variable-1 = some-function-of(free-variable-k,
free-variable-l, free-variable-n)
...
answer = rent-profit-function(...some-arguments...) <=
sale-profit-function(...some-arguments...)

A functional programme, on the other hand, would contain no section to
correspond to the free-variable-n assignments at all. Then in place of
all the dependent-variable-m assignments it would contain function
definitions:

(defn calculate-dependent-variable-1 [free-var-k, free-var-l ...]
  ...)

When you start composing those, you do things like

(defn calculate-problematic-quantity [...all free vars needed in side...]
  (let [dep-var-1 (calculate-dependent-variable-1 ...the arguments...)
dep-var-2 (calculate-dependent-variable-2 ...the arguments...)
...]
...combine the free-vars received as arguments
with the dep-vars calculated in the bindings portion of the
let form to produce the return value...))

Feel free to receive dependent variables as arguments if you're likely
to have multiple functions depend on them in some way:

(defn f1 [dep-var-1 ...] ...)
(defn f2 [dep-var-1 ...] ...)
(defn function-using-f1-f2 [...args...]
  (let [dep-var-1 (calculate-dependent-variable-1 ...args...)
 f1-val (f1 dep-var-1 ...)
 f2-val (f2 dep-var-1 ...)
...))

Then once you do have all the building blocks in place, you'd write
one monster entry function taking some values for the free variables
-- perhaps in the form of a map -- and have it call the
building-block-functions, perhaps using the sequential binding
facitility of the let special form to name intermediate values for use
in further computational steps.

This process strikes me as incredibly similar to what you would do if
you were to solve the equations by hand: you break them down into
well-defined intermediate steps, write down recipes defining the exact
nature of those steps, then write down formulae combining the results
of those intermediate steps. You strive to reduce the number of free
variables any single equation depends on, preferring to break down
huge equations into smaller ones which depend on parameters defined by
further small equations. Etc.

In Haskell you can even write the "main equations" on top, followed by
the helper equations lower down, possibly limiting the scope of the
latter:

calculateFoo x y z = fooComponent1 + fooComponent2
  where
fooComponent1 = (some expression in x, y, z)
fooComponent2 = (some expression in x, y, z)

In Clojure you'd use a let form for that, which may be a blessing or a
curse both syntactically (the issue of what you put on the top) and
semantically (because "where" and "let" bindings are mutually
recursive in Haskell). The basic idea stays the same, though, with
Haskell's syntax perhaps making it slightly more obvious how the
Haskell functions involved are almost direct transliterations of the
mathematical, purely declarative statements of the nature of the
calculational subproblems. That syntax is something you'd actually
have to learn the (considerable) quirks of, so some find the Lisp
syntax-less approach ultimately more manageable (myself included).

Anyway, I'd say that your project is the perfect dream use case for
functional programming... I wonder if I've managed to expose some of
my reasons for feeling this way? :-)

An additional note: given the purpose of the calculations involved, I
guess you'll want to be well-assured of the correctness of the result.
Using maps to pass around named values may help with that; I'd even go
as far as using assertions and / or preconditions to make sure that
each function does receive all the values it expects in its argument
map.

What I *would not* do, however, is to mass around one huge map all the
time; I'd still only give each function the exact arguments it must
receive, putting them

Re: Clojure API doc updated with both master and 1.1 (finally)

2010-02-17 Thread liebke
Fantastic feature, thanks Tom!

David


> However, I have good news: the autodoc robot now supports
> documentation in multiple branches.

> Multi-branch versions of clojure-contrib and incanter coming up RSN.
>
> Tom

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


"hot swapping" + swing + repl?

2010-02-17 Thread Raoul Duke
hi,

any pointers to learn up on how to get a nice environment for doing
swing app development w/out having to kill and restart the whole world
when i make changes to app logic? (yes i'm googling, but i'm still
confused/clueless just yet.)

many thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


issue #259 - TestCase to reproduce the issue

2010-02-17 Thread jpraher
Hi all,

just to make the ticket complete (somehow I can create tickets but
cannot annotate them as a watcher  in assembla - but maybe I am doing
something wrong).

Below you see a simple TestCase.
* This source code below compiles using javac 1.6.0.15 (MacOSX 10.6)
* The identity method can be successfully invoked within java
* The call to .identity using the clojures Reflector fails.

The point is not whether this Java code is potentially flawed but that
there exist code (especially the JDI implementation) that cannot be
used refeclively from clojure yet it is OK to invoke it using JVM
bytecodes.

My patched Reflector that usees the target instance's class to find
the public method is working though. I can send you the patch.

-- Jakob


TestCase.java 
public class TestCase {
public interface Intf {
public String identity(String value);
}
static class B {
public String identity(String value) {
return value;
}
}
static class A extends B implements Intf {
}
public Intf newImpl() {
return new A();
}
public static void main(String[] args) {
System.out.println(new TestCase().newImpl().identity("test"));
}
}

===  JAVA
==
$ java -classpath classes TestCase
test

===  REPL
==
$ java -classpath src:classes:lib/clojure-1.2.0-master-SNAPSHOT.jar
clojure.main
Clojure 1.2.0-master-SNAPSHOT
user=> (.identity (.newImpl (.newInstance (Class/forName "TestCase")))
"test")
java.lang.IllegalArgumentException: Can't call public method of non-
public class: public java.lang.String TestCase
$B.identity(java.lang.String) (NO_SOURCE_FILE:0)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread Laurent PETIT
Hello,

2010/2/17 Yaron :
> I actually started off doing exactly what you suggested. The original
> version of my program used a map for the arguments and then used
> explicit arguments when the number of arguments fell to a reasonable
> level.
>
> For example, I started off with:
>
> (defn months_in_business
>        "The total number of months we will be in the business of renting out
> our home"
>        [Months_To_Find_Tenant Months_In_Lease Lease_Cycles Months_To_Sell]
>        (-> (+ Months_To_Find_Tenant Months_In_Lease) (* Lease_Cycles) (+
> Months_To_Sell)))
>
> Which got called as (months_in_business Months_To_Find_Tenant
> Months_In_Lease Lease_Cycles Months_To_Sell)
>
> But this was a lot of typing every time I wanted to call the function.
> So I changed it to:
>
> (defn months_in_business
>        "The total number of months we will be in the business of renting out
> our home"
>        [:keys [Months_To_Find_Tenant Months_In_Lease Lease_Cycles
> Months_To_Sell]]
>        (-> (+ Months_To_Find_Tenant Months_In_Lease) (* Lease_Cycles) (+
> Months_To_Sell)))
>
> Which got called as (months_in_business bag_o_args)
>
> This at least meant less typing when calling the function but defining
> the function still required a bunch of typing.
>
> So eventually I just went to:
>
> (defn months_in_business
>        "The total number of months we will be in the business of renting out
> our home"
>        []
>        (-> (+ *Months_To_Find_Tenant* *Months_In_Lease*) (* *Lease_Cycles*)
> (+ *Months_To_Sell*)))
>
> Which was called as: (months_in_business)
>
> At least there wasn't much typing involved but now I had a bunch of
> thunks running around. Which is what brought me to the group in the
> first place.
>
> It seems to me that there is a design principal here somewhere that
> says something like "One shouldn't have to pass static values around
> as arguments to functions". But because there is nothing like an
> object context in Clojure this ended up meaning that derived values
> like months_in_business have to be thunks. Which I though was
> inelegant.
>
> If, on the other hand, I was implementing this in an object oriented
> language I would just say:
>
> class foo
>  var A
>  var B
>  foo (bag_o_args)
>  {
>    A = (bag_o_args A)
>    B = A+1
>  }

I would like to try to help, but I first need to understand your
(pseudo?) OO langage above.
Could you detail it a little bit more ?

>
> And I would be done. No heaps of typing. No thunks. Just what looks to
> me like a nice simple solution.
>
> But I recognize that I'm just running home to mommy because my
> background is OO. That's why I came to the group in the first place.
> Since I know I'm blinded by my OO past I wanted to see if there was an
> approach to the problem in Clojure that was as easy and straight
> forward as what I would have done in an OO language.
>
> That having been said, defining a bunch of thunks isn't the worst
> thing in the world. But it is unfortunate from both a design and
> performance perspective.
>
>    Yaron
>
> On Feb 16, 11:07 pm, Richard Newman  wrote:
>> > It seems however that the consensus of the group based on what I've
>> > said so far is to pass around state in a structmap.
>>
>> Not necessarily a struct-map. Just a map.
>>
>> > This is nice in
>> > that it makes each function completely self contained (e.g. no
>> > external references). It's unfortunate in that it now means that every
>> > single function needs this extra argument and every variable access
>> > either needs to use the :keys feature in the arguments or has to
>> > directly refer to the keys in the map.
>>
>> Not necessarily. At some point your functions should be fine-grained
>> enough that they only take a couple of arguments. As soon as you drop
>> below 6 or 7, where they're all mandatory, switch to ordinary function
>> argument style.
>>
>> Wherever you call those functions should do the unpacking.
>>
>> E.g.,
>>
>> (defn outer-1 [{:keys [foo bar baz noo]}]
>>    (let [interm (foo-bar foo bar)
>>          fiddle (frostrup baz noo)]
>>      (tweep interm fiddle)))
>>
>> After all, your house-sale-profit function should be expressed in
>> terms of two arguments:
>>
>> (defn house-sale-profit [house-sale-price house-sale-expenses]
>>    ...)
>>
>> It doesn't care about the other 17.
>>
>> Another thing: that big entry point function is like a much tidier
>> version of the Java constructor that you created with 19 arguments --
>> tidier in that you can use named keys or a map to identify the
>> arguments.
>
> --
> 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 rece

Re: since a list of chars is not a string...

2010-02-17 Thread Laurent PETIT
2010/2/17 Wolfgang Meyer :
> To convert a string to a char sequence, you can use:
>
> (seq (.toCharArray "abc"))
> Clojure strings are Java strings, in case you didn't know.
> Wolfgang


Not so hard.

In the general case you have nothing to do: basic collection handling
functions from core call (seq) on their arguments, and since (seq
"foo") return (\f \o \o) (note there's no need to call
(.toCharArray)), you have nothing to do.

Look:

1:4 paredit.parser=> (seq "foo")
(\f \o \o)

1:6 paredit.parser=> (map identity "foo")

HTH,

-- 
Laurent

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure API doc updated with both master and 1.1 (finally)

2010-02-17 Thread alux
Hello Sean, yes, thats a help too.

Its is just, for me as a beginner, that finding a function is
sometimes difficult, so I go back to read the funny manual ;-)

Thanks & read you.

On 17 Feb., 17:21, Sean Devlin  wrote:
> Alux,
> That's what the doc macro is for.  Here's an example.
>
> user=> (doc +)
> -
> clojure.core/+
> ([] [x] [x y] [x y & more])
>   Returns the sum of nums. (+) returns 0.
>
> On Feb 17, 11:17 am, alux  wrote:
>
> > Very nice!
>
> > But another beginners question: Is there any prossibility to download
> > the API doc? I'm offline a lot, and can't always look at the site.
>
> > Thank you, alux
>
> > On 17 Feb., 14:53, Rich Hickey  wrote:
>
> > > On Wed, Feb 17, 2010 at 3:27 AM, Tom Faulhaber  
> > > wrote:
> > > > The autodoc robot that builds the API docs choked sometime after the
> > > > merge of the new branch into master and the clojure and  clojure-
> > > > contrib API documents haven't been updating for the past 6 weeks or
> > > > so. This has been unfortunate because it's been a time of momentous
> > > > change (deftype and defprotocol, in particular).
>
> > > > As it turns out, it was a busy period in my life as well, so I didn't
> > > > get on top of it as quickly as I would have liked.
>
> > > > However, I have good news: the autodoc robot now supports
> > > > documentation in multiple branches. I have run this and installed it
> > > > for the clojure API docs themselves so you can see both the master
> > > > branch (with all the cool new stuff) and the 1.1.x branch (with all
> > > > the stable stuff) athttp://richhickey.github.com/clojure/index.html.
>
> > > > Multi-branch versions of clojure-contrib and incanter coming up RSN.
>
> > > > Let me know if you see any probs in the docs.
>
> > > Absolutely fantastic, and much appreciated - thanks Tom!
>
> > > Rich

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread David Nolen
(defn months_in_business
   "The total number of months we will be in the business of renting out
our home"
   [:keys [Months_To_Find_Tenant Months_In_Lease Lease_Cycles
Months_To_Sell]]
   (-> (+ Months_To_Find_Tenant Months_In_Lease) (* Lease_Cycles) (+
Months_To_Sell)))

->

I have no idea why you want to type this much:

(defn months-in-business
  [:keys [mtft mil lc mts]
  (-> (+ mtft mil) (* lc) (+ mts))

But how do we know what these abbreviations mean while we develop our
application? Write a couple of helper functions:

(defn map-to-humane-repr [m]
 (let [ok (keys m)
   vs (vals m)]
   (zipmap (map mappings ok) vs)))

(def *dummy*
 {:mtft 1,
  :mil 24,
  :lc 5,
  :mts 12})

(map-to-humane-repr *dummy*) ->

{"Months to Sell" 12,
 "Lease Cycles" 5,
 "Months In Lease" 24,
 "Months To Find Tenant" 1}

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread Tom Faulhaber
You can combine let and binding like this to make this slightly more
elegant:

(let [a# 'expr involving *A* *B* and *C*''
  b# 'expr involving *A* *B* and *C*''
  c# 'expr involving *A* *B* and *C*'']
  (binding [*A* a#
   *B* b#
   *C* c#]
 ...))

Note the x# form which does an implicit gensym for you so you get
unique names.

This at least reduces it from n levels to two levels. It would be
pretty easy to build a parallel-binding macro that did this for you.

hth,

Tom


On Feb 17, 10:09 am, Yaron  wrote:
> I did but it requires two levels of macro and that made me nervous.
> The problem is derived values. When defining a binding, near as I can
> tell, the values in the binding cannot see other values in the
> binding. In other words:
>
> (def *A* 10)
> (binding [*A* 3 B (+ foo 1)] B)
>
> Returns 11, not 4.
>
> So to use the macro I have to:
>
> (def *A* bogus_value)
> (def B bogus_value)
>
> (defmacro in-environment [env & body]
>   `(binding [*A* :A ..]
>     (binding [B (+ *A* 1)...]
>     �...@body))
>
> I think this would actually work. But it requires a bunch of
> accounting (all the bogus global defs) and introduces some worrisome
> ordering issues. For example, let's say I have a value C whose
> definition is (def C (+ B 1)). I can't define it using the previous
> macro. Because, again, bindings can't see each other. So now I'd have
> to write a macro that dynamically created a whole set of nested
> bindings. Which seems like a lot of work.
>
> In other words:
>
> (binding [*A* :A...]
>   (binding [B (+ *A* 1)...]
>    (binding [C (+ *B* 1)...]
>      etc.
>
> And I can't use let (which does allow for internal visibility) because
> then other functions I call will bind to the global value not the let
> value.
>
>    Yaron

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread CuppoJava
I think it will help you get used to Clojure by spending some time to
  "program in the most straight-forward way possible".

Sometimes it's really helpful to just learn from a blank-slate instead
of trying to find analogies to Java.
  -Patrick

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread CuppoJava
Hi Yaron,

You've slightly misunderstood my suggestion. I hope this will shed
some reasoning on it:

In OO, what you are effectively doing is this:

The Object represents the "environment" under which you do your
calculations.
The "environment" object is created by your constructor.
Once this "environment" has been created, you can use it to do
calculations using "foo.tax_deductible_expenses(1)".

My example is meant to capture this style of programming. (Whether
this style is appropriate is up to you to decide.)

The "environment" is represented by a map.
You can write a function that creates an "environment" just like how
you can write a constructor to create an environment object in Java.
  eg.  new-environment( ... )
Once this environment has been created, you may use it to do
calculations using
  "(in-environment foo
 (tax-deductible-expenses 1))"

The in-environment macro is not meant to contain any logic. It is
solely meant to save you some typing.

Hope that's more clear.
  -Patrick

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread Yaron
I actually started off doing exactly what you suggested. The original
version of my program used a map for the arguments and then used
explicit arguments when the number of arguments fell to a reasonable
level.

For example, I started off with:

(defn months_in_business
"The total number of months we will be in the business of renting out
our home"
[Months_To_Find_Tenant Months_In_Lease Lease_Cycles Months_To_Sell]
(-> (+ Months_To_Find_Tenant Months_In_Lease) (* Lease_Cycles) (+
Months_To_Sell)))

Which got called as (months_in_business Months_To_Find_Tenant
Months_In_Lease Lease_Cycles Months_To_Sell)

But this was a lot of typing every time I wanted to call the function.
So I changed it to:

(defn months_in_business
"The total number of months we will be in the business of renting out
our home"
[:keys [Months_To_Find_Tenant Months_In_Lease Lease_Cycles
Months_To_Sell]]
(-> (+ Months_To_Find_Tenant Months_In_Lease) (* Lease_Cycles) (+
Months_To_Sell)))

Which got called as (months_in_business bag_o_args)

This at least meant less typing when calling the function but defining
the function still required a bunch of typing.

So eventually I just went to:

(defn months_in_business
"The total number of months we will be in the business of renting out
our home"
[]
(-> (+ *Months_To_Find_Tenant* *Months_In_Lease*) (* *Lease_Cycles*)
(+ *Months_To_Sell*)))

Which was called as: (months_in_business)

At least there wasn't much typing involved but now I had a bunch of
thunks running around. Which is what brought me to the group in the
first place.

It seems to me that there is a design principal here somewhere that
says something like "One shouldn't have to pass static values around
as arguments to functions". But because there is nothing like an
object context in Clojure this ended up meaning that derived values
like months_in_business have to be thunks. Which I though was
inelegant.

If, on the other hand, I was implementing this in an object oriented
language I would just say:

class foo
 var A
 var B
  foo (bag_o_args)
 {
A = (bag_o_args A)
B = A+1
 }

And I would be done. No heaps of typing. No thunks. Just what looks to
me like a nice simple solution.

But I recognize that I'm just running home to mommy because my
background is OO. That's why I came to the group in the first place.
Since I know I'm blinded by my OO past I wanted to see if there was an
approach to the problem in Clojure that was as easy and straight
forward as what I would have done in an OO language.

That having been said, defining a bunch of thunks isn't the worst
thing in the world. But it is unfortunate from both a design and
performance perspective.

Yaron

On Feb 16, 11:07 pm, Richard Newman  wrote:
> > It seems however that the consensus of the group based on what I've
> > said so far is to pass around state in a structmap.
>
> Not necessarily a struct-map. Just a map.
>
> > This is nice in
> > that it makes each function completely self contained (e.g. no
> > external references). It's unfortunate in that it now means that every
> > single function needs this extra argument and every variable access
> > either needs to use the :keys feature in the arguments or has to
> > directly refer to the keys in the map.
>
> Not necessarily. At some point your functions should be fine-grained  
> enough that they only take a couple of arguments. As soon as you drop  
> below 6 or 7, where they're all mandatory, switch to ordinary function  
> argument style.
>
> Wherever you call those functions should do the unpacking.
>
> E.g.,
>
> (defn outer-1 [{:keys [foo bar baz noo]}]
>    (let [interm (foo-bar foo bar)
>          fiddle (frostrup baz noo)]
>      (tweep interm fiddle)))
>
> After all, your house-sale-profit function should be expressed in  
> terms of two arguments:
>
> (defn house-sale-profit [house-sale-price house-sale-expenses]
>    ...)
>
> It doesn't care about the other 17.
>
> Another thing: that big entry point function is like a much tidier  
> version of the Java constructor that you created with 19 arguments --  
> tidier in that you can use named keys or a map to identify the  
> arguments.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread Yaron
I actually started off doing exactly what you suggested. The original
version of my program used a map for the arguments and then used
explicit arguments when the number of arguments fell to a reasonable
level.

For example, I started off with:

(defn months_in_business
"The total number of months we will be in the business of renting out
our home"
[Months_To_Find_Tenant Months_In_Lease Lease_Cycles Months_To_Sell]
(-> (+ Months_To_Find_Tenant Months_In_Lease) (* Lease_Cycles) (+
Months_To_Sell)))

Which got called as (months_in_business Months_To_Find_Tenant
Months_In_Lease Lease_Cycles Months_To_Sell)

But this was a lot of typing every time I wanted to call the function.
So I changed it to:

(defn months_in_business
"The total number of months we will be in the business of renting out
our home"
[:keys [Months_To_Find_Tenant Months_In_Lease Lease_Cycles
Months_To_Sell]]
(-> (+ Months_To_Find_Tenant Months_In_Lease) (* Lease_Cycles) (+
Months_To_Sell)))

Which got called as (months_in_business bag_o_args)

This at least meant less typing when calling the function but defining
the function still required a bunch of typing.

So eventually I just went to:

(defn months_in_business
"The total number of months we will be in the business of renting out
our home"
[]
(-> (+ *Months_To_Find_Tenant* *Months_In_Lease*) (* *Lease_Cycles*)
(+ *Months_To_Sell*)))

Which was called as: (months_in_business)

At least there wasn't much typing involved but now I had a bunch of
thunks running around. Which is what brought me to the group in the
first place.

It seems to me that there is a design principal here somewhere that
says something like "One shouldn't have to pass static values around
as arguments to functions". But because there is nothing like an
object context in Clojure this ended up meaning that derived values
like months_in_business have to be thunks. Which I though was
inelegant.

If, on the other hand, I was implementing this in an object oriented
language I would just say:

class foo
 var A
 var B
  foo (bag_o_args)
 {
A = (bag_o_args A)
B = A+1
 }

And I would be done. No heaps of typing. No thunks. Just what looks to
me like a nice simple solution.

But I recognize that I'm just running home to mommy because my
background is OO. That's why I came to the group in the first place.
Since I know I'm blinded by my OO past I wanted to see if there was an
approach to the problem in Clojure that was as easy and straight
forward as what I would have done in an OO language.

That having been said, defining a bunch of thunks isn't the worst
thing in the world. But it is unfortunate from both a design and
performance perspective.

Yaron

On Feb 16, 11:07 pm, Richard Newman  wrote:
> > It seems however that the consensus of the group based on what I've
> > said so far is to pass around state in a structmap.
>
> Not necessarily a struct-map. Just a map.
>
> > This is nice in
> > that it makes each function completely self contained (e.g. no
> > external references). It's unfortunate in that it now means that every
> > single function needs this extra argument and every variable access
> > either needs to use the :keys feature in the arguments or has to
> > directly refer to the keys in the map.
>
> Not necessarily. At some point your functions should be fine-grained  
> enough that they only take a couple of arguments. As soon as you drop  
> below 6 or 7, where they're all mandatory, switch to ordinary function  
> argument style.
>
> Wherever you call those functions should do the unpacking.
>
> E.g.,
>
> (defn outer-1 [{:keys [foo bar baz noo]}]
>    (let [interm (foo-bar foo bar)
>          fiddle (frostrup baz noo)]
>      (tweep interm fiddle)))
>
> After all, your house-sale-profit function should be expressed in  
> terms of two arguments:
>
> (defn house-sale-profit [house-sale-price house-sale-expenses]
>    ...)
>
> It doesn't care about the other 17.
>
> Another thing: that big entry point function is like a much tidier  
> version of the Java constructor that you created with 19 arguments --  
> tidier in that you can use named keys or a map to identify the  
> arguments.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread Yaron
I did but it requires two levels of macro and that made me nervous.
The problem is derived values. When defining a binding, near as I can
tell, the values in the binding cannot see other values in the
binding. In other words:

(def *A* 10)
(binding [*A* 3 B (+ foo 1)] B)

Returns 11, not 4.

So to use the macro I have to:

(def *A* bogus_value)
(def B bogus_value)

(defmacro in-environment [env & body]
  `(binding [*A* :A ..]
(binding [B (+ *A* 1)...]
 ~...@body))

I think this would actually work. But it requires a bunch of
accounting (all the bogus global defs) and introduces some worrisome
ordering issues. For example, let's say I have a value C whose
definition is (def C (+ B 1)). I can't define it using the previous
macro. Because, again, bindings can't see each other. So now I'd have
to write a macro that dynamically created a whole set of nested
bindings. Which seems like a lot of work.

In other words:

(binding [*A* :A...]
  (binding [B (+ *A* 1)...]
   (binding [C (+ *B* 1)...]
 etc.

And I can't use let (which does allow for internal visibility) because
then other functions I call will bind to the global value not the let
value.

   Yaron

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Integers can't be Objects?

2010-02-17 Thread Kevin Downey
the [ in front means an array. the String.format takes java varargs,
which the compiler de-sugars as an array. easier to use clojure's own
format function. which calls String's format method in the end, but
you don't have to create the array manually.

On Wed, Feb 17, 2010 at 9:21 AM, Phil  wrote:
> Sorry for the newbie question, but this seems a strange error
> message.  Either it is saying that a java.lang.Integer cannot be cast
> to an Object, or it is saying that it can't be cast to a particular
> object.  Some enlightenment would be appreciated.
>
> user=> (. String format "%d" 28)
> java.lang.ClassCastException: java.lang.Integer cannot be cast to
> [Ljava.lang.Object; (NO_SOURCE_FILE:0)
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: since a list of chars is not a string...

2010-02-17 Thread Wolfgang Meyer
To convert a string to a char sequence, you can use:

(seq (.toCharArray "abc"))

Clojure strings are Java strings, in case you didn't know.

Wolfgang


On Wed, Feb 17, 2010 at 12:10 PM, metaperl  wrote:

> The reference manual example implies that a list of chars is not a
> string:
>
> (let [[a b & c :as str] "asdjhhfdas"]
>  [a b c str])
> ->[\a \s (\d \j \h \h \f \d \a \s) "asdjhhfdas"]
>
>
> So what functions exist for conversion from chars to string and vice
> versa?
>
> Also how should I have been able to use the API docs  richhickey.github.com/clojure/clojure.core-api.html> to find the
> conversion functions myself?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Integers can't be Objects?

2010-02-17 Thread Phil
Sorry for the newbie question, but this seems a strange error
message.  Either it is saying that a java.lang.Integer cannot be cast
to an Object, or it is saying that it can't be cast to a particular
object.  Some enlightenment would be appreciated.

user=> (. String format "%d" 28)
java.lang.ClassCastException: java.lang.Integer cannot be cast to
[Ljava.lang.Object; (NO_SOURCE_FILE:0)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure API doc updated with both master and 1.1 (finally)

2010-02-17 Thread Sean Devlin
Tom,
I was just throwing an idea out there, not very high on my to-do list
either.  I agree with your prioritization.  If I come across a
project, I'll let you know.

Sean

On Feb 17, 11:59 am, Tom Faulhaber  wrote:
> Sean,
>
> Maybe, but it's not very high on my current priority list. Things like
> automated github pages and better searching and formatting are higher
> on the list (as well as a bunch of work on pretty print).
>
> Do you know of a project that is using autodoc that needs this? That
> would be a powerful impetus (as well as a good test case).
>
> Tom
>
> On Feb 17, 5:12 am, Sean Devlin  wrote:
>
> > Is the long term plan to include this multi-branch behavior in the
> > lein pluggin too?
>
> > Sean
>
> > On Feb 17, 3:27 am, Tom Faulhaber  wrote:
>
> > > The autodoc robot that builds the API docs choked sometime after the
> > > merge of the new branch into master and the clojure and  clojure-
> > > contrib API documents haven't been updating for the past 6 weeks or
> > > so. This has been unfortunate because it's been a time of momentous
> > > change (deftype and defprotocol, in particular).
>
> > > As it turns out, it was a busy period in my life as well, so I didn't
> > > get on top of it as quickly as I would have liked.
>
> > > However, I have good news: the autodoc robot now supports
> > > documentation in multiple branches. I have run this and installed it
> > > for the clojure API docs themselves so you can see both the master
> > > branch (with all the cool new stuff) and the 1.1.x branch (with all
> > > the stable stuff) athttp://richhickey.github.com/clojure/index.html.
>
> > > Multi-branch versions of clojure-contrib and incanter coming up RSN.
>
> > > Let me know if you see any probs in the docs.
>
> > > Thanks & Enjoy,
>
> > > Tom

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure API doc updated with both master and 1.1 (finally)

2010-02-17 Thread Tom Faulhaber
Sean,

Maybe, but it's not very high on my current priority list. Things like
automated github pages and better searching and formatting are higher
on the list (as well as a bunch of work on pretty print).

Do you know of a project that is using autodoc that needs this? That
would be a powerful impetus (as well as a good test case).

Tom

On Feb 17, 5:12 am, Sean Devlin  wrote:
> Is the long term plan to include this multi-branch behavior in the
> lein pluggin too?
>
> Sean
>
> On Feb 17, 3:27 am, Tom Faulhaber  wrote:
>
> > The autodoc robot that builds the API docs choked sometime after the
> > merge of the new branch into master and the clojure and  clojure-
> > contrib API documents haven't been updating for the past 6 weeks or
> > so. This has been unfortunate because it's been a time of momentous
> > change (deftype and defprotocol, in particular).
>
> > As it turns out, it was a busy period in my life as well, so I didn't
> > get on top of it as quickly as I would have liked.
>
> > However, I have good news: the autodoc robot now supports
> > documentation in multiple branches. I have run this and installed it
> > for the clojure API docs themselves so you can see both the master
> > branch (with all the cool new stuff) and the 1.1.x branch (with all
> > the stable stuff) athttp://richhickey.github.com/clojure/index.html.
>
> > Multi-branch versions of clojure-contrib and incanter coming up RSN.
>
> > Let me know if you see any probs in the docs.
>
> > Thanks & Enjoy,
>
> > Tom

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: newbie question: Please help me stop creating constructors

2010-02-17 Thread CuppoJava
Hi Yaron,
Have you considered my example yet? It seems to fulfill your
requirements. One of the primary use-cases of (binding) is to avoid
bloating the parameter list of a group of functions.

If my example does not satisfy your needs, then I think we may have
all misunderstood what it is you're looking for. Something that you
could do to get your point across is to post some Java code that
illustrates the sort of abstraction that you're looking for.

  -Patrick

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: REST library

2010-02-17 Thread Roman Roelofsen
Shantanu Kumar wrote:
> On Feb 17, 3:05 pm, Roman Roelofsen 
> wrote:
>   
>> Hi,
>>
>> does someone knows a good Clojure REST framework? It should help with
>> URL destructuring and maybe creating JSON return data etc.
>> 
>
> You can take a look at Taimen (in Alpha now) - 
> http://code.google.com/p/bitumenframework/
>
> Taimen doesn't do serialization for you, but you can use clojure.json
> for that.
>
> This is also worth taking a look at: 
> http://code.google.com/p/implementing-rest/wiki/ByLanguage
>
> Regards,
> Shantanu
>
>   
Thanks!

Roman

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure API doc updated with both master and 1.1 (finally)

2010-02-17 Thread alux
Well, ehm, yes, okay, thank you Meikel.

Regards, alux

On 17 Feb., 17:22, Meikel Brandmeyer  wrote:
> Hi,
>
> On Feb 17, 5:17 pm, alux  wrote:
>
> > But another beginners question: Is there any prossibility to download
> > the API doc? I'm offline a lot, and can't always look at the site.
>
> From the link given by Tom:
>
>     "If you wish to have a version for off-line use you can use the
> download button on the  gh-pages branch page at GitHub."
>
> (In the original even with link...)
>
> Sincerely
> Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure API doc updated with both master and 1.1 (finally)

2010-02-17 Thread Meikel Brandmeyer
Hi,

On Feb 17, 5:17 pm, alux  wrote:

> But another beginners question: Is there any prossibility to download
> the API doc? I'm offline a lot, and can't always look at the site.

>From the link given by Tom:

"If you wish to have a version for off-line use you can use the
download button on the  gh-pages branch page at GitHub."

(In the original even with link...)

Sincerely
Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure API doc updated with both master and 1.1 (finally)

2010-02-17 Thread Sean Devlin
Alux,
That's what the doc macro is for.  Here's an example.

user=> (doc +)
-
clojure.core/+
([] [x] [x y] [x y & more])
  Returns the sum of nums. (+) returns 0.


On Feb 17, 11:17 am, alux  wrote:
> Very nice!
>
> But another beginners question: Is there any prossibility to download
> the API doc? I'm offline a lot, and can't always look at the site.
>
> Thank you, alux
>
> On 17 Feb., 14:53, Rich Hickey  wrote:
>
> > On Wed, Feb 17, 2010 at 3:27 AM, Tom Faulhaber  
> > wrote:
> > > The autodoc robot that builds the API docs choked sometime after the
> > > merge of the new branch into master and the clojure and  clojure-
> > > contrib API documents haven't been updating for the past 6 weeks or
> > > so. This has been unfortunate because it's been a time of momentous
> > > change (deftype and defprotocol, in particular).
>
> > > As it turns out, it was a busy period in my life as well, so I didn't
> > > get on top of it as quickly as I would have liked.
>
> > > However, I have good news: the autodoc robot now supports
> > > documentation in multiple branches. I have run this and installed it
> > > for the clojure API docs themselves so you can see both the master
> > > branch (with all the cool new stuff) and the 1.1.x branch (with all
> > > the stable stuff) athttp://richhickey.github.com/clojure/index.html.
>
> > > Multi-branch versions of clojure-contrib and incanter coming up RSN.
>
> > > Let me know if you see any probs in the docs.
>
> > Absolutely fantastic, and much appreciated - thanks Tom!
>
> > Rich

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure API doc updated with both master and 1.1 (finally)

2010-02-17 Thread alux
Very nice!

But another beginners question: Is there any prossibility to download
the API doc? I'm offline a lot, and can't always look at the site.

Thank you, alux

On 17 Feb., 14:53, Rich Hickey  wrote:
> On Wed, Feb 17, 2010 at 3:27 AM, Tom Faulhaber  wrote:
> > The autodoc robot that builds the API docs choked sometime after the
> > merge of the new branch into master and the clojure and  clojure-
> > contrib API documents haven't been updating for the past 6 weeks or
> > so. This has been unfortunate because it's been a time of momentous
> > change (deftype and defprotocol, in particular).
>
> > As it turns out, it was a busy period in my life as well, so I didn't
> > get on top of it as quickly as I would have liked.
>
> > However, I have good news: the autodoc robot now supports
> > documentation in multiple branches. I have run this and installed it
> > for the clojure API docs themselves so you can see both the master
> > branch (with all the cool new stuff) and the 1.1.x branch (with all
> > the stable stuff) athttp://richhickey.github.com/clojure/index.html.
>
> > Multi-branch versions of clojure-contrib and incanter coming up RSN.
>
> > Let me know if you see any probs in the docs.
>
> Absolutely fantastic, and much appreciated - thanks Tom!
>
> Rich

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure API doc updated with both master and 1.1 (finally)

2010-02-17 Thread Rich Hickey
On Wed, Feb 17, 2010 at 3:27 AM, Tom Faulhaber  wrote:
> The autodoc robot that builds the API docs choked sometime after the
> merge of the new branch into master and the clojure and  clojure-
> contrib API documents haven't been updating for the past 6 weeks or
> so. This has been unfortunate because it's been a time of momentous
> change (deftype and defprotocol, in particular).
>
> As it turns out, it was a busy period in my life as well, so I didn't
> get on top of it as quickly as I would have liked.
>
> However, I have good news: the autodoc robot now supports
> documentation in multiple branches. I have run this and installed it
> for the clojure API docs themselves so you can see both the master
> branch (with all the cool new stuff) and the 1.1.x branch (with all
> the stable stuff) at http://richhickey.github.com/clojure/index.html.
>
> Multi-branch versions of clojure-contrib and incanter coming up RSN.
>
> Let me know if you see any probs in the docs.
>

Absolutely fantastic, and much appreciated - thanks Tom!

Rich

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: clojure-contrib on Windows

2010-02-17 Thread Chris Perkins
On Feb 16, 5:51 pm, Ram  wrote:
> I'm having an issue compiling clojure-contrib on Windows.
>
> I downloaded the code from the git repository and when I run Maven,
> after compilation it runs through the test suite fails in test-io:
>
> FAIL in (test-as-url) (run-test5405918110152723544.clj:47)
> expected: (= (URL. "file:/foo") (as-url (File. "/foo")))
>   actual: (not (= # #))
>
> I'm guessing someone expected UNIX style filenames in this test case
> and not Windows filenames, but that is besides the issue. The issue is
> that the jars aren't actually generating themselves. Am I missing
> something? If I am, its probably something really dumb.

Yes, contrib has had some failing tests on Windows for a while now.
You can tell maven to ignore the tests and install the jars anyway:

mvn -Dmaven.test.skip=true install

Chris

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Very strange swank-clojure error

2010-02-17 Thread George .
Nevermind that, sorry.  1.1 is working.  1.2 might not work because of a
lein issue, perhaps?

On Wed, Feb 17, 2010 at 10:26 PM, George .  wrote:

> If I toss clojure.jar and swank-clojure.jar into the swank classpath (for
> instance ~/.clojure), it works beautifully.  But as soon as I put
> clojure-contrib.jar in there, it explodes:
>
> Clojure 1.2.0-master-SNAPSHOTojure 1.2.0-master-SNAPSHOT
> user=> java.lang.NoSuchMethodError: clojure.lang.RestFn.(I)V
> (pprint.clj:1)
> user=> user=> java.lang.Exception: No such var:
> swank.swank/ignore-protocol-version (NO_SOURCE_FILE:3)
> user=> user=> nil
> java.lang.Exception: No such var: swank.swank/start-server
> (NO_SOURCE_FILE:5)
> user=> java.lang.NoSuchMethodError: clojure.lang.RestFn.(I)V
> (pprint.clj:1)
> user=> user=> java.lang.Exception: No such var:
> swank.swank/ignore-protocol-version (NO_SOURCE_FILE:3)
> user=> user=> nil
> java.lang.Exception: No such var: swank.swank/start-server
> (NO_SOURCE_FILE:5)
>
> This doesn't seem to be a 1.2 issue since I tried it with both 1.2 and 1.1
>
>
> Any idea what's going on?  Same issue with both the trunk and the elpa
> package.
>

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

Very strange swank-clojure error

2010-02-17 Thread George .
If I toss clojure.jar and swank-clojure.jar into the swank classpath (for
instance ~/.clojure), it works beautifully.  But as soon as I put
clojure-contrib.jar in there, it explodes:

Clojure 1.2.0-master-SNAPSHOTojure 1.2.0-master-SNAPSHOT
user=> java.lang.NoSuchMethodError: clojure.lang.RestFn.(I)V
(pprint.clj:1)
user=> user=> java.lang.Exception: No such var:
swank.swank/ignore-protocol-version (NO_SOURCE_FILE:3)
user=> user=> nil
java.lang.Exception: No such var: swank.swank/start-server
(NO_SOURCE_FILE:5)
user=> java.lang.NoSuchMethodError: clojure.lang.RestFn.(I)V
(pprint.clj:1)
user=> user=> java.lang.Exception: No such var:
swank.swank/ignore-protocol-version (NO_SOURCE_FILE:3)
user=> user=> nil
java.lang.Exception: No such var: swank.swank/start-server
(NO_SOURCE_FILE:5)

This doesn't seem to be a 1.2 issue since I tried it with both 1.2 and 1.1

Any idea what's going on?  Same issue with both the trunk and the elpa
package.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Clojure API doc updated with both master and 1.1 (finally)

2010-02-17 Thread Sean Devlin
Is the long term plan to include this multi-branch behavior in the
lein pluggin too?

Sean

On Feb 17, 3:27 am, Tom Faulhaber  wrote:
> The autodoc robot that builds the API docs choked sometime after the
> merge of the new branch into master and the clojure and  clojure-
> contrib API documents haven't been updating for the past 6 weeks or
> so. This has been unfortunate because it's been a time of momentous
> change (deftype and defprotocol, in particular).
>
> As it turns out, it was a busy period in my life as well, so I didn't
> get on top of it as quickly as I would have liked.
>
> However, I have good news: the autodoc robot now supports
> documentation in multiple branches. I have run this and installed it
> for the clojure API docs themselves so you can see both the master
> branch (with all the cool new stuff) and the 1.1.x branch (with all
> the stable stuff) athttp://richhickey.github.com/clojure/index.html.
>
> Multi-branch versions of clojure-contrib and incanter coming up RSN.
>
> Let me know if you see any probs in the docs.
>
> Thanks & Enjoy,
>
> Tom

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: since a list of chars is not a string...

2010-02-17 Thread Sean Devlin
Also, you might want to check out clojure contrib for some string
stuff.  str-utils2 if you're running 1.1, string if you're on edge.

Sean

On Feb 17, 6:10 am, metaperl  wrote:
> The reference manual example implies that a list of chars is not a
> string:
>
> (let [[a b & c :as str] "asdjhhfdas"]
>   [a b c str])
> ->[\a \s (\d \j \h \h \f \d \a \s) "asdjhhfdas"]
>
> So what functions exist for conversion from chars to string and vice
> versa?
>
> Also how should I have been able to use the API docs  richhickey.github.com/clojure/clojure.core-api.html> to find the
> conversion functions myself?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: #

2010-02-17 Thread Michał Marczyk
On 17 February 2010 12:49, Terrence Brannon  wrote:
> The reference manual REPL transcript 
> makes it look like it is being used to retrieve the metadata:
>
> user=> ^#'mymax
> ->{:name mymax,
>:user/comment "this is the best fn ever!",
>:doc "mymax [xs+] gets the maximum value in xs using > ",
>:arglists ([x] [x y] [x y & more])
>:file "repl-1",
>:line 126,
>:ns #,

This is actually outdated and should be corrected -- ^#'mymax breaks
down as ^, then #', then mymax, which used to mean (meta (var mymax)),
only the use of ^ in place of meta is deprecated now...

Sincerely,
Michał

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: #

2010-02-17 Thread Terrence Brannon
On Wed, Feb 17, 2010 at 6:49 AM, Terrence Brannon wrote:

>
>
> Also, I'm not clear on why I cant get the metadata for this variable x I
> just defined even though meta() takes an object as argument <
> http://clojure.org/metadata>
>

Because I passed the value of the variable x, not the object... here's how
to get the metadata:

user=> (meta (var x))
{:ns #,
 :name x,
 :file "NO_SOURCE_PATH",
 :line 2,
 :doc "some doc"}

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: #

2010-02-17 Thread Meikel Brandmeyer
Hi,

On Feb 17, 12:49 pm, Terrence Brannon  wrote:

> On Wed, Feb 17, 2010 at 5:51 AM, Meikel Brandmeyer  wrote:
>
> > #^ attaches metadata to the following thing read.
>
> The reference manual REPL transcript 
> makes it look like it is being used to retrieve the metadata:
>
> user=> ^#'mymax
> ->{:name mymax,
>    :user/comment "this is the best fn ever!",
>    :doc "mymax [xs+] gets the maximum value in xs using > ",
>    :arglists ([x] [x y] [x y & more])
>    :file "repl-1",
>    :line 126,
>    :ns #,
>
> :test #}
>
> Also, I'm not clear on why I cant get the metadata for this variable x I
> just defined even though meta() takes an object as argument 
> 
>
> user=> (def #^{ :doc "some doc" } x 12)
> #'user/x
> user=> (meta x)
> nil
> user=> x
> 12
> user=>

You confuse #^ with #'.

Try (meta #'x).

Sincerely
Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: #

2010-02-17 Thread Terrence Brannon
On Wed, Feb 17, 2010 at 5:51 AM, Meikel Brandmeyer  wrote:
>
>
> #^ attaches metadata to the following thing read.
>

The reference manual REPL transcript 
makes it look like it is being used to retrieve the metadata:

user=> ^#'mymax
->{:name mymax,
   :user/comment "this is the best fn ever!",
   :doc "mymax [xs+] gets the maximum value in xs using > ",
   :arglists ([x] [x y] [x y & more])
   :file "repl-1",
   :line 126,
   :ns #,

:test #}

Also, I'm not clear on why I cant get the metadata for this variable x I
just defined even though meta() takes an object as argument <
http://clojure.org/metadata>

user=> (def #^{ :doc "some doc" } x 12)
#'user/x
user=> (meta x)
nil
user=> x
12
user=>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: :strs and :syms directives

2010-02-17 Thread Timothy Pratley
On 17 February 2010 22:24, metaperl  wrote:
> Hi, the ref manual  introduces :keys
> which I understand. It then says:
>
> """There are similar :strs and :syms directives for matching string
> and symbol keys."""
>
> but no example is given. Could someone supply an example for each of
> these directives please? I simply am finding the manual too terse
> here.


user=> (let [{:keys [fred]} {:fred "I'm fred"}] fred)
"I'm fred"
user=> (let [{:strs [fred]} {"fred" "I'm fred"}] fred)
"I'm fred"
user=> (let [{:syms [fred]} {'fred "I'm fred"}] fred)
"I'm fred"


:keysbinds   fred   to  the value in the map found with key :fred
:strs binds   fred   to the value in the map found with key "fred"
:syms   binds   fred   to the value in the map found with key which is
a symbol fred

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: can the :test metadata be used to constrain the range of a variable?

2010-02-17 Thread Timothy Pratley
On 17 February 2010 21:53, metaperl  wrote:
>
> I tried to use :test to constrain the range of a variable, but it
> didnt seem to work. Am I misunderstanding the purpose of this keyword?

What you want is set-validator!

:test can be used to store a unit test (typically for a function) but
you should use clojure.test for writing unit tests, just ignore :test


Usage: (set-validator! iref validator-fn)

Sets the validator-fn for a var/ref/agent/atom. validator-fn must be nil or a
side-effect-free fn of one argument, which will be passed the intended
new state on any state change. If the new state is unacceptable, the
validator-fn should return false or throw an exception. If the current
state (root
value if var) is not acceptable to the new validator, an exception
will be thrown and the validator will not be changed.

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


:strs and :syms directives

2010-02-17 Thread metaperl
Hi, the ref manual  introduces :keys
which I understand. It then says:

"""There are similar :strs and :syms directives for matching string
and symbol keys."""

but no example is given. Could someone supply an example for each of
these directives please? I simply am finding the manual too terse
here.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: since a list of chars is not a string...

2010-02-17 Thread Timothy Pratley
On 17 February 2010 22:10, metaperl  wrote:

> So what functions exist for conversion from chars to string and vice
> versa?
>

Strings can be passed to any function expecting a collection like map,
reduce, etc.
To convert chars to a string you can use (str).
Most of the string/character support is left to java interop but you can
find some extra helpers in contrib also


user=> (str \a \b \c)
"abc"
user=> (apply str [\a \b \c])
"abc"
user=> (map #(Character/toUpperCase %) "abc")
(\A \B \C)

hope that helps :)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Code Review: how can I make this socket code more functional?

2010-02-17 Thread Matt Culbreth
Thanks Wilson.  I'm actually not using the Java Servlet classes, and
am instead going down to the socket and streams level.

On Feb 16, 5:00 pm, Wilson MacGyver  wrote:
> assuming you are doing this using java servlet.
>
> you may want to look at how compojure does this.
>
> http://github.com/weavejester/compojure/blob/master/src/compojure/htt...
>
> it turns the request into a map.
>
> and then various other parts of compojure can do different things
> based on the map.
>
>
>
>
>
> On Tue, Feb 16, 2010 at 4:17 PM, Matt Culbreth  wrote:
> > Hello Group,
>
> > I'm writing a web server in Clojure and I'd love to have a bit of help
> > on a function I have.
>
> > This function (and athttp://gist.github.com/305909) is used to read
> > the HTTP request from a client and to then act on it:
>
> > (defn handle-request
> >    [in out]
> >    (binding [*in* (BufferedReader. (InputStreamReader. in))]
> >        (let [client-out (OutputStreamWriter. out)]
> >            (loop [lines []]
> >                (let [input (read-line)]
> >                    (if
> >                        (= (.length input) 0)
> >                        ;; 0 length line means it's time to serve the
> > resource
> >                        (println lines)
> >                        ;; add to the lines vector and keep going
> >                        ;; note it makes the incoming request reversed
> >                        (recur (cons input lines
>
> > The code works fine; I've left out the bit that actually does
> > something and replaced it with a println call.  It's not very
> > functional feeling though.  The loop/recur and the building of a list
> > seems very imperative to me.  I'd much rather use something from
> > clojure.contrib.io, probably using read-lines or something.
>
> > Thanks for looking and for any suggestions!
>
> > Matt
>
> > --
> > 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
>
> --
> Omnem crede diem tibi diluxisse supremum.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Code Review: how can I make this socket code more functional?

2010-02-17 Thread Matt Culbreth
Cool, just what I needed Alan.  Thanks for the help.


On Feb 16, 4:30 pm, Alan Dipert  wrote:
> Hi Matt,
> I think what you're looking for is 
> line-seq:http://richhickey.github.com/clojure/clojure.core-api.html#clojure.co...
>
> In your code, if you pass *in* to line-seq, you'll get back a seq of lines
> (the request headers).  Incidentally, I first ran into line-seq in the
> course of writing a Clojure web server as a first project.  You can see
> line-seq in action on line 52 of this gist, inside the 'handle-request'
> function:http://gist.github.com/203329
>
> I'm pretty new to Clojure myself so there might be a better way.  Hope
> this helps,
>
> Alan
>
> Excerpts from Matt Culbreth's message of 2010-02-16 16:17:57 -0500:
>
>
>
> > Hello Group,
>
> > I'm writing a web server in Clojure and I'd love to have a bit of help
> > on a function I have.
>
> > This function (and athttp://gist.github.com/305909) is used to read
> > the HTTP request from a client and to then act on it:
>
> > (defn handle-request
> >     [in out]
> >     (binding [*in* (BufferedReader. (InputStreamReader. in))]
> >         (let [client-out (OutputStreamWriter. out)]
> >             (loop [lines []]
> >                 (let [input (read-line)]
> >                     (if
> >                         (= (.length input) 0)
> >                         ;; 0 length line means it's time to serve the
> > resource
> >                         (println lines)
> >                         ;; add to the lines vector and keep going
> >                         ;; note it makes the incoming request reversed
> >                         (recur (cons input lines
>
> > The code works fine; I've left out the bit that actually does
> > something and replaced it with a println call.  It's not very
> > functional feeling though.  The loop/recur and the building of a list
> > seems very imperative to me.  I'd much rather use something from
> > clojure.contrib.io, probably using read-lines or something.
>
> > Thanks for looking and for any suggestions!
>
> > Matt
>
> --
> Alan Diperthttp://alan.dipert.org

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


since a list of chars is not a string...

2010-02-17 Thread metaperl
The reference manual example implies that a list of chars is not a
string:

(let [[a b & c :as str] "asdjhhfdas"]
  [a b c str])
->[\a \s (\d \j \h \h \f \d \a \s) "asdjhhfdas"]


So what functions exist for conversion from chars to string and vice
versa?

Also how should I have been able to use the API docs  to find the
conversion functions myself?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: REST library

2010-02-17 Thread Shantanu Kumar


On Feb 17, 3:05 pm, Roman Roelofsen 
wrote:
> Hi,
>
> does someone knows a good Clojure REST framework? It should help with
> URL destructuring and maybe creating JSON return data etc.

You can take a look at Taimen (in Alpha now) - 
http://code.google.com/p/bitumenframework/

Taimen doesn't do serialization for you, but you can use clojure.json
for that.

This is also worth taking a look at: 
http://code.google.com/p/implementing-rest/wiki/ByLanguage

Regards,
Shantanu

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


can the :test metadata be used to constrain the range of a variable?

2010-02-17 Thread metaperl
I tried to use :test to constrain the range of a variable, but it
didnt seem to work. Am I misunderstanding the purpose of this keyword?

user=> (def #^{ :doc "Integer between -5 and 5" :test (fn [] (assert
(and (> x -5) (< x 5} x 12)
#'user/x
user=> user/x
12

I had hoped this would throw an exception or something...

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: #

2010-02-17 Thread Meikel Brandmeyer
Hi,

On Feb 17, 11:44 am, metaperl  wrote:

> I was able to successfully define and use the mymax function, but when
> I try to examine the metadata, I get the error above. Source code and
> REPL transcript follow:
>
> 
>
> user=> (com.new-ns/mymax 4 2 9 1)
> 9
> user=> #^'com.new-ns/mymax
> # Metadata must be Symbol,Keyword,String or Map>

#^ attaches metadata to the following thing read. So "#^{:a :b} x"
will set the map {:a :b} as metadata for the symbol x. "#^String x" is
shorthand for "#^{:tag String} x" which gives a tip to the compiler
that x is a String.

What you need is "meta": (meta (quote #^{:a :b} x)) => {:a :b}

Sincerely
Meikel

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


Can I make this faster?

2010-02-17 Thread aria42
Hi all, I was playing with the defprotocol/deftype/reify stuff in 1.2,
and I wanted to test how a common abstraction I use would look if I
did with java data structures vs. clojure ones. I've pasted the code
below. I'll wait for you to take a lookSo on my test, I have the
Clojure version about 5x slower than the Java one only one cpu. Now I
know that JavaMapCounter isn't thread safe, while ClojureCounter is,
and that if I had sufficiently many cpus, the clojure version would be
faster. But is there a better way to do what I'm doing with clojure to
get the performance a bit more up to par with javas?

Thanks, Aria

(defprotocol Counter
  (getCount [_ k])
  (incCount! [_ k v])
  (totalCount [_]))

(defn JavaMapCounter []
  (let [counts (java.util.HashMap.)
total (org.apache.commons.lang.mutable.MutableDouble.)]
(reify :as self
 Counter
 (getCount [k] (.get counts k))
 (incCount! [k v]
   (let [cur-v (if-let [x (getCount self k)] x 0.0)]
(.put counts k (+ v cur-v)))
   (.setValue total (+ (.doubleValue total) v)))
 (totalCount [] (.doubleValue total)

(defn ClojureCounter []
  (let [state (atom {:counts (hash-map) :total 0.0})]
(reify :as self
 Counter
 (getCount [k] (if-let [x (get-in @state [:counts,k])] x 0.0))
 (incCount! [k v]
   (swap! state
 (fn [data]
   (let [add-v (fn [x] (if x (+ x v) v))]
  (-> data (update-in  [:counts,k] add-v)
   (update-in [:total] add-v))
 (totalCount [] (:total @state)

(defn testCounter [counter]
  (let [r (java.util.Random. 0)]
(dotimes  [_ 100]
  (incCount! counter (.nextInt r 10) (.nextDouble r)

(time (testCounter (JavaMapCounter)))
(time (testCounter (ClojureCounter)))

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


#

2010-02-17 Thread metaperl
Hello, I'm trying to study this page  using NetBeans Enclojure.

I was able to successfully define and use the mymax function, but when
I try to examine the metadata, I get the error above. Source code and
REPL transcript follow:



user=> (com.new-ns/mymax 4 2 9 1)
9
user=> #^'com.new-ns/mymax
#
user=> #
user=> #
user=>




(ns com.new-ns
  ;(:require )
  ;(:use )
  ;(:import )
  )


(defn
#^{:doc "mymax [xs+] gets the maximum value in xs using > "
   :test (fn []
 (assert (= 42  (mymax 2 42 5 4
   :user/comment "this is the best fn ever!"}
  mymax
  ([x] x)
  ([x y] (if (> x y) x y))
  ([x y & more]
   (reduce mymax (mymax x y) more)))



-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: REST library

2010-02-17 Thread Alex Ott
Hello

Roman Roelofsen  at "Wed, 17 Feb 2010 11:05:27 +0100" wrote:
 RR> Hi,

 RR> does someone knows a good Clojure REST framework? It should help with
 RR> URL destructuring and maybe creating JSON return data etc.

I built web-services using compojure + clojure.json - all works fine

-- 
With best wishes, Alex Ott, MBA
http://alexott.blogspot.com/   http://alexott.net
http://alexott-ru.blogspot.com/

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Leaning about VM's, JVM in particular

2010-02-17 Thread Jeff Rose
I found this book to be a pretty nice as a full introduction to
virtual machines.  It was readable, and it has detailed sections on
the JVM and the CLR.

http://www.amazon.com/gp/product/1558609105/ref=wms_ohs_product

Beyond that, one really fun way to get your hands dirty with a virtual
machine is to play with or implement your own universal machine (UM).
This is an incredibly simple VM design that was created for the 2006
ICFP competition.  (It has something like 10 instructions.) You can
download the specification and programs that will run on the VM once
you've implemented it here:

http://www.boundvariable.org/task.shtml

Once you implement the VM, which can probably be done in an evening to
a weekend depending on your Clojure chops, you can load an image
provided by the contest, and then actually run a whole unix like OS on
top of your virtual machine, where there are user accounts to hack and
other problems to solve.  Really fun stuff, and it does give you a
concrete sense for what a VM has to do and how it works.

cheers,
Jeff Rose

On Feb 16, 5:29 pm, Andrey Fedorov  wrote:
> Hi all,
>
> I'm looking for approaches to learn about VM's, the JVM in particular.
> I noticed some local university courses use Virtual Machines (Smith,
> Nair) [1]. I'm planning on getting it, but would rather query you guys
> for opinions first, and recommendations on other books/resources?
>
> Cheers,
> Andrey
>
> 1.http://www.amazon.com/gp/product/1558609105/

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


REST library

2010-02-17 Thread Roman Roelofsen
Hi,

does someone knows a good Clojure REST framework? It should help with
URL destructuring and maybe creating JSON return data etc.

Cheers,

Roman

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Clojure API doc updated with both master and 1.1 (finally)

2010-02-17 Thread Tom Faulhaber
The autodoc robot that builds the API docs choked sometime after the
merge of the new branch into master and the clojure and  clojure-
contrib API documents haven't been updating for the past 6 weeks or
so. This has been unfortunate because it's been a time of momentous
change (deftype and defprotocol, in particular).

As it turns out, it was a busy period in my life as well, so I didn't
get on top of it as quickly as I would have liked.

However, I have good news: the autodoc robot now supports
documentation in multiple branches. I have run this and installed it
for the clojure API docs themselves so you can see both the master
branch (with all the cool new stuff) and the 1.1.x branch (with all
the stable stuff) at http://richhickey.github.com/clojure/index.html.

Multi-branch versions of clojure-contrib and incanter coming up RSN.

Let me know if you see any probs in the docs.

Thanks & Enjoy,

Tom

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