Re: Leiningen in Python

2009-12-15 Thread Rob Wolfe


Phil Hagelberg napisał(a):
> Rob Wolfe  writes:
>
> > Yes, there are some escaping problems on Windows. I changed a little bit
> > "lein.py" and this worked for me on Windows and Linux:
>
> Can I include this in Leiningen 1.1.0+ with a note saying it's only
> experimentally supported?

Sure.

Br,
Rob

-- 
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: Help! My slime-fu is broken!

2009-12-15 Thread Mike K
On Dec 15, 8:42 pm, Phil Hagelberg  wrote:

> > Ah, OK.  That explains the overload of the term "compile"
>
> I'll add a note to this to the swank-clojure readme.

Cool.

> I wasn't even aware that the CL version provided error navigation
> here. But it looks like it shouldn't be too hard to fix now that you've
> made me aware of the problem.

Great!

>  Note that in sldb (debugger) buffers
> pressing "v" on a stack trace frame will actually jump to the cause of
> the error if possible.

Well then, here's another potential bug report / teachable moment :-)

I inserted an intentional typo in my code and then used slime-load-
file (^C^L).  I get an sldb buffer as follows:

java.lang.Exception: Unable to resolve symbol: lfjd in this context
(hi.clj:0)
  [Thrown class clojure.lang.Compiler$CompilerException]

Restarts:
 0: [ABORT] Return to SLIME's top level.
 1: [CAUSE] Throw cause of this exception

Backtrace:
  0: clojure.lang.Compiler.analyze(Compiler.java:4340)
  1: clojure.lang.Compiler.analyze(Compiler.java:4286)
  2: clojure.lang.Compiler.eval(Compiler.java:4536)
  3: clojure.lang.Compiler.load(Compiler.java:4857)
  4: clojure.lang.Compiler.loadFile(Compiler.java:4824)
  5: clojure.lang.RT$4.invoke(RT.java:273)
  6: swank.commands.basic$load_file__801.invoke(basic.clj:129)
  7: clojure.lang.Var.invoke(Var.java:346)
  8: user$eval__1256.invoke(NO_SOURCE_FILE)
  9: clojure.lang.Compiler.eval(Compiler.java:4532)
 10: clojure.core$eval__3990.invoke(core.clj:1728)
 11: swank.core$eval_in_emacs_package__366.invoke(core.clj:55)
 12: swank.core$eval_for_emacs__443.invoke(core.clj:123)
 13: clojure.lang.Var.invoke(Var.java:354)
(etc)

One suspicious thing is that the Exception line is reporting line
number 0 whereas the actual typo is at line 3.  Actually, further
digging indicates that the line number is correctly reported if the
typo is an undefined symbol being used as a function, e.g.,
(misspelled-func-name foo), but not if garbage appears outside of a
form like above, i.e.,  lfjd typed on a line by itself.  This behavior
with the line number reporting is consistent whether in sldb buffers
as above or as reported in slime compilation buffers after slime-
compile-and-load-file (^C^K).

Moreover, if I try to view the source on any of the stack frame lines
(v) I simply get an "evaluation aborted" message.  In this scenario,
would you expect "v" to work on any of the stack frames?  In general,
should "v" work on frames coming out of .java files (like frame 0) or
only .clj files (like frame 6).  Again, in my case, it doesn't work
anywhere.

   Thanks,
   Mike

-- 
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: Help! My slime-fu is broken!

2009-12-15 Thread Mike K


On Dec 15, 8:26 am, David Nolen  wrote:
>
> Rereading your post I realize that most of your concerns are about the
> general unfriendliness of SLIME and not so much that it isn't working. As
> Phil alludes, SLIME wasn't designed with Clojure in mind, so a lot of things
> happen that don't make a lot of sense (SLIME with Common Lisp is much more
> sensible).
>
> Beside C-c C-k, it sounds like your setup is in fact working well enough for
> you write programs?

Absolutely.  Having no background with SLIME (in particular not
understanding that its CL roots might cause some impedance mismatches
in its interface with Clojure) I just started exploring the menu
options.  My expectation was that virtually everything would "just
work" given emacs' general reputation for hosting lisp variants.  When
I saw a lot of quirks, I thought I might have a broken install or I
might be running into functionality that works fine under *nix but is
broken under Windows (a common occurrence).  So a lot of this exercise
is about recalibrating my expectations as to what should work.  Alas,
googling turns up little in this regard wrt SLIME + Clojure.

   Mike

-- 
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: Funding Clojure 2010

2009-12-15 Thread Seth
I'm glad Rich stepped up and made this difficult but important point
clearly. With a gentle yearly reminder I will continue to contribute.

For other revenue, I'm glad to say that I've signed up for the
Pragmatic Studio's Clojure training in March 2010 -- 
https://pragmaticstudio.com/clojure
Several other developers from my company have also registered. I will
also be leading an internal training session on Clojure in March.

For advocacy, I have been unconsciously obsessed with Clojure lately
on a personal blog. It's not much but it's hopefully useful to other
people starting at the bottom of all these learning curves.

I think the donations are a great nod to Rich's pioneering work... but
now that Clojure has developed a community I am curious to see how it
grows.

Many thanks to Rich and all seriously involved in this very neat
language!

Seth

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


Funding update - the Clojure community is simply awesome!

2009-12-15 Thread Rich Hickey
The response to the funding appeal has been very encouraging. I can't
express how proud and privileged I am to be part of this community.
What you are doing is tremendous and, I think, unprecedented. Many,
many thanks to everyone who has participated so far:

http://clojure.org/funders

(note: not everyone has responded yet with permission to list their
names)

Best wishes to all during this holiday season,

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: Help! My slime-fu is broken!

2009-12-15 Thread Phil Hagelberg
Mike K  writes:

> (add-to-list 'load-path "C:\\Program Files (x86)\\Clojure Box\\swank-
> clojure")
>
> (require 'swank-clojure-autoload)

Sounds like you're using an old-ish version of swank-clojure; the
autoloads are now generated automatically by elpa.

>> Slime was designed for use with Common Lisp, which has a distinction
>> between compiled and interpreted code. Clojure has no interpreter, so
>> any way of loading in the code runs it through the compiler.
>
> Ah, OK.  That explains the overload of the term "compile"

I'll add a note to this to the swank-clojure readme.

>> There are some features of Slime that have not been ported to Clojure
>> yet and still only work in CL. Unfortunately the author of the Clojure
>> port has dropped it and I am left maintaining it myself, and there are
>> still several portions of the code that I haven't gotten a chance to
>> dive into yet.
>
> Oh, so can you confirm that error navigation is basically broken?
> Actually, I guess the relevant question is what CB 1.0's level of
> functionality is.  If I can get access to a machine without emacs
> currently installed on it, I'll try to run the straight CB install and
> see how it behaves.

I wasn't even aware that the CL version provided error navigation
here. But it looks like it shouldn't be too hard to fix now that you've
made me aware of the problem. Note that in sldb (debugger) buffers
pressing "v" on a stack trace frame will actually jump to the cause of
the error if possible.

-Phil

-- 
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: Leiningen in Python

2009-12-15 Thread Phil Hagelberg
Rob Wolfe  writes:

> Yes, there are some escaping problems on Windows. I changed a little bit
> "lein.py" and this worked for me on Windows and Linux:

Can I include this in Leiningen 1.1.0+ with a note saying it's only
experimentally supported?

-Phil

-- 
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 Console Progress Bar

2009-12-15 Thread Stephen C. Gilardi
> I have following script to show the progress status in Console. But I
> am having an issue where print only prints final string (after 100
> times loop finished) not those in between thread sleeps but println
> prints out all in between. I am pretty new to Clojure ( Lisp for the
> matter) and have no idea why. Can someone point out what is the
> problem?
> 
> (defn progress-string
>  [i]
>  (for [x (range 50)] (if (<= (/ i 2) x) " " "=")))
> 
> (defn show-progress-string
>  [t]
>  (dotimes [percent 100 ]
>(do
>  (Thread/sleep t)
>  (println "\r" (str-join "" (seq (progress-string (inc
> percent

The output is kept in an output buffer until it's flushed (either because the 
buffer is full or by request). println includes a call to (flush) (if 
*flush-on-newline* is true, which is the default). In your case, you can use an 
explicit call to (flush) when you want to be sure the user has seen what's been 
printed so far.

--Steve



smime.p7s
Description: S/MIME cryptographic signature


Clojure Console Progress Bar

2009-12-15 Thread Kasim
I have following script to show the progress status in Console. But I
am having an issue where print only prints final string (after 100
times loop finished) not those in between thread sleeps but println
prints out all in between. I am pretty new to Clojure ( Lisp for the
matter) and have no idea why. Can someone point out what is the
problem?

(defn progress-string
  [i]
  (for [x (range 50)] (if (<= (/ i 2) x) " " "=")))

(defn show-progress-string
  [t]
  (dotimes [percent 100 ]
(do
  (Thread/sleep t)
  (println "\r" (str-join "" (seq (progress-string (inc
percent


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: Trying to rewrite a loop as map/reduce

2009-12-15 Thread DTH
On Dec 15, 9:05 pm, Laurent PETIT  wrote:
>
> The final step is to apply return-fn to the result:
> (return-fn
>   (first (remove
>                     (comp not predicate-fn)
>                     (iterate recur-fn a0)))
>

Damn, well played sir; that's much cleaner.  If I might offer one
small tweak:

(return-fn (some predicate-fn (iterate recur-fn a0)))

would seem equivalent, though I doubt I'd have got there without your
stepwise guide to change the way I was thinking about it.

Cheers,

-DTH

-- 
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: Trying to rewrite a loop as map/reduce

2009-12-15 Thread DTH
On Dec 15, 7:33 pm, Zach Tellman  wrote:
> At first glance I don't see a clean to make this completely higher-
> order, but here's a shorter (albeit a little messy) version:
>
> (loop [a a0]
>     (let [[a b c d e] (reduce #(conj %1 (%2 (last %1))) [a] [f1 f2 f3
> f4])
>           g (f5 c)
>           h (-> e f2 f5)]
>       (if (or (f6? b) (<= g h))
>         e
>         (recur (f7 d b)
>

While I, too, could not spot an obvious "completely" higher order
route, you can use `clojure.contrib.seq-utils/reductions` [1] to
cleanup the `reduce` in the above:

(require '[clojure.contrib.seq-utils :as s-u])

(let [f1-4 [f1 f2 f3 f4]]
  (loop [a a0]
(let [[a b c d e] (s-u/reductions #(%2 %1) a f1-4)
  g (f5 c)
  h (-> e f2 f5)]
  (if (or (f6? b) (<= g h))
e
(recur (f7 d b))

-DTH

[1] 
http://richhickey.github.com/clojure-contrib/seq-utils-api.html#clojure.contrib.seq-utils/reductions

-- 
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: Funding Clojure 2010

2009-12-15 Thread Sergey Didenko
I suggest to make a call for popularizing Clojure also.

I feel lack of publicity and *quick explanations* with *simple examples* of
why Clojure is better than others.

May be we have a situation when everybody thinks that Clojure is so
excellent that everybody understands it. But though Clojure is indeed
excellent, more conservative programmers need real and simple examples. They
need to get that Clojure is not just "another crazy language".

As a community we have a lot of opportunities to tell other people about
Clojure, so let's use this power.

-- 
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: Trying to rewrite a loop as map/reduce

2009-12-15 Thread Meikel Brandmeyer
Hi,

Am 15.12.2009 um 20:06 schrieb Sean Devlin:

> Could you re-write this w/ comp, and repost?

Because you need all intermediate results comp is totally useless here. (Unless 
you want to recompute everything several times, of course. But that might be 
prohobitive due to performance reasons...)

> On Dec 15, 2:00 pm, samppi  wrote:
>> I'm trying to rewrite a loop to use higher-level functions instead.
>> For pure functions f1, f2, f3, f4, f5, f6?, and f7, and a Clojure
>> object a0, how can one rewrite the following loop to use map, reduce,
>> etc.?
>> 
>>   (loop [a a0]
>> (let [b (f1 a)
>>   c (f2 b)
>>   d (f3 c)
>>   e (f4 d)
>>   g (f5 c)
>>   h (-> e f2 f5)]
>>   (if (or (f6? b) (<= g h))
>> e
>> (recur (f7 d b)

I don't think, that higher-order functions make this clearer... Since you are 
only interested in the last step of the computation, this is calling for 
reduce. But reduce acts on a0. Not some inner condition for looping. Another 
approach might be define a lazy seq of the intermediate computation steps and 
calling last on it. I'm not sure, that this clarifies things. I would stick 
with loop/recur here.

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 newbie question regarding compile time type checking.

2009-12-15 Thread ajay gopalakrishnan
On Tue, Dec 15, 2009 at 9:11 AM, Garth Sheldon-Coulson  wrote:

> OTOH, when Rich gave a talk at MIT recently he mentioned he wasn't terribly
> interested in type systems for Clojure apart from (potentially) a simple
> binary type system to distinguish I/O-side-effecty things from
> non-I/O-side-effecty things. He also mentioned something extremely
> interesting about wanting to make Clojure amenable to analysis by external
> static correctness checking tools, rather than build types and type-checking
> into the language itself.
>

external static correctness checking tools, I am definitely looking forward
for this one.


>
> I should let him characterize his views himself, though, because I imagine
> I'm getting it at least part wrong.
>
> Either way, Ajay, Clojure is a dynamic and dynamically typed system. Cons:
> No compile-time type checking, more runtime bug-catching. Pros: Easy,
> module-by-module, REPL-based interactive development, expressiveness,
> somewhat easier code reuse, faster development, and easier interaction with
> external systems that may change under your nose. I was born and bred in
> QBasic, Perl, and later Ruby, so this is what feels most natural to me.
>
> On Tue, Dec 15, 2009 at 8:43 AM, Laurent PETIT wrote:
>
>>
>>
>> 2009/12/15 ajay gopalakrishnan 
>>
>> Oh ... I know all that. What I wanted to know is that is there any way to
>>> FORCE compile time checking by providing some flag or the other to Clojure
>>> compiler. If not, I guess a good set of test cases is the only way to fix
>>> it. (Good test cases are always recommended, it's just that in this case it
>>> becomes unavoidable)
>>>
>>
>> Not yet, and - just guessing - neither in a short nor middle term.
>>
>> But I remember Rich mentioning being interested in type systems "a la" Qi
>> language ( 
>> http://en.wikipedia.org/wiki/Qi_(programming_language)).
>>  This allows to enable/disable type checking, but maybe what seemed more
>> interesting was the way to define the type via sequent calculus (
>> http://en.wikipedia.org/wiki/Qi_(programming_language)#Type_Checking).
>>
>> HTH,
>>
>> --
>> Laurent
>>
>>
>>>
>>> Ajay
>>>
>>>
>>> On Tue, Dec 15, 2009 at 7:23 AM, Baishampayan Ghose <
>>> b.gh...@ocricket.com> wrote:
>>>
 Ajay,

 > It tried the following in REPL and got no error. Personally, I feel
 that
 > I should get an error because calling square on strings is wrong in
 both
 > cases.
 >
 > Is there a way out of this in Clojure?
 >
 > |(defn square[n]  (*  n n))
 >
 > (if  (=  0  0)  (println"hello")  (map square["a"  "b"]))
 >

 What did you expect from Clojure? In the above form the `map` is a part
 of the else form and that's why it's not executed.

 If you don't know already, the syntax for `if` in Clojure is like this -

 (if expression
   (then form)
   (else form))

 If you have multiple then or else forms, you can wrap them inside a `do`
 form like this -

 (if expression
   (do
 (then form)
 (more then form))
   (else form))

 > The following gives error (because it gets evaluated):
 >
 > |(defn square[n]  (*  n n))
 >
 > (if  (=  0  1)  (println"hello")  (map square["a"  "b"]))

 In the above form, the map is a part of the else form and since 1 is not
 equal to 0, the `map` is executed.

 I hope your confusion is cleared.

 PS - If you are worried about "compile time type checking", I think it's
 prudent to mention now that Clojure is a dynamically typed programming
 language where types are checked at run-time and not compile time.

 Regards,
 BG

 --
 Baishampayan Ghose 
 oCricket.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
>>>
>>>
>>>  --
>>> 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@google

Re: Trying to rewrite a loop as map/reduce

2009-12-15 Thread samppi
Wonderful. I'm still getting used to juggling functions like this,
rather than doing standard loops. But it's so much cleaner.

Thanks again, everyone; your explanations showed me not only how to
solve my problem, but to organize my logic better too.

On Dec 15, 2:32 pm, Laurent PETIT  wrote:
> Of course you're right. I couldn't remember filter, was somehow "stuck" with
> some which does not do the job of course, and playing with the doc did not
> help since my version of clojure still has the bug on filter's lack of
> documentation :-)
>
> 2009/12/15 Sean Devlin 
>
>
>
> > On Dec 15, 4:05 pm, Laurent PETIT  wrote:
> > > Hello,
>
> > > it seems to me that your example is unnecessary complicated.
> > > Let's refactor it a bit before trying to obtain your goal.
>
> > > First,
>
> > > your example can be, for the purpose of your goal, simplified as :
>
> > > (loop [a a0]
> > >   (if (predicate-fn a)
> > >     (return-fn a)
> > >     (recur (recur-fn a
>
> > > So now, what can we do with this ?
>
> > > you keep applying function recur-fn to a, starting with a = a0.
> > > This is a job for iterate : (iterate recur-fn a0) will create this lazy
> > > sequence starting with a0, and where each new value is made from
> > (recur-fn
> > > a)
>
> > > Then you want to stop when predicate-fn returns true.
> > > This is a job for remove, for example : (first (remove (comp not
> > > predicate-fn) (iterate recur-fn a0)))
>
> > > The final step is to apply return-fn to the result:
> > > (return-fn
> > >   (first (remove
> > >                     (comp not predicate-fn)
> > >                     (iterate recur-fn a0)))
>
> > Shouldn't this be:
>
> >  (return-fn
> >   (first (filter predicate-fn (iterate recur-fn a0)))
>
> > > As for return-fn, predicate-fn and recur-fn :
>
> > > (def b f1)
> > > (def c (comp f2 b))
> > > (def d (comp f3 c))
> > > (def e (comp f4 d))
> > > (def g (comp f5 c))
> > > (def h (comp f5 f2))
>
> > > (def return-fn e)
> > > (def predicate-fn #(if (or (f6? (b %)) (<= (g %) (h %
> > > (def recur-fn #(f7 (d a) (b a)))
>
> > > Is it something like that you expected ?
>
> > > 2009/12/15 samppi 
>
> > > > I'm trying to rewrite a loop to use higher-level functions instead.
> > > > For pure functions f1, f2, f3, f4, f5, f6?, and f7, and a Clojure
> > > > object a0, how can one rewrite the following loop to use map, reduce,
> > > > etc.?
>
> > > >  (loop [a a0]
> > > >    (let [b (f1 a)
> > > >          c (f2 b)
> > > >          d (f3 c)
> > > >          e (f4 d)
> > > >          g (f5 c)
> > > >          h (-> e f2 f5)]
> > > >      (if (or (f6? b) (<= g h))
> > > >        e
> > > >        (recur (f7 d b)
>
> > > > --
> > > > 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 > > >  >
> >  > s.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: Funding Clojure 2010

2009-12-15 Thread nchubrich
Maybe it would be reasonable to charge for support if it added
something to that already available on the list.  After all, the list
is made up for the most part of volunteers who do not need to earn a
living answering questions, so it seems a little strange to gate
access to them for \anyone, no matter how corporate.  But corporations
may want to pay for more intensive support to solve a particular
problem.  That could be provided by Rich himself, or any number of
other contributors who would receive some money for the privilege, as
would Rich in part.  The results could be posted to the list as well
so all could benefit.

More speculatively, corporations (or individuals, for that matter) may
wish to bid on features that would be specifically useful to them.
This would provide a rigorous (though not necessarily ideal)
prioritizing of features.  Not only could they offer bounties for
features within Clojure, they could offer bounties for contribs.

An author of a contrib could be seen as writing a contrib as a sort of
proposal, that once completed (for a fee) would be more useful.  There
is no reason that a number of people and corporations could not get
together and offer to pay something for a completed feature.

This is a risky approach, because it may encourage \more things to
remain uncompleted until some payment is received; writing of
incomplete features could become a form of shakedown.  The hope would
be that, once people realize a certain feature is probably not going
to be paid for, they would go ahead and finish it anyway.  But that
introduces a delay.

Hard-core open-source people are right to worry about the ill effects
on motivations and priorities of introducing money into the system.
That's why I suggested a packaging approach: money for packaging isn't
going to distort the core functionality of Clojure in the way paying
for support or features might.  (The distortion of paying for support,
is that there is an obvious incentive to make features that \need
support.)



On Dec 15, 5:20 pm, Mike Hogye  wrote:
> Maybe take your ease-of-use idea in a slightly different direction and
> call it "support." Lots of business models rely on selling support.
>
> I have found the support available through the Clojure community
> (specifically: this Google Group, and the IRC channel) to be superb.
> Could commercial/corporate devs be required to pay for access to this
> community?
>
> Maybe:
>   * Hobby-only devs still get free access to group and channel, just
> like now.
>   * Corporate devs get free access to group and channel while
> evaluating Clojure.
>   * Once a corporate dev is no longer "just evaluating," payment is
> required (per-developer per-year).
>
> For me, that would justify spending my company's money. And if I were
> a potential Clojure user, it would not drive me away.
>
> On Dec 15, 3:09 pm, nchubrich  wrote:
>
> > Maybe the _thing_ could be a more packaged version of Clojure;
> > something for which setup is a little more seamless, etc.  No extra
> > features, just convenience.  Maybe an IDE plugin with extra debugging/
> > instructional features, and more facilities for browsing libraries
> > (java and clojure).  It could be something you buy by default, but
> > with an opt-out for people who want to build it themselves.
>
> > On Dec 15, 8:50 am, Mike Hogye  wrote:
>
> > > +1 for the idea of offering a _thing_ for sale.
>
> > > The company I work for isn't going to give a donation; that's just not
> > > something it does. But if there were a _thing_ I could purchase on the
> > > company's dime, well ... it's much more standard for a company to make
> > > a purchase than a donation. Particularly if the thing offered is
> > > useful.
>
> > > Of course, it would take _work_ to make something to sell, and I don't
> > > really have any strong suggestions. Maybe the community can build
> > > something dual-licensed, whose proceeds go to developing Clojure
> > > itself? Boils down to devs donating effort instead of cash.
>
> > > On Dec 15, 4:00 am, olalonde  wrote:
>
> > > > I'm not convinced donations alone is a sustainable funding method. Why
> > > > don't you derive a commercial product ? You could build an IDE for
> > > > Clojure and sell it. You could write a book (although that is unlikely
> > > > to really pay). You could build a "stackoverflow"-type community,
> > > > organize events/conferences, etc. You might want to talk to some VC
> > > > firm and see if they'd be interested in funding you. They could help
> > > > you out figure a revenue model.
>
> > > > Best of luck!
>
> > > > On Dec 14, 9:33 am, Rich Hickey  wrote:
>
> > > > > Funding Clojure 2010
>
> > > > > Background
> > > > > --
>
> > > > > It is important when using open source software that you consider who
> > > > > is paying for it, because someone is. There is no such thing as free
> > > > > software.
>
> > > > > Sometimes open source software is developed under a license with
> > > > > undesirable proper

Re: Funding Clojure 2010

2009-12-15 Thread bOR_
I had some trouble trying to explain my university to pay for free
software as well. They will much rather pay for a mathematica licence.

How about just a printed install CD for clojure. Utterly useless, but
very tangible :).

On Dec 15, 11:20 pm, Mike Hogye  wrote:
> Maybe take your ease-of-use idea in a slightly different direction and
> call it "support." Lots of business models rely on selling support.
>
> I have found the support available through the Clojure community
> (specifically: this Google Group, and the IRC channel) to be superb.
> Could commercial/corporate devs be required to pay for access to this
> community?
>
> Maybe:
>   * Hobby-only devs still get free access to group and channel, just
> like now.
>   * Corporate devs get free access to group and channel while
> evaluating Clojure.
>   * Once a corporate dev is no longer "just evaluating," payment is
> required (per-developer per-year).
>
> For me, that would justify spending my company's money. And if I were
> a potential Clojure user, it would not drive me away.
>
> On Dec 15, 3:09 pm, nchubrich  wrote:
>
>
>
> > Maybe the _thing_ could be a more packaged version of Clojure;
> > something for which setup is a little more seamless, etc.  No extra
> > features, just convenience.  Maybe an IDE plugin with extra debugging/
> > instructional features, and more facilities for browsing libraries
> > (java and clojure).  It could be something you buy by default, but
> > with an opt-out for people who want to build it themselves.
>
> > On Dec 15, 8:50 am, Mike Hogye  wrote:
>
> > > +1 for the idea of offering a _thing_ for sale.
>
> > > The company I work for isn't going to give a donation; that's just not
> > > something it does. But if there were a _thing_ I could purchase on the
> > > company's dime, well ... it's much more standard for a company to make
> > > a purchase than a donation. Particularly if the thing offered is
> > > useful.
>
> > > Of course, it would take _work_ to make something to sell, and I don't
> > > really have any strong suggestions. Maybe the community can build
> > > something dual-licensed, whose proceeds go to developing Clojure
> > > itself? Boils down to devs donating effort instead of cash.
>
> > > On Dec 15, 4:00 am, olalonde  wrote:
>
> > > > I'm not convinced donations alone is a sustainable funding method. Why
> > > > don't you derive a commercial product ? You could build an IDE for
> > > > Clojure and sell it. You could write a book (although that is unlikely
> > > > to really pay). You could build a "stackoverflow"-type community,
> > > > organize events/conferences, etc. You might want to talk to some VC
> > > > firm and see if they'd be interested in funding you. They could help
> > > > you out figure a revenue model.
>
> > > > Best of luck!
>
> > > > On Dec 14, 9:33 am, Rich Hickey  wrote:
>
> > > > > Funding Clojure 2010
>
> > > > > Background
> > > > > --
>
> > > > > It is important when using open source software that you consider who
> > > > > is paying for it, because someone is. There is no such thing as free
> > > > > software.
>
> > > > > Sometimes open source software is developed under a license with
> > > > > undesirable properties (e.g. the GPL), such that people are willing to
> > > > > pay for a (proprietary) version of it that is not subject to that
> > > > > license. Both Monty Widenius [1] and Richard Stallman [2] have argued
> > > > > for the necessity of such a mechanism to fund open source software,
> > > > > lest there be insufficient resources for its development. Clojure
> > > > > doesn't use the GPL, thus conveying more freedom to its users, but
> > > > > precluding me from funding it via dual licensing.
>
> > > > > Some companies develop technology as a component of a proprietary
> > > > > product or service, absorbing it as a necessary expense, only to
> > > > > decide that it is not a core, unique, or advantage-bearing business
> > > > > function. They can reduce their costs in ongoing development by open
> > > > > sourcing it, deriving benefit from community contributions and letting
> > > > > them focus on their core business [3]. It is important to note that
> > > > > the bulk of the costs are often in the original development, and are
> > > > > paid for by the proprietary product or service. That is not the case
> > > > > for Clojure.
>
> > > > > Some open source is the product of academic research, and is funded by
> > > > > the academic institution and/or research grants [4]. That is not the
> > > > > case for Clojure.
>
> > > > > Some open source software is (partially) funded by proprietary
> > > > > support. It is important to note that often the support income does
> > > > > not in fact make it to the people who create the software. Such income
> > > > > models work best for support sold to conservative enterprises [5].
> > > > > That is not the case for Clojure.
>
> > > > > Some companies 'fund' open source software by dedicating some of their
> > > > >

Re: Funding Clojure 2010

2009-12-15 Thread Mike Hogye
Maybe take your ease-of-use idea in a slightly different direction and
call it "support." Lots of business models rely on selling support.

I have found the support available through the Clojure community
(specifically: this Google Group, and the IRC channel) to be superb.
Could commercial/corporate devs be required to pay for access to this
community?

Maybe:
  * Hobby-only devs still get free access to group and channel, just
like now.
  * Corporate devs get free access to group and channel while
evaluating Clojure.
  * Once a corporate dev is no longer "just evaluating," payment is
required (per-developer per-year).

For me, that would justify spending my company's money. And if I were
a potential Clojure user, it would not drive me away.

On Dec 15, 3:09 pm, nchubrich  wrote:
> Maybe the _thing_ could be a more packaged version of Clojure;
> something for which setup is a little more seamless, etc.  No extra
> features, just convenience.  Maybe an IDE plugin with extra debugging/
> instructional features, and more facilities for browsing libraries
> (java and clojure).  It could be something you buy by default, but
> with an opt-out for people who want to build it themselves.
>
> On Dec 15, 8:50 am, Mike Hogye  wrote:
>
> > +1 for the idea of offering a _thing_ for sale.
>
> > The company I work for isn't going to give a donation; that's just not
> > something it does. But if there were a _thing_ I could purchase on the
> > company's dime, well ... it's much more standard for a company to make
> > a purchase than a donation. Particularly if the thing offered is
> > useful.
>
> > Of course, it would take _work_ to make something to sell, and I don't
> > really have any strong suggestions. Maybe the community can build
> > something dual-licensed, whose proceeds go to developing Clojure
> > itself? Boils down to devs donating effort instead of cash.
>
> > On Dec 15, 4:00 am, olalonde  wrote:
>
> > > I'm not convinced donations alone is a sustainable funding method. Why
> > > don't you derive a commercial product ? You could build an IDE for
> > > Clojure and sell it. You could write a book (although that is unlikely
> > > to really pay). You could build a "stackoverflow"-type community,
> > > organize events/conferences, etc. You might want to talk to some VC
> > > firm and see if they'd be interested in funding you. They could help
> > > you out figure a revenue model.
>
> > > Best of luck!
>
> > > On Dec 14, 9:33 am, Rich Hickey  wrote:
>
> > > > Funding Clojure 2010
>
> > > > Background
> > > > --
>
> > > > It is important when using open source software that you consider who
> > > > is paying for it, because someone is. There is no such thing as free
> > > > software.
>
> > > > Sometimes open source software is developed under a license with
> > > > undesirable properties (e.g. the GPL), such that people are willing to
> > > > pay for a (proprietary) version of it that is not subject to that
> > > > license. Both Monty Widenius [1] and Richard Stallman [2] have argued
> > > > for the necessity of such a mechanism to fund open source software,
> > > > lest there be insufficient resources for its development. Clojure
> > > > doesn't use the GPL, thus conveying more freedom to its users, but
> > > > precluding me from funding it via dual licensing.
>
> > > > Some companies develop technology as a component of a proprietary
> > > > product or service, absorbing it as a necessary expense, only to
> > > > decide that it is not a core, unique, or advantage-bearing business
> > > > function. They can reduce their costs in ongoing development by open
> > > > sourcing it, deriving benefit from community contributions and letting
> > > > them focus on their core business [3]. It is important to note that
> > > > the bulk of the costs are often in the original development, and are
> > > > paid for by the proprietary product or service. That is not the case
> > > > for Clojure.
>
> > > > Some open source is the product of academic research, and is funded by
> > > > the academic institution and/or research grants [4]. That is not the
> > > > case for Clojure.
>
> > > > Some open source software is (partially) funded by proprietary
> > > > support. It is important to note that often the support income does
> > > > not in fact make it to the people who create the software. Such income
> > > > models work best for support sold to conservative enterprises [5].
> > > > That is not the case for Clojure.
>
> > > > Some companies 'fund' open source software by dedicating some of their
> > > > employees' time, or making investments, in its development. There must
> > > > be some business value to the company for doing so (e.g. it helps them
> > > > sell hardware [6]), and thus is ultimately paid for by their
> > > > proprietary products/services. That is not the case for Clojure.
>
> > > > There *are* companies that make software themselves, whose consumers
> > > > see a value in it and willingly pay to obtain that

Re: Trying to rewrite a loop as map/reduce

2009-12-15 Thread Laurent PETIT
Of course you're right. I couldn't remember filter, was somehow "stuck" with
some which does not do the job of course, and playing with the doc did not
help since my version of clojure still has the bug on filter's lack of
documentation :-)

2009/12/15 Sean Devlin 

> On Dec 15, 4:05 pm, Laurent PETIT  wrote:
> > Hello,
> >
> > it seems to me that your example is unnecessary complicated.
> > Let's refactor it a bit before trying to obtain your goal.
> >
> > First,
> >
> > your example can be, for the purpose of your goal, simplified as :
> >
> > (loop [a a0]
> >   (if (predicate-fn a)
> > (return-fn a)
> > (recur (recur-fn a
> >
> > So now, what can we do with this ?
> >
> > you keep applying function recur-fn to a, starting with a = a0.
> > This is a job for iterate : (iterate recur-fn a0) will create this lazy
> > sequence starting with a0, and where each new value is made from
> (recur-fn
> > a)
> >
> > Then you want to stop when predicate-fn returns true.
> > This is a job for remove, for example : (first (remove (comp not
> > predicate-fn) (iterate recur-fn a0)))
> >
> > The final step is to apply return-fn to the result:
> > (return-fn
> >   (first (remove
> > (comp not predicate-fn)
> > (iterate recur-fn a0)))
> >
>
> Shouldn't this be:
>
>  (return-fn
>   (first (filter predicate-fn (iterate recur-fn a0)))
>
>
> > As for return-fn, predicate-fn and recur-fn :
> >
> > (def b f1)
> > (def c (comp f2 b))
> > (def d (comp f3 c))
> > (def e (comp f4 d))
> > (def g (comp f5 c))
> > (def h (comp f5 f2))
> >
> > (def return-fn e)
> > (def predicate-fn #(if (or (f6? (b %)) (<= (g %) (h %
> > (def recur-fn #(f7 (d a) (b a)))
> >
> > Is it something like that you expected ?
> >
> > 2009/12/15 samppi 
> >
> > > I'm trying to rewrite a loop to use higher-level functions instead.
> > > For pure functions f1, f2, f3, f4, f5, f6?, and f7, and a Clojure
> > > object a0, how can one rewrite the following loop to use map, reduce,
> > > etc.?
> >
> > >  (loop [a a0]
> > >(let [b (f1 a)
> > >  c (f2 b)
> > >  d (f3 c)
> > >  e (f4 d)
> > >  g (f5 c)
> > >  h (-> e f2 f5)]
> > >  (if (or (f6? b) (<= g h))
> > >e
> > >(recur (f7 d b)
> >
> > > --
> > > 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: Trying to rewrite a loop as map/reduce

2009-12-15 Thread Sean Devlin
On Dec 15, 4:05 pm, Laurent PETIT  wrote:
> Hello,
>
> it seems to me that your example is unnecessary complicated.
> Let's refactor it a bit before trying to obtain your goal.
>
> First,
>
> your example can be, for the purpose of your goal, simplified as :
>
> (loop [a a0]
>   (if (predicate-fn a)
>     (return-fn a)
>     (recur (recur-fn a
>
> So now, what can we do with this ?
>
> you keep applying function recur-fn to a, starting with a = a0.
> This is a job for iterate : (iterate recur-fn a0) will create this lazy
> sequence starting with a0, and where each new value is made from (recur-fn
> a)
>
> Then you want to stop when predicate-fn returns true.
> This is a job for remove, for example : (first (remove (comp not
> predicate-fn) (iterate recur-fn a0)))
>
> The final step is to apply return-fn to the result:
> (return-fn
>   (first (remove
>                     (comp not predicate-fn)
>                     (iterate recur-fn a0)))
>

Shouldn't this be:

 (return-fn
   (first (filter predicate-fn (iterate recur-fn a0)))


> As for return-fn, predicate-fn and recur-fn :
>
> (def b f1)
> (def c (comp f2 b))
> (def d (comp f3 c))
> (def e (comp f4 d))
> (def g (comp f5 c))
> (def h (comp f5 f2))
>
> (def return-fn e)
> (def predicate-fn #(if (or (f6? (b %)) (<= (g %) (h %
> (def recur-fn #(f7 (d a) (b a)))
>
> Is it something like that you expected ?
>
> 2009/12/15 samppi 
>
> > I'm trying to rewrite a loop to use higher-level functions instead.
> > For pure functions f1, f2, f3, f4, f5, f6?, and f7, and a Clojure
> > object a0, how can one rewrite the following loop to use map, reduce,
> > etc.?
>
> >  (loop [a a0]
> >    (let [b (f1 a)
> >          c (f2 b)
> >          d (f3 c)
> >          e (f4 d)
> >          g (f5 c)
> >          h (-> e f2 f5)]
> >      (if (or (f6? b) (<= g h))
> >        e
> >        (recur (f7 d b)
>
> > --
> > 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: macro headaches

2009-12-15 Thread Laurent PETIT
Hello,

so you have a mutating object. To mutate it you must call a method (please
note, I don't use the term function, which has a different meaning than a
class method, especially in clojure where functions are first class).

You want a final call something like that:
(mystery-fn-or-macro object method-to-call list-of-items)

If you can afford in your situation of passing a real higher order function
to mystery-fn-or-macro , like (fn [obj item] (.method-to-call obj item)),
then mystery-fn-or-macro is simply based on doseq :

(defn mystery-fn [object fn-calling-method list-of-items]
  (doseq [item list-of-items] (fn-calling-method obj item)))

and you call it as such :
(mystery-fn object (fn [obj item] (.method-to-call obj item)) list-of-items)

There's also the memfn macro in clojure.core for exactly this purpose:
(mystery-fn object (memfn method-to-call item) list-of-items)

But note that those days, memfn is somewhat deprecated in favor of raw (fn
...) or #(...) constructs.

HTH,

-- 
Laurent

2009/12/15 tristan 

> Hi guys,
>
> I have a list (which i don't know the size of) and i want to do
> something like this:
> (doto (MutatingJavaObject.) (.add (first list-items)) (.add (second
> list-items)) . (.add (last list-items)))
>
> Now I may be doing this the complete wrong way, so if you have a
> better solution please tell me. but i've been trying to build a macro
> to expand this out, given the object, the function to call and the
> list of items.
>
> i've been playing with various things, and manage to get a few things
> that work if i pass the list of items in without being a list (i.e. (1
> 1 1) rather than '(1 1 1) or (list 1 1 1)) for example (defmacro d2
> [obj func inputs] (concat (list 'doto obj) (map #(list func %)
> inputs))) but if i try and pass in my list-items variable it just
> complains that it "Don't know how to create ISeq from:
> clojure.lang.Symbol".
>
> perhaps i'm not fully grasping the concept of macros? i'm very new to
> lisp and FP in general.
>
> while writing this email i had a light switch on that i could simply
> do it like this:
> (let [obj (MutatingJavaObject.)]
>  (loop [in list-items]
>(when (not (empty? in))
>  (.add obj (first in))
>  (recur (rest in
>  obj)
> but i would still like to know if there is a way i could get the macro
> i wanted going.
>
> please help! my googling and trauling through Stuart Halloway's book
> have come up naught.
>
> thanks in advance!
> -Tristan
>
> --
> 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: Trying to rewrite a loop as map/reduce

2009-12-15 Thread Laurent PETIT
Hello,

it seems to me that your example is unnecessary complicated.
Let's refactor it a bit before trying to obtain your goal.

First,

your example can be, for the purpose of your goal, simplified as :

(loop [a a0]
  (if (predicate-fn a)
(return-fn a)
(recur (recur-fn a

So now, what can we do with this ?

you keep applying function recur-fn to a, starting with a = a0.
This is a job for iterate : (iterate recur-fn a0) will create this lazy
sequence starting with a0, and where each new value is made from (recur-fn
a)

Then you want to stop when predicate-fn returns true.
This is a job for remove, for example : (first (remove (comp not
predicate-fn) (iterate recur-fn a0)))

The final step is to apply return-fn to the result:
(return-fn
  (first (remove
(comp not predicate-fn)
(iterate recur-fn a0)))

As for return-fn, predicate-fn and recur-fn :

(def b f1)
(def c (comp f2 b))
(def d (comp f3 c))
(def e (comp f4 d))
(def g (comp f5 c))
(def h (comp f5 f2))

(def return-fn e)
(def predicate-fn #(if (or (f6? (b %)) (<= (g %) (h %
(def recur-fn #(f7 (d a) (b a)))

Is it something like that you expected ?


2009/12/15 samppi 

> I'm trying to rewrite a loop to use higher-level functions instead.
> For pure functions f1, f2, f3, f4, f5, f6?, and f7, and a Clojure
> object a0, how can one rewrite the following loop to use map, reduce,
> etc.?
>
>  (loop [a a0]
>(let [b (f1 a)
>  c (f2 b)
>  d (f3 c)
>  e (f4 d)
>  g (f5 c)
>  h (-> e f2 f5)]
>  (if (or (f6? b) (<= g h))
>e
>(recur (f7 d b)
>
> --
> 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: Funding Clojure 2010

2009-12-15 Thread nchubrich
Maybe the _thing_ could be a more packaged version of Clojure;
something for which setup is a little more seamless, etc.  No extra
features, just convenience.  Maybe an IDE plugin with extra debugging/
instructional features, and more facilities for browsing libraries
(java and clojure).  It could be something you buy by default, but
with an opt-out for people who want to build it themselves.

On Dec 15, 8:50 am, Mike Hogye  wrote:
> +1 for the idea of offering a _thing_ for sale.
>
> The company I work for isn't going to give a donation; that's just not
> something it does. But if there were a _thing_ I could purchase on the
> company's dime, well ... it's much more standard for a company to make
> a purchase than a donation. Particularly if the thing offered is
> useful.
>
> Of course, it would take _work_ to make something to sell, and I don't
> really have any strong suggestions. Maybe the community can build
> something dual-licensed, whose proceeds go to developing Clojure
> itself? Boils down to devs donating effort instead of cash.
>
> On Dec 15, 4:00 am, olalonde  wrote:
>
> > I'm not convinced donations alone is a sustainable funding method. Why
> > don't you derive a commercial product ? You could build an IDE for
> > Clojure and sell it. You could write a book (although that is unlikely
> > to really pay). You could build a "stackoverflow"-type community,
> > organize events/conferences, etc. You might want to talk to some VC
> > firm and see if they'd be interested in funding you. They could help
> > you out figure a revenue model.
>
> > Best of luck!
>
> > On Dec 14, 9:33 am, Rich Hickey  wrote:
>
> > > Funding Clojure 2010
>
> > > Background
> > > --
>
> > > It is important when using open source software that you consider who
> > > is paying for it, because someone is. There is no such thing as free
> > > software.
>
> > > Sometimes open source software is developed under a license with
> > > undesirable properties (e.g. the GPL), such that people are willing to
> > > pay for a (proprietary) version of it that is not subject to that
> > > license. Both Monty Widenius [1] and Richard Stallman [2] have argued
> > > for the necessity of such a mechanism to fund open source software,
> > > lest there be insufficient resources for its development. Clojure
> > > doesn't use the GPL, thus conveying more freedom to its users, but
> > > precluding me from funding it via dual licensing.
>
> > > Some companies develop technology as a component of a proprietary
> > > product or service, absorbing it as a necessary expense, only to
> > > decide that it is not a core, unique, or advantage-bearing business
> > > function. They can reduce their costs in ongoing development by open
> > > sourcing it, deriving benefit from community contributions and letting
> > > them focus on their core business [3]. It is important to note that
> > > the bulk of the costs are often in the original development, and are
> > > paid for by the proprietary product or service. That is not the case
> > > for Clojure.
>
> > > Some open source is the product of academic research, and is funded by
> > > the academic institution and/or research grants [4]. That is not the
> > > case for Clojure.
>
> > > Some open source software is (partially) funded by proprietary
> > > support. It is important to note that often the support income does
> > > not in fact make it to the people who create the software. Such income
> > > models work best for support sold to conservative enterprises [5].
> > > That is not the case for Clojure.
>
> > > Some companies 'fund' open source software by dedicating some of their
> > > employees' time, or making investments, in its development. There must
> > > be some business value to the company for doing so (e.g. it helps them
> > > sell hardware [6]), and thus is ultimately paid for by their
> > > proprietary products/services. That is not the case for Clojure.
>
> > > There *are* companies that make software themselves, whose consumers
> > > see a value in it and willingly pay to obtain that value. The money
> > > produced by this process pays the salaries of the people who are
> > > dedicated to making it, and some profit besides. It's called
> > > "proprietary software". People pay for proprietary software because
> > > they have to, but otherwise the scenario is very similar to open
> > > source - people make software, consumers get value from it. In fact,
> > > we often get a lot less with proprietary software - vendor lock-in, no
> > > source etc. Most alarmingly, this is the only model that associates
> > > value with software itself, and therefore with the people who make it.
>
> > > Why don't people pay for open source software? Primarily, because they
> > > don't *have to*. I think also, partially, it is because open source
> > > software often doesn't have a price tag. I think it should. I'd like
> > > to pay for open source, and know the money is going to those who
> > > create it. I'd 

Re: Funding Clojure 2010

2009-12-15 Thread Mike Hogye
+1 for the idea of offering a _thing_ for sale.

The company I work for isn't going to give a donation; that's just not
something it does. But if there were a _thing_ I could purchase on the
company's dime, well ... it's much more standard for a company to make
a purchase than a donation. Particularly if the thing offered is
useful.

Of course, it would take _work_ to make something to sell, and I don't
really have any strong suggestions. Maybe the community can build
something dual-licensed, whose proceeds go to developing Clojure
itself? Boils down to devs donating effort instead of cash.

On Dec 15, 4:00 am, olalonde  wrote:
> I'm not convinced donations alone is a sustainable funding method. Why
> don't you derive a commercial product ? You could build an IDE for
> Clojure and sell it. You could write a book (although that is unlikely
> to really pay). You could build a "stackoverflow"-type community,
> organize events/conferences, etc. You might want to talk to some VC
> firm and see if they'd be interested in funding you. They could help
> you out figure a revenue model.
>
> Best of luck!
>
> On Dec 14, 9:33 am, Rich Hickey  wrote:
>
>
>
> > Funding Clojure 2010
>
> > Background
> > --
>
> > It is important when using open source software that you consider who
> > is paying for it, because someone is. There is no such thing as free
> > software.
>
> > Sometimes open source software is developed under a license with
> > undesirable properties (e.g. the GPL), such that people are willing to
> > pay for a (proprietary) version of it that is not subject to that
> > license. Both Monty Widenius [1] and Richard Stallman [2] have argued
> > for the necessity of such a mechanism to fund open source software,
> > lest there be insufficient resources for its development. Clojure
> > doesn't use the GPL, thus conveying more freedom to its users, but
> > precluding me from funding it via dual licensing.
>
> > Some companies develop technology as a component of a proprietary
> > product or service, absorbing it as a necessary expense, only to
> > decide that it is not a core, unique, or advantage-bearing business
> > function. They can reduce their costs in ongoing development by open
> > sourcing it, deriving benefit from community contributions and letting
> > them focus on their core business [3]. It is important to note that
> > the bulk of the costs are often in the original development, and are
> > paid for by the proprietary product or service. That is not the case
> > for Clojure.
>
> > Some open source is the product of academic research, and is funded by
> > the academic institution and/or research grants [4]. That is not the
> > case for Clojure.
>
> > Some open source software is (partially) funded by proprietary
> > support. It is important to note that often the support income does
> > not in fact make it to the people who create the software. Such income
> > models work best for support sold to conservative enterprises [5].
> > That is not the case for Clojure.
>
> > Some companies 'fund' open source software by dedicating some of their
> > employees' time, or making investments, in its development. There must
> > be some business value to the company for doing so (e.g. it helps them
> > sell hardware [6]), and thus is ultimately paid for by their
> > proprietary products/services. That is not the case for Clojure.
>
> > There *are* companies that make software themselves, whose consumers
> > see a value in it and willingly pay to obtain that value. The money
> > produced by this process pays the salaries of the people who are
> > dedicated to making it, and some profit besides. It's called
> > "proprietary software". People pay for proprietary software because
> > they have to, but otherwise the scenario is very similar to open
> > source - people make software, consumers get value from it. In fact,
> > we often get a lot less with proprietary software - vendor lock-in, no
> > source etc. Most alarmingly, this is the only model that associates
> > value with software itself, and therefore with the people who make it.
>
> > Why don't people pay for open source software? Primarily, because they
> > don't *have to*. I think also, partially, it is because open source
> > software often doesn't have a price tag. I think it should. I'd like
> > to pay for open source, and know the money is going to those who
> > create it. I'd like companies to *expect* to pay for it. I'd like to
> > see people make a living (and even profit!) directly making open
> > source, not as a side effect of some other proprietary process, to
> > dedicate themselves to it, and not have it be hobby/side work.
>
> > Unfortunately, there seems to be no way to convey the full benefits of
> > open source software while *forcing* people to pay for it. Only in the
> > proprietary (including dual-license) model is there a direct
> > connection between the consumers of software and the funding of those
> > that produce it. This i

Re: macro headaches

2009-12-15 Thread Allen Johnson
I'm just learning lisp but wouldn't a macro be overkill?

; manually add each item
(doseq [item items]
  (.add obj item))

; or wrapped in a function
(defn add-all [obj items]
  (doseq [item items]
(.add obj item)))

(add-all obj items)

If your java object had an addAll method that accepted a collection,
then you probably could do:

(.addAll obj items)

I'm wondering why you want it to be a macro?

Allen

On Tue, Dec 15, 2009 at 12:31 PM, tristan  wrote:
> Hi guys,
>
> I have a list (which i don't know the size of) and i want to do
> something like this:
> (doto (MutatingJavaObject.) (.add (first list-items)) (.add (second
> list-items)) . (.add (last list-items)))
>
> Now I may be doing this the complete wrong way, so if you have a
> better solution please tell me. but i've been trying to build a macro
> to expand this out, given the object, the function to call and the
> list of items.
>
> i've been playing with various things, and manage to get a few things
> that work if i pass the list of items in without being a list (i.e. (1
> 1 1) rather than '(1 1 1) or (list 1 1 1)) for example (defmacro d2
> [obj func inputs] (concat (list 'doto obj) (map #(list func %)
> inputs))) but if i try and pass in my list-items variable it just
> complains that it "Don't know how to create ISeq from:
> clojure.lang.Symbol".
>
> perhaps i'm not fully grasping the concept of macros? i'm very new to
> lisp and FP in general.
>
> while writing this email i had a light switch on that i could simply
> do it like this:
> (let [obj (MutatingJavaObject.)]
>  (loop [in list-items]
>    (when (not (empty? in))
>      (.add obj (first in))
>      (recur (rest in
>  obj)
> but i would still like to know if there is a way i could get the macro
> i wanted going.
>
> please help! my googling and trauling through Stuart Halloway's book
> have come up naught.
>
> thanks in advance!
> -Tristan
>
> --
> 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: macro headaches

2009-12-15 Thread Allen Johnson
I think I misunderstood you. Battling a cold so I'm sorry if I'm way
off here but did you want a macro like this?

(defmacro my-doall [obj func-sym items]
  (let [func-name (symbol (str "." (name func-sym)))
item (gensym)]
`(doseq [~item ~items]
   (~func-name ~obj ~item

(my-doall obj add ["item1" "item2" "item3"])

Allen

On Tue, Dec 15, 2009 at 1:04 PM, Allen Johnson  wrote:
> I'm just learning lisp but wouldn't a macro be overkill?
>
> ; manually add each item
> (doseq [item items]
>  (.add obj item))
>
> ; or wrapped in a function
> (defn add-all [obj items]
>  (doseq [item items]
>    (.add obj item)))
>
> (add-all obj items)
>
> If your java object had an addAll method that accepted a collection,
> then you probably could do:
>
> (.addAll obj items)
>
> I'm wondering why you want it to be a macro?
>
> Allen
>
> On Tue, Dec 15, 2009 at 12:31 PM, tristan  wrote:
>> Hi guys,
>>
>> I have a list (which i don't know the size of) and i want to do
>> something like this:
>> (doto (MutatingJavaObject.) (.add (first list-items)) (.add (second
>> list-items)) . (.add (last list-items)))
>>
>> Now I may be doing this the complete wrong way, so if you have a
>> better solution please tell me. but i've been trying to build a macro
>> to expand this out, given the object, the function to call and the
>> list of items.
>>
>> i've been playing with various things, and manage to get a few things
>> that work if i pass the list of items in without being a list (i.e. (1
>> 1 1) rather than '(1 1 1) or (list 1 1 1)) for example (defmacro d2
>> [obj func inputs] (concat (list 'doto obj) (map #(list func %)
>> inputs))) but if i try and pass in my list-items variable it just
>> complains that it "Don't know how to create ISeq from:
>> clojure.lang.Symbol".
>>
>> perhaps i'm not fully grasping the concept of macros? i'm very new to
>> lisp and FP in general.
>>
>> while writing this email i had a light switch on that i could simply
>> do it like this:
>> (let [obj (MutatingJavaObject.)]
>>  (loop [in list-items]
>>    (when (not (empty? in))
>>      (.add obj (first in))
>>      (recur (rest in
>>  obj)
>> but i would still like to know if there is a way i could get the macro
>> i wanted going.
>>
>> please help! my googling and trauling through Stuart Halloway's book
>> have come up naught.
>>
>> thanks in advance!
>> -Tristan
>>
>> --
>> 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: Funding Clojure 2010

2009-12-15 Thread nchubrich
Mike---

> the thought that the key developer might just stop working on it doesn't 
> exactly
> give me a warm fuzzy feeling.

Look at the last paragraph of Rich's message.  He has every intention
to keep working on it.  Surely he will speak for himself, but my
impression is that he wants to be able to work on this full-time as
opposed to part-time.  I don't see any direct threats to abandon it.

Larry Wall's project was not without risk of dying either.  He could
have lost his job and had to go to work for a less enlightened
employer.  In some ways, it is easier for you to evaluate the Clojure
community than it is to evaluate the likely continuance of other
circumstances in the founder's life.  And a strong community may be
better able to ride out a bubble bursting than a company.

The sort of funding activities you are talking about would work, but
they would inevitably take time away from core Clojure development.
Is it worth being "dunned" for money to allow development to proceed
that much faster?  To me (and apparently plenty of other people), it
is most definitely worth it.  I'm not the first person to say this,
and I won't be the last, but Clojure has been a dream come true.  As
great as it is now, I look forward to everything that Rich wants to
addClojure in Clojure, declarative logic.  I want him to be
able to focus on these new things full time.  I want him to work for
the community, rather than for whoever he consults for, or whoever he
lectures to.  (The community has been greatif the number of dumb
questions of mine that have been cheerfully answered is any
indication)  He has created something that has been of great value
to me personally and in my work.  I feel I owe him.

If you are not sure what Clojure is worth to you yet, then you don't
owe him anything.  And if you believe that there should be no need to
pay people whose open-source work you have found useful, you don't owe
him anything either.

There may be a version of the open-source ethos that disdains making
money directly from coding.  This ethos would claim that the way to
repay people is in code, not in money.  I think this attitude ends up
being exclusionary.  The vast majority of people cannot or do not
contribute useful code.  But they have just as much of a need for good
software as programmers do, if not more, and yet their interests are
not always well-served by open-source software.  When your
remuneration comes not from your core activity, but from various side
activities, or when open-source coding itself is a side activity, you
are bound to be distracted.  When your only currency and standing
comes from other programmers,, things that non-programmers need
especiallyimportant but uninteresting things like documentation,
interface polish and ease of setuptend to get neglected in the
distraction.

Not surprisingly, the open source movement has created a great deal of
powerful software, but it has had mixed success creating software that
the vast majority of people can use.

If we want open-source software to live up to its full potential, we
will have to abandon exclusionary attitudes, and most importantly
think creatively about how to give people like Rich Hickey a living.
I wish he did not have to ask for donations, but that's a lot better
than him wasting his time.

-- 
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: Trying to rewrite a loop as map/reduce

2009-12-15 Thread Zach Tellman
At first glance I don't see a clean to make this completely higher-
order, but here's a shorter (albeit a little messy) version:

(loop [a a0]
(let [[a b c d e] (reduce #(conj %1 (%2 (last %1))) [a] [f1 f2 f3
f4])
  g (f5 c)
  h (-> e f2 f5)]
  (if (or (f6? b) (<= g h))
e
(recur (f7 d b)


On Dec 15, 11:00 am, samppi  wrote:
> I'm trying to rewrite a loop to use higher-level functions instead.
> For pure functions f1, f2, f3, f4, f5, f6?, and f7, and a Clojure
> object a0, how can one rewrite the following loop to use map, reduce,
> etc.?
>
>   (loop [a a0]
>     (let [b (f1 a)
>           c (f2 b)
>           d (f3 c)
>           e (f4 d)
>           g (f5 c)
>           h (-> e f2 f5)]
>       (if (or (f6? b) (<= g h))
>         e
>         (recur (f7 d b)

-- 
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: Trying to rewrite a loop as map/reduce

2009-12-15 Thread Sean Devlin
Could you re-write this w/ comp, and repost?

On Dec 15, 2:00 pm, samppi  wrote:
> I'm trying to rewrite a loop to use higher-level functions instead.
> For pure functions f1, f2, f3, f4, f5, f6?, and f7, and a Clojure
> object a0, how can one rewrite the following loop to use map, reduce,
> etc.?
>
>   (loop [a a0]
>     (let [b (f1 a)
>           c (f2 b)
>           d (f3 c)
>           e (f4 d)
>           g (f5 c)
>           h (-> e f2 f5)]
>       (if (or (f6? b) (<= g h))
>         e
>         (recur (f7 d b)

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


Trying to rewrite a loop as map/reduce

2009-12-15 Thread samppi
I'm trying to rewrite a loop to use higher-level functions instead.
For pure functions f1, f2, f3, f4, f5, f6?, and f7, and a Clojure
object a0, how can one rewrite the following loop to use map, reduce,
etc.?

  (loop [a a0]
(let [b (f1 a)
  c (f2 b)
  d (f3 c)
  e (f4 d)
  g (f5 c)
  h (-> e f2 f5)]
  (if (or (f6? b) (<= g h))
e
(recur (f7 d b)

-- 
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: struct-maps and key removal

2009-12-15 Thread Richard Newman
> Isn't the whole point of a struct that it guarantees that certain keys
> are present?

Oh, I agree -- dissoc on a struct-map would return a non-struct-map.  
I'm not suggesting that struct-maps should be able to be dissociated  
from one of their keys, I'm wondering whether it's better to return an  
array-map or hash-map from dissoc rather than blow up.

(Or whether there should be a `without-keys` function that behaves  
much like dissoc but works on any map, and have rename-keys and other  
"implicit dissoc" functions use that instead. rename-keys on a struct- 
map's core keys implies an abandonment of struct-ness, no?)

I suppose the question is "are struct-maps 'structs' or  
maps?" (speaking ontologically). If they're structs, then it's happy  
coincidence that the map get/assoc functions work on them, and  
slightly confusing that they print as ordinary maps. If they're maps,  
where their struct-ness is an optimization, then dissoc should work in  
the same way that assoc on an array-map can sometimes return a hash-map.

The main reason I bring this up is that I had no reason to suspect  
that the maps returned from my SQL queries were actually struct-maps.  
They printed like any other map, and work correctly for every non- 
removing map operation. Having some subset of maps error on core API  
operations seems opposed to abstraction-oriented programming. It trips  
my disgust switch to see code like

(rename-keys
   (if (struct-map? m)
 (into {} m)
 m)
   {:foo :bar})

-- 
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: macro headaches

2009-12-15 Thread Krešimir Šojat
> while writing this email i had a light switch on that i could simply
> do it like this:
> (let [obj (MutatingJavaObject.)]
>   (loop [in list-items]
> (when (not (empty? in))
>   (.add obj (first in))
>   (recur (rest in
>   obj)
> but i would still like to know if there is a way i could get the macro
> i wanted going.

Macro will not work in this situation, but you can write it as:
(let [obj (MutatingJavaObject.)]
  (doseq [item list-items] (.add obj item)))

--
Krešimir Šojat

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


macro headaches

2009-12-15 Thread tristan
Hi guys,

I have a list (which i don't know the size of) and i want to do
something like this:
(doto (MutatingJavaObject.) (.add (first list-items)) (.add (second
list-items)) . (.add (last list-items)))

Now I may be doing this the complete wrong way, so if you have a
better solution please tell me. but i've been trying to build a macro
to expand this out, given the object, the function to call and the
list of items.

i've been playing with various things, and manage to get a few things
that work if i pass the list of items in without being a list (i.e. (1
1 1) rather than '(1 1 1) or (list 1 1 1)) for example (defmacro d2
[obj func inputs] (concat (list 'doto obj) (map #(list func %)
inputs))) but if i try and pass in my list-items variable it just
complains that it "Don't know how to create ISeq from:
clojure.lang.Symbol".

perhaps i'm not fully grasping the concept of macros? i'm very new to
lisp and FP in general.

while writing this email i had a light switch on that i could simply
do it like this:
(let [obj (MutatingJavaObject.)]
  (loop [in list-items]
(when (not (empty? in))
  (.add obj (first in))
  (recur (rest in
  obj)
but i would still like to know if there is a way i could get the macro
i wanted going.

please help! my googling and trauling through Stuart Halloway's book
have come up naught.

thanks in advance!
-Tristan

-- 
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 newbie question regarding compile time type checking.

2009-12-15 Thread Luc Préfontaine
If Clojure type checking becomes a frequent request/complaint, please
build a lint type tool, not some twisted logic embedded in the
compiler :)))

C did not have any decent type checking when it came out and we had to
use lint to find bad parameter on fn calls and other similar errors.
They were no function prototypes at the time so passing a pointer
address instead of the pointer value did not bother the compiler at all.
In fact you could pass crap in most places and end up at run time with a
bad pointer address or corrupted stack.

You cannot call C a dynamic language, a semi-assembler that evolved to a
higher status over time, 
however it lacked basic type checking in it's early incarnations...
Quite a challenge for a typed language (byte, short, int, long, 8? 16?
32 bits ?).
Debugging stack corruptions daily is not really an efficient way to
program so rules where added to the compiler to eventually
flag data type improper uses.

I never saw a dynamically typed language that had type checking at
compile time :))) In my mind it's mutually exclusive...

Lisp compilers came out in the 1970s if I recall. To compile Lisp you
needed special declarations to define unbound variables and other
similar things
to get the compiler to create a runnable file.
Symbols where not bound to lexical scope so the compiler needed some
hints from time to time telling it that these things would eventually be
available at run time.
This did not apply to symbols within a function, they could appear
without an explicit declaration. It was assumed they were
somewhere on the stack at run time. That's even more dynamic that what
Clojure allows... maybe a bit too much.

The Clojure compiler is in the same vein, it checks for undeclared stuff
BUT mandates that everything used be visible in the lexical
scope. No run time bindings not lexically visible are allowed, that's a
very good compromise, debugging for missing dynamic bindings on the
stack
at run time is not very funny.

This compiler has nothing to do with a data typed compiler that
validates that the "proper" typed variables are used in an acceptable
manner... 

These are two unrelated things. We call them both "compilers" but its
not required for a compiler to do data type checking.
The only thing they may have in common is that they both generate code.


Luc

On Tue, 2009-12-15 at 06:20 -0800, Tayssir John Gabbour wrote:

> On Dec 15, 1:23 pm, Baishampayan Ghose  wrote:
> > PS - If you are worried about "compile time type checking", I think it's
> > prudent to mention now that Clojure is a dynamically typed programming
> > language where types are checked at run-time and not compile time.
> 
> Actually, there are Common Lisp compilers (like SBCL) which signal a
> warning if they infer a type error. I think it's handy, and doesn't do
> anything drastic like refuse to compile your program because of it.
> 
> 
> All the best,
> Tayssir
> 
> 
> On Dec 15, 1:23 pm, Baishampayan Ghose  wrote:
> > Ajay,
> >
> > > It tried the following in REPL and got no error. Personally, I feel that
> > > I should get an error because calling square on strings is wrong in both
> > > cases.
> >
> > > Is there a way out of this in Clojure?
> >
> > > |(defn square[n]  (*  n n))
> >
> > > (if  (=  0  0)  (println"hello")  (map square["a"  "b"]))
> >
> > What did you expect from Clojure? In the above form the `map` is a part
> > of the else form and that's why it's not executed.
> >
> > If you don't know already, the syntax for `if` in Clojure is like this -
> >
> > (if expression
> >(then form)
> >(else form))
> >
> > If you have multiple then or else forms, you can wrap them inside a `do`
> > form like this -
> >
> > (if expression
> >(do
> >  (then form)
> >  (more then form))
> >(else form))
> >
> > > The following gives error (because it gets evaluated):
> >
> > > |(defn square[n]  (*  n n))
> >
> > > (if  (=  0  1)  (println"hello")  (map square["a"  "b"]))
> >
> > In the above form, the map is a part of the else form and since 1 is not
> > equal to 0, the `map` is executed.
> >
> > I hope your confusion is cleared.
> >
> > PS - If you are worried about "compile time type checking", I think it's
> > prudent to mention now that Clojure is a dynamically typed programming
> > language where types are checked at run-time and not compile time.
> >
> > Regards,
> > BG
> >
> > --
> > Baishampayan Ghose 
> > oCricket.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: Try/Catch & Recur

2009-12-15 Thread Chouser
On Tue, Dec 15, 2009 at 10:54 AM, Greg Harman  wrote:
>> doseq is a macro, not a function, and its expansion expands the loop right
>> in place :
>
> Right. Why does it work (in the finally block) when wrapped up in a
> function, but not when doseq is called directly?

The complexity comes from a recur that is lexically within the
finally.  By moving the doseq to a separate function, its
expanded loop/recur is no longer syntactically inside the
finally, so the extra complexity is avoided.

--Chouser
-- 
-- I funded Clojure 2010, did you?

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


Re: Try/Catch & Recur

2009-12-15 Thread Laurent PETIT
doseq expands into a loop.

2009/12/15 Greg Harman 

> > doseq is a macro, not a function, and its expansion expands the loop
> right
> > in place :
>
> Right. Why does it work (in the finally block) when wrapped up in a
> function, but not when doseq is called directly?
>
> --
> 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: Try/Catch & Recur

2009-12-15 Thread Greg Harman
> doseq is a macro, not a function, and its expansion expands the loop right
> in place :

Right. Why does it work (in the finally block) when wrapped up in a
function, but not when doseq is called directly?

-- 
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: Try/Catch & Recur

2009-12-15 Thread Laurent PETIT
doseq is a macro, not a function, and its expansion expands the loop right
in place :

$ java -cp clojure/clojure.jar:clojure-contrib/clojure-contrib.jar
clojure.contrib.repl_ln
Clojure 1.1.0-master-SNAPSHOT
1:1 user=> (require 'clojure.contrib.pprint)
nil
1:2 user=> (clojure.contrib.pprint/pprint (macroexpand-1 '(doseq [x (range 0
10)] x)))
(clojure.core/loop
 [seq_9
  (clojure.core/seq (range 0 10))
  chunk_10
  nil
  count_11
  (clojure.core/int 0)
  i_12
  (clojure.core/int 0)]
 (if
  (clojure.core/< i_12 count_11)
  (clojure.core/let
   [x (.nth chunk_10 i_12)]
   (do x)
   (recur seq_9 chunk_10 count_11 (clojure.core/unchecked-inc i_12)))
  (clojure.core/when-let
   [seq_9 (clojure.core/seq seq_9)]
   (if
(clojure.core/chunked-seq? seq_9)
(clojure.core/let
 [c__5257__auto__ (clojure.core/chunk-first seq_9)]
 (recur
  (clojure.core/chunk-rest seq_9)
  c__5257__auto__
  (clojure.core/int (clojure.core/count c__5257__auto__))
  (clojure.core/int 0)))
(clojure.core/let
 [x (clojure.core/first seq_9)]
 (do x)
 (recur
  (clojure.core/next seq_9)
  nil
  (clojure.core/int 0)
  (clojure.core/int 0)))
nil
1:3 user=>

HTH,

-- 
Laurent

2009/12/15 Greg Harman 

> Why does that work? The same recursion happens in the finally. There's
> a layer of indirection now, but the doseq was already a layer of
> indirection between the finally and doseq's internal recur.
>
> I see from the linked thread above that the basic issue is a known
> implementation issue with Clojure to limit complexity - given that,
> perhaps doseq (and any other out-of-the-box macros/functions that are
> internally implemented with recur, or otherwise trigger that
> exception) should be documented as having this effect.
>
> --
> 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: Try/Catch & Recur

2009-12-15 Thread Greg Harman
Why does that work? The same recursion happens in the finally. There's
a layer of indirection now, but the doseq was already a layer of
indirection between the finally and doseq's internal recur.

I see from the linked thread above that the basic issue is a known
implementation issue with Clojure to limit complexity - given that,
perhaps doseq (and any other out-of-the-box macros/functions that are
internally implemented with recur, or otherwise trigger that
exception) should be documented as having this effect.

-- 
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: Help! My slime-fu is broken!

2009-12-15 Thread David Nolen
On Tue, Dec 15, 2009 at 2:08 AM, Mike K  wrote:

> I hadn't considered another IDE.  Clojure is my first real exposure to
> the JVM, so I'm not familiar with Java IDEs.  OTOH, Emacs has been my
> editor of choice for over two decades (yikes!) so it's definitely home
> turf for me.  Besides, I'm already addicted to paredit mode :-)
>
> However, maybe the slime+Clojure picture is generally less stable than
> I thought it would be.
>

Emacs veteran!

Rereading your post I realize that most of your concerns are about the
general unfriendliness of SLIME and not so much that it isn't working. As
Phil alludes, SLIME wasn't designed with Clojure in mind, so a lot of things
happen that don't make a lot of sense (SLIME with Common Lisp is much more
sensible).

Beside C-c C-k, it sounds like your setup is in fact working well enough for
you write programs?

David


>
>   Mike
>
> --
> 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: struct-maps and key removal

2009-12-15 Thread Sean Devlin
Isn't the whole point of a struct that it guarantees that certain keys
are present?  I think the current behavior is correct.

On Dec 15, 5:21 am, Garth Sheldon-Coulson  wrote:
> I wonder if the fact that this currently doesn't work the way you want it to
> is a necessary consequence of structural sharing and the desired performance
> guarantees of dissoc.
>
> In other words: I wonder if, on account of how struct maps are implemented
> (sort of like a vector, right?), the only way to get a hash map with one key
> gone is to do a linear copy of the struct map.
>
> If that's true (I have no idea if it is!), then there might be a reason for
> forcing you to do
>
> (dissoc (into {} mystruct) :akey)
>
> explicitly. Namely, it preserves the performance guarantees of dissoc.
>
> Garth
>
> On Tue, Dec 15, 2009 at 5:05 AM, ataggart  wrote:
>
> > On Dec 14, 11:23 pm, Richard Newman  wrote:
> > > Something I keep bumping into: the SQL library returns rows as struct-
> > > maps. Often I want to do things like rename keys (:foo_bar => :foo-
> > > bar), strip out :id columns, etc.
>
> > > Nope!
>
> > >    java.lang.Exception: Can't remove struct key
>
> > > Any opinions on returning a hash-map after 'removing' (remember, these
> > > are persistent data structures) a key from a struct-map? They print
> > > the same, act the same... except in this instance.
>
> > So have (dissoc mystruct :akey) act like (dissoc (into {}
> > mystruct) :akey)?  Sounds reasonable to me.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clojure@googlegroups.com
> > Note that posts from new members are moderated - please be patient with
> > your first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en

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


Re: Clojure newbie question regarding compile time type checking.

2009-12-15 Thread Baishampayan Ghose
On Tuesday 15 December 2009 06:21 PM, ajay gopalakrishnan wrote:
> Oh ... I know all that. What I wanted to know is that is there any way
> to FORCE compile time checking by providing some flag or the other to
> Clojure compiler. If not, I guess a good set of test cases is the only
> way to fix it. (Good test cases are always recommended, it's just that
> in this case it becomes unavoidable)

Clojure right now does not have any facility to do type checking at 
compile time (and I doubt if it will ever). Languages like Python, Ruby, 
Perl, etc. are similar in this regard.

Even though Clojure is hosted on the JVM, it has a completely different 
ancestry; it is more different that similar to Java.

Regards,
BG

-- 
Baishampayan Ghose 
oCricket.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: Try/Catch & Recur

2009-12-15 Thread Chouser
On Tue, Dec 15, 2009 at 1:08 AM, Greg Harman  wrote:
> Actually, the for didn't work for me either but I believe that was a
> lazy evaluation issue. The doseq seems to use internal recursion,
> which breaks the try/finally. My final solution was to build up doseq
> functionality with reduce. See below:
>
> (defn foo1 []
>  (try
>   (println "body")
>   (finally
>    (doseq [x (range 3)] (println x)
>
> (defn foo2 []
>  (try
>   (println "body")
>   (finally
>    (for [x (range 3)] (println x)
>
> (defn foo3 []
>  (try
>   (println "body")
>   (finally
>    (reduce (fn [y x] (println x)) () (range 3)
>
> - The foo1 definition can't be evaluated b/c of
> java.lang.UnsupportedOperationException: Cannot recur from catch/
> finally

Simply moving the body of the 'finally' to a fn syntactically
outside the 'finally' clause itself should always work without
having to reimplement the body itself:

(defn foo-fn []
  (let [f #(doseq [x (range 3)]
 (println x))]
 (try (println "body")
   (finally (f)

--Chouser

-- 
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 newbie question regarding compile time type checking.

2009-12-15 Thread Tayssir John Gabbour
On Dec 15, 1:23 pm, Baishampayan Ghose  wrote:
> PS - If you are worried about "compile time type checking", I think it's
> prudent to mention now that Clojure is a dynamically typed programming
> language where types are checked at run-time and not compile time.

Actually, there are Common Lisp compilers (like SBCL) which signal a
warning if they infer a type error. I think it's handy, and doesn't do
anything drastic like refuse to compile your program because of it.


All the best,
Tayssir


On Dec 15, 1:23 pm, Baishampayan Ghose  wrote:
> Ajay,
>
> > It tried the following in REPL and got no error. Personally, I feel that
> > I should get an error because calling square on strings is wrong in both
> > cases.
>
> > Is there a way out of this in Clojure?
>
> > |(defn square[n]  (*  n n))
>
> > (if  (=  0  0)  (println"hello")  (map square["a"  "b"]))
>
> What did you expect from Clojure? In the above form the `map` is a part
> of the else form and that's why it's not executed.
>
> If you don't know already, the syntax for `if` in Clojure is like this -
>
> (if expression
>(then form)
>(else form))
>
> If you have multiple then or else forms, you can wrap them inside a `do`
> form like this -
>
> (if expression
>(do
>  (then form)
>  (more then form))
>(else form))
>
> > The following gives error (because it gets evaluated):
>
> > |(defn square[n]  (*  n n))
>
> > (if  (=  0  1)  (println"hello")  (map square["a"  "b"]))
>
> In the above form, the map is a part of the else form and since 1 is not
> equal to 0, the `map` is executed.
>
> I hope your confusion is cleared.
>
> PS - If you are worried about "compile time type checking", I think it's
> prudent to mention now that Clojure is a dynamically typed programming
> language where types are checked at run-time and not compile time.
>
> Regards,
> BG
>
> --
> Baishampayan Ghose 
> oCricket.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: Try/Catch & Recur

2009-12-15 Thread CuppoJava
That's very interesting. I haven't run into this issue before.

One cleanish way to side-step it is to use

(defn foo2 []
  (try
   (println "body")
   (finally
(doall (for [x (range 3)] (println x))

Which is perhaps a little cleaner in meaning to the original doseq
than a reduce.
  -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: Clojure newbie question regarding compile time type checking.

2009-12-15 Thread Garth Sheldon-Coulson
OTOH, when Rich gave a talk at MIT recently he mentioned he wasn't terribly
interested in type systems for Clojure apart from (potentially) a simple
binary type system to distinguish I/O-side-effecty things from
non-I/O-side-effecty things. He also mentioned something extremely
interesting about wanting to make Clojure amenable to analysis by external
static correctness checking tools, rather than build types and type-checking
into the language itself.

I should let him characterize his views himself, though, because I imagine
I'm getting it at least part wrong.

Either way, Ajay, Clojure is a dynamic and dynamically typed system. Cons:
No compile-time type checking, more runtime bug-catching. Pros: Easy,
module-by-module, REPL-based interactive development, expressiveness,
somewhat easier code reuse, faster development, and easier interaction with
external systems that may change under your nose. I was born and bred in
QBasic, Perl, and later Ruby, so this is what feels most natural to me.

On Tue, Dec 15, 2009 at 8:43 AM, Laurent PETIT wrote:

>
>
> 2009/12/15 ajay gopalakrishnan 
>
> Oh ... I know all that. What I wanted to know is that is there any way to
>> FORCE compile time checking by providing some flag or the other to Clojure
>> compiler. If not, I guess a good set of test cases is the only way to fix
>> it. (Good test cases are always recommended, it's just that in this case it
>> becomes unavoidable)
>>
>
> Not yet, and - just guessing - neither in a short nor middle term.
>
> But I remember Rich mentioning being interested in type systems "a la" Qi
> language ( 
> http://en.wikipedia.org/wiki/Qi_(programming_language)).
>  This allows to enable/disable type checking, but maybe what seemed more
> interesting was the way to define the type via sequent calculus (
> http://en.wikipedia.org/wiki/Qi_(programming_language)#Type_Checking).
>
> HTH,
>
> --
> Laurent
>
>
>>
>> Ajay
>>
>>
>> On Tue, Dec 15, 2009 at 7:23 AM, Baishampayan Ghose > > wrote:
>>
>>> Ajay,
>>>
>>> > It tried the following in REPL and got no error. Personally, I feel
>>> that
>>> > I should get an error because calling square on strings is wrong in
>>> both
>>> > cases.
>>> >
>>> > Is there a way out of this in Clojure?
>>> >
>>> > |(defn square[n]  (*  n n))
>>> >
>>> > (if  (=  0  0)  (println"hello")  (map square["a"  "b"]))
>>> >
>>>
>>> What did you expect from Clojure? In the above form the `map` is a part
>>> of the else form and that's why it's not executed.
>>>
>>> If you don't know already, the syntax for `if` in Clojure is like this -
>>>
>>> (if expression
>>>   (then form)
>>>   (else form))
>>>
>>> If you have multiple then or else forms, you can wrap them inside a `do`
>>> form like this -
>>>
>>> (if expression
>>>   (do
>>> (then form)
>>> (more then form))
>>>   (else form))
>>>
>>> > The following gives error (because it gets evaluated):
>>> >
>>> > |(defn square[n]  (*  n n))
>>> >
>>> > (if  (=  0  1)  (println"hello")  (map square["a"  "b"]))
>>>
>>> In the above form, the map is a part of the else form and since 1 is not
>>> equal to 0, the `map` is executed.
>>>
>>> I hope your confusion is cleared.
>>>
>>> PS - If you are worried about "compile time type checking", I think it's
>>> prudent to mention now that Clojure is a dynamically typed programming
>>> language where types are checked at run-time and not compile time.
>>>
>>> Regards,
>>> BG
>>>
>>> --
>>> Baishampayan Ghose 
>>> oCricket.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
>>
>>
>>  --
>> 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 subscri

Re: Clojure newbie question regarding compile time type checking.

2009-12-15 Thread Laurent PETIT
2009/12/15 ajay gopalakrishnan 

> Oh ... I know all that. What I wanted to know is that is there any way to
> FORCE compile time checking by providing some flag or the other to Clojure
> compiler. If not, I guess a good set of test cases is the only way to fix
> it. (Good test cases are always recommended, it's just that in this case it
> becomes unavoidable)
>

Not yet, and - just guessing - neither in a short nor middle term.

But I remember Rich mentioning being interested in type systems "a la" Qi
language ( http://en.wikipedia.org/wiki/Qi_(programming_language) ). This
allows to enable/disable type checking, but maybe what seemed more
interesting was the way to define the type via sequent calculus (
http://en.wikipedia.org/wiki/Qi_(programming_language)#Type_Checking ).

HTH,

-- 
Laurent


>
> Ajay
>
>
> On Tue, Dec 15, 2009 at 7:23 AM, Baishampayan Ghose 
> wrote:
>
>> Ajay,
>>
>> > It tried the following in REPL and got no error. Personally, I feel that
>> > I should get an error because calling square on strings is wrong in both
>> > cases.
>> >
>> > Is there a way out of this in Clojure?
>> >
>> > |(defn square[n]  (*  n n))
>> >
>> > (if  (=  0  0)  (println"hello")  (map square["a"  "b"]))
>> >
>>
>> What did you expect from Clojure? In the above form the `map` is a part
>> of the else form and that's why it's not executed.
>>
>> If you don't know already, the syntax for `if` in Clojure is like this -
>>
>> (if expression
>>   (then form)
>>   (else form))
>>
>> If you have multiple then or else forms, you can wrap them inside a `do`
>> form like this -
>>
>> (if expression
>>   (do
>> (then form)
>> (more then form))
>>   (else form))
>>
>> > The following gives error (because it gets evaluated):
>> >
>> > |(defn square[n]  (*  n n))
>> >
>> > (if  (=  0  1)  (println"hello")  (map square["a"  "b"]))
>>
>> In the above form, the map is a part of the else form and since 1 is not
>> equal to 0, the `map` is executed.
>>
>> I hope your confusion is cleared.
>>
>> PS - If you are worried about "compile time type checking", I think it's
>> prudent to mention now that Clojure is a dynamically typed programming
>> language where types are checked at run-time and not compile time.
>>
>> Regards,
>> BG
>>
>> --
>> Baishampayan Ghose 
>> oCricket.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
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>

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

Re: Clojure newbie question regarding compile time type checking.

2009-12-15 Thread ajay gopalakrishnan
Oh ... I know all that. What I wanted to know is that is there any way to
FORCE compile time checking by providing some flag or the other to Clojure
compiler. If not, I guess a good set of test cases is the only way to fix
it. (Good test cases are always recommended, it's just that in this case it
becomes unavoidable)

Ajay

On Tue, Dec 15, 2009 at 7:23 AM, Baishampayan Ghose wrote:

> Ajay,
>
> > It tried the following in REPL and got no error. Personally, I feel that
> > I should get an error because calling square on strings is wrong in both
> > cases.
> >
> > Is there a way out of this in Clojure?
> >
> > |(defn square[n]  (*  n n))
> >
> > (if  (=  0  0)  (println"hello")  (map square["a"  "b"]))
> >
>
> What did you expect from Clojure? In the above form the `map` is a part
> of the else form and that's why it's not executed.
>
> If you don't know already, the syntax for `if` in Clojure is like this -
>
> (if expression
>   (then form)
>   (else form))
>
> If you have multiple then or else forms, you can wrap them inside a `do`
> form like this -
>
> (if expression
>   (do
> (then form)
> (more then form))
>   (else form))
>
> > The following gives error (because it gets evaluated):
> >
> > |(defn square[n]  (*  n n))
> >
> > (if  (=  0  1)  (println"hello")  (map square["a"  "b"]))
>
> In the above form, the map is a part of the else form and since 1 is not
> equal to 0, the `map` is executed.
>
> I hope your confusion is cleared.
>
> PS - If you are worried about "compile time type checking", I think it's
> prudent to mention now that Clojure is a dynamically typed programming
> language where types are checked at run-time and not compile time.
>
> Regards,
> BG
>
> --
> Baishampayan Ghose 
> oCricket.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

-- 
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 newbie question regarding compile time type checking.

2009-12-15 Thread Baishampayan Ghose
Ajay,

> It tried the following in REPL and got no error. Personally, I feel that
> I should get an error because calling square on strings is wrong in both
> cases.
>
> Is there a way out of this in Clojure?
>
> |(defn square[n]  (*  n n))
>
> (if  (=  0  0)  (println"hello")  (map square["a"  "b"]))
>

What did you expect from Clojure? In the above form the `map` is a part 
of the else form and that's why it's not executed.

If you don't know already, the syntax for `if` in Clojure is like this -

(if expression
   (then form)
   (else form))

If you have multiple then or else forms, you can wrap them inside a `do` 
form like this -

(if expression
   (do
 (then form)
 (more then form))
   (else form))

> The following gives error (because it gets evaluated):
>
> |(defn square[n]  (*  n n))
>
> (if  (=  0  1)  (println"hello")  (map square["a"  "b"]))

In the above form, the map is a part of the else form and since 1 is not 
equal to 0, the `map` is executed.

I hope your confusion is cleared.

PS - If you are worried about "compile time type checking", I think it's 
prudent to mention now that Clojure is a dynamically typed programming 
language where types are checked at run-time and not compile time.

Regards,
BG

-- 
Baishampayan Ghose 
oCricket.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: Funding Clojure 2010

2009-12-15 Thread olalonde
I'm not convinced donations alone is a sustainable funding method. Why
don't you derive a commercial product ? You could build an IDE for
Clojure and sell it. You could write a book (although that is unlikely
to really pay). You could build a "stackoverflow"-type community,
organize events/conferences, etc. You might want to talk to some VC
firm and see if they'd be interested in funding you. They could help
you out figure a revenue model.

Best of luck!

On Dec 14, 9:33 am, Rich Hickey  wrote:
> Funding Clojure 2010
>
> Background
> --
>
> It is important when using open source software that you consider who
> is paying for it, because someone is. There is no such thing as free
> software.
>
> Sometimes open source software is developed under a license with
> undesirable properties (e.g. the GPL), such that people are willing to
> pay for a (proprietary) version of it that is not subject to that
> license. Both Monty Widenius [1] and Richard Stallman [2] have argued
> for the necessity of such a mechanism to fund open source software,
> lest there be insufficient resources for its development. Clojure
> doesn't use the GPL, thus conveying more freedom to its users, but
> precluding me from funding it via dual licensing.
>
> Some companies develop technology as a component of a proprietary
> product or service, absorbing it as a necessary expense, only to
> decide that it is not a core, unique, or advantage-bearing business
> function. They can reduce their costs in ongoing development by open
> sourcing it, deriving benefit from community contributions and letting
> them focus on their core business [3]. It is important to note that
> the bulk of the costs are often in the original development, and are
> paid for by the proprietary product or service. That is not the case
> for Clojure.
>
> Some open source is the product of academic research, and is funded by
> the academic institution and/or research grants [4]. That is not the
> case for Clojure.
>
> Some open source software is (partially) funded by proprietary
> support. It is important to note that often the support income does
> not in fact make it to the people who create the software. Such income
> models work best for support sold to conservative enterprises [5].
> That is not the case for Clojure.
>
> Some companies 'fund' open source software by dedicating some of their
> employees' time, or making investments, in its development. There must
> be some business value to the company for doing so (e.g. it helps them
> sell hardware [6]), and thus is ultimately paid for by their
> proprietary products/services. That is not the case for Clojure.
>
> There *are* companies that make software themselves, whose consumers
> see a value in it and willingly pay to obtain that value. The money
> produced by this process pays the salaries of the people who are
> dedicated to making it, and some profit besides. It's called
> "proprietary software". People pay for proprietary software because
> they have to, but otherwise the scenario is very similar to open
> source - people make software, consumers get value from it. In fact,
> we often get a lot less with proprietary software - vendor lock-in, no
> source etc. Most alarmingly, this is the only model that associates
> value with software itself, and therefore with the people who make it.
>
> Why don't people pay for open source software? Primarily, because they
> don't *have to*. I think also, partially, it is because open source
> software often doesn't have a price tag. I think it should. I'd like
> to pay for open source, and know the money is going to those who
> create it. I'd like companies to *expect* to pay for it. I'd like to
> see people make a living (and even profit!) directly making open
> source, not as a side effect of some other proprietary process, to
> dedicate themselves to it, and not have it be hobby/side work.
>
> Unfortunately, there seems to be no way to convey the full benefits of
> open source software while *forcing* people to pay for it. Only in the
> proprietary (including dual-license) model is there a direct
> connection between the consumers of software and the funding of those
> that produce it. This is having the effect of driving open source
> software towards having zero apparent cost, becoming a free bounty of
> someone else's other profitable endeavors, and is severely
> compromising our profession.
>
> Foreground
> --
>
> As should be obvious, Clojure is a labor of love on my part. Started
> as a self-funded sabbatical project, Clojure has come to occupy me far
> more than full-time. However, Clojure does not have institutional or
> corporate sponsorship, and was not, and is not, the by-product of
> another profitable endeavor. I have borne the costs of developing
> Clojure myself, but 2009 is the last year I, or my family, can bear
> that.
>
> Many generous people have made donations (thanks all!), but many more
> have not, and, unfortunately, donation

Re: Funding Clojure 2010

2009-12-15 Thread Brent Millare
Rich,

What prevents Clojure from being funded by grants like NSF and DARPA
which normally fund academic research?

Best,
Brent Millare

-- 
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: Try/Catch & Recur

2009-12-15 Thread Meikel Brandmeyer
Hi,

On Dec 15, 7:08 am, Greg Harman  wrote:

> Actually, the for didn't work for me either but I believe that was a
> lazy evaluation issue. The doseq seems to use internal recursion,
> which breaks the try/finally. My final solution was to build up doseq
> functionality with reduce.

See also here: 
http://groups.google.com/group/clojure/browse_thread/thread/2c9f018886e71ee3/87c5698fe30e48a5

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: Funding Clojure 2010

2009-12-15 Thread Charles Nutter
On Dec 14, 12:19 pm, BerlinBrown  wrote:
> Have you ever considered working with a larger company like Oracle/
> Sun, IBM or Google in some kind of research capacity and working on
> Clojure full time there?  For example, I believe the JRuby developers
> worked for Sun at one point while they developed JRuby.

Those were certainly happier times for our industry. Then someone
else's bubble burst (not our fault this time!) and things got tight
again.

Tom Enebo and I were hired by Sun in 2006, and we are very thankful to
Sun for all their sponsorship during the years until we had to make
our exit. It's a damn shame more companies aren't like Sun, willing to
fund promising open-source projects for both the tangible and
intangible benefits they may produce...but with a better strategy for
helping those projects fund their bottom-lines.

To be honest, I still feel like there's a company waiting to happen
that specializes in JVM languages, the frameworks around them, and
making the best use of available language and VM experts. You wouldn't
need that many developers to form the technology core and there would
be scads of support, consulting, and grant-driven research
possibilities as a result. And that's not even mentioning that on the
non-JVM side of the world, Microsoft *does* fund multiple languages,
all in-house, all sharing resources. The Bazaar is definitely stronger
in some areas, but collaboration across religious boundaries is not
one of them.

Unfortunately I think the whole world is still struggling to find the
right way to make funding open-sourced products profitable in the long
term, especially in lean times when people tragically take advantage
of unrestricted common resources. The sad situation is that a massive
number of companies derive tremendous benefits for free on the backs
of open-source devs. I don't know how to fix it.

- Charlie

-- 
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: Funding Clojure 2010

2009-12-15 Thread Charles Nutter
You might find this interesting:

http://www.oreillynet.com/ruby/blog/2008/03/the_ruby_mendicant_project.html

Or this:

http://www.modrails.com/enterprise.html

There are only a handful of such efforts in the Ruby community, but
when buoyed by a reasonably large and active community, it is possible
to live off donations for some time. The Mendicant project lasted over
a summer, and the Phusion guys periodically run donation drives to
bring them up to a particular amount. I know lots of other sites run
similar drives, but they're always targeting a particular dollar
value. Perhaps that might be worth doing here, so people know whether
their $X have brought you closer to a specific goal? At any rate
contacting groups who have run similar drives might stir up some ideas
too.

Best of luck with the donation drive, either way, and after Christmas
perhaps my wife will let me near the bank account again so I can make
a donation myself :)

- Charlie

On Dec 14, 8:33 am, Rich Hickey  wrote:
> Funding Clojure 2010
>
> Background
> --
>
> It is important when using open source software that you consider who
> is paying for it, because someone is. There is no such thing as free
> software.
>
> Sometimes open source software is developed under a license with
> undesirable properties (e.g. the GPL), such that people are willing to
> pay for a (proprietary) version of it that is not subject to that
> license. Both Monty Widenius [1] and Richard Stallman [2] have argued
> for the necessity of such a mechanism to fund open source software,
> lest there be insufficient resources for its development. Clojure
> doesn't use the GPL, thus conveying more freedom to its users, but
> precluding me from funding it via dual licensing.
>
> Some companies develop technology as a component of a proprietary
> product or service, absorbing it as a necessary expense, only to
> decide that it is not a core, unique, or advantage-bearing business
> function. They can reduce their costs in ongoing development by open
> sourcing it, deriving benefit from community contributions and letting
> them focus on their core business [3]. It is important to note that
> the bulk of the costs are often in the original development, and are
> paid for by the proprietary product or service. That is not the case
> for Clojure.
>
> Some open source is the product of academic research, and is funded by
> the academic institution and/or research grants [4]. That is not the
> case for Clojure.
>
> Some open source software is (partially) funded by proprietary
> support. It is important to note that often the support income does
> not in fact make it to the people who create the software. Such income
> models work best for support sold to conservative enterprises [5].
> That is not the case for Clojure.
>
> Some companies 'fund' open source software by dedicating some of their
> employees' time, or making investments, in its development. There must
> be some business value to the company for doing so (e.g. it helps them
> sell hardware [6]), and thus is ultimately paid for by their
> proprietary products/services. That is not the case for Clojure.
>
> There *are* companies that make software themselves, whose consumers
> see a value in it and willingly pay to obtain that value. The money
> produced by this process pays the salaries of the people who are
> dedicated to making it, and some profit besides. It's called
> "proprietary software". People pay for proprietary software because
> they have to, but otherwise the scenario is very similar to open
> source - people make software, consumers get value from it. In fact,
> we often get a lot less with proprietary software - vendor lock-in, no
> source etc. Most alarmingly, this is the only model that associates
> value with software itself, and therefore with the people who make it.
>
> Why don't people pay for open source software? Primarily, because they
> don't *have to*. I think also, partially, it is because open source
> software often doesn't have a price tag. I think it should. I'd like
> to pay for open source, and know the money is going to those who
> create it. I'd like companies to *expect* to pay for it. I'd like to
> see people make a living (and even profit!) directly making open
> source, not as a side effect of some other proprietary process, to
> dedicate themselves to it, and not have it be hobby/side work.
>
> Unfortunately, there seems to be no way to convey the full benefits of
> open source software while *forcing* people to pay for it. Only in the
> proprietary (including dual-license) model is there a direct
> connection between the consumers of software and the funding of those
> that produce it. This is having the effect of driving open source
> software towards having zero apparent cost, becoming a free bounty of
> someone else's other profitable endeavors, and is severely
> compromising our profession.
>
> Foreground
> --
>
> As should be obvious, Clojure is a labor of

Re: Funding Clojure 2010

2009-12-15 Thread Mike Meyer
I'm sorry, but I find the whole "donate" thing a little
off-putting. I've just started looking into Clojure, and the thought
that the key developer might just stop working on it doesn't exactly
give me a warm fuzzy feeling. Now the evaluation will have to include
looking at the community, and trying to decide if Clojure could
survive Rich departing it(*).

Part of it is that I don't recall any other open source software
movement having dunned me for money before - and that's with having
been using, writing, and contributing to such for over 20 years now.

In particular, Larry Wall managed to grow Perl from a cute little
report generation language he used to get his work done at Unisys to a
specification rivaling CL in size without dunning users for money.

Larry - and others I know who've worked on open source - did this in
part by having a position with employers who realized that the tools
helped them do their job, and would let them release the results
unencumbered. I think Rich mentioned that sort of thing in his long
posting, but it's not really something to hope for these days.

But they also did other things. Many of them were regulars running
tutorials on their software at Usenix meetings, which paid a pretty
penny at the time. They also did talks, lectures and tutorials
elsewhere for a fee. From what's been said here, Rich is an excellent
speaker - possibly something like that would help?

They also made money writing books and doing contract work, including
custom code that was later released under an open source license. The
classic example of the latter is Cygnus Solutions, which made money
porting GNU to new chips while under NDA until it was sold to red hat,
turning all the people working for it into millionaires.

Yeah, I realize that those things don't contribute directly to
Clojure, probably aren't as much fun as working on Clojure (for those
of us who think of working inside LISP systems as fun), and would
almost certainly cut into the development time available for
Clojure. But as a potential Clojure user/developer, I'd be a lot more
comfortable if the message was "By donating, you'll free Clojure
development time" or maybe even the typical donationware message of
"Donate to have your feature requests/bug reports given higher
priority" than the current one of"I may not be able to continue
developing if you don't donate".

One last thought: Clojure was designed to help deal with concurrency,
something no really popular language does well. Seems that the people
interested in funding research into that aer the ones putting multiCPU
boxes on people's desks: AMD & Intel. The Java link - as well as Sun's
history of dealing with multi-cpu systems - makes Sun an obvious
choice, but between the potential Oracle purchase and the financial
difficulties that lead to it, that's another thing that's not exactly
a warm fuzzy feeling.

  http://groups.google.com/group/clojure?hl=en


Re: Funding Clojure 2010

2009-12-15 Thread John Bell
I haven't used Clojure for anything yet, but I've really liked your
recorded presentations--they've already had an effect on how I
program.  I also would love to see an open source project like this be
able to survive on contributions from individual developers so I've
donated.

While I appreciate that you don't want to force anyone to contribute,
I think it might be a good idea to incentivize it.  Maybe have some
screencasts, forums, or additional information available only to
contributors.  If someone can't afford to contribute money maybe they
can contribute some code, documentation, or a screencast to get
access.  Admittedly, it might be difficult to find the right mix of
"free" and "premium" content to not alienate new users while still
encouraging donations.  You might also want to have a list of donors
displayed prominently (if the individual donor is okay with it).
Everyone can contribute something, it doesn't have to be money.  I
don't see anything wrong with making contributing an expectation even
if it's not a requirement.

John

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


Re: struct-maps and key removal

2009-12-15 Thread Garth Sheldon-Coulson
I wonder if the fact that this currently doesn't work the way you want it to
is a necessary consequence of structural sharing and the desired performance
guarantees of dissoc.

In other words: I wonder if, on account of how struct maps are implemented
(sort of like a vector, right?), the only way to get a hash map with one key
gone is to do a linear copy of the struct map.

If that's true (I have no idea if it is!), then there might be a reason for
forcing you to do

(dissoc (into {} mystruct) :akey)

explicitly. Namely, it preserves the performance guarantees of dissoc.

Garth

On Tue, Dec 15, 2009 at 5:05 AM, ataggart  wrote:

>
>
> On Dec 14, 11:23 pm, Richard Newman  wrote:
> > Something I keep bumping into: the SQL library returns rows as struct-
> > maps. Often I want to do things like rename keys (:foo_bar => :foo-
> > bar), strip out :id columns, etc.
> >
> > Nope!
> >
> >java.lang.Exception: Can't remove struct key
> >
> > Any opinions on returning a hash-map after 'removing' (remember, these
> > are persistent data structures) a key from a struct-map? They print
> > the same, act the same... except in this instance.
>
> So have (dissoc mystruct :akey) act like (dissoc (into {}
> mystruct) :akey)?  Sounds reasonable to me.
>
> --
> 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: Heap implementation in Clojure

2009-12-15 Thread ataggart


On Dec 15, 1:49 am, ataggart  wrote:
> On Dec 14, 5:48 am, Mark Tomko  wrote:
>
> > I wrote this implementation of a heap (or priority queue) in pure
> > Clojure:
>
> >http://pastebin.com/m2ab1ad5a
>
> > It's probably not of any quality sufficient to be make it to the
> > contrib package, but it seems to work.  Any thoughts on how it might
> > be improved?
>
> > Thanks,
> > Mark
>
> Ideally such a collection would be usable with existing functions,
> e.g. pop, peek.  To accomplish that you really need to implement
> against the expected java interfaces.
>
> I've been playing with the deftype/defprotocol stuff in the "new"
> branch, so I figured I'd try to apply that to this problem.  This is
> what I came up with:
>
> http://gist.github.com/256815

To be clear, my implementation just uses a sorted list, not a true
heap tree.

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


Re: what is the correct way to "mvn install" clojure-contrib

2009-12-15 Thread B Smith-Mannschott
Rob, DTH,

Thanks for the responses. I guess that's more or less what I feared. I
had hoped that I was overlooking something. I'll just put a little
script on my integration branch which calls install:install-file with
the proper arguments. (The pom.xml solution is too great a violation
of DRY for my taste.)

// Ben

-- 
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: struct-maps and key removal

2009-12-15 Thread ataggart


On Dec 14, 11:23 pm, Richard Newman  wrote:
> Something I keep bumping into: the SQL library returns rows as struct-
> maps. Often I want to do things like rename keys (:foo_bar => :foo-
> bar), strip out :id columns, etc.
>
> Nope!
>
>    java.lang.Exception: Can't remove struct key
>
> Any opinions on returning a hash-map after 'removing' (remember, these  
> are persistent data structures) a key from a struct-map? They print  
> the same, act the same... except in this instance.

So have (dissoc mystruct :akey) act like (dissoc (into {}
mystruct) :akey)?  Sounds reasonable to me.

-- 
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: Heap implementation in Clojure

2009-12-15 Thread ataggart


On Dec 14, 5:48 am, Mark Tomko  wrote:
> I wrote this implementation of a heap (or priority queue) in pure
> Clojure:
>
> http://pastebin.com/m2ab1ad5a
>
> It's probably not of any quality sufficient to be make it to the
> contrib package, but it seems to work.  Any thoughts on how it might
> be improved?
>
> Thanks,
> Mark

Ideally such a collection would be usable with existing functions,
e.g. pop, peek.  To accomplish that you really need to implement
against the expected java interfaces.

I've been playing with the deftype/defprotocol stuff in the "new"
branch, so I figured I'd try to apply that to this problem.  This is
what I came up with:

http://gist.github.com/256815

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