Re: Simple things should be simple

2010-09-10 Thread cody koeninger


On Sep 10, 1:32 am, Mike Meyer  wrote:
> I think that Java's strength is enterprise-level, highly scalable web
> servers make people assume that every problem must be a nail for that
> hammer.

I think that Unix's strength is small independent programs
communicating over standard I/O makes you assume that every
environment must be a hammer for that nail.

The JVM environment is philosophically quite different from Unix.
Don't use a JVM language to write one-liners that have to be loaded
every time they're run.

There's not much point in people continuing to defend Clojure and/or
the java ecosystem; unix has its place and so does java.   You've
noticed a symptom of something fundamental in java, you're not
particularly happy about it, so choose a different tool.  Hashbang
script hacks, nailgun, or other workarounds aren't going to change
your mind.

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


Re: Can I GPL my Clojure project?

2010-03-29 Thread cody koeninger
On Mar 27, 11:55 pm, Mike Meyer  wrote:
> But if
> you're serious about this, you need to talk to a real copyright
> lawyer.

This is the only correct answer to the OP's question.

Don't take legal advice from random people on a newsgroup.

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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: The % Schemer Series - are they worth the money?

2010-03-23 Thread cody koeninger


On Mar 23, 10:37 am, Sean Devlin  wrote:
> Hey folks,
> I'm looking to add to my bookshelf.  I was wondering what this groups
> experience with the Schemer series of books is?
>
> Sean


Little, seasoned, + the little MLer are awesome, only thing that comes
close in terms of pedagogical quality is How To Design Programs.
Haven't read reasoned.  A little java isn't that great, that style
doesn't really mesh well with java.

The little schemer may be very basic, but given some of the job
applicants I've seen, we'd all be better off if every programmer had
read it at least once.

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

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Lift equivalent

2010-01-03 Thread cody koeninger
On Jan 2, 11:50 am, Mike Meyer  wrote:
> There are definitely some good ideas there - and I agree with most of
> the goals. But Lift, like most other page-centric web frameworks,
> seems to break one of the fundamental rules of good API design: Simple
> things should be simple.


Having implemented a small site in Lift, I'd have to agree that it
makes some simple things verbose.  However, it's hard to get simpler
than code that's already written for you, even if you have to tweak it
for your needs.  Lift is more mature than options available in
Clojure, which means a lot of code I didn't have to write.


> After looking at the Lift documentation, it's clear that Clojure has
> two major disadvantages when compared to Scala for doing this kind of
> thing: 1) Support for XML as a primitive type. That's just way cool.

Having implemented essentially identical xml processing code in both
scala and clojure, I'd have to disagree with this.  I was never a big
xpath user, so the pseudo-xpath syntax of scala doesn't matter much to
me.  Clojure's zippers are a really nice way of "modifying" xml, imho
nicer than the typical scala way of doing a pattern match (with 5
underscores in it more often than not) and then calling a constructor
for a new xml element.  XML literals in scala vs s-exp literals in
clojure is kind of  a wash, _unless_ you need designers to work on
your xml.  Letting designers easily work on xml is a pretty important
point, and one where the existing Compojure / Conjure projects fall
short.  Enlive is about as clean as you could ask for in this respect,
though, even cleaner than Lift, so I don't think this is inherently a
language issue.

> 2) The web has a natural mapping to OO concepts, so the mixed
> functional/oo model in Scala helps a lot.

As for the OO vs functional . . . a web server is a function from a
request to a response.  How is that functional view any less natural
than an OO view?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 Scoping Rules

2009-11-21 Thread cody koeninger
http://clojure.org/lisps

"All (global) Vars can be dynamically rebound without interfering with
lexical local bindings. No special declarations are necessary to
distinguish between dynamic and lexical bindings."

Other part of that explanation is whether x in a given piece of code
refers to a lexical (local) or dynamic (global) value.
It seems that if there's a local value available for x, it always
hides the global value for x.
Global value is only looked up when there's no local value available
in the surrounding text.

binding may look like a lexical construct, since it has braces that
enclose an area of code, but it's not.
It affects code that actually executes during that time, not code that
was written in that space.

And yeah, dynamic scope interacting with laziness is the single most
confusing thing about Clojure, even if you've had a little lisp
experience.
Use the variants of def just for functions or macros; use ref or let
for variables; avoid using binding.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Datatypes and Protocols - early experience program

2009-11-13 Thread cody koeninger

On Nov 13, 9:42 am, Sean Devlin  wrote:
> In this case, you provide the docs for each method after parameters.
> Would the following be possible:
>
> (defprotocol AProtocol :on AnInterface
>   "A doc string for AProtocol abstraction"
>   (bar "bar docs" [a b] :on barMethod)
>   (baz "baz docs" ([a] [a b] [a b & c])))
>
> This matches the rhythm of the rest of the language.
>
> Sean


+1 for docstring position that matches the rest of the language.  I
actually think this is a big deal.

Other issue regarding docstrings:

user=> (doc AProtocol)
-
user/AProtocol
nil
  protocol doc
nil
user=> (doc bar)
-
user/bar
([a b])
  bar doc
nil


doc gives no indication of any relationship between bar and AProtocol,
other than the shared namespace.  Is the idea to use a convention of
max 1 protocol per namespace?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Periodic tasks

2009-10-31 Thread cody koeninger



On Oct 31, 11:42 am, Richard Newman  wrote:
> VimClojure relies on Nailgun, with a bunch of people on this list  
> using it with Clojure every day.

My recollection from list and IRC was that (aside from random nailgun
issues + the project not being updated in 4 years) there was an issue
with dynamic classes being created and never expired.  Is that
inaccurate?  I'm also not sure how one would work around the security
issues of running a single nailgun for a variety of tasks that needed
different user permissions

I'd love to hear success stories from people using nailgun to actually
run frequent scripted tasks out of cron, as opposed to for
development. It would make clojure more palatable for my work
environment.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Periodic tasks

2009-10-31 Thread cody koeninger



On Oct 31, 5:22 am, alxtoth  wrote:
> Why not use the OS task scheduler? On un*x there is good old cron or
> at. On windoze there is similar task scheduler.
>


Overhead from starting and stopping the JVM every couple of minutes
would probably be unacceptable.  My understanding is that solutions
like Nailgun don't work correctly with Clojure either.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: apply for macros?

2009-10-05 Thread cody koeninger

On Oct 4, 1:31 am, Meikel Brandmeyer  wrote:
> Here we have the smell! You cannot define functions with a function.  
> You have to use a macro!

I am not clear on what you mean by this.  From a user's point of view,
what is the difference between defining a function, and interning a
var with a fn object as its value?

user> (defn define-function [name] (intern *ns* name (fn [] (str
"called a generated function: " name
#'user/define-function
user> (some-function)
; Evaluation aborted.
user> (define-function 'some-function)
#'user/some-function
user> (some-function)
"called a generated function: some-function"

Or is your point just that #'fn is a macro?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: seeking examples/tutorials on clojure/lisp-y design (vs Java/Ruby)

2009-09-11 Thread cody koeninger



On Sep 11, 10:56 am, Michael Teter  wrote:
> What I would like to find now is some kind of guide or document to
> help me learn to design the functional way, instead of just writing
> Java in Clojure.


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



Re: I18n

2009-08-28 Thread cody koeninger



On Aug 28, 12:16 am, ngocdaothanh  wrote:
> Hi all,
>
> Is there an i18n library for Clojure? What Java i18n library should I
> use in a Clojure program (it suits Clojure syntax for example)? For
> Ruby and Erlang I prefer Gettext, but for Java it seems
> that .properties files are in major use.
>
> Thanks,
> Ngoc.


I have an interest in this as well.  Compared to using gettext, the
java style of resource files seems unnecessarily awkward.

There's a java api for gettext, described at
http://www.gnu.org/software/hello/manual/gettext/Java.html
I haven't used it yet, so I can't vouch for it.

You'd think that clojure syntax is, on its surface, close enough to
scheme that xgettext --language=Scheme  blah.clj would work for files
with forms like (_ "some string to be translated") .. . but it
doesn't.  Looks like writing a custom xgettext is going to be
necessary.

I had already hacked up some proof-of-concept clojure code using a
zipper to extract / translate strings from html files without any
additional markup.  Part of me thinks it'd be really nice to be able
to similarly identify a clojure source file as needing to be
translated, then extract any non-docstring text strings (or heck,
maybe even docstrings) automatically, without having to add the (_
"blah") markup.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 vs scala

2009-08-26 Thread cody koeninger



On Aug 26, 5:29 am, Christian Vest Hansen 
wrote:
> Another Scala downer: "Scala is very powerful, some developers might
> shoot themselves into the foot" - I don't see how this applies more to
> Scala than Clojure. If we want to talk about foot-shooting, we could
> talk about macros. There are some common mistakes that people with
> weak macro-fu do.

Yes, we could talk about macros.  The most common mistake that people
make with macros (accidental symbol capture) is prevented by clojure
fully qualifying names inside of syntax quote and preventing you from
let 'ing a fully qualified name; a simple built-in syntax for auto-
gensyms makes this easy to work with.  IMHO, this is the best of both
worlds between Scheme and Common Lisp macros.

I think these language vs language discussions are mostly useful for
finding out what the writer _doesn't_ know about the languages in
question, myself included.

For instance, after having read odersky's Scala book. . . if you like
static typing and are looking for a new language, I don't see why you
would choose Scala over Haskell unless you have a strong investment in
java or really like the Lift web framework.  Unrestricted use of vars,
for instance, seems like a step backwards from the kind of guarantees
a purely functional language gives you.

On the other hand, if you like dynamic typing and lisp, Clojure has
some distinct advantages over both Scheme and Common Lisp, eg macro
example noted above.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~--~~~~--~~--~--~---



Durable transactions in practice?

2009-08-07 Thread cody koeninger

Assuming people aren't patching clojure ala dave griffith's external
transactions patch in the group files, what are people doing in
practice to durably store the state of refs?

Storing within a transaction and somehow ensuring your store operation
is idempotent (not to mention reversible)?
Sending off an agent from a transaction and not worrying about race
conditions?
Forgoing the use of STM in favor of locks + try / catch?

 I'm not so much asking about what particular store (RDBMS, prn to a
file, whatever) is being used, as I am curious what kind of
coordination is being used.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 as a First Language

2009-08-06 Thread cody koeninger

On Aug 6, 3:22 am, Lauri Pesonen  wrote:
> There was a post recently on LtU about a paper by Matthias Felleisen
> et al. (of Little Schemer fame) about a functional teaching language
> that they've been using in schools and freshman classes to teach kids
> how to program. I'm still reading it, but so far it sounds pretty
> cool. AFAICT it's built on top of DrScheme.

Scheme pretty much owns this niche, IMHO.

http://htdp.org/

http://world.cs.brown.edu/




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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 as a CGI language?

2009-07-23 Thread cody koeninger



On Jul 22, 10:15 am, Chouser  wrote:

> Java and therefore Clojure does not play nicely in this
> niche as far as I can tell.  Even if a service allows ssh
> access such that you can install a JVM, Clojure, etc. it's
> almost certain you will not be allowed to keep
> a long-running process going (which rules out simple Jetty
> solutions).  
> ...
> So as far as I can tell, your best options for hosting
> a Clojure web app are still either to get FastCGI working or
> pay for a more expensive service: Java servlet container
> provider, private virtual machine, co-locate, or on up from
> there.
>

[$ ps -ef | grep java
cody 12139 12138  0 Jul07 pts/101:31:03 java -cp .:lib/*:/usr/
local/src/compojure/src

I've had a jetty instance running on slicehost for over 2 weeks now,
which was just the last time I happened to start it.

I dunno if $20 / month counts as expensive (it's less than I was
paying for hosting before), but I'm not sure you can even find
reliable shared hosting for the more usual suspects like Rails for
much less than $10.

Jetty / compojure has been pretty painless to get running, I'd rather
use routes than mess with mod_rewrite rules for instance.  My instinct
is that a simple apache / lighttpd / whatever on port 80 to serve
static content and proxy back to jetty for anything else would be
plenty sufficient for most production needs (along with a real hosting
plan, but that's true of anything).
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from 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: Why do Enlive template functions return a seq instead of a str?

2009-07-15 Thread cody koeninger

On Jul 11, 12:31 pm, Jarkko Oranen  wrote
> Forcing them into a single string at the end would wasteful in case
> the user intends to write the output into a stream (which can be done
> a fragment at a time.) Thus, leaving the choice to the user seems like
> a good decision.
>
> Or maybe it's just a lazy seq, in which case using str on it would
> force it to be strict. :)

Just to clarify . . . in order for this to be useful in practice,
wouldn't the following be necessary:

1. Disable buffering in whatever server is being used to send the data
(which in the case of http means losing the content-length header).

2. Lazy evaluation of all arguments to the template.

Otherwise the client isn't going to get any content at all until the
entire string has already been forced. . . or am I missing something?

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