Re: Example of a real-world ClojureScript web application

2011-08-13 Thread Filip de Waard
On Wed, Aug 10, 2011 at 11:42 PM, Raju Bitter rajubit...@googlemail.comwrote:

 Thanks for sharing the code with us, Filip. I have one additional
 question: Which parts of ClojureScript were documented well enough for
 you, and where was it difficult to find enough information on how to
 implemented certain features?


There is always some room for improvement, but in my experience the
documentation is sufficient. If I had to come up with a suggestion it would
be an overview of ClojureScript specific functions like (js-clj) and
(js-obj)) and implementation details. I'm happy to see the ClojureScript
ecosystem growing this fast and to see the increasing amount of information
and tips from people on this list, blogs, et cetera. With a new project like
ClojureScript there is always a certain amount of polish that still needs to
be applied, but I can't say that a lack of documentation has hindered my
productivity in any way.

-fmw

-- 
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: Stream closed...

2011-08-13 Thread turcio
I'm really fresh to clojure way of doing things and your answers will
definitely help. Thank you!

Cheers,
Daniel


On 13 Sie, 06:46, Sean Corfield seancorfi...@gmail.com wrote:
 Yeah, I got the impression the OP was trying to create a new file with
 double the contents of the old one - the (str file-path 2) piece - but yours
 is certainly a slick way to double the original file!









 On Fri, Aug 12, 2011 at 8:47 PM, Dave Ray dave...@gmail.com wrote:
  Even shorter:

  (defn duplicate-file-data [file-path] (spit file-path (slurp
  file-path) :append true))

  Dave

  On Fri, Aug 12, 2011 at 11:16 PM, Sean Corfield seancorfi...@gmail.com
  wrote:
   I think you also want to reorganize the code so you get the line-seq and
   then the line-count outside the for loop. And bear in mind that (inc
   line-count) just returns line-count + 1 - it does not update line-count
   which is what I'm guessing you're expecting?
   Or you could just use slurp and spit:
   (defn duplicate-file-data [file-path] (let [content (slurp file-path)]
  (spit
   (str file-path 2) (str content content

   On Fri, Aug 12, 2011 at 8:05 PM, Sean Corfield seancorfi...@gmail.com
   wrote:

   (for ...) generates a lazy sequence so it isn't realized until after the
   value is returned from the function. You need to wrap (for ...) with
  (doall
   ...) to realize the sequence inside (with-open ...)

   On Fri, Aug 12, 2011 at 4:47 PM, turcio tur...@gmail.com wrote:

   Hi,
   I'm trying to write a function which creates file twice as big
   compared to the original file by simply duplicating its content.

   It looks like in the for loop I can't even read the first line
   although I'm using with-open. Can you tell me what am I doing wrong?

   (defn duplicate-file-data [file-path]
    (with-open [reader (clojure.java.io/reader file-path)
                writer (clojure.java.io/writer (str file-path 2) :append
   true)]
                                 (for [line (line-seq reader)
                                       :let [line-count (count(line-seq
   reader))
                                             curr-line 0]
                                       :when ( curr-line line-count)]
                                   ((.write writer (str line))
                                            (.newLine writer)
                                            (inc curr-line))
                                   )))


-- 
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: ANN: match 0.1.0-SNAPSHOT

2011-08-13 Thread Baishampayan Ghose
On Sat, Aug 13, 2011 at 9:08 AM, David Nolen dnolen.li...@gmail.com wrote:
 Just pushed a version of match to Clojars, would love to hear feedback!
 Since our earlier announcement we now have:
 * Guard Patterns
 * Or Patterns
 * As Patterns
 * Java Interop
 All this and we've only added about ~260 lines of code which bodes well for
 ease of extending the library.

Incredible work, David. I owe you some insert your favourite drink
for this. See you at Clojure/conj :-)

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.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: Example of a real-world ClojureScript web application

2011-08-13 Thread Raju Bitter
Thanks for your response, Filip. That means for such a new technology
the documentation is very good already. And the community can jump in
and improve it until the first stable release. Good to know!

Raju

On Sat, Aug 13, 2011 at 9:16 AM, Filip de Waard f...@vix.io wrote:
 On Wed, Aug 10, 2011 at 11:42 PM, Raju Bitter rajubit...@googlemail.com
 wrote:

 Thanks for sharing the code with us, Filip. I have one additional
 question: Which parts of ClojureScript were documented well enough for
 you, and where was it difficult to find enough information on how to
 implemented certain features?

 There is always some room for improvement, but in my experience the
 documentation is sufficient. If I had to come up with a suggestion it would
 be an overview of ClojureScript specific functions like (js-clj) and
 (js-obj)) and implementation details. I'm happy to see the ClojureScript
 ecosystem growing this fast and to see the increasing amount of information
 and tips from people on this list, blogs, et cetera. With a new project like
 ClojureScript there is always a certain amount of polish that still needs to
 be applied, but I can't say that a lack of documentation has hindered my
 productivity in any way.
 -fmw

 --
 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: Example of a real-world ClojureScript web application

2011-08-13 Thread Timothy Washington
Btw, I found a PDF version online, of Closure: The Definitive
Guidehttp://files.cnblogs.com/darkangle/Closure-The-Definitive-Guide.pdf
.

There's also the online
docshttp://closure-library.googlecode.com/svn/docs/index.html,
and a video 
overviewhttp://golearnweb.com/web-design-blog/google-io-2011-javascript-programming-in-the-large-with-closure-tools-video-google-developers.htmlby
one of the main authors (Michael Bolin, I think). I found watching the
video really helped me get the gist of Google Closure.


Hope this helps with documentation.

Tim Washington
twash...@gmail.com
416.843.9060



On Sat, Aug 13, 2011 at 7:22 AM, Raju Bitter rajubit...@googlemail.comwrote:

 Thanks for your response, Filip. That means for such a new technology
 the documentation is very good already. And the community can jump in
 and improve it until the first stable release. Good to know!

 Raju

 On Sat, Aug 13, 2011 at 9:16 AM, Filip de Waard f...@vix.io wrote:
  On Wed, Aug 10, 2011 at 11:42 PM, Raju Bitter rajubit...@googlemail.com
 
  wrote:
 
  Thanks for sharing the code with us, Filip. I have one additional
  question: Which parts of ClojureScript were documented well enough for
  you, and where was it difficult to find enough information on how to
  implemented certain features?
 
  There is always some room for improvement, but in my experience the
  documentation is sufficient. If I had to come up with a suggestion it
 would
  be an overview of ClojureScript specific functions like (js-clj) and
  (js-obj)) and implementation details. I'm happy to see the ClojureScript
  ecosystem growing this fast and to see the increasing amount of
 information
  and tips from people on this list, blogs, et cetera. With a new project
 like
  ClojureScript there is always a certain amount of polish that still needs
 to
  be applied, but I can't say that a lack of documentation has hindered my
  productivity in any way.
  -fmw
 
  --
  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 on Javascript: Crockford javascript lectures

2011-08-13 Thread daly
Crockford makes the point that script tag processing
stops every other process in the browser including the
asynchronous fetch of images. He strongly recommends
that script tags be placed toward the end of the body
tag. This allows maximum overlap of processing and makes
the page appear as soon as possible.

If people make tools that create pages that include
Clojurescript code, it might be a good thing if they
follow this advice.

Tim Daly

On Fri, 2011-08-12 at 23:01 -0400, daly wrote:
 You might want to look at some of the information 
 on Crockford's webpage about Javascript
 
 http://javascript.crockford.com
 
 In particular, lecture 3 in his video series is about
 functions, classes, objects, etc in Javascript:
 
 http://www.yuiblog.com/blog/2010/02/24/video-crockonjs-3
 
 Tim Daly
 d...@axiom-developer.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


is my understanding correct for function identity?

2011-08-13 Thread jaime
I found an interesting function identity which will do nothing but
only returns the parameter passed to it. The next minute I came up a
question: then what's the purpose of this function? -- I've tried to
figure out reasons of existence of identity.

The only reason that I can imagine is this: because we often use
higher-order functions, these higher-order functions will accept
functions as its parameters, in such a situation, when we want to use
a higher-order function but don't want to pass any real functions to
it, then we can use function like identity and identity here is
just to fill the role of parameter of higher-order function.

Guys, is my guess correct or not? Are there other reasons for
identity's existence?? Are there other functions for the same purpose?

Thanks,
Jaime

-- 
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: is my understanding correct for function identity?

2011-08-13 Thread Mark Engelberg
(filter identity l) is a great way of removing all the false and nil
items from l

-- 
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: Stanford AI Class

2011-08-13 Thread Lee Spector

On Aug 12, 2011, at 9:07 PM, daly wrote:
 On Fri, 2011-08-12 at 16:30 -0700, pmbauer wrote:
 +1
 
 On Friday, August 12, 2011 3:16:15 PM UTC-7, Sergey Didenko wrote:
BTW, Is there a case when AI self-modifying program is much
more elegant than AI just-data-modifying program?
 
I just can't figure out any example when there is a lot of
sense to go the self-modifying route.
 
 Clearly both are equivalent in a Turing sense.
 ... [text omitted]
 Consider a more advanced kind of learning where we use
 genetic programs to evolve behavior. Clearly you can do this
 all using data but it is a bit more elegant if you can take
 genes (i.e. slices of code), do crossovers (i.e. merge the
 slices of code into other slices), and get a new mutated set
 of genes. These can be embedded in chromosomes which are
 just larger pieces of code. Real cells don't use a data
 scratchpad, they self-modify.
 ...[text omitted]
 
 This isn't intended to be a debate about WHY we might want a
 self-modifying program. It is a question of whether Clojure, as
 a Lisp, is sufficiently well-crafted to allow it to self-modify.
 It has been done in other lisps but I don't yet know how to do
 it in Clojure.

I think there's some blurring of levels of abstraction going on in this 
discussion.

As someone who works on code-modifying AI (genetic programming, much along the 
lines described above -- which, BTW, I would expect Thrun and Norvig to mention 
only briefly, if at all... but that's a debate for a different forum) I find 
that languages that make code manipulation simple and elegant do help one to 
experiment and develop these kinds of AI systems more easily. 

But this is true whether the manipulated code is compiled and executed in the 
normal way or treated as a data structure and interpreted in some other way. 

On the one hand most people who work in genetic programming these days write in 
non-Lisp languages but evolve Lisp-like programs that are interpreted via 
simple, specialized interpreters written in those other languages (C, Java, 
whatever).

On the other hand I prefer to work in Lisp (Common Lisp, Scheme, Clojure), but 
my main project these days involves evolving Push programs rather than Lisp 
programs, for a bunch of reasons related to evolvability -- see 
http://hampshire.edu/lspector/push.html if you really want to know. I prefer to 
work in Lisps because they make it simpler to write code that manipulates 
program-like structures (however they end up being executed) and because I 
like Lisps better than most other languages for a slew of other reasons. But my 
evolved code is executed on a Push interpreter implemented in the host language 
and there are Push-based GP systems in many languages (C++, Java, Javascript, 
Python, several Lisps). The language choice really just affects software 
engineering and workflow issues, not the fundamental power of the system to 
evolve/learn.

So if the question about whether Clojure programs can self-modify in the 
modified code executes the same way as any other code sense then the answer 
is yes, and Ken Wesson provided a simple demonstration of this on this 
thread. But if the question is about whether Clojure is a good language for 
writing AI systems that involve code-self-modification I would say that the 
answer is also yes but for completely different reasons.

 -Lee

-- 
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: is my understanding correct for function identity?

2011-08-13 Thread Thorsten Wilms

On 08/13/2011 06:45 PM, jaime wrote:

The only reason that I can imagine is this: because we often use
higher-order functions, these higher-order functions will accept
functions as its parameters, in such a situation, when we want to use
a higher-order function but don't want to pass any real functions to
it, then we can use function like identity and identity here is
just to fill the role of parameter of higher-order function.


That's what I'm using it for. In a case where I have 2 places requiring 
the same code before and after one step only used in one case. It would 
be slightly more work, otherwise.



Are there other functions for the same purpose?


I don't see how there could be, for the very same purpose. Though you 
might want to consider splitting up functions some more, instead.



--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.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: Stanford AI Class

2011-08-13 Thread Ken Wesson
On Sat, Aug 13, 2011 at 1:36 PM, Lee Spector lspec...@hampshire.edu wrote:
 As someone who works on code-modifying AI (genetic programming, much along 
 the lines described above -- which, BTW, I would expect Thrun and Norvig to 
 mention only briefly, if at all... but that's a debate for a different forum) 
 I find that languages that make code manipulation simple and elegant do help 
 one to experiment and develop these kinds of AI systems more easily.

 But this is true whether the manipulated code is compiled and executed in the 
 normal way or treated as a data structure and interpreted in some other way.

 On the one hand most people who work in genetic programming these days write 
 in non-Lisp languages but evolve Lisp-like programs that are interpreted via 
 simple, specialized interpreters written in those other languages (C, Java, 
 whatever).

The ultimate in Greenspunning. :)

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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: is my understanding correct for function identity?

2011-08-13 Thread Ken Wesson
On Sat, Aug 13, 2011 at 1:57 PM, Thorsten Wilms t...@freenet.de wrote:
 On 08/13/2011 06:45 PM, jaime wrote:
 Are there other functions for the same purpose?

 I don't see how there could be, for the very same purpose. Though you might
 want to consider splitting up functions some more, instead.

I think he means other functions whose main use is as arguments to
HOFs, rather than called directly.

In which case the functions returned by constantly form another
family of such. Though we could get rid of that if we added a reader
macro analogous to #(x) but that expanded into (fn [] x) rather than
(fn [] (x)) as #(x) does. Perhaps #[x]? This could replace constantly,
e.g. #[0] == (constantly 0), but also do a few other things, like
#[[%1 (* 2 %2)]] takes two arguments and producing a vector with one
of the arguments and then the other doubled, which saves relative to
#(vector %1 (* 2 %2)) and makes it more visually clear that it outputs
vectors. On the other hand, the same argument can be made against
#[0], that this looks like it ought to return [0] rather than 0 when
called. On the gripping hand, #{} is accepted as indicating sets,
rather than functions that evaluate to maps. :)

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

-- 
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: is my understanding correct for function identity?

2011-08-13 Thread Sean Corfield
On Sat, Aug 13, 2011 at 9:45 AM, jaime xiejianm...@gmail.com wrote:

 The only reason that I can imagine is this: because we often use
 higher-order functions, these higher-order functions will accept
 functions as its parameters, in such a situation, when we want to use
 a higher-order function but don't want to pass any real functions to
 it, then we can use function like identity and identity here is
 just to fill the role of parameter of higher-order function.

 Guys, is my guess correct or not?


Yup. As an example, in clojure.java.jdbc, there are naming strategies that
determine how to map between entity names in the database (strings) and
keywords in the Clojure maps that represent those entities. The default
behavior from keyword to string is do nothing (other than call 'name' to
convert the keyword to a string) so the code uses the identity function as
the default strategy when the user doesn't override it.

In my own code I have a data mapper that wraps c.j.jdbc and it takes an
optional key-gen function that can calculate and assoc in the primary key
for a record. Again, the default behavior is to do nothing and let the
database had the key generation:

   (defn save-row

  Given a table name (string), a row (struct) and an

   optional key-gen function, either insert it (if no

   :id) or update it. In both cases, return the :id.

   If no key-gen function is provided the database

   must auto-generate the :id.

  ([table r] (save-row table r identity))

  ([table r key-gen] ...))

If you call (save-row :user {:name Sean}) it calls itself as (save-row
:user {:name Sean} identity).

I could call it like this to generate the primary key as the hash of the
name column: (save-row :user {:name Sean} (fn [m] (assoc m :id (.hashCode
(:name m)
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

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

Re: is my understanding correct for function identity?

2011-08-13 Thread Alan Malloy
On Aug 13, 12:45 pm, jaime xiejianm...@gmail.com wrote:
 I found an interesting function identity which will do nothing but
 only returns the parameter passed to it. The next minute I came up a
 question: then what's the purpose of this function? -- I've tried to
 figure out reasons of existence of identity.

 The only reason that I can imagine is this: because we often use
 higher-order functions, these higher-order functions will accept
 functions as its parameters, in such a situation, when we want to use
 a higher-order function but don't want to pass any real functions to
 it, then we can use function like identity and identity here is
 just to fill the role of parameter of higher-order function.

 Guys, is my guess correct or not? Are there other reasons for
 identity's existence?? Are there other functions for the same purpose?

One of my favorite uses of identity is for use with partition-by:

user (partition-by identity '(a a b a a a a c c d))
;; ((a a) (b) (a a a a) (c c) (d))

I sometimes speculate that, while identity is plenty useful, if your
program contains the characters (identity, you probably don't know
how to program.

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


clojure.java.jdbc input requested on JDBC-14

2011-08-13 Thread Sean Corfield
http://dev.clojure.org/jira/browse/JDBC-14 delete-rows does not work
with null WHERE (more accurately: does not work with empty where
vector).

In the absence of a compelling argument to the contrary, I'm leaning
toward resolving this declined - see my comment on the ticket for my
justification.

I figured I'll invite comments from the broader group here before
doing so, just in case anyone can persuade me to the contrary...
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

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


clojure.java.jdbc input on JDBC-3 (esp. Stuart Sierra!)

2011-08-13 Thread Sean Corfield
http://dev.clojure.org/jira/browse/JDBC-3 Inconsistency between
tuples and regular maps

Stuart Sierra highlighted some inconsistencies in the argument formats
expected by various functions in c.j.j. I'm not really seeing those
inconsistencies and would value some input from folks.

I've added a (long) comment to the ticket reviewing the function names
and, whilst a few could probably benefit from better names, I'm not
really sure that any of them are outright inconsistent in terms of
usage.

If folks have strong opinions on renaming functions (or adding better
named ones and deprecating the old ones!) or consistency of the
library in general, I'd love to hear them.
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

Perfection is the enemy of the good.
-- Gustave Flaubert, French realist novelist (1821-1880)

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


Re: Stanford AI Class

2011-08-13 Thread Myriam Abramson
I'm just concerned that teaching AI to 25K+ students is going to have an
impact and it shouldn't be because P. Norvig didn't publish the next edition
of AIMA. I wish they would realize that and change their mind on the
assignments for the class. Even Javascript is more suitable for AI than
Python!

On Sat, Aug 13, 2011 at 5:14 PM, Ken Wesson kwess...@gmail.com wrote:

 On Sat, Aug 13, 2011 at 1:36 PM, Lee Spector lspec...@hampshire.edu
 wrote:
  As someone who works on code-modifying AI (genetic programming, much
 along the lines described above -- which, BTW, I would expect Thrun and
 Norvig to mention only briefly, if at all... but that's a debate for a
 different forum) I find that languages that make code manipulation simple
 and elegant do help one to experiment and develop these kinds of AI systems
 more easily.
 
  But this is true whether the manipulated code is compiled and executed in
 the normal way or treated as a data structure and interpreted in some other
 way.
 
  On the one hand most people who work in genetic programming these days
 write in non-Lisp languages but evolve Lisp-like programs that are
 interpreted via simple, specialized interpreters written in those other
 languages (C, Java, whatever).

 The ultimate in Greenspunning. :)

 --
 Protege: What is this seething mass of parentheses?!
 Master: Your father's Lisp REPL. This is the language of a true
 hacker. Not as clumsy or random as C++; a language for a more
 civilized age.

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

Problems with namespaces in repljs

2011-08-13 Thread Timothy Washington
Hey all,

This is probably a silly question. But I'ms still struggling with some basic
things in ClojureScript. I'm trying to run ./script/repljs to evaluate some
basic Clojurescript code. But evaluation keeps on breaking. So I tried a
clean clojurescript install with the Hello example they give in the
QuickStart guide. In the repljs, a lot of calls fail, first among them a
call to (ns ..).

$ git clone git://github.com/clojure/clojurescript.git
$ cd clojurescript
$ script/bootstrap
$ ./script/repljs

#'user/jse
Type:  :cljs/quit  to quit
*ClojureScript:cljs.user (ns hello)*
Error evaluating: (cljs.core.prn (ns hello)) :as
cljs.core.prn.call(null,goog.provide('hello');\ngoog.require('cljs.core');\n);\n
sun.org.mozilla.javascript.internal.EvaluatorException: missing ) after
argument list
at
sun.org.mozilla.javascript.internal.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:84)
at
sun.org.mozilla.javascript.internal.DefaultErrorReporter.error(DefaultErrorReporter.java:71)


And any subsequent call after that fails…

*ClojureScript:hello (defn thing[v] (str Hello  v)) *
Error evaluating: (cljs.core.prn (defn thing [v] (str Hello  v))) :as
cljs.core.prn.call(null,hello.thing = (function thing(v){\nreturn
cljs.core.str.call(null,\Hello \,v);\n}));\n
sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: hello is
not defined.
at
sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRuntime.java:3224)
at
sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRuntime.java:3214)

However if I just try defining that function before hand, it works cleanly.
I'm wondering why the trouble with working in other namespaces in repljs?
I eventually want to do testing with Google Closure's testing lib
*
*
*(ns bkeeping*
*  (:require [goog.testing.junit :as gtest]))*
*  *
*(gtest/assertEquals A message 1 2)*


But still other calls fail as well. I'm trying to require the goog.testing
library. But even something like this fails...

webkell@ubuntu:~/temp/clojurescript$ ./script/repljs
#'user/jse
Type:  :cljs/quit  to quit
*ClojureScript:cljs.user (require 'goog.testing.junit)*
WARNING: Use of undeclared Var cljs.user/require at line 1
Error evaluating: (cljs.core.prn (require (quote goog.testing.junit))) :as
cljs.core.prn.call(null,cljs.user.require.call(null,\
'goog.testing.junit\));\n
sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot call method
call of undefined
at
sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRuntime.java:3224)
at
sun.org.mozilla.javascript.internal.ScriptRuntime.constructError(ScriptRuntime.java:3214)


I obviously don't want to recompile my cljs code after each edit.
development would just get cumbersome. I'm wondering what I'm missing.


Thanks
Tim

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