Re: [ANN] clojure-py 0.1.0 Clojure on Python

2012-03-11 Thread Daniel Gagnon
On Thu, Mar 8, 2012 at 10:53 AM, Timothy Baldridge wrote:

> > What's the plan for ratios and characters?  I assume they're still on
> > the TODO list?  (Maybe Issue 17 covers the ratios?)
>
> Yeah, I need to run a few more tests, but I'm thinking of somehow
> layering libgmp ontop of Python in order to implement ratios.
>
>
Why wouldn't Python fractions work as ratios?

-- 
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: Need opinions on arglists with optional arguments

2012-03-11 Thread Stephen Compall
On Sat, 2012-03-10 at 21:31 +, James Reeves wrote:
> The Clojure docs docs seem to favour the first style [1], but there's
> an ambiguity as to whether "attrs?" means an optional argument or a
> boolean value.

I've also preferred the Clojure doc style, under the theory that
arglists are meant for humans, who can tell whether a boolean or
optional arg is probably meant from context, and not autocompleters.

-- 
Stephen Compall
^aCollection allSatisfy: [:each|aCondition]: less is better

-- 
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: Compilable clojure program, but unreadable?

2012-03-11 Thread Jonas
Hi,

Is this inconsistent behaviour:

user=> `s/foo
s/foo
user=> ::s/foo
#
nil
user=> (require '[clojure.string :as s])
nil
user=> `s/foo
clojure.string/foo
user=> ::s/foo
:clojure.string/foo

I think that ::s/foo should be resolved to :s/foo if there is no alias for 
s (like symbols).

Jonas


On Monday, March 12, 2012 1:50:50 AM UTC+2, Meikel Brandmeyer (kotarak) 
wrote:
>
> Hi,
>
> Am 12.03.2012 um 00:09 schrieb Stuart Sierra:
>
> > The syntax ::s/kwd is incorrect syntax: it should be either ::kwd (which 
> will resolve in the current namespace) or :s/kwd (only one colon).
>
> The reader page says, with :: they are resolved in the current namespace. 
> And this seems to work since they where introduced:
>
> user=> (require '[clojure.string :as s])
> nil
> user=> ::s/join
> :clojure.string/join
> user=> `s/join
> clojure.string/join
>
> Just as s/join gets resolved to the clojure.string/join, ::s/join gets 
> resolved to :clojure.string/join. Sounds consistent and not in violation of 
> the reader page.
>
> 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: Compilable clojure program, but unreadable?

2012-03-11 Thread Meikel Brandmeyer
Hi,

Am 12.03.2012 um 00:09 schrieb Stuart Sierra:

> The syntax ::s/kwd is incorrect syntax: it should be either ::kwd (which will 
> resolve in the current namespace) or :s/kwd (only one colon).

The reader page says, with :: they are resolved in the current namespace. And 
this seems to work since they where introduced:

user=> (require '[clojure.string :as s])
nil
user=> ::s/join
:clojure.string/join
user=> `s/join
clojure.string/join

Just as s/join gets resolved to the clojure.string/join, ::s/join gets resolved 
to :clojure.string/join. Sounds consistent and not in violation of the reader 
page.

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: Compilable clojure program, but unreadable?

2012-03-11 Thread Kevin Downey
On Mar 11, 2012 4:10 PM, "Stuart Sierra" 
wrote:
>
> The syntax ::s/kwd is incorrect syntax: it should be either ::kwd (which
will resolve in the current namespace) or :s/kwd (only one colon).
>
> -S

::s/kwd is valid, it will cause the namespace of the resulting keyword to
be resolved via the namespace aliases in the current namespace.

please enjoy rhickey explaining this to cemerick:
http://clojure-log.n01se.net/date/2009-04-30.html#08:11

Clojure 1.4.0-master-SNAPSHOT

user=> :s/k

:s/k

user=> ::s/k

RuntimeException Invalid token: ::s/k  clojure.lang.Util.runtimeException
(Util.java:170)

user=> (require '[clojure.string :as s])

nil

user=> ::s/k

:clojure.string/k

user=>

>
> --
> 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: Automatically generating test-cases for functions (problem with macros)

2012-03-11 Thread Stuart Sierra
Looks like you're doing something similar to the clojure.test/with-test 
macro.
-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: Compilable clojure program, but unreadable?

2012-03-11 Thread Stuart Sierra
The syntax ::s/kwd is incorrect syntax: it should be either ::kwd (which 
will resolve in the current namespace) or :s/kwd (only one colon).

-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: clojure.io

2012-03-11 Thread Daniel Barlow
On Sat, Mar 10, 2012 at 9:41 PM, Brian Goslinga wrote:

> There is a trade off here. If you want to be very portable you'll end up
> with something like the CL path API because you need logicals and file
> revisions to really support VMS, for example.
>

In a former life I spent more time than I now care to dwell on in battling
the CL pathname API, both as an implementor (SBCL) and a user (I was the
original author of the ASDF build system).  While I can accept that a
portable pathname system would need to provide support for e.g. logicals
and file revisions, I still claim that CL is in this respect an
extraordinarily rich source of information on how not to do it.  "Customary
case", in particular, still makes me want to scream even ten years later

/rant off

-dan

-- 
d...@telent.net
http://ww.telent.net

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

Automatically generating test-cases for functions (problem with macros)

2012-03-11 Thread alco
Hi!

I've written a macro to generate tests for functions that have the ":_test" 
key in their metadata. I know that clojure.test automatically runs tests 
associated with ":test" keys, but I'd like to implement my own test-case 
generation.

Here' what it looks like:

(defn my-last
  "P01 (*) Find the last box of a list."
  { :_test '(= (my-last '(a b c d)) 'd) }

  [lst]
  (if (<= (count lst) 1)
(first lst)
(recur (rest lst

(defmacro gen-tests []
  `(do ~@(for [f (map first (ns-publics *ns*)) :when (:_test (meta 
(ns-resolve *ns* (symbol f]
  `(clojure.test/deftest ~(symbol (str f '-test)) (clojure.test/is 
~(:_test (meta (ns-resolve *ns* (symbol f)

The gen-tests macro basically enumerates all publics in the current 
namespace and generates a 'deftest' declaration for each function that 
contains the ":_test" key in its metadata.

I'm sure there exists more reasonable and idiomatic way to do the same 
thing. Specifically, I'd really like to remove the repeating "(:_test (meta 
...)" part, but I wasn't able to come up with the solution myself.

Any help will be appreciated. Thanks!

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

Re: how to restart Clojurescript One repl the right way?

2012-03-11 Thread Pierre-Henry Perret
Yes, good question. It leads to another one: is ther a clojure hook  to 
stop the server ?

I personally kill the process to sweep out the vm and then can restart 
again.

Le jeudi 8 mars 2012 09:21:58 UTC+1, George Oliver a écrit :
>
> hi, I'm just starting with ClojureScript and ClojureScript One. 
> Sometimes working with One I kill the cljs-repl for whatever reason 
> (something hangs, I make some mistake and can't correct it, etcetera); 
> when I go to restart (by running lein repl again), I then can't 
> restart the cljs-repl. I get, 
>
> BindException Address already in use: JVM_Bind 
> java.net.PlainSocketImpl.socketBind 
>
> What's the right way to restart in this situation? Thanks.

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

Re: how to restart Clojurescript One repl the right way?

2012-03-11 Thread John Collins


On Thursday, March 8, 2012 9:21:58 AM UTC+1, George Oliver wrote:
>
> hi, I'm just starting with ClojureScript and ClojureScript One. 
> Sometimes working with One I kill the cljs-repl for whatever reason 
> (something hangs, I make some mistake and can't correct it, etcetera); 
> when I go to restart (by running lein repl again), I then can't 
> restart the cljs-repl. I get, 


> BindException Address already in use: JVM_Bind 
> java.net.PlainSocketImpl.socketBind 
>
> What's the right way to restart in this situation? Thanks.




When you get a BindException error like the one you have it's probably 
because your ring server didn't shut down properly when your repl 
disconnected. I always have to resort to looking up the pid(in Linux) and 
killing the process running on the address:port  and running lein repl 
again or cljs-repl if you are still within the clojure repl. I think this 
situation can be remedied somehow if the server connection can be saved to 
a var so that a stop and start function can be called on it.

John 

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