Re: defmethod/defmulti should dispatch on the new arguments when we call the recur..?

2010-12-19 Thread Meikel Brandmeyer
Hi,

Am 19.12.2010 um 08:30 schrieb Sunil S Nandihalli:

> Hello everybody,
>  It would be nice if calling recur inside a defmethod redispatched on the new 
> arguments.. I have shown a simple use-case in the following gist.
> https://gist.github.com/747171
> 
> It might be naive .. but I feel IMHO that this should be the default 
> behaviour and not have any performance issues related to it..

recur is a simple goto to the enclosing loop or method. It cannot cross the 
enclosing method borders. So it also can't redispatch. You'd need recur to 
know, that it is in a mutlimethod and that there is no enclosing loop and then 
it to behave differently in that case. The method itself is just a plain 
clojure function.

If you need to re-dispatch you have to use true recursion and call the 
multimethod again by name.

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


Error Handling for Callback API to Blocking API example in Joy of Clojure

2010-12-19 Thread HiHeelHottie

In Joy of Clojure, there is a callback API to blocking API example in
the section on promises.  Chouser outlines it a briefly in a
discussion on Promise/Deliver use cases here -
http://groups.google.com/group/clojure/browse_thread/thread/b1548aa40ba8072/210ec81bfe26032e?lnk=gst&q=promise#210ec81bfe26032e:

I've used them to convert a callback-based (continuation-passing
style, if you will) API into a blocking one.  The lib I was using
provides something you can call like:
(rpc-call destination method-args done)
Where 'done' is a function that gets called with the results of
the remote procedure call.  But I want to write a function that
does rpc but *returns* the result, so...
(let [p (promise)]
  (rpc-call destination method-args #(deliver p %))
  @p)
This will work just fine whether rpc-call calls 'done'
synchronously, or if it returns right away and 'done' is called
by some other thread later.
--Chouser

This is very neat.  Is this robust as is or would you need to add code
to handle error cases such as an unavailable rpc server, rpc server
never returning, an error trying to make the rpc call, etc.

-- 
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: Dispatch on return type?

2010-12-19 Thread nicolas.o...@gmail.com
On Sun, Dec 19, 2010 at 5:21 AM, Tim Daly  wrote:
>  Axiom, a computer algebra system I maintain,
> can dispatch on return type. I am looking at
> the things Clojure can do that might support
> the Spad language (the mathematical language
> in Axiom). I could not find a way to adjust
> the multimethod to dispatch on return type.
>
>

There is no static typing in Clojure. So the notion of return type do
not really exists.

Meikel's solution seems the simplest.

-- 
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: Dispatch on return type?

2010-12-19 Thread Meikel Brandmeyer
Hi,

Am 19.12.2010 um 11:36 schrieb nicolas.o...@gmail.com:

> There is no static typing in Clojure. So the notion of return type do
> not really exists.

Yes. The type system of eg. Haskell or OCaml is another layer of information, 
which you don't have in Clojure. On the other, it's another bad conscience you 
have to satisfy. This you don't have to do in Clojure, which can makes things 
easier at times. There is always a trade-off.

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: Dispatch on return type?

2010-12-19 Thread nicolas.o...@gmail.com
On Sun, Dec 19, 2010 at 11:24 AM, Meikel Brandmeyer  wrote:
> Hi,
>
> Am 19.12.2010 um 11:36 schrieb nicolas.o...@gmail.com:
>
>> There is no static typing in Clojure. So the notion of return type do
>> not really exists.
>
> Yes. The type system of eg. Haskell or OCaml is another layer of information, 
> which you don't have in Clojure. On the other, it's another bad conscience 
> you have to satisfy. This you don't have to do in Clojure, which can makes 
> things easier at times. There is always a trade-off.

I agree. Some program that makes perfect sense cannot be typed in a
ML-like type system.

But without extra-type information, it is difficult to dispatch on the
return type, as would be possible with type classes in Haskell, for
example.

However, if you have a specific DSL, as in the present case, you might
be able to write your own type inference at the macro level and
annotate term with their return type to dispatch, using Meikel's idea,
at runtime.

-- 
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: defmethod/defmulti should dispatch on the new arguments when we call the recur..?

2010-12-19 Thread Sunil S Nandihalli
thanks Meikel for your clarification.. I used to think loop recur almost
removed the need for TCO .. but here is a case where true TCO could be
really helpfull..
Sunil.

On Sun, Dec 19, 2010 at 1:33 PM, Meikel Brandmeyer  wrote:

> Hi,
>
> Am 19.12.2010 um 08:30 schrieb Sunil S Nandihalli:
>
> > Hello everybody,
> >  It would be nice if calling recur inside a defmethod redispatched on the
> new arguments.. I have shown a simple use-case in the following gist.
> > https://gist.github.com/747171
> >
> > It might be naive .. but I feel IMHO that this should be the default
> behaviour and not have any performance issues related to it..
>
> recur is a simple goto to the enclosing loop or method. It cannot cross the
> enclosing method borders. So it also can't redispatch. You'd need recur to
> know, that it is in a mutlimethod and that there is no enclosing loop and
> then it to behave differently in that case. The method itself is just a
> plain clojure function.
>
> If you need to re-dispatch you have to use true recursion and call the
> multimethod again by name.
>
> 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

-- 
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: defmethod/defmulti should dispatch on the new arguments when we call the recur..?

2010-12-19 Thread Ken Wesson
On Sun, Dec 19, 2010 at 10:34 AM, Sunil S Nandihalli
 wrote:
> thanks Meikel for your clarification.. I used to think loop recur almost
> removed the need for TCO .. but here is a case where true TCO could be
> really helpfull..

If we had a (resolve-method multi & args) that resolved dispatch and
then returned a fn that would call the method with those same args --
so ((resolve-method multi & args)) <=> (multi & args) -- then this
could be used with trampoline in cases like Sunil is describing.

-- 
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: defmethod/defmulti should dispatch on the new arguments when we call the recur..?

2010-12-19 Thread Meikel Brandmeyer
Hi,

Am 19.12.2010 um 16:46 schrieb Ken Wesson:

> If we had a (resolve-method multi & args) that resolved dispatch and
> then returned a fn that would call the method with those same args --
> so ((resolve-method multi & args)) <=> (multi & args) -- then this
> could be used with trampoline in cases like Sunil is describing.

It's called get-method.

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


"classic" clojure-contrib 1.3.0-alpha4 released

2010-12-19 Thread Stuart Sierra
Description of current plans for future releases is 
at http://dev.clojure.org/display/design/Common+Contrib+Build

-Stuart Sierra
clojure.com

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

Re: currying in clojure for fixed number of arg functions

2010-12-19 Thread Robert McIntyre
What do people think about extending the definition of partial in core
to work on just a single argument?

That is, if you call partial with just a function and no arguments, it
just returns the function.

It seems to follow logically from the other airties.

For a case where this is useful, see https://gist.github.com/746185

Sincerely,
--Robert McIntyre

On Sat, Dec 18, 2010 at 5:02 PM, Benny Tsai  wrote:
> This is very cool!
>
> Taken together with the following projects, Clojure now has some of
> the nicest parts of Haskell/ML, IMHO :)
>
> Matchure (pattern matching):
> http://spin.atomicobject.com/2010/04/25/matchure-serious-clojure-pattern-matching
>
> Algebraic Data Types:
> http://clojure.github.com/clojure-contrib/types-api.html
>
> On Dec 17, 7:00 pm, Sunil S Nandihalli 
> wrote:
>> On Sat, Dec 18, 2010 at 7:21 AM, Sunil S Nandihalli <
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> sunil.nandiha...@gmail.com> wrote:
>> > Hi Eric,
>> >  I do know about partial. But what I am saying is that the extra function,
>> > partial, is not necessary if the function was created with
>> > def-curry-fn... The function automatically returns a curried version
>> > when called with fewer number of arguments than necessary like it
>> > happens in haskell..
>> > thanks,
>> > Sunil.
>>
>> > On Sat, Dec 18, 2010 at 3:02 AM, Eric Schulte 
>> > wrote:
>>
>> >> Hi Sunil,
>>
>> >> This is already possible using `partial' function in clojure core, which
>> >> also works for variable arity functions, e.g.
>>
>> >> (map (partial reduce +) [[1 2 3 4] [5 6 7 8]])
>>
>> >> Best -- Eric
>>
>> >> Sunil S Nandihalli  writes:
>>
>> >> > Hello everybody,
>> >> >  I remember that the key reasoning for not supporting currying in
>> >> clojure
>> >> > was to be able to have variable number of arg functions.. So, I just
>> >> thought
>> >> > a bit and realized that it should be possible to do that for fixed arity
>> >> > functions .. and then wrote the following macro to define a curry-able
>> >> > fixed-number-of-argument-function
>>
>> >> >https://gist.github.com/745654
>>
>> > If the following was defined as
>>
>> (defn f [a b c d]
>>   (+ a b c d))
>>
>> >  > (def-curry-fn f [a b c d]
>> >> >   (+ a b c d))
>>
>> >> > ((f 1) 2 3 4)  => 10
>>
>> > the above s-expression using partial would become ...
>>
>> ((partial f 1) 2 3 4) => 10
>>
>> >  > (((f 1 2) 3) 4) => 10
>>
>> and ((partial (partial f 1 2) 3) 4) => 10 instead of (((f 1 2) 3) 4)..
>>
>> f 1) 2) 3) 4) => 10
>> would become
>> ((partial (partial (partial f 1) 2) 3) 4) => 10 .
>>
>> I know there is no real practical utility .. .. it was just something I
>> wrote for fun.. and thought of sharing it ...
>> Sunil.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> >> > I just thought of sharing it with everybody. Would love to hear any
>> >> > criticisms you may have.
>>
>> >> > Thanks for reading,
>> >> > Sunil
>>
>> >> --
>> >> 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

-- 
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: Logos v0.2: or Life w/o Tail Call Optimization

2010-12-19 Thread David Nolen
On Sat, Dec 18, 2010 at 11:06 PM, jim  wrote:

> David,
>
> I started looking at Logos tonight. Really nice. I like the way its
> heading. Looking forward to using it.
>
> Jim


Thanks! Next steps are:

- disequality constraints
- nominal logic
- tabling

Once those are in, I think that's a good foundation to pursue:

- a Clojure type inferencer
- syntax-rules / syntax-case

If anyone's interested in helping out let me know :)

David

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

Re: defmethod/defmulti should dispatch on the new arguments when we call the recur..?

2010-12-19 Thread Robert McIntyre
@Ken Wesson: do you mean something like this:
https://gist.github.com/747571

My fists stab at this technique looks kinda ugly though...
Is there a way to somehow embed the trampoline inside the recursive definition?
Is there a way to get the actual dispatch function other than
(.dispatchFn multimethod)  ?

--Robert McIntyre


On Sun, Dec 19, 2010 at 10:52 AM, Meikel Brandmeyer  wrote:
> Hi,
>
> Am 19.12.2010 um 16:46 schrieb Ken Wesson:
>
>> If we had a (resolve-method multi & args) that resolved dispatch and
>> then returned a fn that would call the method with those same args --
>> so ((resolve-method multi & args)) <=> (multi & args) -- then this
>> could be used with trampoline in cases like Sunil is describing.
>
> It's called get-method.
>
> 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

-- 
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: defmethod/defmulti should dispatch on the new arguments when we call the recur..?

2010-12-19 Thread Meikel Brandmeyer
Hi,

Am 19.12.2010 um 19:35 schrieb Robert McIntyre:

> @Ken Wesson: do you mean something like this:
> https://gist.github.com/747571

Maybe I'm missing something, but why don't you just call the multimethod itself 
again in the trampoline fn?

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


clj-http timeouts

2010-12-19 Thread dsapala
Does anyone know how to set connection or read timeouts for clj-http?

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


Ah-hah! Clojure is a Lisp

2010-12-19 Thread Tim Daly

 There have been discussions, here and elsewhere, about
whether Clojure is a "Lisp". Lots of discussion centers
around facts like homoiconicity, or the REPL, or the
debate of Rich's redefinition of lisp primitives, etc.
These are arguments about the paint on the palace.

I have struggled with this question and I believe I found
the answer that satisfies me that Clojure is a Lisp. The
answer is that "getting Clojure" involves an "ah-hah!"
moment.

The most fundamental thing about "Lisp" is that there is
this universal but personal event when you suddenly
"get it". This does not seem to happen with other languages.
There is a distinct "before vs after" when you suddenly
internalize the language and IT changes YOU.

I recently felt that moment with Clojure.
Did anyone else experience the "ah-hah!"?

Tim Daly

--
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Sean Corfield
On Sun, Dec 19, 2010 at 11:33 AM, Tim Daly  wrote:
> The most fundamental thing about "Lisp" is that there is
> this universal but personal event when you suddenly
> "get it". This does not seem to happen with other languages.

I think it's true to some extent with most languages - particularly
those that aren't mainstream (I'm working through Seven Languages
right now and I think Io and Prolog fit right into the category you
describe, and of course Clojure and Haskell because of their
functional nature). But I will say that "Lisp" languages seem to
'stick' more than other languages: once someone "gets it", they seem
to become a devoted "Lisper" for life... even if they use other
languages for their day job.

> I recently felt that moment with Clojure.
> Did anyone else experience the "ah-hah!"?

Not with Clojure, but probably with Lisp itself back in the early- /
mid-80's which is when I first started using it seriously. I found the
same with Prolog tho' (around the same time)...
-- 
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

-- 
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: clj-http timeouts

2010-12-19 Thread Miki


> Does anyone know how to set connection or read timeouts for clj-http?

I didn't see anything in the API. clj-apache-http has that option though 
(setting http.socket.timeout parameter).


HTH,
--
Miki

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread javajosh
Can you articulate it any better than "ah hah!"?

On Dec 19, 11:33 am, Tim Daly  wrote:
>   There have been discussions, here and elsewhere, about
> whether Clojure is a "Lisp". Lots of discussion centers
> around facts like homoiconicity, or the REPL, or the
> debate of Rich's redefinition of lisp primitives, etc.
> These are arguments about the paint on the palace.
>
> I have struggled with this question and I believe I found
> the answer that satisfies me that Clojure is a Lisp. The
> answer is that "getting Clojure" involves an "ah-hah!"
> moment.
>
> The most fundamental thing about "Lisp" is that there is
> this universal but personal event when you suddenly
> "get it". This does not seem to happen with other languages.
> There is a distinct "before vs after" when you suddenly
> internalize the language and IT changes YOU.
>
> I recently felt that moment with Clojure.
> Did anyone else experience the "ah-hah!"?
>
> Tim Daly

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread gaz jones
"sha-wing"? :D

On Sun, Dec 19, 2010 at 5:41 PM, javajosh  wrote:
> Can you articulate it any better than "ah hah!"?
>
> On Dec 19, 11:33 am, Tim Daly  wrote:
>>   There have been discussions, here and elsewhere, about
>> whether Clojure is a "Lisp". Lots of discussion centers
>> around facts like homoiconicity, or the REPL, or the
>> debate of Rich's redefinition of lisp primitives, etc.
>> These are arguments about the paint on the palace.
>>
>> I have struggled with this question and I believe I found
>> the answer that satisfies me that Clojure is a Lisp. The
>> answer is that "getting Clojure" involves an "ah-hah!"
>> moment.
>>
>> The most fundamental thing about "Lisp" is that there is
>> this universal but personal event when you suddenly
>> "get it". This does not seem to happen with other languages.
>> There is a distinct "before vs after" when you suddenly
>> internalize the language and IT changes YOU.
>>
>> I recently felt that moment with Clojure.
>> Did anyone else experience the "ah-hah!"?
>>
>> Tim Daly
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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


Re: command line options parser

2010-12-19 Thread gaz jones
so i updated this to work with nested arguments which is what i really
wanted to use it for in the first place. i almost always end up
creating a map of config settings and this makes it easy for me to
override things from the CL.

regarding the getopt stuff, i kind of agree but dont particularly like
getopt and parsing the raw args into pairs seemed pretty easy so i
wasnt so bothered about reinventing that wheel...

Example:

(clargon args
 (required ["-p" "--port"] #(Integer. %))
 (optional ["--host" :default "localhost"])
 (optional ["--verbose" :default true])
 (optional ["--log-directory" :default "/some/path"])
 (group "--server"
(optional ["-n" "--name"])
(optional ["-p" "--port"] #(Integer. %))
(group "--paths"
   (optional ["--inbound" :default "/tmp/inbound"])
   (optional ["--outbound" :default "/tmp/outbound"]
with args of:

'("-p" "8080"
  "--no-verbose"
  "--log-directory" "/tmp"
  "--server--name" "localhost"
  "--server--port" "9090"
  "--server--paths--inbound" "/dev/null")
will produce a clojure map with the names picked out for you as keywords:

 {:port 8080
  :host "localhost"
  :verbose false
  :log-directory "/tmp"
  :server {:name "localhost"
   :port 9090
   :paths {:inbound "/dev/null"
   :outbound "/tmp/outbound"}}}

On Sat, Dec 11, 2010 at 12:20 PM, Alan  wrote:
> I confess I didn't notice the type-conversion stuff in clargon; my
> view is now basically the same as Miekel's: it's great to have these
> new features, but they should be on top of getopt, which parses
> excellently. In fact, I think I'll fork clargon and see if I can tweak
> it that way.
>
> On Dec 11, 1:32 am, Meikel Brandmeyer  wrote:
>> Hi,
>>
>> Am 11.12.2010 um 09:53 schrieb Saul Hazledine:
>>
>> > I saw this and thought the opposite! I think it is a good thing that
>> > somebody has done a higher level argument parsing library.
>>
>> > As far as I know, getopt doesn't support type conversion, help text or
>> > field validation. Generally, higher level languages have better
>> > argument parsing libraries than the getopt style, Python for instance:
>> >http://docs.python.org/library/optparse.html
>>
>> This is completely orthogonal. Adding type conversion, help text or field 
>> validation does not require the underlying parser to be re-implemented. One 
>> can use getopt, commons-cli, with-command-line or jopt-simple and add things 
>> on top for real added value.
>>
>> That said: I have no opinion about the posted code, because I haven't looked 
>> at it, yet. Generally, I would prefer the above approach: use something 
>> existing and add functionality on top. But then, I'm also guilty of 
>> implementing a cli parser in Clojure myself.
>>
>> 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

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Vagif Verdi
Haskell has aha moments too. And it is not lisp.

The definition of "lisp" i accept is much simpler and much more
obvious: source code of the program is a valid data  structure in that
language.

On Dec 19, 11:33 am, Tim Daly  wrote:
>   There have been discussions, here and elsewhere, about
> whether Clojure is a "Lisp". Lots of discussion centers
> around facts like homoiconicity, or the REPL, or the
> debate of Rich's redefinition of lisp primitives, etc.
> These are arguments about the paint on the palace.
>
> I have struggled with this question and I believe I found
> the answer that satisfies me that Clojure is a Lisp. The
> answer is that "getting Clojure" involves an "ah-hah!"
> moment.
>
> The most fundamental thing about "Lisp" is that there is
> this universal but personal event when you suddenly
> "get it". This does not seem to happen with other languages.
> There is a distinct "before vs after" when you suddenly
> internalize the language and IT changes YOU.
>
> I recently felt that moment with Clojure.
> Did anyone else experience the "ah-hah!"?
>
> Tim Daly

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Raoul Duke
On Sun, Dec 19, 2010 at 4:31 PM, Vagif Verdi  wrote:
> Haskell has aha moments too. And it is not lisp.

er, yeah, 2nd'd. totally. i mean, same for plenty of programming
languages. and certainly not the same thing for everybody. ah-hahs are
subjective. if i "get" lisp but never had an ah hah because it just
always made sense, or whatever, then is it not a lisp?

weird. :)

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Ken Wesson
On Sun, Dec 19, 2010 at 7:31 PM, Vagif Verdi  wrote:
> Haskell has aha moments too. And it is not lisp.
>
> The definition of "lisp" i accept is much simpler and much more
> obvious: source code of the program is a valid data  structure in that
> language.

Access to the parse tree. C source code is a valid string data
structure in C, but you can't really do that much with it without a
lot of parsing first.

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Tim Daly



On 12/19/2010 6:41 PM, javajosh wrote:

Can you articulate it any better than "ah hah!"?

The proper response is "moo".

But I think there is a point where you "get" concepts
like the distinction between values and identity which
are fundamental. Whatever the event, it feels like
whatever I write is best done in Clojure, which is the
"after-the-event" internal change. It no longer feels
like a struggle to learn the language but a thirst to
learn more, deeper, and better. A soulful addiction.

Unlike the dozens of other languages I have worked in
over my career, Lisp has been the one language that
truly changed the way I understood programming. Many
people have mentioned the "ah hah!" moment when
speaking about Lisp.

Tim Daly

--
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Tim Daly



On 12/19/2010 7:31 PM, Vagif Verdi wrote:

Haskell has aha moments too. And it is not lisp.

The definition of "lisp" i accept is much simpler and much more
obvious: source code of the program is a valid data  structure in that
language.

I agree that you can't BE a lisp without homoiconicity. However,
I was struggling with Clojure because it lacks nil-punning which
I consider fundamental. I have self-debated a lot of the choices
that Rich made. Now that I'm in "thirst for the language" mode
I understand that nil-punning conflicts with lazy so I can accept
the choice.

Haskell has neat ideas but I've seen them before in lisp-based
systems. I work in a language which is strongly typed, allows
currying, is functional, etc., implemented in Common Lisp. I have
not found the "ah-hah!" in Haskell.

In fact, until the "ah-hah!" moment occurred I didn't know that
it was my working definition of Lisp.

Tim Daly
"Your enlightment may vary" :-)

--
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: Free Compojure Hosting? (or mostly free)

2010-12-19 Thread Constantine Vetoshev
On Dec 18, 8:51 pm, javajosh  wrote:
> A little googling revealed that Google App Engine will work:

App Engine very much works. Please use https://github.com/gcv/appengine-magic
(and help me test the v0.4.0 branch, which adds support for the latest
App Engine SDK). It's unfortunate that search results for "clojure app
engine" turn up these outdated, half-broken blog posts instead of a
working, up-to-date, and maintained library.

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Tim Daly

 I didn't mean to imply that other people
don't have the "ah-hah!" experience with
other languages. However, I have only had
the (before lisp)|(after lisp) experience
with lisp.

Your enlightenment might vary.

Rich gave his "Whitehead" talk and brought
up the fact that OO languages get several
things wrong. I watched that with a Java
programmer and he was not able to understand
the points Rich was making. He just saw it
in terms of "value" objects, "function" objects,
"identity" objects, and "state" objects. Sort of,
"I've got an object hammer so everything is an
object nail" approach.

Tim Daly

--
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Ken Wesson
On Sun, Dec 19, 2010 at 8:18 PM, Tim Daly  wrote:
>  I didn't mean to imply that other people
> don't have the "ah-hah!" experience with
> other languages. However, I have only had
> the (before lisp)|(after lisp) experience
> with lisp.
>
> Your enlightenment might vary.
>
> Rich gave his "Whitehead" talk and brought
> up the fact that OO languages get several
> things wrong.

Out of curiosity, which "several things" were these?

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Tim Daly



On 12/19/2010 8:20 PM, Ken Wesson wrote:

On Sun, Dec 19, 2010 at 8:18 PM, Tim Daly  wrote:

  I didn't mean to imply that other people
don't have the "ah-hah!" experience with
other languages. However, I have only had
the (before lisp)|(after lisp) experience
with lisp.

Your enlightenment might vary.

Rich gave his "Whitehead" talk and brought
up the fact that OO languages get several
things wrong.

Out of curiosity, which "several things" were these?

http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

--
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Eric Schulte
Tim Daly  writes:

>
> Haskell has neat ideas but I've seen them before in lisp-based
> systems. I work in a language which is strongly typed, allows
> currying, is functional, etc., implemented in Common Lisp. I have
> not found the "ah-hah!" in Haskell.
>

Sounds interesting, could you share a pointer to this language, or is it
not open?

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Tim Daly



On 12/19/2010 8:33 PM, Eric Schulte wrote:

Tim Daly  writes:


Haskell has neat ideas but I've seen them before in lisp-based
systems. I work in a language which is strongly typed, allows
currying, is functional, etc., implemented in Common Lisp. I have
not found the "ah-hah!" in Haskell.


Sounds interesting, could you share a pointer to this language, or is it
not open?

It is the algebra language in the Axiom project called Spad.
http://axiom-developer.org
It is open source

--
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Ken Wesson
On Sun, Dec 19, 2010 at 8:25 PM, Tim Daly  wrote:
>
>
> On 12/19/2010 8:20 PM, Ken Wesson wrote:
>>
>> On Sun, Dec 19, 2010 at 8:18 PM, Tim Daly
>>  wrote:
>>>
>>>  I didn't mean to imply that other people
>>> don't have the "ah-hah!" experience with
>>> other languages. However, I have only had
>>> the (before lisp)|(after lisp) experience
>>> with lisp.
>>>
>>> Your enlightenment might vary.
>>>
>>> Rich gave his "Whitehead" talk and brought
>>> up the fact that OO languages get several
>>> things wrong.
>>
>> Out of curiosity, which "several things" were these?
>
> http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

"Please install Flash Player".

Has everyone on this list developed a sudden allergy to plain text and
HTML? First I get pointed to a 34-minute video, and now this. A simple
bulleted list with a brief precis about each item would have sufficed;
a multi-megabyte install of an executable and who knows how much
futzing around, overkill.

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Sean Corfield
On Sun, Dec 19, 2010 at 6:24 PM, Ken Wesson  wrote:
> Has everyone on this list developed a sudden allergy to plain text and
> HTML? First I get pointed to a 34-minute video, and now this. A simple
> bulleted list with a brief precis about each item would have sufficed;
> a multi-megabyte install of an executable and who knows how much
> futzing around, overkill.

I don't think people normally create a precis of other people's talks
- they just watch them. And this presentation is really good.
Definitely worth your effort...
-- 
Sean A Corfield -- (904) 302-SEAN
Railo Technologies, Inc. -- http://getrailo.com/
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Tim Daly



On 12/19/2010 9:24 PM, Ken Wesson wrote:

On Sun, Dec 19, 2010 at 8:25 PM, Tim Daly  wrote:


On 12/19/2010 8:20 PM, Ken Wesson wrote:

On Sun, Dec 19, 2010 at 8:18 PM, Tim Daly
  wrote:

  I didn't mean to imply that other people
don't have the "ah-hah!" experience with
other languages. However, I have only had
the (before lisp)|(after lisp) experience
with lisp.

Your enlightenment might vary.

Rich gave his "Whitehead" talk and brought
up the fact that OO languages get several
things wrong.

Out of curiosity, which "several things" were these?

http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

"Please install Flash Player".

Has everyone on this list developed a sudden allergy to plain text and
HTML? First I get pointed to a 34-minute video, and now this. A simple
bulleted list with a brief precis about each item would have sufficed;
a multi-megabyte install of an executable and who knows how much
futzing around, overkill.


The points made by Rich in the video require context.
Besides, the only way I could make a bullet list would
be to listen to the video again. My memory is hopelessly
lossy.

Tim Daly

--
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Ken Wesson
On Sun, Dec 19, 2010 at 9:42 PM, Tim Daly  wrote:
>
>
> On 12/19/2010 9:24 PM, Ken Wesson wrote:
>>
>> On Sun, Dec 19, 2010 at 8:25 PM, Tim Daly
>>  wrote:
>>>
>>> On 12/19/2010 8:20 PM, Ken Wesson wrote:

 On Sun, Dec 19, 2010 at 8:18 PM, Tim Daly
  wrote:
>
>  I didn't mean to imply that other people
> don't have the "ah-hah!" experience with
> other languages. However, I have only had
> the (before lisp)|(after lisp) experience
> with lisp.
>
> Your enlightenment might vary.
>
> Rich gave his "Whitehead" talk and brought
> up the fact that OO languages get several
> things wrong.

 Out of curiosity, which "several things" were these?
>>>
>>> http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
>>
>> "Please install Flash Player".
>>
>> Has everyone on this list developed a sudden allergy to plain text and
>> HTML? First I get pointed to a 34-minute video, and now this. A simple
>> bulleted list with a brief precis about each item would have sufficed;
>> a multi-megabyte install of an executable and who knows how much
>> futzing around, overkill.
>>
> The points made by Rich in the video require context.
> Besides, the only way I could make a bullet list would
> be to listen to the video again. My memory is hopelessly
> lossy.

Exactly why text is preferable to video for stuff that can be
expressed in text. Your memory wouldn't matter -- you could link to
the text. And Google could search inside it.

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Tim Daly



On 12/19/2010 10:21 PM, Ken Wesson wrote:

On Sun, Dec 19, 2010 at 9:42 PM, Tim Daly  wrote:


On 12/19/2010 9:24 PM, Ken Wesson wrote:

On Sun, Dec 19, 2010 at 8:25 PM, Tim Daly
  wrote:

On 12/19/2010 8:20 PM, Ken Wesson wrote:

On Sun, Dec 19, 2010 at 8:18 PM, Tim Daly
  wrote:

  I didn't mean to imply that other people
don't have the "ah-hah!" experience with
other languages. However, I have only had
the (before lisp)|(after lisp) experience
with lisp.

Your enlightenment might vary.

Rich gave his "Whitehead" talk and brought
up the fact that OO languages get several
things wrong.

Out of curiosity, which "several things" were these?

http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

"Please install Flash Player".

Has everyone on this list developed a sudden allergy to plain text and
HTML? First I get pointed to a 34-minute video, and now this. A simple
bulleted list with a brief precis about each item would have sufficed;
a multi-megabyte install of an executable and who knows how much
futzing around, overkill.


The points made by Rich in the video require context.
Besides, the only way I could make a bullet list would
be to listen to the video again. My memory is hopelessly
lossy.

Exactly why text is preferable to video for stuff that can be
expressed in text. Your memory wouldn't matter -- you could link to
the text. And Google could search inside it.

This video is not just a list of broken things. It goes to the
very philosophy behind the difference between values, identity,
and state. The bullet point you seek is:

* OO programs conflate value, state, and identity.

That is the essence but I'm not sure you'll understand it
without the video.

Tim Daly

--
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Ken Wesson
On Sun, Dec 19, 2010 at 10:33 PM, Tim Daly  wrote:
> On 12/19/2010 10:21 PM, Ken Wesson wrote:
>>
>> On Sun, Dec 19, 2010 at 9:42 PM, Tim Daly
>>  wrote:
>>>
>>> On 12/19/2010 9:24 PM, Ken Wesson wrote:

 On Sun, Dec 19, 2010 at 8:25 PM, Tim Daly
  wrote:
>
> On 12/19/2010 8:20 PM, Ken Wesson wrote:
>>
>> On Sun, Dec 19, 2010 at 8:18 PM, Tim Daly
>>  wrote:
>>>
>>>  I didn't mean to imply that other people
>>> don't have the "ah-hah!" experience with
>>> other languages. However, I have only had
>>> the (before lisp)|(after lisp) experience
>>> with lisp.
>>>
>>> Your enlightenment might vary.
>>>
>>> Rich gave his "Whitehead" talk and brought
>>> up the fact that OO languages get several
>>> things wrong.
>>
>> Out of curiosity, which "several things" were these?
>
> http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

 "Please install Flash Player".

 Has everyone on this list developed a sudden allergy to plain text and
 HTML? First I get pointed to a 34-minute video, and now this. A simple
 bulleted list with a brief precis about each item would have sufficed;
 a multi-megabyte install of an executable and who knows how much
 futzing around, overkill.

>>> The points made by Rich in the video require context.
>>> Besides, the only way I could make a bullet list would
>>> be to listen to the video again. My memory is hopelessly
>>> lossy.
>>
>> Exactly why text is preferable to video for stuff that can be
>> expressed in text. Your memory wouldn't matter -- you could link to
>> the text. And Google could search inside it.
>
> This video is not just a list of broken things. It goes to the
> very philosophy behind the difference between values, identity,
> and state. The bullet point you seek is:
>
> * OO programs conflate value, state, and identity.
>
> That is the essence but I'm not sure you'll understand it
> without the video.

Ah. So, like the confused situations you get with Java's mutable
collections. Two lists are equal if they have the same contents in the
same order -- but then you use one as a key in a hashmap, and then add
an item to it, and boom! Clojure separates this stuff out because the
Clojure vector's immutability makes its value stable given its
identity. Refs and atoms and agents can encapsulate mutable state, but
their identity (as defined by = and hash) is fixed rather than
changing with its state. And some objects (keywords and symbols) exist
to be almost pure identity, used to label other things.

Something like that?

-- 
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Mike Meyer
On Sun, 19 Dec 2010 21:24:42 -0500
Ken Wesson  wrote:

> On Sun, Dec 19, 2010 at 8:25 PM, Tim Daly  wrote:
> >
> >
> > On 12/19/2010 8:20 PM, Ken Wesson wrote:
> >>
> >> On Sun, Dec 19, 2010 at 8:18 PM, Tim Daly
> >>  wrote:
> >>>
> >>>  I didn't mean to imply that other people
> >>> don't have the "ah-hah!" experience with
> >>> other languages. However, I have only had
> >>> the (before lisp)|(after lisp) experience
> >>> with lisp.
> >>>
> >>> Your enlightenment might vary.
> >>>
> >>> Rich gave his "Whitehead" talk and brought
> >>> up the fact that OO languages get several
> >>> things wrong.
> >>
> >> Out of curiosity, which "several things" were these?
> >
> > http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
> 
> "Please install Flash Player".
> 
> Has everyone on this list developed a sudden allergy to plain text and
> HTML? First I get pointed to a 34-minute video, and now this. A simple
> bulleted list with a brief precis about each item would have sufficed;
> a multi-megabyte install of an executable and who knows how much
> futzing around, overkill.

Let me second that - especially since flash isn't available for my
normal mail platform, so the kludges required to run it make it even
flakier than what Jobs objects to, and tends to hose performance there
no end.

Yes, somethings may best be presented on video, but all to often
people try pass videos off as documentation (*). Even when video is
actually the best choice, the least you could do is post something in
an actual video format, and not as an executable for a poorly
documented, proprietary VM that has had more than one security issue
in the past.

http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.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


Re: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Tim Daly



On 12/19/2010 10:53 PM, Ken Wesson wrote:

On Sun, Dec 19, 2010 at 10:33 PM, Tim Daly  wrote:

On 12/19/2010 10:21 PM, Ken Wesson wrote:

On Sun, Dec 19, 2010 at 9:42 PM, Tim Daly
  wrote:

On 12/19/2010 9:24 PM, Ken Wesson wrote:

On Sun, Dec 19, 2010 at 8:25 PM, Tim Daly
  wrote:

On 12/19/2010 8:20 PM, Ken Wesson wrote:

On Sun, Dec 19, 2010 at 8:18 PM, Tim Daly
  wrote:

  I didn't mean to imply that other people
don't have the "ah-hah!" experience with
other languages. However, I have only had
the (before lisp)|(after lisp) experience
with lisp.

Your enlightenment might vary.

Rich gave his "Whitehead" talk and brought
up the fact that OO languages get several
things wrong.

Out of curiosity, which "several things" were these?

http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

"Please install Flash Player".

Has everyone on this list developed a sudden allergy to plain text and
HTML? First I get pointed to a 34-minute video, and now this. A simple
bulleted list with a brief precis about each item would have sufficed;
a multi-megabyte install of an executable and who knows how much
futzing around, overkill.


The points made by Rich in the video require context.
Besides, the only way I could make a bullet list would
be to listen to the video again. My memory is hopelessly
lossy.

Exactly why text is preferable to video for stuff that can be
expressed in text. Your memory wouldn't matter -- you could link to
the text. And Google could search inside it.

Ah. So, like the confused situations you get with Java's mutable
collections. Two lists are equal if they have the same contents in the
same order -- but then you use one as a key in a hashmap, and then add
an item to it, and boom! Clojure separates this stuff out because the
Clojure vector's immutability makes its value stable given its
identity. Refs and atoms and agents can encapsulate mutable state, but
their identity (as defined by = and hash) is fixed rather than
changing with its state. And some objects (keywords and symbols) exist
to be almost pure identity, used to label other things.

Something like that?


Ummm. no. You're approaching the question in an OO mindset.
There is no path from that starting point to Rich's insight.

Rich spent the better part of an hour trying to explain the
insights that he got from what must certainly be months of
reading and thinking. I'm part way through the Whitehead
book he mentioned (and the other book is on-order). That's
some heavy reading he's been doing. I also downloaded the
primary paper on Multiversion Concurrency Control.
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.103.5778&rep=rep1&type=pdf

And, no, I don't plan to summarize Whitehead or the MVCC paper :-)

@mike, Yes, a video isn't "documentation". But the MVCC paper
certainly is. Open source software doesn't seem to "do" documentation
(which annoys me also since I'm a literate programming fanatic).


Tim Daly

--
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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Laurent PETIT
2010/12/20 Tim Daly 

>
>
> On 12/19/2010 10:53 PM, Ken Wesson wrote:
>
>> On Sun, Dec 19, 2010 at 10:33 PM, Tim Daly
>>  wrote:
>>
>>> On 12/19/2010 10:21 PM, Ken Wesson wrote:
>>>
 On Sun, Dec 19, 2010 at 9:42 PM, Tim Daly
  wrote:

> On 12/19/2010 9:24 PM, Ken Wesson wrote:
>
>> On Sun, Dec 19, 2010 at 8:25 PM, Tim Daly
>>  wrote:
>>
>>> On 12/19/2010 8:20 PM, Ken Wesson wrote:
>>>
 On Sun, Dec 19, 2010 at 8:18 PM, Tim Daly
  wrote:

>  I didn't mean to imply that other people
> don't have the "ah-hah!" experience with
> other languages. However, I have only had
> the (before lisp)|(after lisp) experience
> with lisp.
>
> Your enlightenment might vary.
>
> Rich gave his "Whitehead" talk and brought
> up the fact that OO languages get several
> things wrong.
>
 Out of curiosity, which "several things" were these?

>>> http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
>>>
>> "Please install Flash Player".
>>
>> Has everyone on this list developed a sudden allergy to plain text and
>> HTML? First I get pointed to a 34-minute video, and now this. A simple
>> bulleted list with a brief precis about each item would have sufficed;
>> a multi-megabyte install of an executable and who knows how much
>> futzing around, overkill.
>>
>>  The points made by Rich in the video require context.
> Besides, the only way I could make a bullet list would
> be to listen to the video again. My memory is hopelessly
> lossy.
>
 Exactly why text is preferable to video for stuff that can be
 expressed in text. Your memory wouldn't matter -- you could link to
 the text. And Google could search inside it.

>>> Ah. So, like the confused situations you get with Java's mutable
>>
>> collections. Two lists are equal if they have the same contents in the
>> same order -- but then you use one as a key in a hashmap, and then add
>> an item to it, and boom! Clojure separates this stuff out because the
>> Clojure vector's immutability makes its value stable given its
>> identity. Refs and atoms and agents can encapsulate mutable state, but
>> their identity (as defined by = and hash) is fixed rather than
>> changing with its state. And some objects (keywords and symbols) exist
>> to be almost pure identity, used to label other things.
>>
>> Something like that?
>>
>>  Ummm. no. You're approaching the question in an OO mindset.
> There is no path from that starting point to Rich's insight.
>

I disagree, it /is/ "something like that" :

in clojure parlance :

  * a value is an immutable object (and beyond that, also a /persistent/
datastructure for performance reasons). Clojure datastructures are the
classical building blocks for creating values.
  * an identity is represented by a "ref" in clojure : an ref, an atom, an
agent. An identity is an object representing "something" which can have
different values at different points in time.
  * a "state" is a pair "identity/value" at some point in time.

Refs and atoms and agents can also be considered as values, and can be
embedded in other refs. But then, the "value" you must consider is just
their "identity", not their "changing over time" flux of values.

All of this is pretty much the same as for relational databases. Once you
get the technical id of a table row, you've a stable pointer for the
identity of a concept. The values of the concept may change over time,
though.

And yes, languages which allow uncontrolled mutation of class instances
fields generally will "conflate" those notions of identity and state, making
it more difficult, for example, to write correct concurrent programs because
it's much harder to work on a "consistent set" of the values of an object.

Anyway, Ken, this video really is worth watching when you have the time to.




>
> Rich spent the better part of an hour trying to explain the
> insights that he got from what must certainly be months of
> reading and thinking. I'm part way through the Whitehead
> book he mentioned (and the other book is on-order). That's
> some heavy reading he's been doing. I also downloaded the
> primary paper on Multiversion Concurrency Control.
>
> http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.103.5778&rep=rep1&type=pdf
>
> And, no, I don't plan to summarize Whitehead or the MVCC paper :-)
>
> @mike, Yes, a video isn't "documentation". But the MVCC paper
> certainly is. Open source software doesn't seem to "do" documentation
> (which annoys me also since I'm a literate programming fanatic).
>
>
> Tim Daly
>
>
> --
> 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.
> T

Native Clojure

2010-12-19 Thread kaveh_shahbazian
Is there a natively compiled version of Clojure? Is there any plans to
do so?

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: Ah-hah! Clojure is a Lisp

2010-12-19 Thread Alex Osborne
Ken Wesson  writes:

> Ah. So, like the confused situations you get with Java's mutable
> collections. Two lists are equal if they have the same contents in the
> same order -- but then you use one as a key in a hashmap, and then add
> an item to it, and boom! Clojure separates this stuff out because the
> Clojure vector's immutability makes its value stable given its
> identity. Refs and atoms and agents can encapsulate mutable state, but
> their identity (as defined by = and hash) is fixed rather than
> changing with its state.

Sort of.  Identity (in the Clojure model) is not the same concept as
equality.  Nor is it reference equality ("identical?").  The overloading
of terminology is somewhat unfortunate.

"By identity I mean a stable logical entity associated with a series
 of different values over time." -- clojure.org/state

As Laurent mentioned the usual identities in Clojure are reference
objects: vars, atoms, refs and so on.

> And some objects (keywords and symbols) exist
> to be almost pure identity, used to label other things.

Symbols and keywords (and database IDs) aren't identities, they're
identifiers (names).

"Note that by identities I don't mean names (I call my mother Mom,
 but you wouldn't)." -- clojure.org/state

An identifier can be resolved in some sort of context to obtain an
identity, but it is not itself that identity.

If you wrote a program with a data model like this:

  (def people {"Alice" (ref {:age 25}), "Bob" (ref {:age 17})})

Then the various objects would be:

  name: a string like "Alice"
  context: the people map
  identity: a ref
  value: the {:age XX} maps

In the vars and global environment model we have:

  name: a symbol
  context: a namespace
  identity: a var
  value: a number, list, vector, fn, string etc

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