osc-clj 0.5.0 - Open Sound Control for Clojure

2011-08-16 Thread Sam Aaron
Hi there,

I just thought I'd announce quite a significant update to osc-clj. This is the 
first release that can claim to have full support for the OSC spec:

http://opensoundcontrol.org/spec-1_0

The major new features are as follows:

* Support for the timely dispatch of bundles scheduled for the future (using 
at-at)
* Full support for OSC pattern matching (allowing incoming messages to match 
against multiple handler 'methods'
* Support for zeroconf - when you create a server, you can pass a string as an 
optional param which will be automatically registered with zeroconf when you 
explicitly turn it on with (zero-conf-on).

So, if you're interested with working with new-school instruments/interfaces 
such as TouchOSC, grab a copy of osc-clj and happy hacking!

https://github.com/overtone/osc-clj/

Sam

---
http://sam.aaron.name

-- 
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: osc-clj 0.5.0 - Open Sound Control for Clojure

2011-08-16 Thread cassiel
Nice work. Perhaps it's getting to be time to retire my own Java OSC
library...

Is this reachable via Lein/Maven?

-- N.

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


Spitting out a lazy seq to file???

2011-08-16 Thread Thomas
Hi everyone,

I have been struggling with this, hopefully, simple problem now for
quite sometime, What I want to do is:

*) read a file line by line
*) modify each line
*) write it back to a different file

This is a bit of sample code that reproduces the problem:

==
(def old-data (line-seq (reader input.txt)))

(defn change-line
[i]
(str i  added stuff))

(spit output.txt (map change-line old-data))
==
#cat output.txt
clojure.lang.LazySeq@58d844f8

Because I get the lazy sequence I think I have to force the execution?
but where
exactly? And how?

Thanks in advance!!!

Thomas

-- 
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: Spitting out a lazy seq to file???

2011-08-16 Thread Ken Wesson
On Tue, Aug 16, 2011 at 11:26 AM, Thomas th.vanderv...@gmail.com wrote:
 Hi everyone,

 I have been struggling with this, hopefully, simple problem now for
 quite sometime, What I want to do is:

 *) read a file line by line
 *) modify each line
 *) write it back to a different file

 This is a bit of sample code that reproduces the problem:

 ==
 (def old-data (line-seq (reader input.txt)))

 (defn change-line
    [i]
    (str i  added stuff))

 (spit output.txt (map change-line old-data))
 ==
 #cat output.txt
 clojure.lang.LazySeq@58d844f8

 Because I get the lazy sequence I think I have to force the execution?
 but where
 exactly? And how?

The spit function expects a string; you need to pr-str the object.
However, that will output it like the REPL would: (line1 line2 line3
...)

You probably want no parentheses, and separate lines. So you'll want
something more like

(with-open [w (writer-on output.txt)]
  (binding [*out* w]
(doseq [l (map change-line old-data)]
  (println l

The output part is lazy now, so you might want to consider making the
input part lazy as well:

(with-open [r (reader-on the-input-file)
w (writer-on output.txt)]
  (binding [*out* w]
(doseq [l (line-seq r)]
  (println (change-line l)

(note: untested, and assumes suitable reader-on and writer-on
functions such as from contrib)

Then it will be able to process files bigger than can be held in main
memory all at once.

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


Access `this` in ClojureScript

2011-08-16 Thread Kevin Lynagh
Is there a recommended way to access `this` within ClojureScript aside
from (js* this)?
I'm using jQuery event handlers, which set `this` to originating DOM
element, and I'd like to get my hands on them.

In other news, I'm liking ClojureScript more and more every day = )

-- 
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-16 Thread ax2groin
The NYTimes article on the class also mentions two other classes being
offered for free:
 * Machine Learning, by Andrew Ng
 * Introductory course on database software, by Jennifer Widom

I'm not sure of the official website for either of these, but the
Machine Learning class sounds promising and didn't have a required
textbook the way the AI class does.

-- 
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: Spitting out a lazy seq to file???

2011-08-16 Thread Meikel Brandmeyer
Hi,

Am 16.08.2011 um 17:26 schrieb Thomas:

 I have been struggling with this, hopefully, simple problem now for
 quite sometime, What I want to do is:
 
 *) read a file line by line
 *) modify each line
 *) write it back to a different file
 
 This is a bit of sample code that reproduces the problem:
 
 ==
 (def old-data (line-seq (reader input.txt)))
 
 (defn change-line
[i]
(str i  added stuff))
 
 (spit output.txt (map change-line old-data))
 ==
 #cat output.txt
 clojure.lang.LazySeq@58d844f8
 
 Because I get the lazy sequence I think I have to force the execution?
 but where
 exactly? And how?

spit does not take a sequence of lines. Hence you'll have to do something like 
this:

(- old-data
  (map change-line)
  (interpose \newline)
  (apply str)
  (spit output.txt))

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

2011-08-16 Thread daly
Ng's course on machine learning is online.
I've already taken it.
You need a background in probability.

Tim Daly


On Tue, 2011-08-16 at 08:52 -0700, ax2groin wrote:
 The NYTimes article on the class also mentions two other classes being
 offered for free:
  * Machine Learning, by Andrew Ng
  * Introductory course on database software, by Jennifer Widom
 
 I'm not sure of the official website for either of these, but the
 Machine Learning class sounds promising and didn't have a required
 textbook the way the AI class does.
 


-- 
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-16 Thread Mark Engelberg
The Machine Learning class from 2008 has been available at iTunes
University for a while, but I'm not aware of it having the same kinds
of support materials as the online AI class has said they will offer.

Be forewarned: the Machine Learning class is presented in a very math
intensive way (statistics, linear algebra, and multivariate calculus),
and a lot of the math refreshers were apparently offered in sessions
with TAs that were not (as far as I know) placed online.

I felt like I got a greater understanding of machine learning by
reading the book Data Mining by Witten.

-- 
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: Spitting out a lazy seq to file???

2011-08-16 Thread Rasmus Svensson
2011/8/16 Thomas th.vanderv...@gmail.com:
 Hi everyone,

 I have been struggling with this, hopefully, simple problem now for
 quite sometime, What I want to do is:

 *) read a file line by line
 *) modify each line
 *) write it back to a different file

 This is a bit of sample code that reproduces the problem:

 ==
 (def old-data (line-seq (reader input.txt)))

 (defn change-line
    [i]
    (str i  added stuff))

 (spit output.txt (map change-line old-data))
 ==
 #cat output.txt
 clojure.lang.LazySeq@58d844f8

 Because I get the lazy sequence I think I have to force the execution?
 but where
 exactly? And how?

 Thanks in advance!!!

spit operates on strings, so therefore you have to turn your data into
one big string first. (spit implicitly calls str on its argument, but
this is not very useful.)

What you have is a sequence of string, so depending of what you want
to appear in the file you have multiple options:

For an arbitrary clojure data structure you can use pr-str to convert
it into the same format you get at the repl: (spit output.txt
(pr-str (map change-line old-data))). This can be useful to dump some
data to a file and will yield something like this:

(line1 added stuff line2 added stuff)

To simply write a file where each line corresponds to a string element
in the sequence, you can either build a new string with consisting of
the strings of the seq, each with a newline character appended to the
end, concatenated together and spit that, or you can use something
else that doesn't require you to build this monolithic string. Since
you used line-seq rather than slurp to read in the file, I will
instead demonstrate an other approach than spit:

(require '[clojure.java.io :as io])

(with-open [in (io/reader input-filename)
out (io/writer output-filename)]
  (binding [*out* out]
(- in (line-seq) (map change-line) (map println) (dorun

This consumes the sequence line by line and writes the lines to the
file. This solution only needs to have one line in memory at a time.
The spit approach would require one big string to be constructed, and
might not be very suited for big files. The code would output a file
like this:

line1 added stuff
line2 added stuff

So in general, use slurp together with spit or read-line (or its
line-seq variant) together with println.

// raek

-- 
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: Spitting out a lazy seq to file???

2011-08-16 Thread Armando Blancas
You can put the line break back into each line ( added stuff\n) and
then do:
(spit output.txt (reduce str (map change-line old-data)))

On Aug 16, 8:26 am, Thomas th.vanderv...@gmail.com wrote:
 Hi everyone,

 I have been struggling with this, hopefully, simple problem now for
 quite sometime, What I want to do is:

 *) read a file line by line
 *) modify each line
 *) write it back to a different file

 This is a bit of sample code that reproduces the problem:

 ==
 (def old-data (line-seq (reader input.txt)))

 (defn change-line
     [i]
     (str i  added stuff))

 (spit output.txt (map change-line old-data))
 ==
 #cat output.txt
 clojure.lang.LazySeq@58d844f8

 Because I get the lazy sequence I think I have to force the execution?
 but where
 exactly? And how?

 Thanks in advance!!!

 Thomas

-- 
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: osc-clj 0.5.0 - Open Sound Control for Clojure

2011-08-16 Thread Sam Aaron
Hey Nick,

On 16 Aug 2011, at 13:57, cassiel wrote:

 
 Is this reachable via Lein/Maven?

Absolutely. The 0.5.0 release is on Clojars, so you just need to add:

[overtone/osc-clj 0.5.0]

to your project dependencies in project.clj for cake/lein.

To get started with the lib, first up, check out the README on github: 
https://github.com/overtone/osc-clj and then take a peek through the fns in the 
'public' osc ns: https://github.com/overtone/osc-clj/blob/master/src/osc.clj

Let me know if I can be of any further assistance. It's important to me that 
the library should be easy to get started with - so I'd like to hear about any 
places where this isn't the case - i.e. dodgy documentation/unexpected 
behaviour etc.

Sam

---
http://sam.aaron.name

-- 
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-16 Thread Jeff Heon
They will also be available to be taken as an online class with
grading as the AI introduction class.

Links are on the main introduction to AI page - http://www.ai-class.com/
:
http://www.db-class.com/
http://www.ml-class.com/

See also Stanford Engineering Everywhere where past lectures and
material of several other courses are available for free:
http://see.stanford.edu/

On Aug 16, 12:21 pm, daly d...@axiom-developer.org wrote:
 Ng's course on machine learning is online.
 I've already taken it.
 You need a background in probability.

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


[ANN] napalm

2011-08-16 Thread Miro Bezjak
First, apologies to anyone not interested. This isn't clojure project but it
helps to setup it. Windows users can skip this announcement because napalm
doesn't help them very much.

Napalm is a tool to help manage multiple versions of clojure and other java
like projects. It's a small project written as a bash script therefore it
should work in most Linux distributions. Definitely works in Arch Linux,
Linux Mint and Ubuntu. It should even work in Mac but I haven't tried it.

Here is a quick summary:
Automate installation of archived (zip, gz, bz2, jar) programs that are
unsuited or unavailable from a package repository.

Screenshots for the impatient that show how to use it:
https://github.com/mbezjak/napalm/wiki

And documentation for the rest:
https://github.com/mbezjak/napalm

Feedback is always appreciated.

Cheers,
Miro

-- 
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/conj for beginners?

2011-08-16 Thread Christopher Burke
Hi

   Recently I've taken interest to learning Clojure. I've watched
presentations, read the Joy of Clojure, done some examples on
4clojure, but have yet to do any real programming. I work in
enterprise-land and for the most part its all Java without much room
to try newer things.

   With that being said, I do have some company money dedicated to
professional development. Unfortunately its not enough for the
training option at Clojure/conj, but would be enough for travel and
conference attendance. I was wondering if the conference would be
useful for someone in my position, a Clojure beginner. Would the
presentations be over my head, or worthwhile?

   Thanks!

   --- Chris

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


Clojure for Android

2011-08-16 Thread James Swift
http://dev.clojure.org/display/design/Android+Support

Issues

Needs a motivated owner

This topic gets a regular mention but I thought it might be worth
asking again if it's ever likely to get the 'motivated owner' ?

Given that 'reach' was a primary reason for the development of
ClojureScript shouldn't the reach of Android encourage someone to go
for it?

I only wish I was capable of doing it myself :)

James.

-- 
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-CLR, CLASSPATH, clojure.load.path and Cygwin

2011-08-16 Thread Alan D. Salewski
On Tue, Aug 16, 2011 at 12:34:39AM -0400, Ken Wesson spake thus:
 On Mon, Aug 15, 2011 at 11:13 AM, mrwizard82d1 mrwizard8...@gmail.com wrote:
  I understand that the 1.3 beta plans to add an environment variable
  named clojure.load.path to provide a CLASSPATH mechanism for Clojure
  on the CLR.
 
  Although I use Windows, I have installed cygwin because I prefer the
  Unix tool set to that provided by Windows. Although a Windows console
  allows one to set environment variables like clojure.load.path, the
  bash shell does not.
 
 Are you sure there isn't some form of quoting or escaping that will
 make that name acceptable to bash?

Identifiers in bash may contain only alphanumeric characters and
underscores, and must start with an alphabetic character or underscore;
there's no way to get around that with escaping or quoting.

-Al

-- 
-
a l a n   d.   s a l e w s k i   salew...@att.net
1024D/FA2C3588 EDFA 195F EDF1 0933 1002  6396 7C92 5CB3 FA2C 3588
-

-- 
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-CLR, CLASSPATH, clojure.load.path and Cygwin

2011-08-16 Thread Ken Wesson
On Tue, Aug 16, 2011 at 1:20 AM, Alan D. Salewski salew...@att.net wrote:
 On Tue, Aug 16, 2011 at 12:34:39AM -0400, Ken Wesson spake thus:
 On Mon, Aug 15, 2011 at 11:13 AM, mrwizard82d1 mrwizard8...@gmail.com 
 wrote:
  I understand that the 1.3 beta plans to add an environment variable
  named clojure.load.path to provide a CLASSPATH mechanism for Clojure
  on the CLR.
 
  Although I use Windows, I have installed cygwin because I prefer the
  Unix tool set to that provided by Windows. Although a Windows console
  allows one to set environment variables like clojure.load.path, the
  bash shell does not.

 Are you sure there isn't some form of quoting or escaping that will
 make that name acceptable to bash?

 Identifiers in bash may contain only alphanumeric characters and
 underscores, and must start with an alphabetic character or underscore;
 there's no way to get around that with escaping or quoting.

Pardon me, but that seems to be missing the point. You don't need a
bash-language variable named clojure.load.path, you just need to set
a Windows environment variable named clojure.load.path, and the
rules for what characters are allowed in the names of Windows
environment variables will still be those set by Windows, which
apparently permit periods. As far as your bash script is concerned,
clojure.load.path probably needn't be anything more than an opaque
string passed to the host operating system via a call of some kind --
though that string could conceivably require quoting or escaping where
it's embedded as a literal in the script.

If bash has its own environment variable system, then that could be
confusing you, but then even if you succeeded it wouldn't work; the
Clojure tools won't see bash's internal system, only the host OS's, so
it's the host OS environment variables you need to get at regardless.

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

2011-08-16 Thread Mark Engelberg
Nice.  I'm glad these other classes are getting the full treatment.

It's really a shame they don't do a clearer job of defining the
prerequisites.  For example, they should post some sort of pre-test
with specific examples of the kind of math that is needed to
understand the class.  I find it difficult to know whether to
recommend the classes to the high school students I know.

-- 
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/conj for beginners?

2011-08-16 Thread Stuart Sierra
Hi Chris,

The Clojure-Conj presentations will be varied. Some will be technical and 
advanced, some will be beginner introductions, and some will be about 
interesting projects being done in Clojure.

Whatever your level, if you are interested in Clojure and want to learn 
more, Clojure-Conj should be a good place to do it.

Stuart Sierra
clojure.com

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

Re: Problems with namespaces in repljs

2011-08-16 Thread Stuart Sierra
Hi Tim,

The `ns` macro doesn't work from the ClojureScript REPL right now. This is a 
known bug caused by the JavaScript code the compiler emits for `ns`. Also, 
there is no `require` function for the REPL yet. Some people have written 
versions of `require` and posted them to the list.

-Stuart Sierra
clojure.com

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

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

2011-08-16 Thread Stuart Sierra
Hi Sean,

I no longer remember what I was looking at when I wrote that ticket. :)  
Maybe I just wasn't aware of `insert-records`.

-S

-- 
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: syntax quoting and namespaces misbehaving in test?

2011-08-16 Thread Richard Rattigan
Thanks for your replies. Do you think this is a bug, given that the
documentation doesn't seem to concur with this behaviour?

On Aug 15, 9:54 pm, Mark Rathwell mark.rathw...@gmail.com wrote:
 Wow, forget everything I said, this has nothing to do with macro
 expansion.  Looks more like inside a function you can only def
 something in the same namespace as the function:

 user (defn ff [] (in-ns 'foo.core2) (def anything5 10))
 #'user/ff
 user anything5

 Var user/anything5 is unbound.
   [Thrown class java.lang.IllegalStateException]

 user (ff)
 #'user/anything5
 foo.core2 (in-ns 'foo.core2)
 #Namespace foo.core2
 foo.core2 (def anything6 10)
 #'foo.core2/anything6







 On Mon, Aug 15, 2011 at 9:36 PM, Mark Rathwell mark.rathw...@gmail.com 
 wrote:
  You are correct, I must have messed something up in my expansions.
  From the below, however, it looks like a var is being declared just by
  having the macro called, but not bound to the value:

  user (defmacro foo [name  body] `(def ~name ~(identity `(fn [] ~@body
  #'user/foo
  user (foo xx (in-ns 'foo.core) (def anything3 10))
  #'user/xx
  user anything3

  Var user/anything3 is unbound.
   [Thrown class java.lang.IllegalStateException]

  user anything4

  Unable to resolve symbol: anything4 in this context
   [Thrown class java.lang.Exception]

  On Mon, Aug 15, 2011 at 8:56 PM, Alan Malloy a...@malloys.org wrote:
  I either disagree or don't understand. The deftest macro doesn't touch
  your body arg; it's expanded as-is. For example, (let [x 'foo] `(inc
  ~x)) doesn't result in foo getting qualified, and most macros behave
  the same way.

  On Aug 15, 4:36 pm, Mark Rathwell mark.rathw...@gmail.com wrote:
  Just to be clear, it is namespace resolved because of syntax quote:

  (defmacro deftest
    [name  body]
    (when *load-tests*
      `(def ~(vary-meta name assoc :test `(fn [] ~@body))
            (fn [] (test-var (var ~name))

  On Mon, Aug 15, 2011 at 7:23 PM, Alan Malloy a...@malloys.org wrote:
   Is it? That's neat; I guess I've never thought about how the compiler
   treats def. Thanks for the explanation.

   On Aug 15, 3:03 pm, Mark Rathwell mark.rathw...@gmail.com wrote:
   deftest is a macro.  Macros are expanded at compile time.  So, in this
   case, at compile time, a function called namespace2 is def'd with meta
   data :test set to the body of your deftest.

   All of that body is namespace resolved in macro expansion, before
   in-ns is ever executed (which happens when you actually call the
   namespace2 function created by the macro).  Put another way, (def
   anything 10) is namespace resolved to (def
   learn.clojure.test.core/anything 10) at macro expansion time (compile
   time), before the test function is ever called, and thereby before
   in-ns is ever executed.

   Hope this helps.
   On Mon, Aug 15, 2011 at 5:07 PM, Richard  Rattigan 
   ratti...@gmail.com wrote:

I'm finding that namespaces don't seem to behave as I expect
intuitively, or according to the reference. It's quite possible I'm 
in
the wrong here though, as I'm just kicking clojure's tires at this
point.

Here is the relevant doc:

   http://clojure.org/special_forms
(def symbol init?)
Creates and interns or locates a global var with the name of symbol
and a namespace of the value of the current namespace (*ns*).

In the test below, which succeeds, the var does not appear to end up
in the current namespace per this definition. Am I misinterpreting
something, or is this a deviation from the spec/reference?

(ns learn.clojure.test.core
 (:use [clojure.test]))
(deftest namespace2
 (in-ns 'my.new.namespace)
 ;confirm the current namespace
 (is (= my.new.namespace (str *ns*)))
 ;attempt to def a var in the current namespace
 (def anything 10)
 ;the var is not defined in the current namespace
 (is (nil? (ns-resolve *ns* 'anything)))
 ;the var is however definined in the orginal namespace
 (is (not (nil? (ns-resolve (find-ns 'learn.clojure.test.core)
'anything
 (is (= 10 learn.clojure.test.core/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

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

Re: syntax quoting and namespaces misbehaving in test?

2011-08-16 Thread Ken Wesson
The def special form seems to be a bit strange that way, in that (def
sym thingy) seems to do two things: execute a (declare sym) at read or
macroexpansion time, even when inside a function definition rather
than at top level, and execute an (alter-var-root! sym (constantly
thingy)) when actually reached by flow of control.

If you want runtime-only def behavior you need to either use the
namespace object's intern methods via interop or use (eval `(def ~sym
~thingy)).

-- 
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: syntax quoting and namespaces misbehaving in test?

2011-08-16 Thread Mark Rathwell
I *think* it is expected behavior.  Take this with a grain of salt,
but I *think* that defs are namespace resolved at compile time, and so
will not be checking in-ns calls within a function to determine the
appropriate namespace, but will instead always use the ns of the
function containing the def.

 - Mark

On Tue, Aug 16, 2011 at 2:54 PM, Richard  Rattigan ratti...@gmail.com wrote:
 Thanks for your replies. Do you think this is a bug, given that the
 documentation doesn't seem to concur with this behaviour?

 On Aug 15, 9:54 pm, Mark Rathwell mark.rathw...@gmail.com wrote:
 Wow, forget everything I said, this has nothing to do with macro
 expansion.  Looks more like inside a function you can only def
 something in the same namespace as the function:

 user (defn ff [] (in-ns 'foo.core2) (def anything5 10))
 #'user/ff
 user anything5

 Var user/anything5 is unbound.
   [Thrown class java.lang.IllegalStateException]

 user (ff)
 #'user/anything5
 foo.core2 (in-ns 'foo.core2)
 #Namespace foo.core2
 foo.core2 (def anything6 10)
 #'foo.core2/anything6







 On Mon, Aug 15, 2011 at 9:36 PM, Mark Rathwell mark.rathw...@gmail.com 
 wrote:
  You are correct, I must have messed something up in my expansions.
  From the below, however, it looks like a var is being declared just by
  having the macro called, but not bound to the value:

  user (defmacro foo [name  body] `(def ~name ~(identity `(fn [] ~@body
  #'user/foo
  user (foo xx (in-ns 'foo.core) (def anything3 10))
  #'user/xx
  user anything3

  Var user/anything3 is unbound.
   [Thrown class java.lang.IllegalStateException]

  user anything4

  Unable to resolve symbol: anything4 in this context
   [Thrown class java.lang.Exception]

  On Mon, Aug 15, 2011 at 8:56 PM, Alan Malloy a...@malloys.org wrote:
  I either disagree or don't understand. The deftest macro doesn't touch
  your body arg; it's expanded as-is. For example, (let [x 'foo] `(inc
  ~x)) doesn't result in foo getting qualified, and most macros behave
  the same way.

  On Aug 15, 4:36 pm, Mark Rathwell mark.rathw...@gmail.com wrote:
  Just to be clear, it is namespace resolved because of syntax quote:

  (defmacro deftest
    [name  body]
    (when *load-tests*
      `(def ~(vary-meta name assoc :test `(fn [] ~@body))
            (fn [] (test-var (var ~name))

  On Mon, Aug 15, 2011 at 7:23 PM, Alan Malloy a...@malloys.org wrote:
   Is it? That's neat; I guess I've never thought about how the compiler
   treats def. Thanks for the explanation.

   On Aug 15, 3:03 pm, Mark Rathwell mark.rathw...@gmail.com wrote:
   deftest is a macro.  Macros are expanded at compile time.  So, in this
   case, at compile time, a function called namespace2 is def'd with meta
   data :test set to the body of your deftest.

   All of that body is namespace resolved in macro expansion, before
   in-ns is ever executed (which happens when you actually call the
   namespace2 function created by the macro).  Put another way, (def
   anything 10) is namespace resolved to (def
   learn.clojure.test.core/anything 10) at macro expansion time (compile
   time), before the test function is ever called, and thereby before
   in-ns is ever executed.

   Hope this helps.
   On Mon, Aug 15, 2011 at 5:07 PM, Richard  Rattigan 
   ratti...@gmail.com wrote:

I'm finding that namespaces don't seem to behave as I expect
intuitively, or according to the reference. It's quite possible I'm 
in
the wrong here though, as I'm just kicking clojure's tires at this
point.

Here is the relevant doc:

   http://clojure.org/special_forms
(def symbol init?)
Creates and interns or locates a global var with the name of symbol
and a namespace of the value of the current namespace (*ns*).

In the test below, which succeeds, the var does not appear to end up
in the current namespace per this definition. Am I misinterpreting
something, or is this a deviation from the spec/reference?

(ns learn.clojure.test.core
 (:use [clojure.test]))
(deftest namespace2
 (in-ns 'my.new.namespace)
 ;confirm the current namespace
 (is (= my.new.namespace (str *ns*)))
 ;attempt to def a var in the current namespace
 (def anything 10)
 ;the var is not defined in the current namespace
 (is (nil? (ns-resolve *ns* 'anything)))
 ;the var is however definined in the orginal namespace
 (is (not (nil? (ns-resolve (find-ns 'learn.clojure.test.core)
'anything
 (is (= 10 learn.clojure.test.core/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

  --
  You received this 

Re: Async Requests in ClojureScript

2011-08-16 Thread Edmund
Hi Base,

I have a super basic example of this on my blog at
http://boss-level.com/?p=119  It should get you over this hump.

Gimme a shout if you have problems,

Edmund

On 16/08/2011 19:08, Base wrote:
 Hi All -
 
 I am attempting to get started in ClojureScript and am completely 
 flummoxed on getting my connectivity set up.
 
 I have a web server running on my local machine such that
 
 http://localhost:8080/m
 
 yields my data correctly (just a test URL...)
 
 I am attempting to connect using the following cljs
 
 (ns hello.foo.dat (:require [goog.net.XhrIo :as gxhr] [goog.Uri :as
 uri] [cljs.reader :as reader]))
 
 (defn- extract-response [message] (reader/read-string (.
 message/target (getResponseText
 
 (defn get-data [_] (gxhr/send (goog.Uri. http://localhost:8080/m;)
 extract-response))
 
 However when I attempt to execute this function in the browser I get 
 'undefined' returned. Anything you can see here that I am doing
 wrong?  This does appear to execute correctly (i.e. the function is
 called, as a hard coded return string does return correctly)
 
 Any help is most welcomed!
 
 Thanks,
 
 Base
 

-- 
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: syntax quoting and namespaces misbehaving in test?

2011-08-16 Thread Alan Malloy
100% expected. Try (def other.ns/some-var 1) - the compiler tells you
it's illegal. If you read the compiler source, it's looking at the
var's namespace and refusing to def it if it's not the current
namespace.

If you want behavior like this, you want (intern), not (def).

On Aug 16, 12:07 pm, Mark Rathwell mark.rathw...@gmail.com wrote:
 I *think* it is expected behavior.  Take this with a grain of salt,
 but I *think* that defs are namespace resolved at compile time, and so
 will not be checking in-ns calls within a function to determine the
 appropriate namespace, but will instead always use the ns of the
 function containing the def.

  - Mark

 On Tue, Aug 16, 2011 at 2:54 PM, Richard  Rattigan ratti...@gmail.com wrote:







  Thanks for your replies. Do you think this is a bug, given that the
  documentation doesn't seem to concur with this behaviour?

  On Aug 15, 9:54 pm, Mark Rathwell mark.rathw...@gmail.com wrote:
  Wow, forget everything I said, this has nothing to do with macro
  expansion.  Looks more like inside a function you can only def
  something in the same namespace as the function:

  user (defn ff [] (in-ns 'foo.core2) (def anything5 10))
  #'user/ff
  user anything5

  Var user/anything5 is unbound.
    [Thrown class java.lang.IllegalStateException]

  user (ff)
  #'user/anything5
  foo.core2 (in-ns 'foo.core2)
  #Namespace foo.core2
  foo.core2 (def anything6 10)
  #'foo.core2/anything6

  On Mon, Aug 15, 2011 at 9:36 PM, Mark Rathwell mark.rathw...@gmail.com 
  wrote:
   You are correct, I must have messed something up in my expansions.
   From the below, however, it looks like a var is being declared just by
   having the macro called, but not bound to the value:

   user (defmacro foo [name  body] `(def ~name ~(identity `(fn [] 
   ~@body
   #'user/foo
   user (foo xx (in-ns 'foo.core) (def anything3 10))
   #'user/xx
   user anything3

   Var user/anything3 is unbound.
    [Thrown class java.lang.IllegalStateException]

   user anything4

   Unable to resolve symbol: anything4 in this context
    [Thrown class java.lang.Exception]

   On Mon, Aug 15, 2011 at 8:56 PM, Alan Malloy a...@malloys.org wrote:
   I either disagree or don't understand. The deftest macro doesn't touch
   your body arg; it's expanded as-is. For example, (let [x 'foo] `(inc
   ~x)) doesn't result in foo getting qualified, and most macros behave
   the same way.

   On Aug 15, 4:36 pm, Mark Rathwell mark.rathw...@gmail.com wrote:
   Just to be clear, it is namespace resolved because of syntax quote:

   (defmacro deftest
     [name  body]
     (when *load-tests*
       `(def ~(vary-meta name assoc :test `(fn [] ~@body))
             (fn [] (test-var (var ~name))

   On Mon, Aug 15, 2011 at 7:23 PM, Alan Malloy a...@malloys.org wrote:
Is it? That's neat; I guess I've never thought about how the compiler
treats def. Thanks for the explanation.

On Aug 15, 3:03 pm, Mark Rathwell mark.rathw...@gmail.com wrote:
deftest is a macro.  Macros are expanded at compile time.  So, in 
this
case, at compile time, a function called namespace2 is def'd with 
meta
data :test set to the body of your deftest.

All of that body is namespace resolved in macro expansion, before
in-ns is ever executed (which happens when you actually call the
namespace2 function created by the macro).  Put another way, (def
anything 10) is namespace resolved to (def
learn.clojure.test.core/anything 10) at macro expansion time 
(compile
time), before the test function is ever called, and thereby before
in-ns is ever executed.

Hope this helps.
On Mon, Aug 15, 2011 at 5:07 PM, Richard  Rattigan 
ratti...@gmail.com wrote:

 I'm finding that namespaces don't seem to behave as I expect
 intuitively, or according to the reference. It's quite possible 
 I'm in
 the wrong here though, as I'm just kicking clojure's tires at this
 point.

 Here is the relevant doc:

http://clojure.org/special_forms
 (def symbol init?)
 Creates and interns or locates a global var with the name of 
 symbol
 and a namespace of the value of the current namespace (*ns*).

 In the test below, which succeeds, the var does not appear to end 
 up
 in the current namespace per this definition. Am I 
 misinterpreting
 something, or is this a deviation from the spec/reference?

 (ns learn.clojure.test.core
  (:use [clojure.test]))
 (deftest namespace2
  (in-ns 'my.new.namespace)
  ;confirm the current namespace
  (is (= my.new.namespace (str *ns*)))
  ;attempt to def a var in the current namespace
  (def anything 10)
  ;the var is not defined in the current namespace
  (is (nil? (ns-resolve *ns* 'anything)))
  ;the var is however definined in the orginal namespace
  (is (not (nil? (ns-resolve (find-ns 'learn.clojure.test.core)
 'anything
  (is (= 10 

Re: Stanford AI Class

2011-08-16 Thread Christopher Burke
I was wondering about the prerequisites as well and found some further
information here:

http://www.stanford.edu/class/cs229/materials.html

In particular, the first 2 entries under Section Notes.

On Aug 16, 1:46 pm, Mark Engelberg mark.engelb...@gmail.com wrote:
 Nice.  I'm glad these other classes are getting the full treatment.

 It's really a shame they don't do a clearer job of defining the
 prerequisites.  For example, they should post some sort of pre-test
 with specific examples of the kind of math that is needed to
 understand the class.  I find it difficult to know whether to
 recommend the classes to the high school students I know.

-- 
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: Trouble embedding clojurescript in server application

2011-08-16 Thread kjeldahl
Thank you for confirming this. Hopefully the clojurescript gods will
figure it out, because I'm still clueless. Until then I'll either
create manual buildscripts or stick with the current coffeescript
client.

Thanks,

Marius K.

On Aug 16, 3:17 am, deduktion j...@duktion.de wrote:
 I can confirm the problem. Same java (ubuntu) version here.

 To reproduce the problem please try:


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


Java 7 development branch?

2011-08-16 Thread André Thieme
Are there plans to have a branch for Clojure in which Java 7 specific
functions will be developed and included and updated? For example spit
taking a java.nio.file.Path [1] as first arg. Or putting pvec using
the Fork/Join lib into core, on that specific feature branch.


[1] http://download.oracle.com/javase/7/docs/api/java/nio/file/Path.html

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


try catch and finally

2011-08-16 Thread rakesh
In java the finally block is executed after the catch block. But in
clojure, I observed that the finally block is executed before catch
block. Is this behavior right.

-- 
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: calling mysql stored procedure with OUT or INOUT parameter

2011-08-16 Thread clj-noob
How to make a call to a mysql stored procedure with INOUT parameter, and use 
the OUT parameter to decide whether to rollback or continue with transaction 
using clojure.java.jdbc?


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

2011-08-16 Thread Sean Corfield
On Tue, Aug 16, 2011 at 12:36 PM, rakesh rakesh.pulip...@gmail.com wrote:
 In java the finally block is executed after the catch block. But in
 clojure, I observed that the finally block is executed before catch
 block. Is this behavior right.

Are you sure?

user= (try (println in try) (throw (Exception. oops!)) (catch
Exception e (println caught it!)) (finally (println ...and
finally)))
in try
caught it!
...and finally
nil
-- 
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: Problems with namespaces in repljs

2011-08-16 Thread Timothy Washington
Hi Stuart, That's fair enough. Is this the
CLJS-57http://dev.clojure.org/jira/browse/CLJS-57JIRA issue? It's
not exactly the error I'm having, but looks to be a broken
'ns' macro all the same. Can I track all of the bugs and known issues on
(open and in progress) the JIRA pagehttp://dev.clojure.org/jira/browse/CLJS?
I'll bee keen to know when the official 'ns' and 'require' are working in
the clojurescript repl.

Thanks for getting back to me.

Tim Washington
twash...@gmail.com
416.843.9060



On Tue, Aug 16, 2011 at 1:58 PM, Stuart Sierra
the.stuart.sie...@gmail.comwrote:

 Hi Tim,

 The `ns` macro doesn't work from the ClojureScript REPL right now. This is
 a known bug caused by the JavaScript code the compiler emits for `ns`. Also,
 there is no `require` function for the REPL yet. Some people have written
 versions of `require` and posted them to the list.

 -Stuart Sierra
 clojure.com

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

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

2011-08-16 Thread Jeremy Heiler
On Tue, Aug 16, 2011 at 3:36 PM, rakesh rakesh.pulip...@gmail.com wrote:
 In java the finally block is executed after the catch block. But in
 clojure, I observed that the finally block is executed before catch
 block. Is this behavior right.

The behavior is correct. What you are probably seeing is that the side
effect of the finally block is showing up *before* the expression
completes.

Example:

(try (Integer/parseInt hi) (catch Exception e catch) (finally
(println finally))
;= finallycatch

This is because catch is returned *after* the finally executes.

-- 
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-16 Thread André Thieme
On Aug 12, 6:41 pm, daly d...@axiom-developer.org wrote:

 In AI this is often modeled as a self-modifying program.
 The easiest way to see this would be a program that handles
 a rubics cube problem. Initially it only knows some general
 rules for manipulation, some measure of progress, and a goal
 to achieve.

The rubic cube is actually a not-so-simple problem, because
the function that measures progress is very difficult to write,
if you don’t know the algorithm of how to solve a cube.
But if you want to have the program find that out, then there
would be no point in having a fitness function that already
contains the solution.


 Hmmm.
 Clojure has immutable data structures.
 Programs are data structures.
 Therefore, programs are immutable.

CL Programs are also immutable. At some point you will need
to call eval or compile.


 So is it possible to create a Clojure program that modifies itself?

Yes, in the same sense as it is possible with CL.

-- 
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-16 Thread André Thieme
On Aug 12, 10:25 pm, daly d...@axiom-developer.org wrote:

 Consing up a new function and using eval is certainly possible but
 then you are essentially just working with an interpreter on the data.

This is the same in CL. When you have a GP system that constructs new
program trees then inside your fitness function you will eval it.
Clojure does not come with an interpreter, so eval results in a
compiled program that gets executed.
You can of course use recombination and mutation of programs and/or
subprograms and thus create a new generation that is now modified,
which then gets its fitness measured.


 How does function invocation actually work in Clojure?

Lisp-1.
This is much better suited for a (predominantly) functional
programming
style. Also see this paper by Kent Pitman:
http://www.nhplace.com/kent/Papers/Technical-Issues.html
(“Probably a programmer who frequently passes functions as arguments
or who uses passed arguments functionally finds Lisp1 syntax easier to
read than Lisp2 syntax;”)


 In Common Lisp you fetch the function slot of the symbol and execute it.
 To modify a function you can (compile (modify-the-source fn)).
 This will change the function slot of the symbol so it will execute the
 new version of itself next time.

 Does anyone know the equivalent in Clojure? Would you have to invoke
 javac on a file and reload it? The Clojure compile function only seems
 to know about files, not in-memory objects.

In Clojure it is: (eval (modify-the-source fn)).

-- 
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-16 Thread André Thieme
On Aug 13, 12:16 am, Sergey Didenko sergey.dide...@gmail.com 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.

They are all data-modifying programs.
The thing is that the program is itself the data. It is just a list,
nothing
more, and you can apply functions that operate on trees.
Those can be recombined and/or mutated, and then get executed in a
fitness
function.

-- 
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: Async Requests in ClojureScript

2011-08-16 Thread Chris Granger
You could also look at how I do remotes in Pinot. 
http://github.com/ibdknox/pinot

Cheers,
Chris.

On Aug 16, 12:16 pm, Edmund edmundsjack...@gmail.com wrote:
 Hi Base,

         I have a super basic example of this on my blog 
 athttp://boss-level.com/?p=119 It should get you over this hump.

 Gimme a shout if you have problems,

 Edmund

 On 16/08/2011 19:08, Base wrote:







  Hi All -

  I am attempting to get started in ClojureScript and am completely
  flummoxed on getting my connectivity set up.

  I have a web server running on my local machine such that

 http://localhost:8080/m

  yields my data correctly (just a test URL...)

  I am attempting to connect using the following cljs

  (ns hello.foo.dat (:require [goog.net.XhrIo :as gxhr] [goog.Uri :as
  uri] [cljs.reader :as reader]))

  (defn- extract-response [message] (reader/read-string (.
  message/target (getResponseText

  (defn get-data [_] (gxhr/send (goog.Uri. http://localhost:8080/m;)
  extract-response))

  However when I attempt to execute this function in the browser I get
  'undefined' returned. Anything you can see here that I am doing
  wrong?  This does appear to execute correctly (i.e. the function is
  called, as a hard coded return string does return correctly)

  Any help is most welcomed!

  Thanks,

  Base

-- 
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-16 Thread André Thieme


On Aug 13, 11:14 pm, Ken Wesson kwess...@gmail.com wrote:
 On Sat, Aug 13, 2011 at 1:36 PM, Lee Spector lspec...@hampshire.edu wrote:

  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. :)


Exactly!
All those people doing GP in C++ end up doing it in Lisp anyway.
They write a GP engine that generates trees and manipulates them and
then
they'll have to write an interpreter for that limited language, which
is basically the idea of Lisp. OMG ;)

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


Problem with Greeks!

2011-08-16 Thread cran1988
I tried (str Γεια!)
and i got  !
what can I do to fix it ?

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


Re: Stanford AI Class

2011-08-16 Thread Ken Wesson
On Tue, Aug 16, 2011 at 6:45 PM, André Thieme
splendidl...@googlemail.com wrote:


 On Aug 13, 11:14 pm, Ken Wesson kwess...@gmail.com wrote:
 On Sat, Aug 13, 2011 at 1:36 PM, Lee Spector lspec...@hampshire.edu wrote:

  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. :)


 Exactly!
 All those people doing GP in C++ end up doing it in Lisp anyway.
 They write a GP engine that generates trees and manipulates them and
 then
 they'll have to write an interpreter for that limited language, which
 is basically the idea of Lisp. OMG ;)

Whereas if you started out with Lisp, you can skip all that and just write:

a) a few functions/macros

b) something to make/evolve trees of forms whose operator-position
symbols name those functions and macros

c) (eval evolved-form)

and Bob's your uncle. The interpreter you get for free, in the form of
the macroexpander and eval. Actually using Lisp is like having library
support for your 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: Problem with Greeks!

2011-08-16 Thread Ken Wesson
On Tue, Aug 16, 2011 at 7:56 PM, cran1988 rmanolis1...@hotmail.com wrote:
 I tried (str Γεια!)
 and i got  !
 what can I do to fix it ?

Set something, somewhere, to UTF-8 that's probably set to ISO-8859-1
or US-ASCII right now.

Also, her name would be spelt Λεια, and her famous plea Ηελπ με,
Οβι-ωαν Κενοβι! or something like that. :)

-- 
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: Problem with Greeks!

2011-08-16 Thread cran1988
My jvm is already UTF-8
however it works with clojure 1.3.0 beta1
but i have problems i get an error
NoSuchMethodError clojure.lang.KeywordLookupSite.init(ILclojure/lang/
Keyword;)V  clout.core/request-url (core.clj:53)


On Aug 17, 3:30 am, Ken Wesson kwess...@gmail.com wrote:
 On Tue, Aug 16, 2011 at 7:56 PM, cran1988 rmanolis1...@hotmail.com wrote:
  I tried (str Γεια!)
  and i got   !
  what can I do to fix it ?

 Set something, somewhere, to UTF-8 that's probably set to ISO-8859-1
 or US-ASCII right now.

 Also, her name would be spelt Λεια, and her famous plea Ηελπ με,
 Οβι-ωαν Κενοβι! or something like that. :)

 --
 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: Problem with Greeks!

2011-08-16 Thread Kevin Livingston
I don't know about the clojure compiler.  But we've run into some
issues with the java compiler.  There are flags to inform it what file
encodings are being used in a file.  For example,

http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp#set-default-locale

Java will make assumptions about output format based on your machine
too

http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp#default-encoding


sorry this isn't really an answer, but it's evidence that you aren't
hallucinating anyway,

Kevin


On Aug 16, 7:09 pm, cran1988 rmanolis1...@hotmail.com wrote:
 My jvm is already UTF-8
 however it works with clojure 1.3.0 beta1
 but i have problems i get an error
 NoSuchMethodError clojure.lang.KeywordLookupSite.init(ILclojure/lang/
 Keyword;)V  clout.core/request-url (core.clj:53)

 On Aug 17, 3:30 am, Ken Wesson kwess...@gmail.com wrote:







  On Tue, Aug 16, 2011 at 7:56 PM, cran1988 rmanolis1...@hotmail.com wrote:
   I tried (str Γεια!)
   and i got   !
   what can I do to fix it ?

  Set something, somewhere, to UTF-8 that's probably set to ISO-8859-1
  or US-ASCII right now.

  Also, her name would be spelt Λεια, and her famous plea Ηελπ με,
  Οβι-ωαν Κενοβι! or something like that. :)

  --
  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: defining tests for an api to be called by the implementations

2011-08-16 Thread Kevin Livingston
actually this isn't as bad as I thought.

things work more or less as expected, I can blocke the tests with the
test-ns-hook and run them in other namespaces as expected...

the reason things ran in my repl but would not compile outside is that
there were some missing test dependencies that were in scope in the
pom running my repl, but not in the one running the test.  lesson
learned.

Kevin


On Aug 15, 11:31 pm, Alan Malloy a...@malloys.org wrote:
 On Aug 15, 10:16 pm, Kevin Livingston









 kevinlivingston.pub...@gmail.com wrote:
  I am working on an api that has an interface and two distinct
  implementations lets call them: foo and bar.

  I have a testing routine with a bunch of functions that each call a
  function to get a clean instance of an implementation, initializes it
  with some data and then interrogate it.

  with the exception of calling (new-foo) or (new-bar), foo and bar can
  be tested identically.  I would like to be able to define tests in a
  namespace for the api, then have a test-foo namespace that calls those
  tests with *new-test-instance* bound to new-foo.  likewise for new
  bar.  because I would like the exact same tests run, the whole point
  is these things should behave the same at the API level.  I don't want
  to have to copy and paste all my tests and make sure I keep them
  synchronized, that seems like an error waiting to happen.

  I can define the tests in test-api with deftest but doing so will
  cause the test to be run there (when I call mvn clojure:test), and as
  there is no implementation they will of course fail.  I can block test-
  api from calling it's tests with:
  (defn test-ns-hook [])
  but then the tests become a pain to call from another namespace.

  surely there is a way to do this?

 (defn test-ns-hook []
   (when (bound? #'api-instance)
     ...))?







  in test-api with the blocking test-ns-hook, I tried
  (def the-tests [
  (deftest test-1  ) ])

  then in test-foo I tried

  (defn test-ns-hook []
    (dorun
     (map (fn [x]
            (binding [project.test-api/*new-test-instance*
                      (fn [] (new-foo))]
              (x)))
          project.test-api/the-tests)))

  that doesn't work I keep seeing this:

  Uncaught exception, not in assertion.
  expected: nil
    actual: java.lang.NoClassDefFoundError: org/slf4j/impl/
  StaticLoggerBinder
  ...

  except if I put that exact same test-ns-hook implementation into the
  repl and call (run-tests) everything checks out *exactly* as expected.

  I have spent way too many hours on this... help?

  Kevin

-- 
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: Problem with Greeks!

2011-08-16 Thread cran1988
I am going to try java 7 with clojure

On Aug 17, 6:36 am, Kevin Livingston
kevinlivingston.pub...@gmail.com wrote:
 I don't know about the clojure compiler.  But we've run into some
 issues with the java compiler.  There are flags to inform it what file
 encodings are being used in a file.  For example,

 http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp#set-d...

 Java will make assumptions about output format based on your machine
 too

 http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp#defau...

 sorry this isn't really an answer, but it's evidence that you aren't
 hallucinating anyway,

 Kevin

 On Aug 16, 7:09 pm, cran1988 rmanolis1...@hotmail.com wrote:







  My jvm is already UTF-8
  however it works with clojure 1.3.0 beta1
  but i have problems i get an error
  NoSuchMethodError clojure.lang.KeywordLookupSite.init(ILclojure/lang/
  Keyword;)V  clout.core/request-url (core.clj:53)

  On Aug 17, 3:30 am, Ken Wesson kwess...@gmail.com wrote:

   On Tue, Aug 16, 2011 at 7:56 PM, cran1988 rmanolis1...@hotmail.com 
   wrote:
I tried (str Γεια!)
and i got   !
what can I do to fix it ?

   Set something, somewhere, to UTF-8 that's probably set to ISO-8859-1
   or US-ASCII right now.

   Also, her name would be spelt Λεια, and her famous plea Ηελπ με,
   Οβι-ωαν Κενοβι! or something like that. :)

   --
   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: clojure.java.jdbc input on JDBC-3 (esp. Stuart Sierra!)

2011-08-16 Thread jaime
Not related to this topic, but just wonder if it's possible to have
c.j.j to support Unicode? And if it's already there, how can I use it
for Unicode?

On Aug 17, 2:17 am, Sean Corfield seancorfi...@gmail.com wrote:
 On Tue, Aug 16, 2011 at 11:02 AM, Stuart Sierra

 the.stuart.sie...@gmail.com wrote:
  I no longer remember what I was looking at when I wrote that ticket. :)
  Maybe I just wasn't aware of `insert-records`.

 Cool.

 Any thoughts on the struct-map issue? resultset-seq currently uses a
 deprecated feature - it should just use regular maps, right? I'm not
 familiar enough with struct-maps to understand the full implications
 of switching that out...
 --
 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: Problem with Greeks!

2011-08-16 Thread cran1988
THE PROBLEM SOLVED !!!
https://groups.google.com/group/clj-noir/browse_thread/thread/b02a740e6db62b58

Thanks for your support !

On Aug 17, 6:58 am, cran1988 rmanolis1...@hotmail.com wrote:
 I am going to try java 7 with clojure

 On Aug 17, 6:36 am, Kevin Livingston







 kevinlivingston.pub...@gmail.com wrote:
  I don't know about the clojure compiler.  But we've run into some
  issues with the java compiler.  There are flags to inform it what file
  encodings are being used in a file.  For example,

 http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp#set-d...

  Java will make assumptions about output format based on your machine
  too

 http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp#defau...

  sorry this isn't really an answer, but it's evidence that you aren't
  hallucinating anyway,

  Kevin

  On Aug 16, 7:09 pm, cran1988 rmanolis1...@hotmail.com wrote:

   My jvm is already UTF-8
   however it works with clojure 1.3.0 beta1
   but i have problems i get an error
   NoSuchMethodError clojure.lang.KeywordLookupSite.init(ILclojure/lang/
   Keyword;)V  clout.core/request-url (core.clj:53)

   On Aug 17, 3:30 am, Ken Wesson kwess...@gmail.com wrote:

On Tue, Aug 16, 2011 at 7:56 PM, cran1988 rmanolis1...@hotmail.com 
wrote:
 I tried (str Γεια!)
 and i got   !
 what can I do to fix it ?

Set something, somewhere, to UTF-8 that's probably set to ISO-8859-1
or US-ASCII right now.

Also, her name would be spelt Λεια, and her famous plea Ηελπ με,
Οβι-ωαν Κενοβι! or something like that. :)

--
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: Clojure for Android

2011-08-16 Thread Paul deGrandis
I'd consider taking this.  I've worked a little bit behind the scenes
to get Clojure to run better for me personally on android.  Recently,
I've been working to get ClojureScript to work well for SL4A
(Scripting Layer for Android).

I wanted to try to get a native Clojure package working for SL4A, but
given that the above works pretty well, I need some sort of real
motivation to continue the work.

Paul // OhPauleez
http://www.pauldee.org/blog


On Aug 16, 7:31 am, James Swift ja...@3dengineer.com wrote:
 http://dev.clojure.org/display/design/Android+Support

 Issues

     Needs a motivated owner

 This topic gets a regular mention but I thought it might be worth
 asking again if it's ever likely to get the 'motivated owner' ?

 Given that 'reach' was a primary reason for the development of
 ClojureScript shouldn't the reach of Android encourage someone to go
 for it?

 I only wish I was capable of doing it myself :)

 James.

-- 
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: Problem with Greeks!

2011-08-16 Thread Meikel Brandmeyer (kotarak)
Hi,

Am Mittwoch, 17. August 2011 06:53:11 UTC+2 schrieb cran1988:

THE PROBLEM SOLVED !!! 

 https://groups.google.com/group/clj-noir/browse_thread/thread/b02a740e6db62b58
  


To expand a bit on this issue:
NoSuchMethodError 
clojure.lang.KeywordLookupSite.init(ILclojure/lang/Keyword;)V 
 clout.core/request-url (core.clj:53)

The source of such error messages is most likely AOT-compilation. You try to 
use code which was AOT compiled with clojure 1.2.1 with eg. clojure 
1.3.0-beta1 at runtime. Then you'll run into this issue. Just don't use AOT 
compilation when it's not necessary.

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